30/08/23 - 14h
parent
5f29dc49e3
commit
8355a5debb
|
@ -1,12 +1,12 @@
|
|||
<?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="28/08/23 - 20h30">
|
||||
<change afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="28/08/23 - 19h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -70,13 +70,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00040" summary="05/07/23 - 20h">
|
||||
<created>1688579855150</created>
|
||||
<option name="number" value="00040" />
|
||||
<option name="presentableId" value="LOCAL-00040" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1688579855150</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00041" summary="08/07/23 - 20h">
|
||||
<created>1688846277129</created>
|
||||
<option name="number" value="00041" />
|
||||
|
@ -413,7 +406,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1693250192838</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="89" />
|
||||
<task id="LOCAL-00089" summary="28/08/23 - 19h30">
|
||||
<created>1693331416912</created>
|
||||
<option name="number" value="00089" />
|
||||
<option name="presentableId" value="LOCAL-00089" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1693331416913</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="90" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -428,7 +428,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="11/08/23 - 16h" />
|
||||
<MESSAGE value="12/08/23 - 12h" />
|
||||
<MESSAGE value="13/08/23 - 14h" />
|
||||
<MESSAGE value="13/08/23 - 21h30" />
|
||||
|
@ -453,6 +452,7 @@
|
|||
<MESSAGE value="27/08/23 - 22h" />
|
||||
<MESSAGE value="28/08/23 - 13h30" />
|
||||
<MESSAGE value="28/08/23 - 20h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="28/08/23 - 20h30" />
|
||||
<MESSAGE value="28/08/23 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="28/08/23 - 19h30" />
|
||||
</component>
|
||||
</project>
|
1091
Log/log_file.log
1091
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -25,9 +25,6 @@ from datetime import timedelta
|
|||
"""
|
||||
Fonction de creation et mise à jour d'une session de formation.
|
||||
|
||||
la clée est :
|
||||
- formation_session_id,
|
||||
- class_internal_url
|
||||
|
||||
/!\ : le champ 'source' definit la source de la creation de la session
|
||||
|
||||
|
@ -42,7 +39,7 @@ def Add_Update_SessionFormation(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['token', 'date_debut', 'date_fin', 'nb_participant', 'formation_session_id', 'adresse',
|
||||
field_list = ['token', 'date_debut', 'date_fin', 'nb_participant', 'adresse',
|
||||
'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',
|
||||
|
@ -335,7 +332,7 @@ def Add_Update_SessionFormation(diction):
|
|||
print(" ###laaa mydata = ", mydata)
|
||||
coll_name = MYSY_GV.dbname['session_formation']
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'_id':ObjectId(str(session_id))},
|
||||
{'_id':ObjectId(str(session_id)), 'valide':'1'},
|
||||
{"$set": mydata},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
|
@ -1971,3 +1968,96 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'importer les sessions de formation en masse "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction supprime une session de formation.
|
||||
/!\ : il faut s'assurer qu'il n'y a aucune inscription avant de supprimer valide.
|
||||
Et la session est supprimé, alors supprimer toutes inscriptions (annulée) associés
|
||||
Ensuite supprimer les affectations d'enseignants et de materiels associée
|
||||
"""
|
||||
def Delete_SessionFormation(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'session_id', ]
|
||||
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, "de recuperer la liste des stagiaires . Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'session_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, "Impossible de recuperer la liste des stagiaires, Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Les informations d'identification sont incorrectes ")
|
||||
return False, "Impossible de recuperer la liste des stagiaires, Les informations d'identification sont incorrectes "
|
||||
|
||||
|
||||
session_id = ""
|
||||
if ("session_id" in diction.keys()):
|
||||
if diction['session_id']:
|
||||
session_id = diction['session_id']
|
||||
|
||||
|
||||
|
||||
# Verifier qu'il n'y a pas d'incription valide
|
||||
inscription_count_qry = {'session_id':str(session_id), 'status':{'$in':['0', '1', '2']} , 'partner_owner_recid':str(partner_recid)}
|
||||
print(" #### inscription_count_qry aa =", inscription_count_qry)
|
||||
inscription_count = MYSY_GV.dbname['inscription'].count_documents(inscription_count_qry)
|
||||
if( inscription_count > 0 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de supprimer la session. Vous avez "+str(inscription_count)+" inscriptions associées ")
|
||||
return False, "Impossible de supprimer la session. Vous avez "+str(inscription_count)+" inscriptions associées"
|
||||
|
||||
# Suppression des insciption eventuellement annulées
|
||||
MYSY_GV.dbname['inscription'].delete_many({'session_id':str(session_id)})
|
||||
|
||||
# Suppression des affectation de ressources associées
|
||||
delete_affectation_qry = {'related_target_collection':'session_formation', 'related_target_collection_id':str(session_id),
|
||||
'partner_owner_recid': str(partner_recid)
|
||||
}
|
||||
|
||||
# Pour les Ressource Humaine
|
||||
MYSY_GV.dbname['ressource_humaine_affectation'].delete_many(delete_affectation_qry)
|
||||
|
||||
# Pour le materiel
|
||||
MYSY_GV.dbname['ressource_materielle_affectation'].delete_many(delete_affectation_qry)
|
||||
|
||||
|
||||
# Suppression de la session
|
||||
deleted_session_qry = {'_id':ObjectId(str(session_id)), 'partner_owner_recid':str(partner_recid)}
|
||||
deleted_data = MYSY_GV.dbname['session_formation'].delete_many(deleted_session_qry)
|
||||
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + str(deleted_data.deleted_count)+" Document supprimé. La session_id " + str(
|
||||
session_id) + " a été correctement supprimée ")
|
||||
|
||||
|
||||
return True, "La session a été correctement supprimée"
|
||||
|
||||
|
||||
|
||||
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 supprimer la session de formation"
|
||||
|
|
20
main.py
20
main.py
|
@ -2006,6 +2006,26 @@ def GetSessionFormation():
|
|||
localStatus, message= SF.GetSessionFormation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de suppression d'une session de formation :
|
||||
/!\ : il faut s'assurer qu'il n'y a aucune inscription avant de supprimer valide.
|
||||
Et la session est supprimé, alors supprimer toutes inscriptions (annulée) associés
|
||||
Ensuite supprimer les affectations d'enseignants et de materiels associée
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_SessionFormation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_SessionFormation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_SessionFormation : payload = ",str(payload))
|
||||
localStatus, message= SF.Delete_SessionFormation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de generation de liste PDF des liste d'emargement
|
||||
"""
|
||||
|
|
|
@ -706,7 +706,7 @@ def Get_List_Ressource_Materielle_no_filter(diction):
|
|||
|
||||
find_qry = {'partner_recid': str(my_partner['recid']), 'valide':'1', 'locked':'0' }
|
||||
|
||||
|
||||
print(" ### materiel find_qry = ", find_qry)
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue