DEFINITION Multidistribution_Non_660004629 0
DEFINITION Multidistribution_Oui_660004629 1
DEFINITION DISTRIBUTION_INCONNU_660004629 1
DEFINITION TRAI_KO_660004629 -1
DEFINITION TRAI_REDISTRIBUTION_660004629 -2
DEFINITION MODULE_DISTR_660004629 0xA000
DEFINITION ERR_SEM_660004629 0x040
DEFINITION ERR_DUPL_660004629 0x0D0
REGISTRE ENTIER erreur_660004629
REGISTRE ENTIER flag_rdt_660004629	
REGISTRE POINTEUR pt_val_idemet_660004629
REGISTRE POINTEUR ptr_str_660004629
REGISTRE ENTIER date_art_660004629
REGISTRE ENTIER date_fin_660004629
REGISTRE ENTIER L3t23_def_660004629
REGISTRE ENTIER L3t24_def_660004629
REGISTRE ENTIER L3t27_def_660004629
REGISTRE ENTIER L3t28_def_660004629
REGISTRE ENTIER OriginatorIMSI_present_660004629
REGISTRE ENTIER RecipientIMSI_present_660004629
REGISTRE ENTIER OutgoingInterfId_present_660004629
REGISTRE ENTIER IncomingInterfId_present_660004629
REGISTRE ENTIER RoamingInfo_present_660004629
REGISTRE ENTIER ent_MC_660004629
REGISTRE ENTIER taille_destinationN_660004629
REGISTRE ENTIER taille_originator_660004629
REGISTRE ENTIER taille_destination1_660004629
REGISTRE ENTIER taille_OutgoingInterfId_660004629
REGISTRE ENTIER taille_IncomingInterfId_660004629
REGISTRE ENTIER taille_mailIdpart_660004629
REGISTRE ENTIER taille_mailMsOrEntity_660004629
REGISTRE ENTIER taille_MMSoutInterf_660004629
REGISTRE ENTIER taille_MMSinInterf_660004629
REGISTRE ENTIER taille_RoamingInfo_660004629
REGISTRE ENTIER taille_local_660004629
REGISTRE ENTIER indice_octet_660004629
REGISTRE ENTIER indice_660004629
REGISTRE ENTIER caract_660004629
REGISTRE ENTIER caractFIN_660004629
REGISTRE ENTIER caract_F0_660004629
REGISTRE ENTIER caract_0F_660004629
REGISTRE ENTIER L4t40_1_def_660004629
REGISTRE ENTIER L4t50_3_def_660004629	
REGISTRE ENTIER taille_userIdNet_660004629
REGISTRE ENTIER taille_partTransID_660004629
REGISTRE ENTIER dest_is_not_numcourt_660004629
REGISTRE ENTIER callType_660004629
REGISTRE ENTIER eventDisposition_660004629
REGISTRE ENTIER MultiDestinations_660004629
REGISTRE ENTIER recordOriginalDate_660004629
REGISTRE ENTIER count_660004629
REGISTRE ENTIER deliverTime_660004629
REGISTRE ENTIER submissTime_660004629
REGISTRE ENTIER taille_OriginatorIMSI_660004629
REGISTRE ENTIER taille_RecipientIMSI_660004629
REGISTRE ENTIER taille_Destination1_660004629
REGISTRE ENTIER taille_Originator_660004629
REGISTRE ENTIER taille_str_660004629
REGISTRE ENTIER date_reference_660004629
REGISTRE POINTEUR str_destination1_660004629
REGISTRE POINTEUR str_dest_660004629
REGISTRE POINTEUR str_count_660004629
REGISTRE POINTEUR str_destinationCount_660004629
REGISTRE POINTEUR str_originator_660004629
REGISTRE POINTEUR str_recordType_660004629
REGISTRE POINTEUR str_IMSI_660004629
REGISTRE POINTEUR str_MC_660004629
REGISTRE POINTEUR str_subId2_660004629
REGISTRE ENTIER code_rejet_660004629
REGISTRE ENTIER EFFICACE_660004629
REGISTRE ENTIER MODULE_660004629
REGISTRE ENTIER ERREUR_660004629
####################################################################
#	article TmmsR2, MMS-C R2 Originated VASP
#
#	MP 30/01/03	Creation
# URS PSA	20/07/07	FO 550 : remplacement || par && sur tests de plage
#
# 11/06/2010 - JLG - G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2, 
#                                     ajout champ T3t55 (GFlag2) et T3t56 (GValue)
# 08/12/2010 - JLG - G3R1lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 10/03/2011 - JLG - G3R2C4 fusion G3R2C3 avec G3R1C600 (ajout champ T3t99)
# 29/02/2012 - JLG -G3R6 QC1005 modif alarme retour aiguillage
# 11/02/2014 - JLG -G5R1 QC1331, Built 3 : Changement Marque Audit
# 02/07/2014 - JLG -G5R1 QC1405, champ eec du DPV si g_ieec > 500
#####################################################################
#
# Indices des types de communication
# Les TYPCOM sont compris entre 0 et 126
#


# FE 54 ##
# /FE 54 ##



trace("")
trace("**** MMS-C R2 : Debut de distribution ****")

# Initialisations
# FE 54 ##
EFFICACE_660004629 = 1
MODULE_660004629 = MODULE_DISTR_660004629
ERREUR_660004629 = 0
code_rejet_660004629 = 0
# /FE 54 ##
date_art_660004629 = -1
recordOriginalDate_660004629 = -1
deliverTime_660004629 = -1
str_IMSI_660004629 = "strimsi8901234564444"
str_subId2_660004629 = "strsubid201234567777"
str_MC_660004629 = "strmc67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"
str_destination1_660004629="strdestination1232121234567890123456789012345678901234567890123456789012345678901234567890123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999111222444555661232121234567890123456789012345678901234567890123456789012345678901234567890123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
str_dest_660004629="str_dest3456789012345678901234567890123456789012345678901234567890123456789012345678999999999999999999999999999999999999999777777777777777799999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999111111113456789012345678901234567890123456789012345678901234567890123456789012345678999999999999999999999999999999999999999777777777777777799999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
str_count_660004629="strcount"
str_destinationCount_660004629="strdestinationCount1"
str_originator_660004629="stroriginator12345671234567890123456444444444444444444444444444444444444444488888888888888888888888888888888888888888888888888888888888888888888888888888888884444444444488888884444444789012345678901234567890123456789012345678901234567890123456789111111111111112345671234567890123456444444444444444444444444444444444444444488888888888888888888888888888888888888888888888888888888888888888888888888888888884444444444488888884444444789012345678901234567890123456789012345678901234567890123456789"
str_recordType_660004629 = "str_recordType123456"
pt_val_idemet_660004629 = "val_idemet123456789"
ptr_str_660004629 = "ptr_str12345678945678945612346654789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890126789012345678444444901234567890123456789012345611111111117890123456789012345678901234567890123456111111112345678945678945612346654789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890126789012345678444444901234567890123456789012345611111111117890123456789012345678901234567890123456"

# OGA MMS DEV7 30/03/2007
i_strcpy(str_IMSI_660004629, "")
i_strcpy(str_subId2_660004629, "")
i_strcpy(str_MC_660004629, "")
i_strcpy(str_destination1_660004629, "")
i_strcpy(str_dest_660004629, "")
i_strcpy(str_count_660004629, "")
i_strcpy(str_destinationCount_660004629, "")
i_strcpy(str_originator_660004629, "")
i_strcpy(str_recordType_660004629, "")
i_strcpy(pt_val_idemet_660004629, "")
i_strcpy(str_MC_660004629, "")
i_strcpy(ptr_str_660004629, "")
# /OGA MMS DEV7

##################################################################################
# Identification de la provenance de l'article
# flag_rdt : nb de passage en redistribution (lecture de l'enveloppe obligatoire)
##################################################################################
flag_rdt_660004629 = -1
flag_rdt_660004629 = i_LireRedistCpt()

SI (flag_rdt_660004629 == 0)
ALORS
	erreur_660004629 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004629 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)



# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004629=i_get_art_field(g_iartin,$TmmsR2::dfin)
erreur_660004629= i_incr_redist_dist_660004265(date_fin_660004629)

#typeCom = TYPE_MMSC_INC
submissTime_660004629 = i_get_art_field(g_iartin, $TmmsR2::SubmissTime)
deliverTime_660004629 = i_get_art_field(g_iartin, $TmmsR2::DeliverTime)
eventDisposition_660004629 = i_get_art_field(g_iartin, $TmmsR2::eventdisposit)
erreur_660004629 = i_get_field_str(g_iartin,"RecordType",str_recordType_660004629)
SI (! i_strcmp(str_recordType_660004629,"MMSOrecord"))
ALORS
         callType_660004629 = 0x30
#        typeCom = TYPE_MMSOM
#        date_art = submissTime
FINSI
## ano 3017
#SI ((! i_strcmp(str_recordType,"MMSRrecord")) && (eventDisposition !=3 ))
SI (! i_strcmp(str_recordType_660004629,"MMSRrecord"))
ALORS
         callType_660004629 = 0x31
#        typeCom = TYPE_MMSTM
#        date_art = deliverTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM3Orecord"))
ALORS
         callType_660004629 = 0x32
#        typeCom = TYPE_MM3OR
#        date_art = submissTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM3Rrecord"))
ALORS
         callType_660004629 = 0x33
#        typeCom = TYPE_MM3RR
#        date_art = deliverTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM4Orecord"))
ALORS
         callType_660004629 = 0x34
#        typeCom = TYPE_MM40R
#        date_art = submissTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM4Rrecord"))
ALORS
         callType_660004629 = 0x35
#        typeCom = TYPE_MM4RR
#        date_art = deliverTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM7Orecord"))
ALORS
         callType_660004629 = 0x36
#        typeCom = TYPE_MM7OR
#        date_art = submissTime
FINSI
SI (! i_strcmp(str_recordType_660004629,"MM7Rrecord"))
ALORS
         callType_660004629 = 0x37
#        typeCom = TYPE_MM7RR
#        date_art = deliverTime
FINSI

####################################################################
#	duplication au format DPV TLV
####################################################################

#
# Boucle sur les N destinations
#
        count_660004629 = 0
	MultiDestinations_660004629 = 0
	indice_660004629 = 0
POINT BOUCLE
	SI (i_get_art_field(g_iartin,$TmmsR2::Destination1+3*indice_660004629 -1) > 0)
	ALORS 
		MultiDestinations_660004629  = MultiDestinations_660004629 +1
		indice_660004629 = indice_660004629 +1
		SAUT BOUCLE
	FINSI

POINT NOUV_DESTINATION
SI (count_660004629 < MultiDestinations_660004629)
ALORS
	
	SI (! i_strcmp(str_recordType_660004629,"MMSOrecord")) 
	ALORS
        	date_art_660004629 = submissTime_660004629 + count_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MMSRrecord")) 
	ALORS
       		date_art_660004629 = deliverTime_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM3Orecord")) 
	ALORS
        	date_art_660004629 = submissTime_660004629+count_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM3Rrecord")) 
	ALORS
       		date_art_660004629 = deliverTime_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM4Orecord"))
	ALORS
       		date_art_660004629 = submissTime_660004629+count_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM4Rrecord")) 
	ALORS
       		date_art_660004629 = deliverTime_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM7Orecord")) 
	ALORS
       		date_art_660004629 = submissTime_660004629+count_660004629
	FINSI
	SI (! i_strcmp(str_recordType_660004629,"MM7Rrecord")) 
	ALORS
      		date_art_660004629 = deliverTime_660004629
	FINSI

	erreur_660004629 = i_dup_art_tab(g_iartin,g_iartout,"Tdpvgsm")
	
  SI (erreur_660004629 != 0)
	ALORS	
#              typeCom = TYPE_MMSC_INC
# FE 54 ##
		ERREUR_660004629 = ERR_DUPL_660004629
		code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
# /FE 54 ##
		erreur_660004629=i_PlvMessEmettre(8217 , 2, g_iartin, "", 2, code_rejet_660004629, "Tdpvgsm", 0)
	       SAUT STOCKE_ERRONE
	FINSI

#
#----- Complement de duplication hors table
#

#
# --- Mise a jour du champ callType
#

	erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::type, callType_660004629)

#   mise a jour du champ idemet

  i_strcpy(pt_val_idemet_660004629,i_get_tab_field("VariableContexte",date_art_660004629,"AX_IDEMET_MMS_ERICSSON"))
	trace2("TmmsR2 [Dist] :valeur de idemet recupere est %d",pt_val_idemet_660004629,"")
	SI ( i_strcmp( pt_val_idemet_660004629,g_inull) != 0 )
	ALORS
		erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::idemet,pt_val_idemet_660004629)		
	SINON
		erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::idemet,"33022000000FFFFFFF")		
	FINSI

#	
# MAJ du champ indeff
#		
  eventDisposition_660004629 = i_get_art_field(g_iartin, $TmmsR2::eventdisposit)
	SI (eventDisposition_660004629 == 1 || eventDisposition_660004629 == 2)
	ALORS
		erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::indeff, 0)
        SINON
		erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::indeff, 1)
	FINSI

#
# MAJ du champ tlserv
#
  erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0xE0 + (0x0F & callType_660004629))

#
# MAJ du typeCom pour comptage des articles generes (a partir du 2e destinataire correct)dans le bilan
#

#
# Mise a jour du champ tterm
#

SI (eventDisposition_660004629 == 1)
ALORS
    erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x21)
SINON
      SI (eventDisposition_660004629 == 2)
      ALORS
          erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x22)
      SINON
         SI (eventDisposition_660004629 == 3)
         ALORS
              erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x23)
         SINON
               SI (eventDisposition_660004629 == 4)
               ALORS
                     erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x29)
               SINON
                     SI (eventDisposition_660004629 == 5)
                     ALORS
                           erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x24)
                     SINON
                           SI (eventDisposition_660004629 == 6)
                           ALORS
                                 erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x27)
                           SINON
                              SI (eventDisposition_660004629 == 7)
                               ALORS
                                     erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x25)
                               SINON
                                   SI (eventDisposition_660004629 == 8)
                                   ALORS
                                         erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x26)
                                   SINON
                                       SI (eventDisposition_660004629 == 9)
                                       ALORS
                                             erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x29)
                                       SINON
                                           SI (eventDisposition_660004629 == 0x0A)
                                           ALORS
                                                 erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2A)
                                           SINON
                                               SI (eventDisposition_660004629 == 0x0B)
                                               ALORS
                                                     erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2B)
                                               SINON
                                                 SI (eventDisposition_660004629 == 0x0C)
                                                 ALORS
                                                       erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2B)
                                                 SINON
                                                    SI (eventDisposition_660004629 == 0x0D)
                                                    ALORS
                                                            erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2D)
                                                    SINON
                                                      SI (eventDisposition_660004629 == 0x13)
                                                      ALORS
                                                              erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x28)
                                                      SINON
                                                        SI (eventDisposition_660004629 == 0x1C)
                                                        ALORS
                                                            erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2E)
                                                        SINON
                                                            erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x2F)
                                                        FINSI
                                                      FINSI
                                                    FINSI
                                                 FINSI
                                               FINSI
                                            FINSI
                                       FINSI
                                   FINSI
                               FINSI
                           FINSI
                     FINSI
               FINSI
         FINSI
      FINSI
FINSI

#	mise a jour du champ IMSI

SI ((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	OriginatorIMSI_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::OriginatorIMSI)
	taille_OriginatorIMSI_660004629 = i_get_art_field(g_iartin, $TmmsR2::OriginatorIMSI-1)			
	SI ((OriginatorIMSI_present_660004629)&& (taille_OriginatorIMSI_660004629 > 0))
	ALORS
		erreur_660004629 = i_get_field_str(g_iartin,"OriginatorIMSI",str_IMSI_660004629)

		SI (!i_strplcmp(str_IMSI_660004629,"999999999999999",0,15))
		ALORS
#   			la table de duplication a initialise a 9999...
#   			on ajoute le F final pour etre conforme au format IMSI
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xf)
		SINON
			erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::IMSI,str_IMSI_660004629)
#Bourrage a F
			indice_660004629 = i_strlen(str_IMSI_660004629)
			POINT BOUR1
			SI(indice_660004629 < 16)	
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,indice_660004629,0xF)
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,indice_660004629+1,0xF)
				indice_660004629 = indice_660004629 + 1
				SAUT BOUR1
			FINSI	
		FINSI
	SINON
#   		la table de duplication a initialise a 9999...
#   		on ajoute le F final pour etre conforme au format IMSI
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xf)
	FINSI
FINSI
SI ((callType_660004629 == 0x31) || (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37))
ALORS
	taille_RecipientIMSI_660004629 =i_get_art_field(g_iartin, $TmmsR2::RecipientIMSI-1)
	RecipientIMSI_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::RecipientIMSI)
	SI ((RecipientIMSI_present_660004629) && (taille_RecipientIMSI_660004629 > 0))
	ALORS
		erreur_660004629 = i_get_field_str(g_iartin,"RecipientIMSI",str_IMSI_660004629)
		SI (!i_strplcmp(str_IMSI_660004629,"999999999999999",0,15))
		ALORS
#   				la table de duplication a initialise a 9999...
#   				on ajoute le F final pour etre conforme au format IMSI
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xf)
		SINON
#			erreur = i_fill_field_hexastr(g_iartout,ICD_IMSI,str_IMSI)
			erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::IMSI,str_IMSI_660004629)
		  
#Bourrage a F
			indice_660004629 = i_strlen(str_IMSI_660004629)
			POINT BOUR2
			SI(indice_660004629 < 16)	
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,indice_660004629,0xF)
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,indice_660004629+1,0xF)
				indice_660004629 = indice_660004629 + 1
				SAUT BOUR2
			FINSI
		FINSI
	SINON
#   			la table de duplication a initialise a 9999...
#   			on ajoute le F final pour etre conforme au format IMSI
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xf)
	FINSI
FINSI


#
#----- Ajout des champs idpart et MSISDN
# 	champ idpart
	erreur_660004629 = i_get_field_str(g_iartin,"Originator",str_originator_660004629)
	trace2("TmmsR2 [Dist] :la valeur recupere de Originator est:<%s>",str_originator_660004629," ")
	erreur_660004629 = i_get_field_str(g_iartin,"Destination1",str_destination1_660004629)
	trace2("TmmsR2 [Dist] :la valeur recupere de Destination1 est:<%s>",str_destination1_660004629," ")	
	taille_Destination1_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1-1)
	taille_Originator_660004629 = i_get_art_field(g_iartin,$TmmsR2::Originator-1)
	taille_destinationN_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1+3*count_660004629-1)
       
SI((callType_660004629== 0x31) || (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37))
ALORS
	
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)
	ALORS
# anomalie interne 2938 : pas de "+.....@....."
		caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,0)
		SI (caract_660004629 == 0x2B)
		ALORS
			trace("Erreur duplication champ idpart : adresse mail commencant par +")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"idpart")
			SAUT STOCKE_ERRONE
		FINSI
# /anomalie interne 2938

# cas d'un mail
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","")
		SI (taille_Originator_660004629 < 19)
		ALORS
			erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",8*taille_Originator_660004629+8)
		SINON
			erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",8*19)
		FINSI
# on affecte au premier ocet de idpart 0
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,0,0)
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,1,0)                     
# suivi par la valeur en ascii 	
		erreur_660004629 = i_get_art_str(g_iartin,$TmmsR2::Originator,ptr_str_660004629)
		taille_str_660004629= i_strlen(ptr_str_660004629)
		SI (taille_str_660004629 > 36)
		ALORS
			taille_str_660004629 = 36
		FINSI
		indice_octet_660004629 = 0

		POINT	BOUCLE1	
		SI (indice_octet_660004629 <= taille_str_660004629-1)
		ALORS
			caract_F0_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629)
			SI((caract_F0_660004629 >=0x30) && (caract_F0_660004629 <=0x39))
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+2,caract_F0_660004629)
			SINON
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+2,caract_F0_660004629-0x37)
			FINSI
			trace3("TmmsR2 [Dist] :g_iartout[%d]=%x %d",indice_octet_660004629,g_iartout.idpart[indice_octet_660004629],indice_octet_660004629) 
			caract_0F_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629+1)
			SI((caract_0F_660004629 >=0x30) && (caract_0F_660004629 <=0x39))
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+3,caract_0F_660004629)
			SINON
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+3,caract_0F_660004629-0x37)
			FINSI
			trace3("TmmsR2 [Dist] :g_iartout[%d]=%x %d",indice_octet_660004629,g_iartout.idpart[indice_octet_660004629+1],indice_octet_660004629)
			indice_octet_660004629 = indice_octet_660004629 +2
			SAUT BOUCLE1
		FINSI
		trace("TmmsR2 [Dist] :idpart est mis a jour :cas de originator mail")
				
	FINSI

# test si format_MSISDN (commence par +)
	caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,0)
	SI (caract_660004629 == 0x2B)
	ALORS
# ano 2968 : pas de "+...*"
	caractFIN_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator, taille_Originator_660004629-1 ) 
	SI ( caractFIN_660004629 == 0x2A)
	ALORS
		trace("Erreur duplication champ idpart : +...*")
		ERREUR_660004629 = ERR_DUPL_660004629
		code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
		erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"idpart")
		SAUT STOCKE_ERRONE
	FINSI
# /ano 2968 : pas de "+...*"
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","") 
#Debut 1722
	
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",4*(taille_Originator_660004629-1))
	indice_octet_660004629 = 1
	POINT BOUCLE_PLUS_1
	SI(indice_octet_660004629 < taille_Originator_660004629)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629-1,i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) - 0x30) 
		indice_octet_660004629 = indice_octet_660004629 + 1
		SAUT BOUCLE_PLUS_1
	FINSI
	

# Fin Ano 1722	
	FINSI

# test  si Format_ShortID

indice_octet_660004629 = 0
SI (taille_Originator_660004629 <= 5)
ALORS
	POINT	BOUCLE2
	SI (indice_octet_660004629 < taille_Originator_660004629)
	ALORS	
		SI((i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) >= '0') 
		&& (i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) <= '9'))
		ALORS 
			indice_octet_660004629 = indice_octet_660004629 +1
			SAUT	BOUCLE2	
		SINON 
			SAUT FIN_F_SHORT
		FINSI
	FINSI
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","")
#Debut Ano1722
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",4*taille_Originator_660004629)
	indice_octet_660004629 = 0
	POINT	BOUCLE_6
	SI (indice_octet_660004629 < taille_Originator_660004629)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629,i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) - 0x30) 
		indice_octet_660004629 = indice_octet_660004629 + 1
		SAUT BOUCLE_6
	FINSI	
# Fin Ano 1722
		
FINSI

	FINSI
POINT	FIN_F_SHORT
SI((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	
#	Format@mail(DestinationN)
	indice_660004629 = 0
	POINT	BOUCLE_mail
	SI (indice_660004629 < taille_destinationN_660004629)
	ALORS
	     caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,indice_660004629)
	     SI (caract_660004629 != 0x40)
	     ALORS
			indice_660004629 = indice_660004629 +1
			SAUT BOUCLE_mail
	     SINON
			dest_is_not_numcourt_660004629 = 1
			SAUT CAS_MAIL
	     FINSI
	SINON
		SAUT  FIN_CAS_MAIL
	FINSI	
		
POINT CAS_MAIL
# anomalie interne 2938 : pas de "+.....@....."
		caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,0)
		SI (caract_660004629 == 0x2B)
		ALORS
			trace("Erreur duplication champ idpart : adresse mail commencant par +")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"idpart")
			SAUT STOCKE_ERRONE
		FINSI
# /anomalie interne 2938

# cas d'un mail
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","") 
	SI (taille_destinationN_660004629 < 19)
	ALORS
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",8*taille_destinationN_660004629+8)
	SINON
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",8*19)
	FINSI
# on affecte au premier ocet de idpart 0
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,0,0)
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,1,0)			
# suivi par la valeur en ascii 	
	erreur_660004629 = i_get_art_str(g_iartin,$TmmsR2::Destination1+3*count_660004629,ptr_str_660004629)
	taille_str_660004629= i_strlen(ptr_str_660004629)
	SI (taille_str_660004629 > 36)
	ALORS 
		taille_str_660004629 = 36
	FINSI
	indice_octet_660004629 = 0

	POINT	BOUCLE3	
	SI (indice_octet_660004629 <= taille_str_660004629-1)
	ALORS
		caract_F0_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629)
		SI((caract_F0_660004629 >=0x30) &&(caract_F0_660004629 <= 0x39))
		ALORS
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+2,caract_F0_660004629)
		SINON
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+2,caract_F0_660004629-0x37)
		FINSI
		trace3("TmmsR2 [Dist] :g_iartout[%d]=%x %d",indice_octet_660004629,g_iartout.idpart[indice_octet_660004629],indice_octet_660004629) 
		caract_0F_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629+1)
		SI((caract_0F_660004629 >= 0x30) && (caract_0F_660004629 <= 0x39))
		ALORS
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+3,caract_0F_660004629)
		SINON
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629+3,caract_0F_660004629-0x37)
		FINSI
		trace3("TmmsR2 [Dist] :g_iartout[%d]=%x %d",indice_octet_660004629,g_iartout.idpart[indice_octet_660004629+1],indice_octet_660004629)
		indice_octet_660004629 = indice_octet_660004629 +2
		SAUT BOUCLE3
	FINSI
	trace("TmmsR2 [Dist] :idpart est mis a jour :cas d une destination mail")		
			
POINT FIN_CAS_MAIL
# test si format_MSISDN (commence par +)

	caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,0)
	SI (caract_660004629 == 0x2B)
	ALORS
# ano 2968 : pas de "+...*"
# ano duplication MSISDN 02 04 2007
		erreur_660004629 = i_EntierToString( count_660004629, str_count_660004629, 4)
# /ano duplication MSISDN 02 04 2007
		erreur_660004629 = i_format_str2(str_destinationCount_660004629, "%s%s", "Destination", str_count_660004629)
		trace2("## str_destinationCount == <%s>%s", str_destinationCount_660004629, "")
		erreur_660004629 = i_get_field_str(g_iartin,str_destinationCount_660004629,str_dest_660004629)
		
		caractFIN_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629, taille_destinationN_660004629-1 ) 
		SI ( caractFIN_660004629 == 0x2A)
		ALORS
			trace("Erreur duplication champ idpart : +...*")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"idpart")
			SAUT STOCKE_ERRONE
		FINSI
# /ano 2968 : pas de "+...*"

	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","")
# Debut Ano 1722
		
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",4*(taille_destinationN_660004629-1))
	indice_octet_660004629 = 1
	POINT BOUCLE_PLUS
	SI(indice_octet_660004629 < taille_destinationN_660004629)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629-1,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,indice_octet_660004629) - 0x30) 
		indice_octet_660004629 = indice_octet_660004629 + 1
		SAUT BOUCLE_PLUS
	FINSI
	
# Fin Ano 1722		
	
	FINSI

# test  si Format_ShortID
	
	indice_octet_660004629 = 0
	SI (taille_destinationN_660004629 <= 5)
	ALORS
	POINT	BOUCLE4
	SI (indice_octet_660004629 < taille_destinationN_660004629)
	ALORS	
		SI ((i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,indice_octet_660004629) >= '0') 
					&& (i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,indice_octet_660004629) <= '9'))
		ALORS 
			indice_octet_660004629 = indice_octet_660004629 +1
			SAUT	BOUCLE4	
		SINON 
			SAUT FIN_F_SHT
		FINSI
	FINSI
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t2","")
#Debut Ano 1722
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t2","idpart",4*taille_destinationN_660004629)
	indice_octet_660004629 = 0
	POINT	BOUCLE_5
	SI (indice_octet_660004629 < taille_destinationN_660004629)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_octet_660004629,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,indice_octet_660004629) - 0x30) 
		indice_octet_660004629 = indice_octet_660004629 + 1
		SAUT BOUCLE_5
	FINSI	
# Fin Ano 1722
	FINSI
	FINSI
POINT	FIN_F_SHT
 
SI((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)
	ALORS
# anomalie interne 2938 : pas de "+.....@....."
		caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,0)
		SI (caract_660004629 == 0x2B)
		ALORS
			trace("Erreur duplication champ MSISDN : adresse mail commencant par +")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"MSISDN")
			SAUT STOCKE_ERRONE
		FINSI
# /anomalie interne 2938

# cas d'un mail
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
		SI ( taille_Originator_660004629 < 19)
		ALORS
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",8*taille_Originator_660004629+8)
		SINON
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",8*19)
		FINSI
# on affecte au premier ocet de idpart 0
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0)
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0)			
# suivi par la valeur en ascii 	
	erreur_660004629 = i_get_art_str(g_iartin,$TmmsR2::Originator,ptr_str_660004629)
	taille_str_660004629= i_strlen(ptr_str_660004629)
	SI (taille_str_660004629 > 36)
	ALORS
		taille_str_660004629 =36
	FINSI
	indice_octet_660004629 = 0
	POINT	BOUCLE5	
	SI (indice_octet_660004629 <= taille_str_660004629-1)
	ALORS
	caract_F0_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629)
	SI((caract_F0_660004629 >= 0x30) && (caract_F0_660004629 <= 0x39))
	ALORS
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+2,caract_F0_660004629)
	SINON
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+2,caract_F0_660004629-0x37)
	FINSI
	caract_0F_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629+1)
	SI((caract_0F_660004629 >= 0x30) && (caract_0F_660004629 <= 0x39))
	ALORS
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+3,caract_0F_660004629)
	SINON
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+3,caract_0F_660004629-0x37)
	FINSI
	trace3("TmmsR2 [Dist] :MSISDN[%d]=%x %d",indice_octet_660004629+3,g_iartout.MSISDN[indice_octet_660004629+3],indice_octet_660004629+3)
	indice_octet_660004629 = indice_octet_660004629 +2
	SAUT BOUCLE5
	FINSI
	trace("TmmsR2 [Dist] :MSISDN est mis a jour :cas d une destination mail")
	
	FINSI

# test si format_MSISDN (commence par +)

	caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,0)
	SI (caract_660004629 == 0x2B)
	ALORS
# ano 2968 : pas de "+...*"
		caractFIN_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Originator, taille_Originator_660004629-1 )
		SI (caractFIN_660004629 == 0x2A)
		ALORS
			trace("Erreur duplication champ MSISDN : +...*")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"MSISDN")
			SAUT STOCKE_ERRONE
		FINSI
# /ano 2968 : pas de "+...*"
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","") 

#Debut Ano 1801
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*(taille_Originator_660004629-1))
		indice_octet_660004629 = 1
		POINT BOUCLE_MSISDN_PLUS
		SI(indice_octet_660004629 < taille_Originator_660004629)
		ALORS
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629-1,i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) - 0x30) 
			indice_octet_660004629 = indice_octet_660004629 + 1
			SAUT BOUCLE_MSISDN_PLUS
		FINSI
		
	#trace("duplication par dup_chp_rnis")		
#Fin Ano 1801
		FINSI

# test  si Format_ShortID

indice_octet_660004629 = 0
SI (taille_Originator_660004629 <= 5)
ALORS
POINT	BOUCLE6
	SI indice_octet_660004629 < taille_Originator_660004629
	ALORS	
		SI((i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) >= '0') 
					&& (i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) <= '9'))
		ALORS 
			indice_octet_660004629 = indice_octet_660004629 +1
			SAUT	BOUCLE6	
		SINON 
			SAUT FIN_SHORT
		FINSI
	FINSI
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
#Debut Ano 1801
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*taille_Originator_660004629)
	indice_octet_660004629 = 0
	POINT	BOUCLE_MSISDN_1
	SI (indice_octet_660004629 < taille_Originator_660004629)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629,i_get_art_fieldtab(g_iartin,$TmmsR2::Originator,indice_octet_660004629) - 0x30) 
		indice_octet_660004629 = indice_octet_660004629 + 1
		SAUT BOUCLE_MSISDN_1
	FINSI	
FINSI
	
FINSI  
POINT	FIN_SHORT

SI ( (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37) )
ALORS	
	SI (i_strcmp(i_strchr_660004265(str_destination1_660004629,'@'),g_inull)!=0)
	ALORS
# anomalie interne 2938 : pas de "+.....@....."
		caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,0)
		SI (caract_660004629 == 0x2B)
		ALORS
			trace("Erreur duplication champ MSISDN : adresse mail commencant par +")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"MSISDN")
			SAUT STOCKE_ERRONE
		FINSI
# /anomalie interne 2938

# cas d'un mail
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
		SI (taille_Destination1_660004629 < 19)
		ALORS
## OGA 532
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",8*taille_Destination1_660004629+8)
## /OGA 532
		SINON
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",8*19)
		FINSI
# on affecte au premier ocet de idpart 0
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0)
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0)			
# suivi par la valeur en ascii 	
	erreur_660004629 = i_get_art_str(g_iartin,$TmmsR2::Destination1,ptr_str_660004629)
	taille_str_660004629= i_strlen(ptr_str_660004629)
	SI (taille_str_660004629 > 36)
	ALORS
		taille_str_660004629 = 36
	FINSI
	indice_octet_660004629 = 0
	POINT	BOUCLE7	
	SI (indice_octet_660004629 <= taille_str_660004629-1)
	ALORS
	caract_F0_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629)
	SI((caract_F0_660004629 >= 0x30) && (caract_F0_660004629 <= 0x39))
	ALORS
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+2,caract_F0_660004629)
	SINON
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+2,caract_F0_660004629-0x37)
	FINSI
	caract_0F_660004629 = i_strtab(ptr_str_660004629,indice_octet_660004629+1)
	SI((caract_0F_660004629 >= 0x30) && (caract_0F_660004629 <= 0x39))
	ALORS
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+3,caract_0F_660004629)
	SINON
	erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629+3,caract_0F_660004629-0x37)
	FINSI
	indice_octet_660004629 = indice_octet_660004629 +2
	SAUT BOUCLE7
	FINSI
	trace("TmmsR2 [Dist] :MSISDN est mis a jour :cas d une destination mail")
		FINSI

# test si format_MSISDN (commence par +)

	caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,0)
	SI (caract_660004629 == 0x2B)
	ALORS
# ano 2968 : pas de "+...*"
		caractFIN_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1, taille_Destination1_660004629-1 )
		SI (caractFIN_660004629 == 0x2A)
		ALORS
			trace("Erreur duplication champ MSISDN : +...*")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"MSISDN")
			SAUT STOCKE_ERRONE
		FINSI
# /ano 2968 : pas de "+...*"

		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
#Debut Ano 1801

			erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*(taille_Destination1_660004629-1))
			indice_octet_660004629 = 1
			POINT BOUCLE_MSISDN_PLUS_1
			SI(indice_octet_660004629 < taille_Destination1_660004629)
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629-1,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) - 0x30) 
				indice_octet_660004629 = indice_octet_660004629 + 1
				SAUT BOUCLE_MSISDN_PLUS_1
			FINSI
		
#Fin Ano 1801
	
		FINSI

# test  si Format_ShortID

indice_octet_660004629 = 0
SI (taille_Destination1_660004629 <= 5)
ALORS
POINT	BOUCLE8
	SI (indice_octet_660004629 < taille_Destination1_660004629)
	ALORS	
	SI ((i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) >= '0') 
					&& (i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) <= '9'))
	ALORS 
			indice_octet_660004629 = indice_octet_660004629 +1
			SAUT	BOUCLE8	
	SINON 
			SAUT FIN_FSHORT
	FINSI
	FINSI
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
#Debut Ano 1801
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*taille_Destination1_660004629)
			indice_octet_660004629 = 0
			POINT BOUCLE_MSISDN_2
			SI(indice_octet_660004629 < taille_Destination1_660004629)
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) - 0x30) 
				indice_octet_660004629 = indice_octet_660004629 + 1
				SAUT BOUCLE_MSISDN_2
			FINSI		
FINSI

FINSI
POINT	FIN_FSHORT
SI (callType_660004629 == 0x31)
ALORS
# test si format_MSISDN (commence par +)
	caract_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,0)
	SI (caract_660004629 == 0x2B)
	ALORS
# ano 2968 : pas de "+...*"
		caractFIN_660004629 = i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1, taille_Destination1_660004629-1 )
		SI (caractFIN_660004629 == 0x2A)
		ALORS
			trace("Erreur duplication champ MSISDN : +...*")
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"MSISDN")
			SAUT STOCKE_ERRONE
		FINSI
# /ano 2968 : pas de "+...*"

		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
		
#Debut Ano 1801
			erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*(taille_Destination1_660004629-1))	
			indice_octet_660004629 = 1
			POINT BOUCLE_MSISDN_PLUS_2
			SI(indice_octet_660004629 < taille_Destination1_660004629)
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629-1,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) - 0x30) 
				indice_octet_660004629 = indice_octet_660004629 + 1
				SAUT BOUCLE_MSISDN_PLUS_2
			FINSI
#Fin Ano 1801
			
		
		FINSI

# test  si Format_ShortID

indice_octet_660004629 = 0
SI (taille_Destination1_660004629 <= 5)
ALORS
POINT	BOUCLE9
	SI indice_octet_660004629 < taille_Destination1_660004629
	ALORS	
		SI((i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) >= '0') 
					&& (i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) <= '9'))
		ALORS 
					
			indice_octet_660004629 = indice_octet_660004629 +1
			SAUT	BOUCLE9	
		SINON 
			SAUT FIN_F_ST
		FINSI
	FINSI
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t4","")
#Debut Ano 1801
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t4","MSISDN",4*taille_Destination1_660004629)
			indice_octet_660004629 = 0
			POINT BOUCLE_MSISDN_3
			SI(indice_octet_660004629 < taille_Destination1_660004629)
			ALORS
				erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_octet_660004629,i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1,indice_octet_660004629) - 0x30) 
				indice_octet_660004629 = indice_octet_660004629 + 1
				SAUT BOUCLE_MSISDN_3
			FINSI
		FINSI

	FINSI	
POINT	FIN_F_ST

#----- Ajout du champ local 
RoamingInfo_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::RoamingInfo)
SI (RoamingInfo_present_660004629)
ALORS
	taille_RoamingInfo_660004629 = i_get_art_field(g_iartin,$TmmsR2::RoamingInfo-1)
        erreur_660004629 = i_ajout_tlv(g_iartout,"T3t3","")
        SI (taille_RoamingInfo_660004629 < 18)
        ALORS
                 taille_local_660004629 = (taille_RoamingInfo_660004629+1)/2
        SINON
                 taille_local_660004629 = 9
        FINSI
        erreur_660004629 = i_resize_tlv(g_iartout,"T3t3","local",8*taille_local_660004629)
	indice_octet_660004629 = 0
	POINT BOUCLE_LOCAL
	SI ((indice_octet_660004629 < taille_RoamingInfo_660004629) && (indice_octet_660004629/2 < taille_local_660004629))
	ALORS
		caract_660004629 = i_get_field_char_660004265(g_iartin,$TmmsR2::RoamingInfo,indice_octet_660004629)
		trace1("la valeur recupere de caract est %x",caract_660004629)
		SI ((caract_660004629 >= '0') && (caract_660004629 <= '9'))
		ALORS
			erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,indice_octet_660004629,caract_660004629-'0')	
		        trace1("la valeur affecte est %x",caract_660004629-'0')
		SINON
			trace("Erreur duplication champ local : digit incorrect")
# FE 54 ##
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
# /FE 54 ##
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"local")
			SAUT STOCKE_RECYCLE
		FINSI
        	indice_octet_660004629 = indice_octet_660004629 + 1
        	SAUT BOUCLE_LOCAL
	FINSI
	SI ((indice_octet_660004629%2)==1)
	ALORS
		erreur_660004629 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,indice_octet_660004629,0xF)
	FINSI

FINSI
trace("local est mis a jour")
#----- 		Ajout des champs MailIdpart et MailMsOrEntity en DPV 3.2
SI ((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	SI ((dest_is_not_numcourt_660004629 == 1) && (i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,0) != '+'))
#	Cas d'une adresse email Destinations
	ALORS
	trace("maj de MailIdpart: destinationN est une adresse mail")
	taille_destinationN_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1+3*count_660004629-1)
	trace1("la taille de DestinationN est %x",taille_destinationN_660004629)
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t23","")
	L3t23_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::MailIdpart-1)
		SI (taille_destinationN_660004629 < L3t23_def_660004629)
		ALORS
			taille_mailIdpart_660004629 = taille_destinationN_660004629
		SINON
			taille_mailIdpart_660004629 = L3t23_def_660004629
		FINSI
	
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t23","MailIdpart",taille_mailIdpart_660004629)
        erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MailIdpart,i_get_art_fieldptr(g_iartin,$TmmsR2::Destination1+3*count_660004629),taille_mailIdpart_660004629)
	FINSI
	
#	SI (i_isnull_str(i_strchr(str_originator,'@')) != 0)
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)
	ALORS
		trace("maj de MailMsOrEntity: Originator est adresse mail")
#		Cas d'une adresse email Originator
		taille_originator_660004629 = i_get_art_field(g_iartin,$TmmsR2::Originator-1)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t24","")
		L3t24_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::MailMsOrEntity-1) 
		SI (taille_originator_660004629 < L3t24_def_660004629)
		ALORS
			taille_mailMsOrEntity_660004629 = taille_originator_660004629
		SINON
			taille_mailMsOrEntity_660004629 = L3t24_def_660004629
		FINSI
		
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t24","MailMsOrEntity",taille_mailMsOrEntity_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MailMsOrEntity,g_iartin.Originator[],taille_mailMsOrEntity_660004629)	
	FINSI
FINSI

#----- 		Ajout des champs MailIdpart et MailMsOrEntity en DPV 3.1
SI ((callType_660004629 == 0x31) || (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37))
ALORS
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)			
	ALORS
		trace("maj de MailIdpart: Originator est adresse mail")
#		Cas d'une adresse email Originator
		taille_originator_660004629 = i_get_art_field(g_iartin,$TmmsR2::Originator-1)				
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t23","")
		L3t23_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::MailIdpart-1)
		SI (taille_originator_660004629 < L3t23_def_660004629)
		ALORS
			taille_mailIdpart_660004629 = taille_originator_660004629
		SINON
			taille_mailIdpart_660004629 = L3t23_def_660004629
		FINSI
		
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t23","MailIdpart",taille_mailIdpart_660004629)
	erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MailIdpart,g_iartin.Originator[],taille_mailIdpart_660004629)
	FINSI

	SI (i_strcmp(i_strchr_660004265(str_destination1_660004629,'@'),g_inull)!=0)
	ALORS
		trace("maj de MailMsOrEntity : Destination1 est adresse mail") 
#		Cas d'une adresse email Destinations
		taille_destination1_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1-1)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t24","")
		L3t24_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::MailMsOrEntity-1)
		SI (taille_destination1_660004629 < L3t24_def_660004629)
		ALORS
			taille_mailMsOrEntity_660004629 = taille_destinationN_660004629
		SINON
			taille_mailMsOrEntity_660004629 = L3t24_def_660004629
		FINSI
		
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t24","MailMsOrEntity",taille_mailMsOrEntity_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MailMsOrEntity,g_iartin.Destination1[],taille_mailMsOrEntity_660004629)
	FINSI
FINSI
trace("	mailMsOrEntity est mis a jour")		
#----- Ajout du champ MMSsubscribId2
SI ((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	RecipientIMSI_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::RecipientIMSI)
	SI (RecipientIMSI_present_660004629)
	ALORS
		erreur_660004629 = i_get_field_str(g_iartin,"RecipientIMSI",str_subId2_660004629)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t25","")
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t25","MMSsubscribId2",64)
		erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::MMSsubscribId2,str_subId2_660004629)
	SINON
		RecipientIMSI_present_660004629 = i_get_art_field(g_iartin,$TmmsR2::RecipientIMSI-1)
		SI (RecipientIMSI_present_660004629 == 0)
		ALORS
			erreur_660004629 = i_ajout_tlv(g_iartout,"T3t25","")
			erreur_660004629 = i_resize_tlv(g_iartout,"T3t25","MMSsubscribId2",64)
			erreur_660004629 = affectation_tab_660004265(g_iartout,$Tdpvgsm::MMSsubscribId2,"FFFFFFFFFFFFFFFF")
		FINSI		
	FINSI
FINSI
#----- Ajout des champs MMSoutInterf et MMSinInterf
OutgoingInterfId_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::OutggInterfId)
SI (OutgoingInterfId_present_660004629)
ALORS
	trace("Outgoinginterf est present")
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t27","")
	taille_OutgoingInterfId_660004629 = i_get_art_field(g_iartin,$TmmsR2::OutggInterfId-1)
	L3t27_def_660004629= i_get_art_field(g_iartout,$Tdpvgsm::MMSoutInterf -1)
	SI (taille_OutgoingInterfId_660004629 < L3t27_def_660004629)
	ALORS
		taille_MMSoutInterf_660004629 = taille_OutgoingInterfId_660004629
	SINON
		taille_MMSoutInterf_660004629 = L3t27_def_660004629
	FINSI
	
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t27","MMSoutInterf",taille_MMSoutInterf_660004629)
	erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MMSoutInterf,g_iartin.OutggInterfId[],taille_MMSoutInterf_660004629)
FINSI
trace("MMSoutInterf est mis a jour")
IncomingInterfId_present_660004629 = i_valid_field_n(g_iartin,$TmmsR2::IncgInterfId)
SI (IncomingInterfId_present_660004629)
ALORS
	trace("incomingInterf est present")
	erreur_660004629 = i_ajout_tlv(g_iartout,"T3t28","")
	taille_IncomingInterfId_660004629 = i_get_art_field(g_iartin,$TmmsR2::IncgInterfId-1)
	L3t28_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::MMSinInterf-1)	
	SI (taille_IncomingInterfId_660004629 < L3t28_def_660004629)
	ALORS
		taille_MMSinInterf_660004629 = taille_IncomingInterfId_660004629
	SINON
		taille_MMSinInterf_660004629 = L3t28_def_660004629
	FINSI	
	erreur_660004629 = i_resize_tlv(g_iartout,"T3t28","MMSinInterf",taille_MMSinInterf_660004629)
	erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::MMSinInterf,g_iartin.IncgInterfId[],taille_MMSinInterf_660004629)
FINSI	
trace("fin mise a jour MMSinInterf")

#Debut FE_0022
####################################################################
#Maj du champ V4t35.2 Occurrence Number
####################################################################

	SI ((callType_660004629==0x31)||(callType_660004629==0x33)||(callType_660004629==0x35)||(callType_660004629==0x37))
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t35.2","")
		erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::occurenceNb,0x01)
	FINSI
	
	SI ((callType_660004629==0x30)||(callType_660004629==0x32)||(callType_660004629==0x34)||(callType_660004629==0x36))
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t35.2","")
		erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::occurenceNb,count_660004629+1)
	FINSI
#Fin FE_0022
# Ajout du champ participantsNb dans le cas simple et Multiple
	
	erreur_660004629 = i_ajout_tlv(g_iartout,"T4t35.3","")
	erreur_660004629 = i_resize_tlv(g_iartout,"T4t35.3","participantsNb",2)
# OGA-218
        erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::participantsNb,MultiDestinations_660004629)

#  Ajout du champ userIdNet en DPV3.2
SI ((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)
	ALORS
		trace("maj de userIdNet : originator est une adresse mail")
#		Cas d'une adresse email Originator
		taille_originator_660004629 = i_get_art_field(g_iartin,$TmmsR2::Originator-1)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t40.1","")
		L4t40_1_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::userIdNet-1)
		SI (taille_originator_660004629 < L4t40_1_def_660004629)
		ALORS
			taille_userIdNet_660004629 = taille_originator_660004629
		SINON
			taille_userIdNet_660004629 = L4t40_1_def_660004629
		FINSI			
		erreur_660004629 = i_resize_tlv(g_iartout,"T4t40.1","userIdNet",taille_userIdNet_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::userIdNet,g_iartin.Originator[],taille_userIdNet_660004629)	
		FINSI
	FINSI
SI ((callType_660004629 == 0x31) || (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37))
ALORS
	SI (i_strcmp(i_strchr_660004265(str_destination1_660004629,'@'),g_inull)!=0)
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t40.1","")
		taille_destination1_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1-1)
		L4t40_1_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::userIdNet-1)
		SI (taille_destination1_660004629 < L4t40_1_def_660004629)
		ALORS
			taille_userIdNet_660004629 = taille_destination1_660004629
		SINON
			taille_userIdNet_660004629 = L4t40_1_def_660004629
		FINSI	
		erreur_660004629 = i_resize_tlv(g_iartout,"T4t40.1","userIdNet",taille_userIdNet_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::userIdNet,g_iartin.Destination1[],taille_userIdNet_660004629)
	FINSI
FINSI
#  Ajout du champ partTransID en DPV3.2
SI ((callType_660004629 == 0x30) || (callType_660004629 == 0x32) || (callType_660004629 == 0x34) || (callType_660004629 == 0x36))
ALORS
	SI ((dest_is_not_numcourt_660004629 == 1) && (i_get_art_fieldtab(g_iartin,$TmmsR2::Destination1+3*count_660004629,0) != '+'))
	ALORS
		trace("mise a jour de partTransId: cas de destinationN mail")
#		Cas d'une adresse email Destinations
		taille_destinationN_660004629 = i_get_art_field(g_iartin,$TmmsR2::Destination1+3*count_660004629-1)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t50.3","")
		L4t50_3_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::partTransID-1)
		SI (taille_destinationN_660004629 < L4t50_3_def_660004629)
		ALORS
			taille_partTransID_660004629 = taille_destinationN_660004629
		SINON
			taille_partTransID_660004629 = L4t50_3_def_660004629
		FINSI			
		erreur_660004629 = i_resize_tlv(g_iartout,"T4t50.3","partTransID",taille_partTransID_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::partTransID,i_get_art_fieldptr(g_iartin,$TmmsR2::Destination1+3*count_660004629),taille_partTransID_660004629)
		FINSI
	FINSI
	
SI ((callType_660004629 == 0x31) || (callType_660004629 == 0x33) || (callType_660004629 == 0x35) || (callType_660004629 == 0x37))
ALORS
	trace("mise a jour de partTransId: cas de originator mail")
	SI (i_strcmp(i_strchr_660004265(str_originator_660004629,'@'),g_inull)!=0)
	ALORS
#		Cas d'une adresse email Originator
#		taille_originator = i_get_field_osize(g_iartin,ICC_Originator)
		taille_originator_660004629 = i_get_art_field(g_iartin,$TmmsR2::Originator-1)
		erreur_660004629 = i_ajout_tlv(g_iartout,"T4t50.3","")
		L4t50_3_def_660004629=i_get_art_field(g_iartout,$Tdpvgsm::partTransID-1)
		SI (taille_originator_660004629 < L4t50_3_def_660004629)
		ALORS
			taille_partTransID_660004629 = taille_originator_660004629
		SINON
			taille_partTransID_660004629 = L4t50_3_def_660004629
		FINSI		
		erreur_660004629 = i_resize_tlv(g_iartout,"T4t50.3","partTransID",taille_partTransID_660004629)
		erreur_660004629 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::partTransID,g_iartin.Originator[],taille_partTransID_660004629)
	FINSI
	
FINSI
	

#----- Ajout du champ MMStypeOfCont
SI (i_valid_field_n(g_iartin,$TmmsR2::MessageContent))
ALORS
		trace("MessageContent est present")
		erreur_660004629 = i_get_field_str(g_iartin,"MessageContent",str_MC_660004629)
		trace2("str_MC est %s",str_MC_660004629,"")
		ent_MC_660004629 = 0x00

		SI (i_strstr_660004265(str_MC_660004629,"text") ==0)
		ALORS
			ent_MC_660004629 = ent_MC_660004629 | 0x01
			trace1("ent_MC %x",ent_MC_660004629)
		FINSI

		SI (i_strstr_660004265(str_MC_660004629,"audio") ==0)
		ALORS		
		ent_MC_660004629 = ent_MC_660004629 | 0x02
		FINSI

		SI (i_strstr_660004265(str_MC_660004629,"image") ==0)
		ALORS
			ent_MC_660004629 = ent_MC_660004629 | 0x04
			trace1("ent_MC %x",ent_MC_660004629)
		FINSI

		SI (i_strstr_660004265(str_MC_660004629,"video") ==0)
		ALORS
			ent_MC_660004629 = ent_MC_660004629 | 0x08
		FINSI

		SI (i_strstr_660004265(str_MC_660004629,"application") ==0)
		ALORS
			ent_MC_660004629 = ent_MC_660004629 | 0x10
		FINSI
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t26","")
		erreur_660004629 = i_resize_tlv(g_iartout,"T3t26","MMStypeOfCont",1)
		erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::MMStypeOfCont,ent_MC_660004629)
FINSI


#----- Mise a jour de la cellule Ajout CE
# QC1331
#erreur=set_timeInCE_EEC(0)
########### Date_Audit
erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004629 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#
# Creation d'un DPV pour chaque destinataire
#
	date_reference_660004629 = i_get_art_date(g_iartout)
	recordOriginalDate_660004629 = i_get_art_field(g_iartin, $TmmsR2::SubmissTime)
	
	SI ((callType_660004629==0x30)||(callType_660004629==0x32)||(callType_660004629==0x34)||(callType_660004629==0x36))
	ALORS
		date_art_660004629 = recordOriginalDate_660004629
		SI (date_art_660004629 ==-1)
		ALORS
# FE 54 ##
			ERREUR_660004629 = ERR_SEM_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
# /FE 54 ##
			erreur_660004629=i_PlvMessEmettre(8218 , 2, g_iartin, "", 2, code_rejet_660004629, callType_660004629, 0)
			SAUT STOCKE_ERRONE
		FINSI
		erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::DATE,recordOriginalDate_660004629 +count_660004629)
		SI (erreur_660004629)
		ALORS
			trace("TmmsR2 [Dist] :erreur de duplication DATE => Fin de traitement")
# FE 54 ##
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
# /FE 54 ##
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629,"DATE")
			SAUT STOCKE_ERRONE
		FINSI
		date_reference_660004629 = recordOriginalDate_660004629
	FINSI		
	SI ((callType_660004629==0x31)||(callType_660004629==0x33)||(callType_660004629==0x35)||(callType_660004629==0x37))
	ALORS
	erreur_660004629 = i_set_art_field(g_iartout,$Tdpvgsm::DATE,deliverTime_660004629)
		SI (erreur_660004629)
		ALORS
			trace("TmmsR2 [Dist] :erreur de duplication DATE => Fin de traitement")
# FE 54 ##
			ERREUR_660004629 = ERR_DUPL_660004629
			code_rejet_660004629 = MODULE_660004629 + ERREUR_660004629 + EFFICACE_660004629
# /FE 54 ##
			erreur_660004629=i_PlvMessEmettre(8219 , 2, g_iartin, "", 3, code_rejet_660004629, callType_660004629, "DATE")
			SAUT STOCKE_ERRONE
		FINSI
	FINSI
		
# Maj du champ DATE par rappot au Nieme champ destination

#	fin du complement de duplication
####################################################################
#	stockage de l'article
####################################################################

	# Ajout des T3t55 et T3t56
	SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GFlag2))
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t55","")
	FINSI

	SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GValue))
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t56","")
	FINSI

	SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GretaTag))
	ALORS
		erreur_660004629 = i_ajout_tlv(g_iartout,"T3t99","")
	FINSI

	SI (count_660004629 == 0)
	ALORS
		erreur_660004629 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_INCONNU_660004629, Multidistribution_Non_660004629)
	SINON
		erreur_660004629 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_INCONNU_660004629, Multidistribution_Oui_660004629)
	FINSI
# QC1005
	SI (erreur_660004629 == TRAI_KO_660004629)
	ALORS
		trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
#		ERREUR = ERR_DUPL
#		code_rejet = MODULE + ERREUR + EFFICACE
#		erreur=i_PlvMessEmettre(8220 , 2, g_iartin, "", 1, code_rejet, 0, 0)
		SAUT STOCKE_ERRONE
	SINON
		SI (erreur_660004629 == TRAI_REDISTRIBUTION_660004629)
		ALORS
			trace("TMMS R2 multi-destinataire en redistribution - Arret temporaire du traitement des autres CRAs")
			count_660004629 = MultiDestinations_660004629
		FINSI
	FINSI
	
	count_660004629 = count_660004629 + 1
	SAUT NOUV_DESTINATION
FINSI

trace("")
trace("**** Fin du distribution ok ****")
RETOUR TRAIT_OK


POINT STOCKE_ERRONE		
      trace("TmmsR2 [Dist] : erreur de duplication")
# FE 54 ##
	erreur_660004629 = i_make_art_rej(g_iartin, g_iartout11, code_rejet_660004629)
	erreur_660004629 = i_stocke_art(g_iartout11,0,PT_ERRONE,0)	
# /FE 54
      RETOUR TRAIT_OK

POINT STOCKE_RECYCLE
      erreur_660004629 = i_stocke_art(g_iartin,0,PT_ERRONE,0)	
      RETOUR TRAIT_OK
#--------------------------------- Fin TmmsR2_dis.src --------------------------------
