DEFINITION C_Article_860026547 "Tpppwl2"
DEFINITION FA_DHCP_V6_860026547 "5"
REGISTRE ENTIER erreur_860026547
REGISTRE ENTIER res_860026547
REGISTRE ENTIER duree_860026547
REGISTRE ENTIER date_860026547
REGISTRE ENTIER b_DHCP_V6_860026547
REGISTRE ENTIER code_errone_860026547
REGISTRE POINTEUR pt_BUF20_860026547
REGISTRE POINTEUR pt_MESSAGE_860026547
############################################################################
# Fichier : Tpppwl2.src
#
# Traitement :  
# En entree :
#    Article : Tpppwl2 article PPP wanadoo lot 2	Ppp
#		informations de consommation
# En sortie :
#	Envoi en divers des DC dont la taille est superieure a 1000 octets
#	Envoi en OK 
#
#HISTORIQUE
#	18/10/05 -FAL- G2R1CwooNG creation
#	05/10/2011 RHE VerifPcode
#	14/11/2014 - DRE - G4R8 QC851 controle des champs devenu optionnels
############################################################################

############################################################################
#			          DEFINITIONS
############################################################################

trace( "Article Tpppwl2 - ppP wanadoo lot2 ")
############################################################################
# Declarations
############################################################################

#DRE G4R8 QC851
# Constantes





#DRE G4R8 QC851



#Affectation
pt_BUF20_860026547 = "pt_BUF20pt_BUF20pt_B"
pt_MESSAGE_860026547 = "pt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGE"


#Initialisation
b_DHCP_V6_860026547	= 0
code_errone_860026547 	= 0


i_strcpy(pt_BUF20_860026547,"")
i_strcpy(pt_MESSAGE_860026547,"")



res_860026547=0
erreur_860026547=0
############################################################################
#initialisations

# VerifPcode - RHE # pt_BUF   = "123456789123456789123456123451234567891234567891234561234512345678912345678912345612345123456789123456789123456123451234567891234567891234561234512345678912345678912345612345123456789123456789123456123451234567891234567891234561234512345678912345678912345612345"
# VerifPcode - RHE # pt_SGTQS = "22345678901234567890223456789"

############################             TRAITEMENT              ################################################

### Elimination en divers des DC dont la taille est superieure a 1000 octets
res_860026547= i_get_art_field (g_iartin, $L1)
SI ( res_860026547 >= 996 )
ALORS
	SAUT STOCKE_DIVERS
FINSI

#DRE G4R8 QC851
erreur_860026547 = i_get_art_str(g_iartin, $Tpppwl2::fa, pt_BUF20_860026547)

SI (i_strcmp(pt_BUF20_860026547, FA_DHCP_V6_860026547) == 0 )
ALORS
	b_DHCP_V6_860026547 = 1
FINSI	

SI b_DHCP_V6_860026547 == 0
ALORS
	SI (!i_valid_field_n(g_iartin, $Tpppwl2::nasname))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'nasname' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::ra))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'ra' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI
 
	SI (!i_valid_field_n(g_iartin, $Tpppwl2::modemspeed))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'modemspeed' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::octestsin))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'octestsin' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::octestsout))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'octestsout' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::packetsin))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'packetsin' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::packetsout))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'packetsout' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::unitpricevalue))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'unitpricevalue' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::unitpriceunit))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'unitpriceunit' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::vat))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'vat' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI

	SI (!i_valid_field_n(g_iartin, $Tpppwl2::ratio))
	ALORS
		#E.PPPWL2.TC8
		i_strcpy(pt_MESSAGE_860026547," Champ obligatoire 'ratio' absent ")	
		code_errone_860026547 = 0x5082
		erreur_860026547 = i_PlvMessEmettre(7090,2,g_iartin,"",3,code_errone_860026547,C_Article_860026547,pt_MESSAGE_860026547)
		SAUT STOCKE_ERRONE
	FINSI
FINSI


#\DRE G4R8 QC851


erreur_860026547 = i_get_art_field(g_iartin, $ddebut)
trace1("relecture ddebut en traitement <%d> ", erreur_860026547)


#==============================================================================
# Creation Enveloppe Optionnelle E_WL2 pour recopie des metachamps de l entree vers les sorties
#==============================================================================
erreur_860026547 = i_add_opt( "E_WL2" )

#champ debut					# utilise par  
date_860026547 = i_get_art_field(g_iartin,$Tpppwl2::DATE)
trace1("2>>>>>>> __LINE__ >>>>>>date =<0x%x>",date_860026547)
erreur_860026547 = i_set_attr_val_n($E_WL2::debut,date_860026547)

#champ duree					# utilise par

duree_860026547 = i_get_art_field(g_iartin,$Tpppwl2::sestimevalH)
trace1("2>>>>>>> __LINE__ >>>>>>duree =<%d>",duree_860026547)
erreur_860026547 = i_set_attr_val_n($E_WL2::duree,duree_860026547)

#champ fin	en entree ajout debut et duree	# utilise par CTT dlot_abs dlot_rel
#							     SIVM dlot_abs dlot_rel
res_860026547  = date_860026547 + duree_860026547
trace1("2>>>>>>> __LINE__ >>>>>>datefin =<0x%x>",res_860026547)
erreur_860026547 = i_set_attr_val_n($E_WL2::fin,res_860026547)

#champ pivot	en entree comme debut		# utilise par CTT dpivot dcompteur
#							     SIVM dpivot dcompteur
#							      SIM dpivot dcompteur
erreur_860026547 = i_set_attr_val_n($E_WL2::pivot,date_860026547)

#champ compteur	en entree comme fin		# utilise par
erreur_860026547 = i_set_attr_val_n($E_WL2::compteur,res_860026547)

#champ trou	en entree comme fin		# utilise par
erreur_860026547 = i_set_attr_val_n($E_WL2::trou,res_860026547)

SAUT STOCKE_OK

############################################################################
#
#                               STOCKAGE
#
############################################################################

#---------------------------------------------------------------------------
# STOCKAGE EN DIVERS
#----------------------------------------------------------------------------
POINT STOCKE_DIVERS
	trace( "Stockage en Divers")
	erreur_860026547 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0)
RETOUR TRAIT_OK

#DRE G4R8 QC851
############################################
#  POINT de branchement : stockage ERRONE  #
############################################

POINT STOCKE_ERRONE

#trace("Stockage en ERRONE ")
erreur_860026547 = i_make_art_rej(g_iartin,g_iartin,code_errone_860026547)
erreur_860026547 = i_stocke_art(g_iartin, 0, PT_ERRONE,0)

RETOUR TRAIT_OK
#\DRE G4R8 QC851



#---------------------------------------------------------------------------
# STOCKAGE EN OK
#----------------------------------------------------------------------------
POINT STOCKE_OK
	erreur_860026547 = i_stocke_art(g_iartin, 0, PT_OK, 0)
RETOUR TRAIT_OK



############################################################################
#                               FIN  Pcode Tpppwl2_tr.src
############################################################################
