25/08/23 - 21h
parent
b0a7914ba1
commit
26166f9533
|
@ -1,15 +1,14 @@
|
|||
<?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="23/08/23 - 20h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="24/08/23 - 12h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/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" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -73,13 +72,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00033" summary="06/06/23 - 19h">
|
||||
<created>1686072292768</created>
|
||||
<option name="number" value="00033" />
|
||||
<option name="presentableId" value="LOCAL-00033" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1686072292768</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00034" summary="08/06/23 - 21h">
|
||||
<created>1686251029490</created>
|
||||
<option name="number" value="00034" />
|
||||
|
@ -416,7 +408,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1692815833458</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="82" />
|
||||
<task id="LOCAL-00082" summary="24/08/23 - 12h">
|
||||
<created>1692874458640</created>
|
||||
<option name="number" value="00082" />
|
||||
<option name="presentableId" value="LOCAL-00082" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1692874458640</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="83" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -431,7 +430,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="01/08/230- 21h" />
|
||||
<MESSAGE value="03/08/23 - 19h" />
|
||||
<MESSAGE value="05/08/23 - 16h" />
|
||||
<MESSAGE value="06/08/23 - 23h" />
|
||||
|
@ -456,6 +454,7 @@
|
|||
<MESSAGE value="22/08/23 - 13h" />
|
||||
<MESSAGE value="22/08/23 - 20h" />
|
||||
<MESSAGE value="23/08/23 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="23/08/23 - 20h" />
|
||||
<MESSAGE value="24/08/23 - 12h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="24/08/23 - 12h" />
|
||||
</component>
|
||||
</project>
|
|
@ -466,3 +466,11 @@ Les profils des ressources humaines autorisé
|
|||
"""
|
||||
RESSOURCE_PROFIL = ['enseignant', 'cadre', 'employe', 'autre', '']
|
||||
|
||||
"""
|
||||
Dans le processus d'inscription, les statuts accepté sont :
|
||||
- '-1' => Annulé
|
||||
- 0 => Préinscription
|
||||
- 1 => Inscription (validée)
|
||||
- 2 => Encours (Inscription en cours de creation, ici, on ne declenche aucun email)
|
||||
"""
|
||||
INSCRIPTION_STATUS = ['-1', '0', '1', '2']
|
|
@ -137,9 +137,16 @@ def AddStagiairetoClass(diction):
|
|||
if diction['client_rattachement_id']:
|
||||
mydata['client_rattachement_id'] = diction['client_rattachement_id']
|
||||
|
||||
if ("pays" in diction.keys()):
|
||||
if diction['pays']:
|
||||
mydata['pays'] = diction['ville']
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents( {'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'valide': '1','locked': '0', 'partner_recid': str(partner_recid)})
|
||||
|
||||
if( local_client_retval_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le client de rattachement est invalide : local_client_retval_count = "+ str(local_client_retval_count))
|
||||
return False, " Le client de rattachement est invalide "
|
||||
|
||||
|
||||
|
||||
if ("ville" in diction.keys()):
|
||||
if diction['ville']:
|
||||
|
@ -154,12 +161,15 @@ def AddStagiairetoClass(diction):
|
|||
mydata['adresse'] = diction['adresse']
|
||||
|
||||
|
||||
if ("pays" in diction.keys()):
|
||||
if diction['pays']:
|
||||
mydata['pays'] = diction['pays']
|
||||
|
||||
|
||||
if ("inscription_validation_date" in diction.keys()):
|
||||
if diction['inscription_validation_date']:
|
||||
mydata['inscription_validation_date'] = str(diction['inscription_validation_date']).strip()
|
||||
|
||||
|
||||
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
mydata['email'] = str(diction['email']).strip()
|
||||
|
@ -186,10 +196,16 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y, %H:%M:%S")
|
||||
|
||||
new_status = "0" # 0 ==> Preinscription, par defaut
|
||||
new_status = "2" # 0 ==> par defaut Encours (Inscription en cours de creation, ici, on ne declenche aucun email)
|
||||
if ("status" in diction.keys()):
|
||||
if diction['status']:
|
||||
new_status = str(diction['status']).strip()
|
||||
if( new_status not in MYSY_GV.INSCRIPTION_STATUS):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le statut d'inscription : " + str(diction['status']) + " est invalide ")
|
||||
return False, " Le statut d'inscription : " + str(diction['status']) + " est invalide "
|
||||
|
||||
|
||||
mydata['status'] = str(new_status)
|
||||
|
||||
|
||||
|
@ -210,14 +226,17 @@ def AddStagiairetoClass(diction):
|
|||
mydata['price'] = '0'
|
||||
|
||||
|
||||
print(" #### mydata = " + str(mydata))
|
||||
#print(" #### mydata = " + str(mydata))
|
||||
|
||||
coll_inscription = MYSY_GV.dbname['inscription']
|
||||
|
||||
## Verification si cette adresse n'est pas deja inscrite à cette session
|
||||
# print(" myquery pr demo_account = " + str(myquery))
|
||||
qry_count = {'email':str(mydata['email']), 'session_id':str( mydata['session_id']), }
|
||||
|
||||
#print(" ### qry_count = ", qry_count)
|
||||
tmp = coll_inscription.count_documents({'email':str(mydata['email']),
|
||||
'session_id':ObjectId(str( mydata['session_id'])),
|
||||
'session_id':str( mydata['session_id']),
|
||||
})
|
||||
|
||||
if( tmp > 0 ) :
|
||||
|
@ -246,22 +265,40 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
#ret_val = coll_inscription.insert_one(mydata)
|
||||
|
||||
inserted_id = ret_val['_id']
|
||||
if( inserted_id ):
|
||||
# Le stagaire a bien ete inseré, on declenche l'envoi des emaisl
|
||||
print(" ### l'inscription est ok, il faut declenché l'envoi des email")
|
||||
## Envoie de l'email de preinscription
|
||||
mail_data = {}
|
||||
mail_data['email'] = diction['email']
|
||||
mail_data['class_internal_url'] = diction['class_internal_url']
|
||||
mail_data['session_id'] = diction['session_id']
|
||||
Warning_message = ""
|
||||
|
||||
print(" ### l'inscription est ok, il faut declenché l'envoi des email a "+str(mail_data))
|
||||
local_status, message = SendPre_InscriptionEmail(mail_data)
|
||||
if( local_status is False):
|
||||
mycommon.myprint(" WARNING : Impossible d'envoyer le mail de preinscriton à "+
|
||||
str(inspect.stack()[0][3]) + " - l'adresse email " + str(
|
||||
mydata['email']) + " pour la session " + str(mydata['session_id']) + " ")
|
||||
inserted_id = ret_val['_id']
|
||||
|
||||
"""
|
||||
update du 25/08/23
|
||||
On ne declenche l'envoie d'un email que l'inscription est soit :
|
||||
- Preinscrit soit
|
||||
- inscrit soit
|
||||
- annulé.
|
||||
|
||||
Donc pas d'email si le statut est (2 => 'encours de creation'
|
||||
On doit donner la possibilité a l'utilisateur de saisir une inscription avec un statut en cours de creation : 'creation'
|
||||
"""
|
||||
if( inserted_id ):
|
||||
# On verifie que le statut de l'inscription n'est pas (2 : en cours) avant de declencher des envoies d'email
|
||||
if( new_status != "2"):
|
||||
# Le stagaire a bien ete inseré, on declenche l'envoi des emaisl
|
||||
print(" ### l'inscription est ok, il faut declenché l'envoi des email")
|
||||
## Envoie de l'email de preinscription
|
||||
mail_data = {}
|
||||
mail_data['email'] = diction['email']
|
||||
mail_data['class_internal_url'] = diction['class_internal_url']
|
||||
mail_data['session_id'] = diction['session_id']
|
||||
mail_data['inscription_id'] = ret_val['_id']
|
||||
|
||||
print(" ### l'inscription est ok, il faut declencher l'envoi des email a "+str(mail_data))
|
||||
local_status, message = SendPre_InscriptionEmail(mail_data)
|
||||
if( local_status is False):
|
||||
mycommon.myprint(" WARNING : Impossible d'envoyer le mail de preinscriton à "+
|
||||
str(inspect.stack()[0][3]) + " - l'adresse email " + str(
|
||||
mydata['email']) + " pour la session " + str(mydata['session_id']) + " ")
|
||||
|
||||
Warning_message = " WARNING : Impossible d'envoyer le mail de preinscriton à "+ str(inspect.stack()[0][3]) + " - l'adresse email " + str( mydata['email']) + " pour la session " + str(mydata['session_id']) + " "
|
||||
|
||||
|
||||
else:
|
||||
|
@ -269,7 +306,8 @@ def AddStagiairetoClass(diction):
|
|||
str(inspect.stack()[0][3]) + " - ret_val.inserted_id is null ")
|
||||
return False, "Impossible de créer le stagiaire"
|
||||
|
||||
return True, " Le stagiaire à bien été créé"
|
||||
|
||||
return True, " Le stagiaire à bien été créé. "+str(Warning_message)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
@ -285,6 +323,7 @@ Mettre à jour les infomration d'un stgiaire
|
|||
# status : 0 ==> Preinscription
|
||||
# status : 1 ==> Inscription validée
|
||||
# status : -1 ==> Inscription annulée
|
||||
# status : 2 ==> Inscription encours de creation
|
||||
|
||||
/!\ Inscription sur le LMS :
|
||||
Si la session de formation possede un code de formation lms 'lms_class_code'
|
||||
|
@ -374,8 +413,6 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
""""
|
||||
/!\ : update du 18/08/2023 : On va autoriser le changement le session de formation.
|
||||
en effet il peut arriver qu'on souhaite deplacer la formation d'une personne à une autre session.
|
||||
|
@ -425,14 +462,23 @@ def UpdateStagiairetoClass(diction):
|
|||
if ("pays" in diction.keys()):
|
||||
mydata['pays'] = str(diction['pays']).strip()
|
||||
|
||||
|
||||
|
||||
new_status = ""
|
||||
old_status = ""
|
||||
if ("status" in diction.keys()):
|
||||
if diction['status']:
|
||||
mydata['status'] = str(diction['status']).strip()
|
||||
new_status = str(diction['status']).strip()
|
||||
|
||||
# On stock le old_status avec la valeur de new_status.
|
||||
# Cela permettra de comparer apres pour voir s'il y a un changement de statut.
|
||||
old_status = str(diction['status']).strip()
|
||||
|
||||
if (new_status not in MYSY_GV.INSCRIPTION_STATUS):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le statut d'inscription : " + str(
|
||||
diction['status']) + " est invalide ")
|
||||
return False, " Le statut d'inscription : " + str(diction['status']) + " est invalide "
|
||||
|
||||
|
||||
if ("comment" in diction.keys()):
|
||||
mydata['comment'] = str(diction['comment']).strip()
|
||||
|
@ -440,6 +486,17 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
if ("client_rattachement_id" in diction.keys()):
|
||||
mydata['client_rattachement_id'] = str(diction['client_rattachement_id']).strip()
|
||||
if(len(str(diction['client_rattachement_id']).strip()) > 0 ):
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)})
|
||||
|
||||
if (local_client_retval_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le client de rattachement est invalide : local_client_retval_count = "+str(local_client_retval_count))
|
||||
return False, " Le client de rattachement est invalide "
|
||||
|
||||
|
||||
# ici recup des infos de la session
|
||||
local_query = {'_id': ObjectId(str(mysession_id)), 'valide': '1'}
|
||||
|
@ -452,7 +509,7 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
if (local_tmp_session_count > 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Plusieurs session existent pour ce code sessions " + str(
|
||||
str(inspect.stack()[0][3]) + " - Plusieurs sessions existent pour ce code sessions " + str(
|
||||
local_query))
|
||||
return False, "Impossible de mettre à jour le stagiaire, Cette session de formation n'est pas valide (2) "
|
||||
|
||||
|
@ -478,8 +535,11 @@ def UpdateStagiairetoClass(diction):
|
|||
print(" #### query_key = ", query_key)
|
||||
local_retval = coll_inscription.find_one(query_key)
|
||||
|
||||
|
||||
if( local_retval is not None ):
|
||||
if( "status" in local_retval.keys()):
|
||||
|
||||
# On recupere le statut stock en base dans 'old_status'
|
||||
old_status = local_retval['status']
|
||||
inscription_line_id = local_retval['_id']
|
||||
|
||||
|
@ -492,6 +552,9 @@ def UpdateStagiairetoClass(diction):
|
|||
if (new_status == "-1"):
|
||||
mydata['inscription_refuse_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
if (new_status == "2"):
|
||||
mydata['inscription_preinscription_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
|
||||
ret_val2 = coll_inscription.find_one_and_update(query_key,
|
||||
{"$set": mydata},
|
||||
|
@ -503,6 +566,7 @@ def UpdateStagiairetoClass(diction):
|
|||
"""
|
||||
- Si le status == 1; alors il s'agit d'une validation d'une inscription.
|
||||
- Si le status == -1; alors il s'agit d'une refus d'une inscription.
|
||||
- Si le status == 0; alors il s'agit d'une preinscription.
|
||||
|
||||
Du coup, il faut envoyer le mail de confirmation de l'inscription:
|
||||
1 - recuperation des infos de la session
|
||||
|
@ -532,12 +596,29 @@ def UpdateStagiairetoClass(diction):
|
|||
if ("lms_class_code" in local_tmp_myclass.keys() ):
|
||||
lms_class_code = local_tmp_myclass['lms_class_code']
|
||||
|
||||
print(" #### new_status / old_status / diction['status'] = ",new_status, old_status, str(diction['status']) )
|
||||
if ( new_status != old_status and diction['status'] == "0" ):
|
||||
mail_data = {}
|
||||
mail_data['email'] = diction['email']
|
||||
mail_data['class_internal_url'] = diction['class_internal_url']
|
||||
mail_data['session_id'] = diction['session_id']
|
||||
mail_data['inscription_id'] = diction['_id']
|
||||
|
||||
# Il s'agit d'envoyer le message de presinscription
|
||||
|
||||
local_status, local_message = SendPre_InscriptionEmail(mail_data)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(" WARNING : Impossible d'envoyer le mail de preinscriton à " +
|
||||
str(inspect.stack()[0][3]) + " - l'adresse email " + str(
|
||||
mydata['email']) + " pour la session " + str(mydata['session_id']) + " ")
|
||||
|
||||
Warning_message = " WARNING : Impossible d'envoyer le mail de preinscriton à " + str(
|
||||
inspect.stack()[0][3]) + " - l'adresse email " + str(
|
||||
mydata['email']) + " pour la session " + str(mydata['session_id']) + " "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( diction['status'] == "1" ):
|
||||
if (new_status != old_status and diction['status'] == "1" ):
|
||||
# Il s'agit d'envoyer le message de confirmation d'une inscription
|
||||
local_status, local_message = email_session.incription_training_confirmation_mail(email_data)
|
||||
|
||||
|
@ -609,8 +690,7 @@ def UpdateStagiairetoClass(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
elif ( diction['status'] == "-1" ):
|
||||
elif ( new_status != old_status and diction['status'] == "-1" ):
|
||||
# Il s'agit d'envoyer le message de refus d'une inscription
|
||||
local_status, local_message = email_session.incription_training_refused_mail(email_data)
|
||||
|
||||
|
@ -740,7 +820,7 @@ def GetAllClassStagiaire(diction):
|
|||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
print(" #### myquery 01111 = "+str(myquery))
|
||||
#print(" #### myquery 01111 = "+str(myquery))
|
||||
|
||||
|
||||
for retval in coll_session.find(myquery):
|
||||
|
@ -871,7 +951,8 @@ def SendPre_InscriptionEmail(diction):
|
|||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = [ 'email', 'class_internal_url', 'session_id']
|
||||
print(" ## GRRRR = ", diction)
|
||||
field_list_obligatoire = [ 'email', 'session_id', 'inscription_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
@ -880,21 +961,18 @@ def SendPre_InscriptionEmail(diction):
|
|||
|
||||
|
||||
data_mail = {}
|
||||
# 1 - Recuperation des données de la formation
|
||||
local_class = MYSY_GV.dbname['myclass'].find({'internal_url':str(diction['class_internal_url'])})
|
||||
data_mail['title'] = local_class[0]['title']
|
||||
partner_recid = local_class[0]['partner_owner_recid']
|
||||
|
||||
# 1-BIS : Recuperation des donnees de l'editeur de la formation
|
||||
local_partner = MYSY_GV.dbname['partnair_account'].find_one({'recid':str(partner_recid)})
|
||||
data_mail['partner_mail'] = local_partner['email']
|
||||
|
||||
|
||||
|
||||
# 2 - Recuperation des données de l'inscription
|
||||
local_session = MYSY_GV.dbname['inscription'].find({'session_id':str(diction['session_id']),
|
||||
'email':str(diction['email'])})
|
||||
'email':str(diction['email']),
|
||||
'_id':ObjectId(str(diction['inscription_id']))})
|
||||
|
||||
if (local_session is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Impossible de recuperer les information de la session de formation")
|
||||
return False, "Impossible de recuperer les information de la session de formation "
|
||||
|
||||
data_mail['nom'] = local_session[0]['nom']
|
||||
data_mail['prenom'] = local_session[0]['prenom']
|
||||
|
@ -909,13 +987,35 @@ def SendPre_InscriptionEmail(diction):
|
|||
if local_session[0]['telephone']:
|
||||
data_mail['telephone'] = local_session[0]['telephone']
|
||||
|
||||
# 1 - Recuperation des données de la formation
|
||||
local_class = MYSY_GV.dbname['myclass'].find({'internal_url': str(local_session[0]['class_internal_url']),
|
||||
'partner_owner_recid':str(local_session[0]['partner_owner_recid']),
|
||||
'valide':'1', 'locked':'0'})
|
||||
|
||||
if( local_class is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Impossible de recuperer les information de la formation")
|
||||
return False, "Impossible de recuperer les information de la formation "
|
||||
|
||||
|
||||
data_mail['title'] = local_class[0]['title']
|
||||
partner_recid = local_class[0]['partner_owner_recid']
|
||||
|
||||
# 1-BIS : Recuperation des donnees de l'editeur de la formation
|
||||
local_partner = MYSY_GV.dbname['partnair_account'].find_one({'recid': str(partner_recid)})
|
||||
if( local_partner is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Impossible de recuperer les information du partenaire")
|
||||
return False, "Impossible de recuperer les information du partenaire "
|
||||
|
||||
|
||||
data_mail['partner_mail'] = local_partner['email']
|
||||
|
||||
|
||||
#3 - Recuperations des info de la session (a distance, formateur, etc)
|
||||
local_info_session = MYSY_GV.dbname['session_formation'].find({'code_session': str(diction['session_id']),
|
||||
'class_internal_url':str(diction['class_internal_url']),
|
||||
'valide':'1'})
|
||||
local_info_session = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id'])), 'valide':'1'})
|
||||
|
||||
|
||||
|
||||
if( local_info_session is None):
|
||||
mycommon.myprint(
|
||||
|
@ -923,59 +1023,59 @@ def SendPre_InscriptionEmail(diction):
|
|||
return False, " impossible d'envoyer le mail de presinscription. la session "+str(diction['session_id'])+" est introuvable "
|
||||
|
||||
code_postal = ""
|
||||
if ("code_postal" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['code_postal']:
|
||||
code_postal = local_info_session[0]['code_postal']
|
||||
if ("code_postal" in local_info_session.keys()):
|
||||
if local_info_session['code_postal']:
|
||||
code_postal = local_info_session['code_postal']
|
||||
data_mail['code_postal'] = code_postal
|
||||
|
||||
|
||||
date_debut = ""
|
||||
if ("date_debut" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['date_debut']:
|
||||
date_debut = str(local_info_session[0]['date_debut'])[0:10]
|
||||
if ("date_debut" in local_info_session.keys()):
|
||||
if local_info_session['date_debut']:
|
||||
date_debut = str(local_info_session['date_debut'])[0:10]
|
||||
data_mail['date_du'] = date_debut
|
||||
|
||||
date_fin = ""
|
||||
if ("date_fin" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['date_fin']:
|
||||
date_fin = str(local_info_session[0]['date_fin'])[0:10]
|
||||
if ("date_fin" in local_info_session.keys()):
|
||||
if local_info_session['date_fin']:
|
||||
date_fin = str(local_info_session['date_fin'])[0:10]
|
||||
data_mail['date_au'] = date_fin
|
||||
|
||||
formateur = ""
|
||||
if ("formateur" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['formateur']:
|
||||
formateur = local_info_session[0]['formateur']
|
||||
if ("formateur" in local_info_session.keys()):
|
||||
if local_info_session['formateur']:
|
||||
formateur = local_info_session['formateur']
|
||||
data_mail['formateur'] = formateur
|
||||
|
||||
distantiel = ""
|
||||
if ("distantiel" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['distantiel']:
|
||||
distantiel = local_info_session[0]['distantiel']
|
||||
if ("distantiel" in local_info_session.keys()):
|
||||
if local_info_session['distantiel']:
|
||||
distantiel = local_info_session['distantiel']
|
||||
data_mail['distantiel'] = distantiel
|
||||
|
||||
presentiel = ""
|
||||
if ("presentiel" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['presentiel']:
|
||||
presentiel = local_info_session[0]['presentiel']
|
||||
if ("presentiel" in local_info_session.keys()):
|
||||
if local_info_session['presentiel']:
|
||||
presentiel = local_info_session['presentiel']
|
||||
data_mail['presentiel'] = presentiel
|
||||
|
||||
ville = ""
|
||||
if ("ville" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['ville']:
|
||||
ville = local_info_session[0]['ville']
|
||||
if ("ville" in local_info_session.keys()):
|
||||
if local_info_session['ville']:
|
||||
ville = local_info_session['ville']
|
||||
data_mail['ville'] = ville
|
||||
|
||||
|
||||
adresse = ""
|
||||
if ("adresse" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['adresse']:
|
||||
adresse = local_info_session[0]['adresse']
|
||||
if ("adresse" in local_info_session.keys()):
|
||||
if local_info_session['adresse']:
|
||||
adresse = local_info_session['adresse']
|
||||
data_mail['adresse'] = adresse
|
||||
|
||||
session_ondemande = ""
|
||||
if ("session_ondemande" in local_info_session[0].keys()):
|
||||
if local_info_session[0]['session_ondemande']:
|
||||
session_ondemande = local_info_session[0]['session_ondemande']
|
||||
if ("session_ondemande" in local_info_session.keys()):
|
||||
if local_info_session['session_ondemande']:
|
||||
session_ondemande = local_info_session['session_ondemande']
|
||||
data_mail['session_ondemande'] = session_ondemande
|
||||
|
||||
|
||||
|
@ -2232,8 +2332,8 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
|
|||
"""
|
||||
qry = {'external_code':str(class_external_code), 'valide':'1', 'locked':'0', 'partner_owner_recid':str(partner_recid)}
|
||||
print(" ### qry = ", qry)
|
||||
myclass_data_count = MYSY_GV.dbname['myclass'].count_documents({'external_code':str(class_external_code), 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(partner_recid)})
|
||||
myclass_data_count = MYSY_GV.dbname['myclass'].count_documents(qry)
|
||||
#print(" ### myclass_data_count = ", myclass_data_count)
|
||||
|
||||
if( myclass_data_count != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -2249,7 +2349,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
|
|||
mysession_count_qry = {'class_internal_url': str(myclass_data['internal_url']), 'valide': '1',
|
||||
'partner_owner_recid': str(partner_recid), 'code_session':str(df['code_session'].values[n]) }
|
||||
|
||||
print(" ### mysession_count_qry = ", qry)
|
||||
print(" ### mysession_count_qry = ", mysession_count_qry)
|
||||
|
||||
mysession_count = MYSY_GV.dbname['session_formation'].count_documents(mysession_count_qry)
|
||||
|
||||
|
@ -4282,6 +4382,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
# Recuperation des informations de la session
|
||||
local_qry = {'_id':ObjectId(retVal['session_id']), 'valide':'1'}
|
||||
|
||||
#print(" #### local_qry zzz = ", local_qry)
|
||||
|
||||
count_session = MYSY_GV.dbname['session_formation'].count_documents(local_qry)
|
||||
|
||||
|
|
3954
Log/log_file.log
3954
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@ def Add_Update_SessionFormation(diction):
|
|||
'code_postal', 'ville', 'formateur', 'code_session',
|
||||
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription',
|
||||
'attestation_certif', "distantiel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'source', 'session_id', 'session_etape']
|
||||
'session_ondemande', 'source', 'session_id', 'session_etape', 'pays']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -172,6 +172,12 @@ def Add_Update_SessionFormation(diction):
|
|||
else:
|
||||
mydata['ville'] = ""
|
||||
|
||||
if ("pays" in diction.keys()):
|
||||
if diction['pays']:
|
||||
mydata['pays'] = diction['pays']
|
||||
else:
|
||||
mydata['pays'] = ""
|
||||
|
||||
if ("attestation_certif" in diction.keys()):
|
||||
mydata['attestation_certif'] = diction['attestation_certif']
|
||||
|
||||
|
@ -814,7 +820,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': filt_class_title}, {'$project': {'title': 1, 'domaine':1,
|
||||
'pipeline': [{'$match': { '$and' : [ filt_class_title, {'partner_owner_recid':str(my_partner['recid'])} ]} }, {'$project': {'title': 1, 'domaine':1,
|
||||
'duration':1, 'duration_unit':1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
|
@ -832,23 +838,46 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
val['_id'] = retVal['_id']
|
||||
val['class_internal_url'] = retVal['class_internal_url']
|
||||
val['code_session'] = retVal['code_session']
|
||||
val['session_etape'] = retVal['session_etape']
|
||||
val['session_status'] = retVal['session_status']
|
||||
if( "session_etape" in retVal.keys()):
|
||||
val['session_etape'] = retVal['session_etape']
|
||||
else:
|
||||
val['session_etape'] = "0"
|
||||
|
||||
if( "session_status" in retVal.keys()):
|
||||
val['session_status'] = retVal['session_status']
|
||||
else:
|
||||
val['session_status'] = "0"
|
||||
|
||||
val['date_debut'] = retVal['date_debut'][0:10]
|
||||
val['date_fin'] = retVal['date_fin'][0:10]
|
||||
val['date_debut_inscription'] = retVal['date_debut_inscription'][0:10]
|
||||
val['date_fin_inscription'] = retVal['date_fin_inscription'][0:10]
|
||||
|
||||
val['distantiel'] = retVal['distantiel']
|
||||
val['formateur'] = retVal['formateur']
|
||||
if ("distantiel" in retVal.keys()):
|
||||
val['distantiel'] = retVal['distantiel']
|
||||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("formateur" in retVal.keys()):
|
||||
val['formateur'] = retVal['formateur']
|
||||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
nb_participant = "0"
|
||||
if ("nb_participant" in retVal.keys()):
|
||||
nb_participant = retVal['nb_participant']
|
||||
|
||||
val['nb_participant'] = nb_participant
|
||||
val['presentiel'] = retVal['presentiel']
|
||||
val['prix_session'] = retVal['prix_session']
|
||||
|
||||
if ("presentiel" in retVal.keys()):
|
||||
val['presentiel'] = retVal['presentiel']
|
||||
else:
|
||||
val['presentiel'] = "0"
|
||||
|
||||
if ("prix_session" in retVal.keys()):
|
||||
val['prix_session'] = retVal['prix_session']
|
||||
else:
|
||||
val['prix_session'] = "0"
|
||||
|
||||
val['title'] = retVal['myclass_collection'][0]['title']
|
||||
val['domaine'] = retVal['myclass_collection'][0]['domaine']
|
||||
|
@ -909,6 +938,171 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
return False, "Impossible de recuperer la liste des sessions de formation valides et actives."
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste sans filtre
|
||||
"""
|
||||
def GetAllValideSessionPartner_List_no_filter(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token','class_title', 'code_session']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " - Le champ '" + val + "' n'est pas autorisé, Creation partenaire annulée")
|
||||
return False, " Impossible de recuperer la liste des session de formation"
|
||||
|
||||
"""
|
||||
Verification de la liste 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, "Impossible de recuperer la liste des session de formation"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
coll_session = MYSY_GV.dbname['session_formation']
|
||||
|
||||
query = [{'$match':{'partner_owner_recid': str(my_partner['recid'])} },
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'partner_owner_recid': str(my_partner['recid'])} },
|
||||
{'$project': {'title': 1, 'domaine': 1,
|
||||
'duration': 1, 'duration_unit': 1}}],
|
||||
'as': 'myclass_collection'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
print("#### GetAllValideSessionPartner_List_filter_likequery = ", query)
|
||||
RetObject = []
|
||||
cpt = 1
|
||||
for retVal in MYSY_GV.dbname['session_formation'].aggregate(query):
|
||||
if( 'myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0 ):
|
||||
val = {}
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
val['_id'] = retVal['_id']
|
||||
val['class_internal_url'] = retVal['class_internal_url']
|
||||
val['code_session'] = retVal['code_session']
|
||||
if( "session_etape" in retVal.keys()):
|
||||
val['session_etape'] = retVal['session_etape']
|
||||
else:
|
||||
val['session_etape'] = "0"
|
||||
|
||||
if( "session_status" in retVal.keys()):
|
||||
val['session_status'] = retVal['session_status']
|
||||
else:
|
||||
val['session_status'] = "0"
|
||||
|
||||
val['date_debut'] = retVal['date_debut'][0:10]
|
||||
val['date_fin'] = retVal['date_fin'][0:10]
|
||||
val['date_debut_inscription'] = retVal['date_debut_inscription'][0:10]
|
||||
val['date_fin_inscription'] = retVal['date_fin_inscription'][0:10]
|
||||
|
||||
if ("distantiel" in retVal.keys()):
|
||||
val['distantiel'] = retVal['distantiel']
|
||||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("formateur" in retVal.keys()):
|
||||
val['formateur'] = retVal['formateur']
|
||||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
nb_participant = "0"
|
||||
if ("nb_participant" in retVal.keys()):
|
||||
nb_participant = retVal['nb_participant']
|
||||
|
||||
val['nb_participant'] = nb_participant
|
||||
|
||||
if ("presentiel" in retVal.keys()):
|
||||
val['presentiel'] = retVal['presentiel']
|
||||
else:
|
||||
val['presentiel'] = "0"
|
||||
|
||||
if ("prix_session" in retVal.keys()):
|
||||
val['prix_session'] = retVal['prix_session']
|
||||
else:
|
||||
val['prix_session'] = "0"
|
||||
|
||||
val['title'] = retVal['myclass_collection'][0]['title']
|
||||
val['domaine'] = retVal['myclass_collection'][0]['domaine']
|
||||
|
||||
if (str(retVal['myclass_collection'][0]['duration_unit']) == "heure"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " h"
|
||||
|
||||
elif (str(retVal['myclass_collection'][0]['duration_unit']) == "jour"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " j"
|
||||
|
||||
elif (str(retVal['myclass_collection'][0]['duration_unit']) == "semaine"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " s"
|
||||
|
||||
elif (str(retVal['myclass_collection'][0]['duration_unit']) == "mois"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " m"
|
||||
|
||||
elif (str(retVal['myclass_collection'][0]['duration_unit']) == "annee"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " a"
|
||||
|
||||
elif (str(retVal['myclass_collection'][0]['duration_unit']) == "user_rythme"):
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " u"
|
||||
|
||||
else:
|
||||
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " ?"
|
||||
|
||||
val['duration'] = retVal['myclass_collection'][0]['duration']
|
||||
val['duration_unit'] = retVal['myclass_collection'][0]['duration_unit']
|
||||
|
||||
## Recuperation du nombre d'inscrits
|
||||
Count_Inscrit = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'session_id': str(retVal['code_session']), 'class_internal_url': str(retVal['class_internal_url']),
|
||||
'status': "1"})
|
||||
val['nb_inscrit'] = str(Count_Inscrit)
|
||||
|
||||
## Recuperation du nombre de preinscrits
|
||||
Count_Preinscrit = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'session_id': str(retVal['code_session']), 'class_internal_url': str(retVal['class_internal_url']),
|
||||
'status': "0"})
|
||||
|
||||
val['nb_preinscrit'] = str(Count_Preinscrit)
|
||||
|
||||
taux_replissage = "0"
|
||||
if (str(nb_participant) != "0"):
|
||||
taux_replissage = round(int(mycommon.tryInt(Count_Inscrit)) / int(mycommon.tryInt(nb_participant)),
|
||||
2)
|
||||
|
||||
val['taux_replissage'] = str(taux_replissage)
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de recuperer la liste des sessions de formation valides et actives."
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction crée les sessions de formation en mass
|
||||
|
@ -991,7 +1185,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
'''
|
||||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville',
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville', 'pays',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation', 'formateur',
|
||||
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
|
||||
'session_ondemande', 'session_etape']
|
||||
|
@ -1139,7 +1333,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
"""
|
||||
mydata['lms_class_code'] = formation_data_lms_class_code
|
||||
|
||||
session_ondemande = ""
|
||||
session_ondemande = "0"
|
||||
if ("session_ondemande" in df.keys()):
|
||||
if (str(df['session_ondemande'].values[n])):
|
||||
session_ondemande = str(df['session_ondemande'].values[n]).strip()
|
||||
|
@ -1197,6 +1391,12 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
local_ville = str(df['ville'].values[n]).strip()
|
||||
mydata['ville'] = local_ville
|
||||
|
||||
local_pays = ""
|
||||
if ("pays" in df.keys()):
|
||||
if (str(df['pays'].values[n])):
|
||||
local_pays = str(df['pays'].values[n]).strip()
|
||||
mydata['pays'] = local_pays
|
||||
|
||||
contenu_ftion = ""
|
||||
if ("contenu_ftion" in df.keys()):
|
||||
if (str(df['contenu_ftion'].values[n])):
|
||||
|
|
16
main.py
16
main.py
|
@ -1978,6 +1978,22 @@ def GetAllValideSessionPartner_List_filter_like():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
Cette API recupere toutes les sessions de formation d'un partneaire sans aucun filtre
|
||||
"""
|
||||
@app.route('/myclass/api/GetAllValideSessionPartner_List_no_filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GetAllValideSessionPartner_List_no_filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### GetAllValideSessionPartner_List_no_filter : payload = ",str(payload))
|
||||
localStatus, message= SF.GetAllValideSessionPartner_List_no_filter(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation session de formation
|
||||
"""
|
||||
|
|
|
@ -2954,6 +2954,9 @@ def GetAttendeeDetail_perSession(diction):
|
|||
if ("code_postal" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['code_postal'] = local_Insc_retval['code_postal']
|
||||
|
||||
if ("pays" in local_Insc_retval.keys()):
|
||||
my_retrun_dict['pays'] = local_Insc_retval['pays']
|
||||
|
||||
if ("certification_send_date" in local_Insc_retval.keys()):
|
||||
if (str(local_Insc_retval['certification_send_date'])):
|
||||
my_retrun_dict['certification_send_date'] = str(local_Insc_retval['certification_send_date'])[0:10]
|
||||
|
|
Loading…
Reference in New Issue