SCRIPT SELECTIONNE :

QC22824 - INSERT_Loyality_Card_Issues.sql


-- QC22824
-- US32189 19/02/198 DB - [ALFA][Booking][Loyalty] New tiers
-- Impossible d'ajouter certaines cartes de fidelite dans le cardex
-- Message d'erreur Fols : Le mode de versement n'est pas actif dans l'hotel : MARQUE_HOTEL
-- Pas de variable a modifier


DECLARE @hoteId int
DECLARE @COUN_ID int
DECLARE @msg varchar(255)

SET @hoteId = (SELECT distinct hote_id FROM hotel )
SET @COUN_ID = (SELECT distinct coun_id FROM hotel )

-- Insert Card Type
if not exists(SELECT 1 FROM cc_card_type WHERE hote_id = @hoteId and ccct_corresp_code = '1050') BEGIN EXEC up_CC_CARD_TYPE_Insert @HoteId, 'LeClub-A Diamond','A5','1050',1,1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1050' PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1050' PRINT @msg END
if not exists(SELECT 1 FROM cc_card_type WHERE hote_id = @hoteId and ccct_corresp_code = '1051') BEGIN EXEC up_CC_CARD_TYPE_Insert @HoteId, 'LeClub-A Black','A6','1051',1,1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1051' PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1051' PRINT @msg END
if not exists(SELECT 1 FROM cc_card_type WHERE hote_id = @hoteId and ccct_corresp_code = '1055') BEGIN EXEC up_CC_CARD_TYPE_Insert @HoteId, 'Accor Plus Diamond','D1','1055',1,1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1055' PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1055' PRINT @msg END
if not exists(SELECT 1 FROM cc_card_type WHERE hote_id = @hoteId and ccct_corresp_code = '1056') BEGIN EXEC up_CC_CARD_TYPE_Insert @HoteId, 'Accor Plus Black','D2','1056',1,1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1056' PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccct_corresp_code = 1056' PRINT @msg END


-- Insert Range-Bin
if not exists(SELECT 1 FROM cc_range_bin WHERE hote_id = @hoteId and ccrb_bin_range_min ='3081035' and coun_id in (@coun_id, -1)) BEGIN EXEC up_CC_range_bin_insert @hoteId,'3081035','3081035',16,16,0,@coun_id,'1050' , 1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin_min = 3081035, coun_id =' + convert(varchar,@coun_id) PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin =3081035, coun_id =' + convert(varchar,@coun_id) PRINT @msg END
if not exists(SELECT 1 FROM cc_range_bin WHERE hote_id = @hoteId and ccrb_bin_range_min ='3081036' and coun_id in (@coun_id, -1)) BEGIN EXEC up_CC_range_bin_insert @hoteId,'3081036','3081036',16,16,0,@coun_id,'1051' , 1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin_min = 3081036, coun_id =' + convert(varchar,@coun_id) PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin =3081036, coun_id =' + convert(varchar,@coun_id) PRINT @msg END
if not exists(SELECT 1 FROM cc_range_bin WHERE hote_id = @hoteId and ccrb_bin_range_min ='3084091' and coun_id in (@coun_id, -1)) BEGIN EXEC up_CC_range_bin_insert @hoteId,'3084091','3084091',16,19,0,@coun_id,'1055' , 1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin_min = 3084091, coun_id =' + convert(varchar,@coun_id) PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin =3084091, coun_id =' + convert(varchar,@coun_id) PRINT @msg END
if not exists(SELECT 1 FROM cc_range_bin WHERE hote_id = @hoteId and ccrb_bin_range_min ='3084092' and coun_id in (@coun_id, -1)) BEGIN EXEC up_CC_range_bin_insert @hoteId,'3084092','3084092',16,19,0,@coun_id,'1056' , 1 SET @msg = 'Inserted : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin_min = 3084092, coun_id =' + convert(varchar,@coun_id) PRINT @msg END ELSE BEGIN SET @msg = 'ALREADY exists : hote_id = ' + convert(varchar,@HoteId) + ', ccbr_range_bin =3084092, coun_id =' + convert(varchar,@coun_id) PRINT @msg END