master
cherif 2024-08-28 16:34:57 +02:00
parent 1931c81c11
commit ea1a763e14
9 changed files with 9714 additions and 33 deletions

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ddd">
<change afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" afterDir="false" />
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="dddqsd">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/BPF.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -82,13 +80,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00332" summary="15/06/2024 - 21h30">
<created>1718490413169</created>
<option name="number" value="00332" />
<option name="presentableId" value="LOCAL-00332" />
<option name="project" value="LOCAL" />
<updated>1718490413170</updated>
</task>
<task id="LOCAL-00333" summary="17/06/2024 - 21h30">
<created>1718656591744</created>
<option name="number" value="00333" />
@ -425,7 +416,14 @@
<option name="project" value="LOCAL" />
<updated>1724497994600</updated>
</task>
<option name="localTasksCounter" value="381" />
<task id="LOCAL-00381" summary="dddqsd">
<created>1724781881428</created>
<option name="number" value="00381" />
<option name="presentableId" value="LOCAL-00381" />
<option name="project" value="LOCAL" />
<updated>1724781881429</updated>
</task>
<option name="localTasksCounter" value="382" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -467,7 +465,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="26/07/2024 - 12h" />
<MESSAGE value="29/07/2024 - 12h" />
<MESSAGE value="29/07/2024 - 21h" />
<MESSAGE value="30/07/2024 - 12h" />
@ -492,6 +489,7 @@
<MESSAGE value="21/08/2024 - 13h55" />
<MESSAGE value="ss" />
<MESSAGE value="ddd" />
<option name="LAST_COMMIT_MESSAGE" value="ddd" />
<MESSAGE value="dddqsd" />
<option name="LAST_COMMIT_MESSAGE" value="dddqsd" />
</component>
</project>

View File

@ -285,6 +285,390 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
print(" ### Get_Qery_Generate_BPF C2_pipe_qry = ", C2_pipe_qry)
C2_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_organisme_financement__type_apprenant = ([
{"$addFields": {
"mysy_invoice_date": {
'$dateFromString': {
'dateString': '$invoice_date',
'format': "%d/%m/%Y"
}
}
}
},
{'$match': {'invoice_header_type':'facture',
'credit_note_ref': {'$exists': False},
'invoice_header_ref_interne':{'$in':['Invoice_567', 'Invoice_568', 'Invoice_569', 'Invoice_570', 'Invoice_571', 'Invoice_572', 'Invoice_573' ]} } },
{'$lookup': {
'from': 'partner_invoice_line_detail',
"let": {"invoice_header_id": {'$toString': "$_id"},
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$valide", "1"]},
{'$eq': ["$invoice_header_ref_interne",'$$partner_invoice_line_invoice_header_ref_interne']},
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
]
}
}
},
],
'as': 'collection_partner_invoice_line'
}
},
{
'$unwind': '$collection_partner_invoice_line'
},
{'$lookup': {
'from': 'type_organisme_financement',
"let": {'type_financeur_id': "$order_header_type_financeur_id",
},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$type_financeur_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
]
}
}
},
],
'as': 'type_organisme_financement_collection'
}
},
{
'$unwind': '$type_organisme_financement_collection'
},
{'$lookup': {
'from': 'type_apprenant',
"let": {'type_apprenant_code': "$collection_partner_invoice_line.order_line_inscription_type_apprenant",
},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$valide", "1"]},
{'$eq': ["$code",'$$type_apprenant_code']},
]
}
}
},
],
'as': 'type_apprenante_collection'
}
},
{
'$unwind': '$type_apprenante_collection'
},
{'$group': {
'_id': {
"Type Apprenant": "$collection_partner_invoice_line.order_line_inscription_type_apprenant",
"Type Apprenant Description": "$type_apprenante_collection.description",
},
"TotalAmount_HT": {
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
"count": {"$sum": 1}
}
},
{
'$sort': {'count': -1}
},
])
C3_C8_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_pouvoir_public = ([
{"$addFields": {
"mysy_invoice_date": {
'$dateFromString': {
'dateString': '$invoice_date',
'format': "%d/%m/%Y"
}
}
}
},
{'$match': {'invoice_header_type':'facture',
'credit_note_ref': {'$exists': False},
'invoice_header_ref_interne':{'$in':['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592', 'Invoice_593', 'Invoice_594', 'Invoice_595' ]} } },
{'$lookup': {
'from': 'partner_invoice_line_detail',
"let": {"invoice_header_id": {'$toString': "$_id"},
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$valide", "1"]},
{'$eq': ["$invoice_header_ref_interne",'$$partner_invoice_line_invoice_header_ref_interne']},
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
]
}
}
},
],
'as': 'collection_partner_invoice_line'
}
},
{
'$unwind': '$collection_partner_invoice_line'
},
{'$lookup': {
'from': 'type_pouvoir_public',
"let": {'order_header_type_pouvoir_public_id': "$order_header_type_pouvoir_public_id",
},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$order_header_type_pouvoir_public_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
]
}
}
},
],
'as': 'type_pouvoir_public_collection'
}
},
{
'$unwind': '$type_pouvoir_public_collection'
},
{'$group': {
'_id': {
"Type pouvoir public": "$type_pouvoir_public_idt",
"Type pouvoir public": "$type_pouvoir_public_collection.description",
},
"TotalAmount_HT": {
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
"count": {"$sum": 1}
}
},
{
'$sort': {'count': -1}
},
])
C9_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_pouvoir_public = ([
{"$addFields": {
"mysy_invoice_date": {
'$dateFromString': {
'dateString': '$invoice_date',
'format': "%d/%m/%Y"
}
}
}
},
{'$match': {'invoice_header_type':'facture',
'credit_note_ref': {'$exists': False},
'order_header_is_company':'0',
'invoice_header_ref_interne':{'$in':['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592', 'Invoice_593', 'Invoice_594', 'Invoice_595' ]} } },
{'$lookup': {
'from': 'partner_invoice_line_detail',
"let": {"invoice_header_id": {'$toString': "$_id"},
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$valide", "1"]},
{'$eq': ["$invoice_header_ref_interne",'$$partner_invoice_line_invoice_header_ref_interne']},
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
]
}
}
},
],
'as': 'collection_partner_invoice_line'
}
},
{
'$unwind': '$collection_partner_invoice_line'
},
{'$group': {
'_id': {
"Type Client": "$order_header_is_company",
"Type Client public": "Client Type Particulier",
},
"TotalAmount_HT": {
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
"count": {"$sum": 1}
}
},
{
'$sort': {'count': -1}
},
])
F1_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_pouvoir_public = ([
{"$addFields": {
"mysy_date_debut_session": {
'$dateFromString': {
'dateString': '$date_du',
'format': "%d/%m/%Y"
}
}
}
},
{'$project': {'_id': 1, 'email': 1, 'session_id': 1, 'nom': 1, 'prenom':1, 'partner_owner_recid':1, 'valide':1, 'type_apprenant':1}},
{'$match': {'session_id':'66cdeb5d7e8061b7b6f9b066'} },
{'$lookup': {
'from': 'session_formation',
'let': {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [
{'$project': {'_id': 1, 'code_session': 1, 'class_internal_url': 1, 'date_debut': 1, 'date_fin':1, 'nb_participant':1, 'partner_owner_recid':1, 'valide':1}},
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$session_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
]
}
}
},
],
'as': 'session_formation_collection'
}
},
{
'$unwind': '$session_formation_collection'
},
{
"$lookup": {
'from': 'myclass',
'localField': 'session_formation_collection.class_internal_url',
'foreignField': 'internal_url',
"pipeline": [{'$project': {'title': 1, 'internal_url': 1, 'external_code': 1, 'published': 1, 'duration':1, 'duration_unit':1}}
],
"as": "myclass_collection"
}
},
{
'$unwind': '$myclass_collection'
},
{'$lookup': {
'from': 'type_apprenant',
"let": {'type_apprenant_code': "$type_apprenant",
},
'pipeline': [
{'$project': {'_id': 1, 'code': 1, 'description': 1, 'valide':1}},
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$valide", "1"]},
{'$eq': ["$code",'$$type_apprenant_code']},
]
}
}
},
],
'as': 'type_apprenante_collection'
}
},
{
'$unwind': '$type_apprenante_collection'
},
{'$group': {
'_id': {
"Type Apprenant": "$type_apprenant",
"Type Apprenant Description": "$type_apprenante_collection.description",
},
"TotalAmount_HT": {
"$sum": 1},
"count": {"$sum": 1}
}
},
{
'$sort': {'count': -1}
},
])
return True, RetObject

View File

@ -742,6 +742,12 @@ Completude des etapes d'une session de formation : "statut_completude"
"""
"""
Gestion is_company ?
- 0 : Particulier
- 1 : Société
- 2 : Pouvoir Public
"""
"""
Gestion du module d'envoie d'email

View File

@ -233,6 +233,8 @@ def AddStagiairetoClass(diction):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
else:
type_apprenant = str(diction['type_apprenant'])
new_price = "-1" # 0 ==> par defaut
@ -538,7 +540,7 @@ def AddStagiairetoClass(diction):
"""
Un email ne pouvant s'inscrire qu'a une seule session_id; on fait un usert
"""
#print(" #### mydata before inscr = ", mydata)
ret_val = MYSY_GV.dbname['inscription'].find_one_and_update(
{'session_id': str(mydata['session_id']), 'email': str(mydata['email']),},
{"$set": mydata},
@ -2695,7 +2697,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
print( "#### clean_dict ", clean_dict)
#print( "#### clean_dict ", clean_dict)
status, retval = AddStagiairetoClass(clean_dict)
if( status is False ):
@ -3184,7 +3186,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
field_list = ['formation_code_externe', 'code_session', 'prenom', 'nom', 'employeur',
'telephone', 'email', 'modefinancement', 'opco', 'status', 'prix', 'adresse', 'code_postal',
'ville', 'pays', 'client_rattachement_email', 'client_rattachement_nom','facture_client_rattachement_email',
'facture_client_rattachement_nom', 'civilite']
'facture_client_rattachement_nom', 'civilite', 'type_apprenant']
# Controle du nombre de lignes dans le fichier.
@ -3497,15 +3499,31 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
local_status, new_price = mycommon.IsFloat(local_price)
if( local_status is False ):
mycommon.myprint(
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de la ligne " + str( n) + " est incorrecte.")
return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de la ligne " + str(n+2) + " est incorrecte.")
return False, " Le champ prix de la ligne " + str(n+2) + " est incorrecte. "
mydata['price'] = local_price
type_apprenant = ""
if ("type_apprenant" in df.keys()):
if (str(df['type_apprenant'].values[n])):
type_apprenant = str(df['type_apprenant'].values[n]).strip()
if( type_apprenant not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT):
mycommon.myprint(
str(inspect.stack()[0][3]) + "Ligne : " + str(
n + 2) + ". Le type apprenant doit etre l'une des valeurs suivantes :" + str(
MYSY_GV.INSCRIPTION_TYPE_APPRENANT) )
return False, "Ligne : " + str(
n + 2) + ". Le type apprenant doit etre l'une des valeurs suivantes :" + str(
MYSY_GV.INSCRIPTION_TYPE_APPRENANT)
mydata['type_apprenant'] = type_apprenant
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
print( "#### clean_dict ", clean_dict)
#print( "#### clean_dict tt ", clean_dict)
status, retval = AddStagiairetoClass(clean_dict)
if( status is False ):
@ -3583,7 +3601,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
field_list = ['formation_code_externe', 'code_session', 'prenom', 'nom', 'employeur',
'telephone', 'email', 'modefinancement', 'opco', 'status', 'prix', 'adresse', 'code_postal',
'ville', 'pays', 'client_rattachement_email', 'client_rattachement_nom',
'facture_client_rattachement_email', 'facture_client_rattachement_nom', 'civilite']
'facture_client_rattachement_email', 'facture_client_rattachement_nom', 'civilite', 'type_apprenant']
# Controle du nombre de lignes dans le fichier.
@ -3615,9 +3633,6 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
"""
# Recuperation des info de la session.
session_data = MYSY_GV.dbname['session_formation'].find_one({'formation_session_id':str(session_id)})
@ -3864,15 +3879,31 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
local_status, new_price = mycommon.IsFloat(local_price)
if( local_status is False ):
mycommon.myprint(
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de la ligne " + str( n) + " est incorrecte.")
return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de la ligne " + str( n+2) + " est incorrecte.")
return False, " Le champ prix de la ligne " + str(n+2) + " est incorrecte. "
mydata['price'] = local_price
type_apprenant = "0"
if ("type_apprenant" in df.keys()):
if (str(df['type_apprenant'].values[n])):
type_apprenant = str(df['type_apprenant'].values[n]).strip()
if (type_apprenant not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT):
mycommon.myprint(
str(inspect.stack()[0][3]) + "Ligne : " + str(
n + 2) + ". Le type apprenant doit etre l'une des valeurs suivantes :" + str(
MYSY_GV.INSCRIPTION_TYPE_APPRENANT))
return False, "Ligne : " + str(
n + 2) + ". Le type apprenant doit etre l'une des valeurs suivantes :" + str(
MYSY_GV.INSCRIPTION_TYPE_APPRENANT)
mydata['type_apprenant'] = type_apprenant
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
print( "#### clean_dict ", clean_dict)
#print( "#### clean_dict ", clean_dict)
return True, str(total_rows)+" participants dans le fichier"

File diff suppressed because one or more lines are too long

View File

@ -10752,7 +10752,35 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
order_header_type_client_id = partner_client_id_data['client_type_id']
partner_invoice_header_data['order_header_type_client_id'] = order_header_type_client_id
order_header_type_financeur_id = ""
if ("type_financeur_id" in partner_client_id_data.keys()):
order_header_type_financeur_id = partner_client_id_data['type_financeur_id']
partner_invoice_header_data['order_header_type_financeur_id'] = order_header_type_financeur_id
order_header_is_financeur = ""
if ("is_financeur" in partner_client_id_data.keys()):
order_header_is_financeur = partner_client_id_data['is_financeur']
partner_invoice_header_data['order_header_is_financeur'] = order_header_is_financeur
order_header_is_client = ""
if ("is_client" in partner_client_id_data.keys()):
order_header_is_client = partner_client_id_data['is_client']
partner_invoice_header_data['order_header_is_client'] = order_header_is_client
order_header_is_fournisseur = ""
if ("is_fournisseur" in partner_client_id_data.keys()):
order_header_is_fournisseur = partner_client_id_data['is_fournisseur']
partner_invoice_header_data['order_header_is_fournisseur'] = order_header_is_fournisseur
order_header_is_company = ""
if ("is_company" in partner_client_id_data.keys()):
order_header_is_company = partner_client_id_data['is_company']
partner_invoice_header_data['order_header_is_company'] = order_header_is_company
order_header_type_pouvoir_public_id = ""
if ("type_pouvoir_public_id" in partner_client_id_data.keys()):
order_header_type_pouvoir_public_id = partner_client_id_data['type_pouvoir_public_id']
partner_invoice_header_data['order_header_type_pouvoir_public_id'] = order_header_type_pouvoir_public_id
# Calcul du Totol HT sans reduction
total_ht = 0
@ -11260,6 +11288,36 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
order_header_type_client_id = partner_client_id_data['client_type_id']
partner_invoice_header_data['order_header_type_client_id'] = order_header_type_client_id
order_header_type_financeur_id = ""
if ("type_financeur_id" in partner_client_id_data.keys()):
order_header_type_financeur_id = partner_client_id_data['type_financeur_id']
partner_invoice_header_data['order_header_type_financeur_id'] = order_header_type_financeur_id
order_header_is_financeur = ""
if ("is_financeur" in partner_client_id_data.keys()):
order_header_is_financeur = partner_client_id_data['is_financeur']
partner_invoice_header_data['order_header_is_financeur'] = order_header_is_financeur
order_header_is_client = ""
if ("is_client" in partner_client_id_data.keys()):
order_header_is_client = partner_client_id_data['is_client']
partner_invoice_header_data['order_header_is_client'] = order_header_is_client
order_header_is_fournisseur = ""
if ("is_fournisseur" in partner_client_id_data.keys()):
order_header_is_fournisseur = partner_client_id_data['is_fournisseur']
partner_invoice_header_data['order_header_is_fournisseur'] = order_header_is_fournisseur
order_header_is_company = ""
if ("is_company" in partner_client_id_data.keys()):
order_header_is_company = partner_client_id_data['is_company']
partner_invoice_header_data['order_header_is_company'] = order_header_is_company
order_header_type_pouvoir_public_id = ""
if ("type_pouvoir_public_id" in partner_client_id_data.keys()):
order_header_type_pouvoir_public_id = partner_client_id_data['type_pouvoir_public_id']
partner_invoice_header_data['order_header_type_pouvoir_public_id'] = order_header_type_pouvoir_public_id
order_header_montant_reduction = "0"
partner_invoice_header_data['order_header_montant_reduction'] = order_header_montant_reduction

31
main.py
View File

@ -10948,6 +10948,37 @@ def Get_Partner_Data_From_Subdomain():
"""
API de Recuperation de la liste de TYPE dispositifs de financement de la formation professionnelle
"""
@app.route('/myclass/api/Get_List_Type_Organisme_Financement/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Type_Organisme_Financement():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Type_Organisme_Financement payload = ",payload)
status, retval = mycommon.Get_List_Type_Organisme_Financement(payload)
return jsonify(status=status, message=retval)
"""
API de Recuperation de la liste des type de pouvoir public (des instances européennes,
de lEtat,
des conseils régionaux,
du Pôle Emploi et
des collectivités territoriales,
etc)
"""
@app.route('/myclass/api/Get_List_Type_Pouvoir_Public/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Type_Pouvoir_Public():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Type_Pouvoir_Public payload = ",payload)
status, retval = mycommon.Get_List_Type_Pouvoir_Public(payload)
return jsonify(status=status, message=retval)
"""
API de Recuperation des thème des catalog publics

View File

@ -45,6 +45,7 @@ def Add_Partner_Client(diction):
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
'invoice_code_postal', 'invoice_pays', "client_type_id",
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
'type_financeur_id', 'type_pouvoir_public_id'
]
incom_keys = diction.keys()
@ -271,6 +272,40 @@ def Add_Partner_Client(diction):
return False, " - L'adresse email de facturation '" + str(invoice_email) + "' n'est pas valide "
data['invoice_email'] = invoice_email
type_financeur_id = ""
if ("type_financeur_id" in diction.keys()):
if (diction['type_financeur_id']):
type_financeur_id = diction['type_financeur_id']
is_valide_type_financeur_id_count = MYSY_GV.dbname['type_organisme_financement'].count_documents(
{'_id': ObjectId(str(diction['type_financeur_id'])),
'vallide': '1', 'locked': '0'})
if (is_valide_type_financeur_id_count != 0):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'identifiant du type de financeur est invalide ")
return False, " L'identifiant du type de financeur est invalide "
data['type_financeur_id'] = type_financeur_id
type_pouvoir_public_id = ""
if ("type_pouvoir_public_id" in diction.keys()):
if (diction['type_pouvoir_public_id']):
type_pouvoir_public_id = diction['type_pouvoir_public_id']
is_valide_type_pouvoir_public_id_count = MYSY_GV.dbname['type_pouvoir_public'].count_documents(
{'_id': ObjectId(str(diction['type_pouvoir_public_id'])),
'vallide': '1', 'locked': '0'})
if (is_valide_type_pouvoir_public_id_count != 0):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'identifiant du type de pouvoir public est invalide ")
return False, " L'identifiant du type de pouvoir public est invalide "
data['type_pouvoir_public_id'] = type_pouvoir_public_id
invoice_nom = ""
if ("invoice_nom" in diction.keys()):
if diction['invoice_nom']:
@ -833,9 +868,11 @@ def Update_Partner_Client_Contact(diction):
)
"""
print("raw:", result.raw_result)
print("acknowledged:", result.acknowledged)
print("matched_count:", result.matched_count)
"""
return True, " Le contact du client a été correctement mis à jour"
@ -864,7 +901,8 @@ def Update_Partner_Client(diction):
'invoice_email', 'invoice_nom', 'invoice_siret',
'invoice_tva','invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
'invoice_code_postal', 'invoice_pays', 'client_type_id',
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique']
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
'type_financeur_id', 'type_pouvoir_public_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -934,7 +972,7 @@ def Update_Partner_Client(diction):
is_company = "0"
if ("is_company" in diction.keys()):
is_company = diction['is_company']
if( is_company in ['0', '1']):
if( is_company in ['0', '1', '2']):
data_update['is_company'] = is_company
else:
data_update['is_company'] = "0"
@ -1001,6 +1039,37 @@ def Update_Partner_Client(diction):
is_financeur = str(diction['is_financeur'])
data_update['is_financeur'] = is_financeur
type_financeur_id = ""
if ("type_financeur_id" in diction.keys()):
if( diction['type_financeur_id'] ):
is_valide_type_financeur_id_count = MYSY_GV.dbname['type_organisme_financement'].count_documents({'_id':ObjectId(str(diction['type_financeur_id'])),
'vallide':'1', 'locked':'0'})
if( is_valide_type_financeur_id_count != 0 ):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'identifiant du type de financeur est invalide ")
return False, " L'identifiant du type de financeur est invalide "
data_update['type_financeur_id'] = diction['type_financeur_id']
type_pouvoir_public_id = ""
if ("type_pouvoir_public_id" in diction.keys()):
if (diction['type_pouvoir_public_id']):
type_pouvoir_public_id = diction['type_pouvoir_public_id']
is_valide_type_pouvoir_public_id_count = MYSY_GV.dbname['type_pouvoir_public'].count_documents(
{'_id': ObjectId(str(diction['type_pouvoir_public_id'])),
'vallide': '1', 'locked': '0'})
if (is_valide_type_pouvoir_public_id_count != 0):
mycommon.myprint(str(inspect.stack()[0][
3]) + " L'identifiant du type de pouvoir public est invalide ")
return False, " L'identifiant du type de pouvoir public est invalide "
data_update['type_pouvoir_public_id'] = type_pouvoir_public_id
adr_adresse = ""
@ -1158,7 +1227,7 @@ def Update_Partner_Client(diction):
return_document=ReturnDocument.AFTER
)
print(" ###result = ", result)
#print(" ###result = ", result)
if (result is None):
mycommon.myprint(
" Impossible de mettre à jour le client : email = " + str(diction['email']))
@ -1471,6 +1540,15 @@ def Get_Given_Partner_Client(diction):
if (client_type_data and "code" in client_type_data.keys()):
user['client_type_code'] = client_type_data['code']
if ("invoice_automatique" not in retval.keys()):
user['invoice_automatique'] = ""
if ("type_financeur_id" not in retval.keys()):
user['type_financeur_id'] = ""
if ("type_pouvoir_public_id" not in retval.keys()):
user['type_pouvoir_public_id'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
#print(" ### RetObject = ", RetObject)
@ -1574,6 +1652,12 @@ def Get_Given_Partner_Client_From_Id(diction):
if( "invoice_automatique" not in retval.keys() ):
user['invoice_automatique'] = ""
if ("type_financeur_id" not in retval.keys()):
user['type_financeur_id'] = ""
if ("type_pouvoir_public_id" not in retval.keys()):
user['type_pouvoir_public_id'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
#print(" ### RetObject = ", RetObject)

View File

@ -6436,3 +6436,148 @@ def Get_Partner_Data_From_Subdomain(diction):
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récuperer les données liées au sous domaine "
"""
Recuperation de la liste de TYPE dispositifs de financement de la formation professionnelle
"""
def Get_List_Type_Organisme_Financement(diction):
try:
diction = strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', ]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
return False, " Les informations fournies sont incorrectes",
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes",
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = "default"
data_cle['valide'] = "1"
data_cle['locked'] = "0"
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['type_organisme_financement'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
RetObject.append(JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des categories de formation "
"""
Recuperation de la liste des type de pouvoir public (des instances européennes,
de lEtat,
des conseils régionaux,
du Pôle Emploi et
des collectivités territoriales,
etc)
"""
def Get_List_Type_Pouvoir_Public(diction):
try:
diction = strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', ]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
return False, " Les informations fournies sont incorrectes",
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes",
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
"""
Clés de mise à jour
"""
data_cle = {}
data_cle['partner_owner_recid'] = "default"
data_cle['valide'] = "1"
data_cle['locked'] = "0"
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['type_pouvoir_public'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
RetObject.append(JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des categories de formation "