11/12/2023 - 20h30
parent
68cf730cbd
commit
5285007abe
|
@ -3,11 +3,9 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/12/2023 - 22h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.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$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
|
|
|
@ -514,7 +514,8 @@ PARTNER_QUOTATION_STATUS = ['-1', '0', '1', '2']
|
|||
"""
|
||||
Pour mettre en place un système de configuration global, on va definir les valeur acceptée
|
||||
"""
|
||||
PARTNER_BASE_CONFIG_NAME = ['tva', 'smtp_server', 'smtp_user', 'smtp_user_pwd', 'smtp_count_from_name', 'smtp_count_port', 'partner_smtp' ]
|
||||
PARTNER_BASE_CONFIG_NAME = ['tva', 'smtp_server', 'smtp_user', 'smtp_user_pwd', 'smtp_count_from_name',
|
||||
'smtp_count_port', 'partner_smtp', 'partner_jour_heure' ]
|
||||
|
||||
|
||||
"""
|
||||
|
@ -557,4 +558,14 @@ AGENDA_EVENT_TYPE = ['absence', 'planning', 'autre', '']
|
|||
Limite pour l'affichage des historique d'action coté front.
|
||||
Par exemple on va afficher les 100 dernières action, mais pas tout.
|
||||
"""
|
||||
HISTORIQUE_MAX_EVENT = 100
|
||||
HISTORIQUE_MAX_EVENT = 100
|
||||
|
||||
"""
|
||||
Type d'apprenant à l'inscription d'une session de formation
|
||||
• 0 => autre
|
||||
• 1 => salariés
|
||||
• 2 => apprentis
|
||||
• 3 => particuliers
|
||||
• 4 => sans_emploi
|
||||
"""
|
||||
INSCRIPTION_TYPE_APPRENANT = [ '0', '1', '2', '3', '4']
|
|
@ -62,7 +62,7 @@ def AddStagiairetoClass(diction):
|
|||
field_list = ['nom', 'prenom', 'email', 'telephone', 'modefinancement', 'opco',
|
||||
'class_internal_url', 'session_id', 'employeur', 'status', 'price',
|
||||
'inscription_validation_date', 'token', 'client_rattachement_id',
|
||||
'adresse', 'code_postal', 'ville', 'pays', ]
|
||||
'adresse', 'code_postal', 'ville', 'pays', 'type_apprenant' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -122,11 +122,23 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
|
||||
"""
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
type_apprenant = "0"
|
||||
if (str(diction['type_apprenant']) not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT):
|
||||
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
|
||||
session_partner_owner_recid = ""
|
||||
for tmp_val in MYSY_GV.dbname['session_formation'].find({"_id":ObjectId(str(session_id)), 'valide':'1' }):
|
||||
mydata['date_du'] = tmp_val['date_debut']
|
||||
mydata['date_au'] = tmp_val['date_fin']
|
||||
mydata['date_du'] = str(tmp_val['date_debut'])[0:10]
|
||||
mydata['date_au'] = str(tmp_val['date_fin'])[0:10]
|
||||
mydata['partner_owner_recid'] = tmp_val['partner_owner_recid']
|
||||
|
||||
if ("prix_session" in tmp_val.keys()):
|
||||
|
@ -137,6 +149,11 @@ def AddStagiairetoClass(diction):
|
|||
if( "partner_owner_recid" in tmp_val.keys() ):
|
||||
session_partner_owner_recid = tmp_val['partner_owner_recid']
|
||||
|
||||
## Update du 11/12/2023 : On doit prendre le class_internal_url sur la session et non sur la valeur du ditionnaire d'entré.
|
||||
## car realité ces deux doivent etre les meme.
|
||||
if ("class_internal_url" in tmp_val.keys()):
|
||||
mydata['class_internal_url'] = str(tmp_val['class_internal_url']).strip()
|
||||
|
||||
|
||||
|
||||
if ("nom" in diction.keys()):
|
||||
|
@ -211,10 +228,6 @@ def AddStagiairetoClass(diction):
|
|||
mydata['opco'] = str(diction['opco']).strip()
|
||||
|
||||
|
||||
if ("class_internal_url" in diction.keys()):
|
||||
if diction['class_internal_url']:
|
||||
mydata['class_internal_url'] = str(diction['class_internal_url']).strip()
|
||||
|
||||
|
||||
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y, %H:%M:%S")
|
||||
|
||||
|
@ -229,6 +242,7 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
|
||||
mydata['status'] = str(new_status)
|
||||
mydata['type_apprenant'] = str(type_apprenant)
|
||||
|
||||
|
||||
if ("price" in diction.keys()):
|
||||
|
@ -402,7 +416,7 @@ def UpdateStagiairetoClass(diction):
|
|||
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
|
||||
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
|
||||
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com',
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -441,6 +455,8 @@ def UpdateStagiairetoClass(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
myemail = ""
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
|
@ -553,6 +569,15 @@ def UpdateStagiairetoClass(diction):
|
|||
if ("tuteur2_include_com" in diction.keys()):
|
||||
mydata['tuteur2_include_com'] = str(diction['tuteur2_include_com']).strip()
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
if( "type_apprenant" in diction.keys() ):
|
||||
if (str(diction['type_apprenant']) not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le type d'apprenant est invalide ")
|
||||
return False, " Le type d'apprenant est invalide "
|
||||
else:
|
||||
mydata['type_apprenant'] = str(diction['type_apprenant'])
|
||||
|
||||
|
||||
user_prenom = ""
|
||||
if ("prenom" in diction.keys()):
|
||||
|
@ -1929,7 +1954,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
'''
|
||||
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']
|
||||
'pays', 'client_rattachement_email', 'client_rattachement_nom', 'type_apprenant']
|
||||
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
|
@ -2028,6 +2053,14 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
opco = str(df['opco'].values[n])
|
||||
mydata['opco'] = opco
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
type_apprenant = "0"
|
||||
if ("type_apprenant" in df.keys()):
|
||||
if (str(df['type_apprenant'].values[n])):
|
||||
type_apprenant = str(df['type_apprenant'].values[n])
|
||||
mydata['type_apprenant'] = type_apprenant
|
||||
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in df.keys()):
|
||||
if (str(df['adresse'].values[n])):
|
||||
|
@ -2268,7 +2301,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
|
|||
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']
|
||||
'pays', 'client_rattachement_email', 'client_rattachement_nom', 'type_apprenant']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
total_rows = len(df)
|
||||
|
@ -2368,6 +2401,13 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
|
|||
opco = str(df['opco'].values[n])
|
||||
mydata['opco'] = opco
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
type_apprenant = "0"
|
||||
if ("type_apprenant" in df.keys()):
|
||||
if (str(df['type_apprenant'].values[n])):
|
||||
type_apprenant = str(df['type_apprenant'].values[n])
|
||||
mydata['type_apprenant'] = type_apprenant
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in df.keys()):
|
||||
if (str(df['adresse'].values[n])):
|
||||
|
@ -5704,7 +5744,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
val['session_ondemande'] = "0"
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
|
1546
Log/log_file.log
1546
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -22,6 +22,7 @@ from math import isnan
|
|||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import Inscription_mgt as Inscription_mgt
|
||||
|
||||
|
||||
"""
|
||||
|
@ -137,6 +138,19 @@ def Add_Apprenant(diction):
|
|||
" Impossible de créer l'apprenant (1) ")
|
||||
return False, " Impossible de créer l'apprenant (1) "
|
||||
|
||||
## Add to log history
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
history_event_dict['related_collection'] = "apprenant"
|
||||
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Creation"
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, "L'apprenant a été correctement ajouté "
|
||||
|
||||
except Exception as e:
|
||||
|
@ -263,6 +277,19 @@ def Update_Apprenant(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de mettre à jour l'apprenant (1) ")
|
||||
return False, " Impossible de mettre à jour l'apprenant (1) "
|
||||
|
||||
## Add to log history
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
history_event_dict['related_collection'] = "apprenant"
|
||||
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Mise à jour "
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
|
||||
return True, "L'apprenant a été correctement mise à jour "
|
||||
|
||||
|
@ -421,7 +448,8 @@ def Get_List_Partner_Apprenant(diction):
|
|||
|
||||
|
||||
"""
|
||||
Inscrire un apprenant à un session de formation
|
||||
Inscrire un apprenant à un session de formation.
|
||||
|
||||
"""
|
||||
def Apprenant_Inscrire_Session(diction):
|
||||
try:
|
||||
|
@ -430,7 +458,7 @@ def Apprenant_Inscrire_Session(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'session_id' ]
|
||||
field_list = ['token', '_id', 'session_id', 'type_apprenant' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -442,7 +470,7 @@ def Apprenant_Inscrire_Session(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id', 'session_id' ]
|
||||
field_list_obligatoire = ['token', '_id', 'session_id', 'type_apprenant' ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -463,6 +491,16 @@ def Apprenant_Inscrire_Session(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier que le type d'apprenant est bien valide
|
||||
type_apprenant = "0"
|
||||
if( str(diction['type_apprenant']) not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT ):
|
||||
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'])
|
||||
|
||||
|
||||
# Verifier que l'apprenant existe
|
||||
is_apprenant_exist = MYSY_GV.dbname['apprenant'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
|
@ -504,6 +542,7 @@ def Apprenant_Inscrire_Session(diction):
|
|||
new_data['session_id'] = str(session_data['_id'])
|
||||
new_data['class_internal_url'] = session_data['class_internal_url']
|
||||
new_data['status'] = "1"
|
||||
new_data['type_apprenant'] = str(type_apprenant)
|
||||
|
||||
|
||||
new_data['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
@ -511,14 +550,24 @@ def Apprenant_Inscrire_Session(diction):
|
|||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
"""
|
||||
# Reste à faire : xxxx
|
||||
- ajout dans la collection 'inscription'
|
||||
- log historique
|
||||
- envoie email inscription
|
||||
"""
|
||||
local_status, local_retval = Inscription_mgt.AddStagiairetoClass(new_data)
|
||||
if( local_status is False ):
|
||||
return local_status, local_retval
|
||||
|
||||
return True
|
||||
## Add to log history
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = diction['token']
|
||||
history_event_dict['related_collection'] = "apprenant"
|
||||
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
history_event_dict['action_description'] = "Inscription session "+str(session_data["code_session"])
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " L'apprenant a été correctement inscrit à la session de formation"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
29
class_mgt.py
29
class_mgt.py
|
@ -52,7 +52,8 @@ def add_class(diction):
|
|||
'price', 'url','duration', 'duration_unit', 'token', 'plus_produit', 'mots_cle','domaine',
|
||||
'internal_url', 'zone_diffusion', 'metier', 'published', 'img_url', 'objectif',
|
||||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url', 'pourqui',
|
||||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id']
|
||||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -103,7 +104,9 @@ def add_class(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le recid du partenaire")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token':str(diction['token'])})
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
part_status, part_pack, part_pack_nb_training_auto = mycommon.Partner_Get_pack_nbTraining(user_recid)
|
||||
if( part_status is False):
|
||||
|
@ -204,6 +207,12 @@ def add_class(diction):
|
|||
if diction['cpf']:
|
||||
mydata['cpf'] = diction['cpf']
|
||||
|
||||
class_level = "0"
|
||||
if ("class_level" in diction.keys()):
|
||||
if diction['class_level']:
|
||||
class_level = diction['class_level']
|
||||
mydata['class_level'] = class_level
|
||||
|
||||
if ("class_inscription_url" in diction.keys()):
|
||||
if diction['class_inscription_url']:
|
||||
mydata['class_inscription_url'] = diction['class_inscription_url']
|
||||
|
@ -470,6 +479,8 @@ def add_class(diction):
|
|||
mydata['indexed_title'] = '0'
|
||||
mydata['indexed_desc'] = '0'
|
||||
mydata['indexed_obj'] = '0'
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
# A supprimer apres (a reflechir .... me tate)
|
||||
mydata['freeacces'] = '1'
|
||||
|
@ -577,7 +588,7 @@ def update_class(diction):
|
|||
'domaine', 'internal_code', 'internal_url','zone_diffusion', 'metier',
|
||||
'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note',
|
||||
'cpf', 'certif', 'class_inscription_url','pourqui', 'support', 'img_banner_detail_class',
|
||||
'duration_unit', 'source', 'lms_class_code', 'formateur_id']
|
||||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -605,6 +616,12 @@ def update_class(diction):
|
|||
if diction['token']:
|
||||
mydata['token'] = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
# Verification de la validité du token
|
||||
'''
|
||||
Important : pour modifier une formation, il faut obligatoirement avoir un token.
|
||||
|
@ -639,6 +656,9 @@ def update_class(diction):
|
|||
if ("lms_class_code" in diction.keys()):
|
||||
mydata['lms_class_code'] = diction['lms_class_code']
|
||||
|
||||
if ("class_level" in diction.keys()):
|
||||
mydata['class_level'] = diction['class_level']
|
||||
|
||||
|
||||
source = ""
|
||||
if ("source" in diction.keys()):
|
||||
|
@ -991,6 +1011,7 @@ def update_class(diction):
|
|||
mydata['datelieu'] = tab_dl
|
||||
'''
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['recid'])
|
||||
|
||||
# Recuperation des champs spécifiques se trouvant dans le dictionnaire. ils commencent tous par 'my_'
|
||||
for val in diction.keys():
|
||||
|
@ -2356,8 +2377,6 @@ def get_partner_class(diction):
|
|||
|
||||
user['zone_diffusion_str'] = str(tmp_zone_diffusion[:-1])
|
||||
|
||||
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
|
13
main.py
13
main.py
|
@ -3795,6 +3795,19 @@ def Delete_Given_Partner_Client():
|
|||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
API de recupération de la liste des types de client
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Client_Type_List/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Client_Type_List():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Client_Type_List : payload = ",payload)
|
||||
localStatus, message = partner_client.Get_Client_Type_List(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
@ -39,7 +39,7 @@ def Add_Partner_Client(diction):
|
|||
'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_pays',
|
||||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays'
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id"
|
||||
]
|
||||
|
||||
print(" diction = ", diction)
|
||||
|
@ -138,6 +138,12 @@ def Add_Partner_Client(diction):
|
|||
siret = diction['siret']
|
||||
data['siret'] = siret
|
||||
|
||||
client_type_id = ""
|
||||
if ("client_type_id" in diction.keys()):
|
||||
if diction['client_type_id']:
|
||||
client_type_id = diction['client_type_id']
|
||||
data['client_type_id'] = client_type_id
|
||||
|
||||
adr_adresse = ""
|
||||
if ("adr_adresse" in diction.keys()):
|
||||
if diction['adr_adresse']:
|
||||
|
@ -343,7 +349,8 @@ def Update_Partner_Client_Contact(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "partner_client_contact_recid", "adresse", "ville", "code_postal", "pays", "email", "telephone" ]
|
||||
field_list = ['token', "partner_client_contact_recid", "adresse", "ville", "code_postal", "pays", "email", "telephone",
|
||||
"client_type_id"]
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
|
@ -399,6 +406,8 @@ def Update_Partner_Client_Contact(diction):
|
|||
pays = diction['pays']
|
||||
data_update["address.$[elem].pays"] = pays
|
||||
|
||||
|
||||
|
||||
email = ""
|
||||
if ("email" in diction.keys()):
|
||||
email = diction['email']
|
||||
|
@ -458,7 +467,7 @@ def Update_Partner_Client(diction):
|
|||
'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_pays',
|
||||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays']
|
||||
'invoice_code_postal', 'invoice_pays', 'client_type_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -542,6 +551,11 @@ def Update_Partner_Client(diction):
|
|||
siret = diction['siret']
|
||||
data_update['siret'] = diction['siret']
|
||||
|
||||
client_type_id = ""
|
||||
if ("client_type_id" in diction.keys()):
|
||||
client_type_id = diction['client_type_id']
|
||||
data_update['client_type_id'] = diction['client_type_id']
|
||||
|
||||
adr_adresse = ""
|
||||
if ("adr_adresse" in diction.keys()):
|
||||
adr_adresse = diction['adr_adresse']
|
||||
|
@ -869,6 +883,18 @@ def Get_Given_Partner_Client(diction):
|
|||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le client a un 'client_type_id', aller le chercher le code
|
||||
if ("client_type_id" in retval.keys() and retval['retval']):
|
||||
client_type_data = MYSY_GV.dbname['partner_client_type'].find_one(
|
||||
{'_id': ObjectId(str(retval['retval'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (client_type_data and "code" in client_type_data.keys()):
|
||||
user['client_type_code'] = client_type_data['code']
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
|
@ -942,11 +968,22 @@ def Get_Given_Partner_Client_From_Id(diction):
|
|||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
print(" ### data_cle 2= ", data_cle)
|
||||
for retval in MYSY_GV.dbname['partner_client'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le client a un 'client_type_id', aller le chercher le code
|
||||
if( "client_type_id" in retval.keys() and retval['client_type_id']):
|
||||
client_type_data = MYSY_GV.dbname['partner_client_type'].find_one({'_id':ObjectId(str(retval['client_type_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( client_type_data and "code" in client_type_data.keys() ):
|
||||
user['client_type_code'] = client_type_data['code']
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
|
@ -1245,3 +1282,79 @@ def Delete_Given_Partner_Client(diction):
|
|||
return False, " Impossible de supprimer le client "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des type de client
|
||||
"""
|
||||
|
||||
def Get_Client_Type_List(diction):
|
||||
try:
|
||||
diction = mycommon.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:
|
||||
mycommon.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:
|
||||
mycommon.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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
#print(" ### Get_Partner_List_Partner_Client data_cle = ", data_cle)
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_client_type'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des types de client "
|
||||
|
|
|
@ -3079,6 +3079,9 @@ def GetAttendeeDetail_perSession(diction):
|
|||
if ("pays" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['pays'] = local_Insc_retval['pays']
|
||||
|
||||
if ("type_apprenant" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['type_apprenant'] = local_Insc_retval['type_apprenant']
|
||||
|
||||
# Tuteurs
|
||||
if ("tuteur1_nom" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_nom'] = local_Insc_retval['tuteur1_nom']
|
||||
|
|
Loading…
Reference in New Issue