12/03/2024 - 20h30
parent
a446b4640b
commit
52a250d9c0
|
@ -1,10 +1,15 @@
|
|||
<?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="10/03/24 - 21h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="11/03/2024 - 15h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/site_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/site_formation.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -74,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00193" summary="11/01/24 - 21h30">
|
||||
<created>1705004951917</created>
|
||||
<option name="number" value="00193" />
|
||||
<option name="presentableId" value="LOCAL-00193" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1705004951917</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00194" summary="12/01/24 - 16h30">
|
||||
<created>1705071129313</created>
|
||||
<option name="number" value="00194" />
|
||||
|
@ -417,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1710101347417</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="242" />
|
||||
<task id="LOCAL-00242" summary="11/03/2024 - 15h">
|
||||
<created>1710165434009</created>
|
||||
<option name="number" value="00242" />
|
||||
<option name="presentableId" value="LOCAL-00242" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1710165434010</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="243" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -432,7 +437,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="09/02/24 - 22hqsdsq" />
|
||||
<MESSAGE value="11/02/2024 - 22h" />
|
||||
<MESSAGE value="sdsdqs" />
|
||||
<MESSAGE value="13/02/2024 - 11h" />
|
||||
|
@ -457,6 +461,7 @@
|
|||
<MESSAGE value="ddd" />
|
||||
<MESSAGE value="ddds" />
|
||||
<MESSAGE value="10/03/24 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="10/03/24 - 21h" />
|
||||
<MESSAGE value="11/03/2024 - 15h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="11/03/2024 - 15h" />
|
||||
</component>
|
||||
</project>
|
|
@ -5162,6 +5162,117 @@ def RefuseAttendeeInscription_with_motif(diction):
|
|||
return False, " Impossible d'annuler l'inscription"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction refuse les inscription en mase avec un motif
|
||||
"""
|
||||
|
||||
"""
|
||||
Cette fonction une liste d'inscrit à une session de formation
|
||||
"""
|
||||
def Refuse_List_AttendeeInscription_with_motif(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'list_inscription_id', 'motif']
|
||||
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 ne sont pas correctes"
|
||||
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = 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
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
list_inscription_id = []
|
||||
if ("list_inscription_id" in diction.keys()):
|
||||
if diction['list_inscription_id']:
|
||||
list_inscription_id = str(diction['list_inscription_id']).replace(",", ";").split(";")
|
||||
|
||||
for inscription_id in list_inscription_id:
|
||||
"""
|
||||
# Verification que l'inscription existe et qu'elle est valide et qu'elle est au statut : en cours (status =2) ou
|
||||
preinscrit (status = 0) ou validé (status = 1)
|
||||
"""
|
||||
ret_val2_count = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid':str(my_partner['recid']),
|
||||
},
|
||||
)
|
||||
|
||||
if (ret_val2_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + "L'identifiant de l'inscription "+ str(inscription_id) +" n'est pas valide ")
|
||||
return False, " L'identifiant de l'inscription "+ str(inscription_id) +" n'est pas valide "
|
||||
|
||||
inscription_id_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']),
|
||||
},
|
||||
)
|
||||
|
||||
if( "status" not in inscription_id_data.keys() or inscription_id_data['status'] not in ['0', '2', '1']):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " Toutes les inscriptions doivent être au statut : en cours ou preinscription ")
|
||||
return False, " Toutes les inscriptions doivent être au statut : en cours ou preinscription "
|
||||
|
||||
|
||||
# Verifier que la session de formation concernée est valide
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(inscription_id_data['session_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1'})
|
||||
|
||||
if (is_valide_session != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session de formation "+ str(inscription_id_data['session_id']) +" n'est pas valide ")
|
||||
return False, " L'identifiant de la session de formation "+ str(inscription_id_data['session_id']) +" n'est pas valide "
|
||||
|
||||
|
||||
|
||||
# A present les controles sont ok sur la liste on peut valide la liste des inscription
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
for inscription_id in list_inscription_id:
|
||||
|
||||
inscription_id_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']),
|
||||
'status':{'$in':['0', '1', '2']}
|
||||
},
|
||||
)
|
||||
|
||||
print(" ### inscription_id_data = ",inscription_id_data)
|
||||
if( inscription_id_data ):
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
new_diction['motif'] = diction['motif']
|
||||
new_diction['inscription_id'] = str(inscription_id_data['_id'])
|
||||
new_diction['email'] = str(inscription_id_data['email'])
|
||||
|
||||
#print(" ### new_diction = ",new_diction)
|
||||
|
||||
local_status, local_retval = RefuseAttendeeInscription_with_motif(new_diction)
|
||||
if( local_status is False ):
|
||||
is_warning = "1"
|
||||
warning_msg = warning_msg + "\n"+str(local_retval)
|
||||
|
||||
if( is_warning == "1" ):
|
||||
return True, str(warning_msg)
|
||||
|
||||
return True, "La liste des inscriptions a été refusée"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de refuser la liste des inscriptions"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Fontion de validation / acceptation d'une inscription
|
||||
"""
|
||||
|
@ -5678,6 +5789,107 @@ def AcceptAttendeeInscription(diction):
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction une liste d'inscrit à une session de formation
|
||||
"""
|
||||
def Accept_List_AttendeeInscription(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'list_inscription_id']
|
||||
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 ne sont pas correctes"
|
||||
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = 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
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
list_inscription_id = []
|
||||
if ("list_inscription_id" in diction.keys()):
|
||||
if diction['list_inscription_id']:
|
||||
list_inscription_id = str(diction['list_inscription_id']).replace(",", ";").split(";")
|
||||
|
||||
for inscription_id in list_inscription_id:
|
||||
# Verification que l'inscription existe et qu'elle est valide et qu'elle est au statut : en cours (status =2) ou preinscrit (status = 0)
|
||||
ret_val2_count = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid':str(my_partner['recid']),
|
||||
},
|
||||
)
|
||||
|
||||
if (ret_val2_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + "L'identifiant de l'inscription "+ str(inscription_id) +" n'est pas valide ")
|
||||
return False, " L'identifiant de l'inscription "+ str(inscription_id) +" n'est pas valide "
|
||||
|
||||
inscription_id_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']),
|
||||
},
|
||||
)
|
||||
|
||||
if( "status" not in inscription_id_data.keys() or inscription_id_data['status'] not in ['0', '2', '1']):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " Toutes les inscriptions doivent être au statut : en cours ou preinscription ")
|
||||
return False, " Toutes les inscriptions doivent être au statut : en cours ou preinscription "
|
||||
|
||||
|
||||
# Verifier que la session de formation concernée est valide
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(inscription_id_data['session_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1'})
|
||||
|
||||
if (is_valide_session != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session de formation "+ str(inscription_id_data['session_id']) +" n'est pas valide ")
|
||||
return False, " L'identifiant de la session de formation "+ str(inscription_id_data['session_id']) +" n'est pas valide "
|
||||
|
||||
|
||||
|
||||
# A present les controles sont ok sur la liste on peut valide la liste des inscription
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
for inscription_id in list_inscription_id:
|
||||
|
||||
inscription_id_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']),
|
||||
'status':{'$in':['0', '2']}
|
||||
},
|
||||
)
|
||||
|
||||
print(" ### inscription_id_data = ",inscription_id_data)
|
||||
if( inscription_id_data ):
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
new_diction['inscription_id'] = str(inscription_id_data['_id'])
|
||||
new_diction['email'] = str(inscription_id_data['email'])
|
||||
|
||||
#print(" ### new_diction = ",new_diction)
|
||||
|
||||
local_status, local_retval = AcceptAttendeeInscription(new_diction)
|
||||
if( local_status is False ):
|
||||
is_warning = "1"
|
||||
warning_msg = warning_msg + "\n"+str(local_retval)
|
||||
|
||||
if( is_warning == "1" ):
|
||||
return True, str(warning_msg)
|
||||
|
||||
return True, "La liste des inscriptions a été validée"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de valider la liste des inscriptions"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction supprime un stagiaire.
|
||||
|
|
4871
Log/log_file.log
4871
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -230,7 +230,8 @@ def Update_Apprenant(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', 'civilite', 'date_naissance'
|
||||
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'civilite', 'date_naissance',
|
||||
'tuteur1_civilite', 'tuteur2_civilite'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
|
45
main.py
45
main.py
|
@ -3496,6 +3496,21 @@ def DeleteAttendeeInscription():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de validation en masse des inscriptions
|
||||
"""
|
||||
@app.route('/myclass/api/Accept_List_AttendeeInscription/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Accept_List_AttendeeInscription():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Accept_List_AttendeeInscription : payload = ",payload)
|
||||
localStatus, message= inscription.Accept_List_AttendeeInscription(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de suppression en masse des stagiaires
|
||||
"""
|
||||
|
@ -3521,6 +3536,20 @@ def RefuseAttendeeInscription_with_motif():
|
|||
localStatus, message= inscription.RefuseAttendeeInscription_with_motif(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de d'annulation d'une liste inscription avec mise à jour du motif en masse
|
||||
"""
|
||||
@app.route('/myclass/api/Refuse_List_AttendeeInscription_with_motif/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Refuse_List_AttendeeInscription_with_motif():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Refuse_List_AttendeeInscription_with_motif : payload = ",payload)
|
||||
localStatus, message= inscription.Refuse_List_AttendeeInscription_with_motif(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de validation d'une inscription d'un stagiaire
|
||||
"""
|
||||
|
@ -7922,12 +7951,26 @@ def Get_Given_Paiement_Condition():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Get_Given_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'initialiser les elements de configuration d'un partenaire.
|
||||
Les document / modele de journée de travail / Les étapes d'un session.... voir la fonction pour plus de detail
|
||||
"""
|
||||
@app.route('/myclass/api/Configure_Partner_Init_Setup_No_Token/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Configure_Partner_Init_Setup_No_Token():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Configure_Partner_Init_Setup_No_Token payload = ",payload)
|
||||
status, retval = mycommon.Configure_Partner_Init_Setup_No_Token(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
24
partners.py
24
partners.py
|
@ -1027,7 +1027,29 @@ def valide_partnair_account(value):
|
|||
str(inspect.stack()[0][3]) + " Impossible d'initialiser le point de configuration technique " + str(val_tmp['config_name']) + ". ")
|
||||
|
||||
|
||||
|
||||
"""
|
||||
12/03/2024 - Initialiser le reste des points de configuration pour rendre le compte plus opérationnel
|
||||
|
||||
Liste des points de configuration à ajouter
|
||||
- Les document : Il faut créer à minima les documents suivants :
|
||||
|
||||
- Un modele de journée de travail
|
||||
|
||||
- Les étapes d'un session :
|
||||
|
||||
|
||||
- Un site par defaut :
|
||||
|
||||
|
||||
- CRM Etap Opportunité:
|
||||
|
||||
|
||||
- Conditions de paiement
|
||||
|
||||
"""
|
||||
local_status, local_retval = mycommon.Configure_Partner_Init_Setup_No_Token({'partner_id':str(value)})
|
||||
if( local_status is False) :
|
||||
return local_status, local_retval
|
||||
|
||||
mycommon.myprint("La modif a bien ete faite Ajout secret_key OK, =" + str(ret_val['_id']))
|
||||
# Envoie du mail de notification
|
||||
|
|
272
prj_common.py
272
prj_common.py
|
@ -4914,3 +4914,275 @@ def Get_Partner_Currency(partner_owner_recid):
|
|||
return False
|
||||
|
||||
|
||||
"""
|
||||
12/03/2024 :
|
||||
Cette fonction permette d'initialiser les configuration par defaut d'un nouveau partenaire de MySy.
|
||||
|
||||
C'est une fonction qui doit etre utilisé à l'activation du compte partenaire. Cela ne l'empechera pas de
|
||||
ensuite de faire la mise à jour manuellement.
|
||||
|
||||
Mais ca permet d'envoir un systeme pleinement operationnel des l'activation du compte.
|
||||
Liste des points de configuration à ajoouter
|
||||
- Les document : Il faut créer à minima les documents suivants :
|
||||
-> Demande d'inscription
|
||||
-> Confirmation Inscription
|
||||
-> Convention individuelle
|
||||
-> Convention d'entreprise
|
||||
-> Convocation
|
||||
-> Attestation
|
||||
-> Devis / Commande
|
||||
-> Factue
|
||||
|
||||
|
||||
- Un modele de journée de travail
|
||||
|
||||
- Les étapes d'un session :
|
||||
-> Plannification
|
||||
-> En cours
|
||||
-> Terminée
|
||||
-> Archivée
|
||||
|
||||
- Un site par defaut :
|
||||
-> Site Principal
|
||||
|
||||
- CRM Etap Opportunité:
|
||||
-> Nouveau
|
||||
-> Qualification
|
||||
-> Proposition
|
||||
-> Gagne
|
||||
-> Perdu
|
||||
-> Archivé
|
||||
|
||||
- Conditions de paiement
|
||||
-> 0JF
|
||||
-> 30JF
|
||||
-> 15JFDM
|
||||
"""
|
||||
def Configure_Partner_Init_Setup_No_Token(diction):
|
||||
try:
|
||||
diction = strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_id']
|
||||
|
||||
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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_id']
|
||||
|
||||
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",
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données du partenaire.
|
||||
/!\ : Ceci ne s'applique qu'a un compte de type admin -- test ko à refaire
|
||||
"""
|
||||
my_partner_data = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(str(diction['partner_id'])),
|
||||
})
|
||||
if (my_partner_data is None ):
|
||||
myprint(str(
|
||||
inspect.stack()[0][3]) + " L'identifiant '" + str(diction['partner_id']) + "' n'est pas valide ")
|
||||
return False, " L'identifiant '" + str(diction['partner_id']) + "' n'est pas valide",
|
||||
|
||||
|
||||
""""
|
||||
1 - Configuration des documents
|
||||
"""
|
||||
liste_document_ref_interne = ['CONF_PRE_INSCRIPTION', 'CONF_INSCRIPTION', 'REFUS_INSCRIPTION','ANNULE_INSCRIPTION',
|
||||
'EMARGEMENT_FORMATION', 'TABLEAU EMARGEMENT', 'EMPLOYEE_CREDENTIALS', 'EMARGEMENT'
|
||||
'CONVOCATION_STAGIAIRE', 'EMPLOYEE_CREDENTIALS_FOR_LMS', 'ATTESTATION_FORMATION',
|
||||
'PART_INVOICE', 'PART_ORDER', 'CONVENTION_STAGIAIRE']
|
||||
|
||||
"""
|
||||
Supprimer les eventuel ancienne information de ce type pour ce partenaire
|
||||
"""
|
||||
MYSY_GV.dbname['courrier_template'].delete_many({'partner_owner_recid':str(my_partner_data['recid'])})
|
||||
|
||||
"""
|
||||
Insertion des nouveaux courriers
|
||||
"""
|
||||
cpt = 0
|
||||
for my_courrier_data in MYSY_GV.dbname['courrier_template'].find({"ref_interne": {"$in": liste_document_ref_interne},
|
||||
'partner_owner_recid':'default', 'valide':'1',
|
||||
'locked':'0'}, ):
|
||||
new_courrier = my_courrier_data
|
||||
new_courrier['date_update'] = str(datetime.now())
|
||||
new_courrier['update_by'] = str(my_partner_data['_id'])
|
||||
new_courrier['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
new_courrier['original_courrier_template_id'] = str(my_courrier_data['_id'])
|
||||
if( "_id" in new_courrier.keys() ):
|
||||
del new_courrier['_id']
|
||||
|
||||
MYSY_GV.dbname['courrier_template'].insert_one(new_courrier)
|
||||
cpt = cpt +1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE "+str(cpt)+" DOCUMENT(S) ")
|
||||
|
||||
"""
|
||||
2 - Configuration du modele de journée de travail
|
||||
"""
|
||||
"""
|
||||
Supprimer les eventuel ancienne information de ce type pour ce partenaire
|
||||
"""
|
||||
MYSY_GV.dbname['base_config_modele_journee'].delete_many({'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
|
||||
cpt = 0
|
||||
my_modele_journee_data = MYSY_GV.dbname['base_config_modele_journee'].find_one({'partner_owner_recid':'default',
|
||||
'valide':'1',
|
||||
'locked':'0'}, {'_id': 0})
|
||||
if( my_modele_journee_data ):
|
||||
new_my_modele_journee_data = my_modele_journee_data
|
||||
new_my_modele_journee_data['date_update'] = str(datetime.now())
|
||||
new_my_modele_journee_data['update_by'] = str(my_partner_data['_id'])
|
||||
new_my_modele_journee_data['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
MYSY_GV.dbname['base_config_modele_journee'].insert_one(new_my_modele_journee_data)
|
||||
|
||||
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " MODELE DE JOURNEE (S) ")
|
||||
|
||||
|
||||
|
||||
"""
|
||||
3 - Configuration des étapes d'un session de formation
|
||||
"""
|
||||
|
||||
# Suppression des étapes qui existe pour ce partenaire
|
||||
MYSY_GV.dbname['base_partner_session_step'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
"""
|
||||
Insertion des nouvelles étapes par defaut
|
||||
"""
|
||||
cpt = 0
|
||||
for my_step_session in MYSY_GV.dbname['base_partner_session_step'].find(
|
||||
{'partner_owner_recid': 'default', 'valide': '1',
|
||||
'locked': '0'}, {'_id': 0}):
|
||||
new_step_session = my_step_session
|
||||
new_step_session['date_update'] = str(datetime.now())
|
||||
new_step_session['update_by'] = str(my_partner_data['_id'])
|
||||
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
|
||||
|
||||
MYSY_GV.dbname['base_partner_session_step'].insert_one(new_step_session)
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " ETAPE(S) DE SESSION DE FORMATION ")
|
||||
|
||||
|
||||
"""
|
||||
4 - Configuration des CRM Etap Opportunité
|
||||
"""
|
||||
# Suppression des étapes qui existe pour ce partenaire
|
||||
MYSY_GV.dbname['base_partner_opportunite_step'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
|
||||
"""
|
||||
Insertion des nouvelles étapes des CRM opportunité par defaut
|
||||
"""
|
||||
cpt = 0
|
||||
for my_step_CRM_Opp in MYSY_GV.dbname['base_partner_opportunite_step'].find(
|
||||
{'partner_owner_recid': 'default', 'valide': '1',
|
||||
'locked': '0'}, {'_id': 0}):
|
||||
new_step_CRM_Opp = my_step_CRM_Opp
|
||||
new_step_CRM_Opp['date_update'] = str(datetime.now())
|
||||
new_step_CRM_Opp['update_by'] = str(my_partner_data['_id'])
|
||||
new_step_CRM_Opp['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
MYSY_GV.dbname['base_partner_opportunite_step'].insert_one(new_step_CRM_Opp)
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " ETAPE(S) DE CRM OPPORTUNITE ")
|
||||
|
||||
|
||||
|
||||
"""
|
||||
5 - Configuration des Conditions de paiement
|
||||
"""
|
||||
# Suppression des étapes qui existe pour ce partenaire
|
||||
MYSY_GV.dbname['base_partner_paiement_condition'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
cpt = 0
|
||||
for my_paiement_cdtion in MYSY_GV.dbname['base_partner_paiement_condition'].find(
|
||||
{'partner_owner_recid': 'default', 'valide': '1',
|
||||
'locked': '0'}, {'_id': 0}):
|
||||
new_paiement_cdtion = my_paiement_cdtion
|
||||
new_paiement_cdtion['date_update'] = str(datetime.now())
|
||||
new_paiement_cdtion['update_by'] = str(my_partner_data['_id'])
|
||||
new_paiement_cdtion['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
MYSY_GV.dbname['base_partner_paiement_condition'].insert_one(new_paiement_cdtion)
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " CONDITION(S) PAIEMENT ")
|
||||
|
||||
|
||||
"""
|
||||
6 - Creation d'un site par default
|
||||
"""
|
||||
# Suppression des site qui existe pour ce partenaire
|
||||
MYSY_GV.dbname['site_formation'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner_data['recid'])})
|
||||
|
||||
cpt = 0
|
||||
new_site_formation_default = {}
|
||||
new_site_formation_default['date_update'] = str(datetime.now())
|
||||
new_site_formation_default['update_by'] = str(my_partner_data['_id'])
|
||||
new_site_formation_default['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
new_site_formation_default['code_site'] = "site_01"
|
||||
new_site_formation_default['nom_site'] = "Site Principale de Formation"
|
||||
new_site_formation_default['valide'] = "1"
|
||||
new_site_formation_default['locked'] = "0"
|
||||
|
||||
site_ville = ""
|
||||
if( "adr_city" in my_partner_data.keys() ):
|
||||
site_ville = my_partner_data['adr_city']
|
||||
new_site_formation_default['site_ville'] = site_ville
|
||||
|
||||
site_pays = ""
|
||||
if ("adr_country" in my_partner_data.keys()):
|
||||
site_pays = my_partner_data['adr_country']
|
||||
new_site_formation_default['site_pays'] = site_pays
|
||||
|
||||
site_adr = ""
|
||||
if ("adr_street" in my_partner_data.keys()):
|
||||
site_adr = my_partner_data['adr_street']
|
||||
new_site_formation_default['site_adr'] = site_adr
|
||||
|
||||
site_cp = ""
|
||||
if ("adr_zip" in my_partner_data.keys()):
|
||||
site_cp = my_partner_data['adr_zip']
|
||||
new_site_formation_default['site_cp'] = site_cp
|
||||
|
||||
MYSY_GV.dbname['site_formation'].insert_one(new_site_formation_default)
|
||||
cpt = cpt + 1
|
||||
|
||||
myprint(" #### FIN CONFIGURATION DE " + str(cpt) + " SITE DE FORMATION ")
|
||||
|
||||
|
||||
return True, "La configuration fonctionnelle a été correctement faite"
|
||||
|
||||
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 Configurer le partenaire "
|
|
@ -310,6 +310,7 @@ def Get_List_Site_Formation_with_filter(diction):
|
|||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
|
||||
query_with_filter = {'$and': [qry, filt_code_site, filt_nom_site ]}
|
||||
|
||||
print(" ### Get_List_Site_Formation_with_filter query_with_filter = ", query_with_filter)
|
||||
for New_retVal in MYSY_GV.dbname['site_formation'].find(query_with_filter):
|
||||
user = New_retVal
|
||||
user['id'] = str(val_tmp)
|
||||
|
|
Loading…
Reference in New Issue