parent
1c009b100e
commit
f8444fbcd7
|
|
@ -4,10 +4,11 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="19/10/2025 - 14h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/10/2025 - 14h">
|
||||
<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$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -450,7 +451,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="501" />
|
||||
<option name="localTasksCounter" value="502" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -492,7 +493,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="05/06/2025 - 20h" />
|
||||
<MESSAGE value="05/06/2025 - 22h" />
|
||||
<MESSAGE value="06/06/2025 - 20h" />
|
||||
<MESSAGE value="07/06/2025 - 21h30" />
|
||||
|
|
@ -517,6 +517,7 @@
|
|||
<MESSAGE value="12/10/2025 - 17:14 - Elyos V1.2" />
|
||||
<MESSAGE value="14/10/2025 - 23h" />
|
||||
<MESSAGE value="19/10/2025 - 14h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="19/10/2025 - 14h" />
|
||||
<MESSAGE value="20/10/2025 - 14h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="20/10/2025 - 14h" />
|
||||
</component>
|
||||
</project>
|
||||
1676
Log/log_file.log
1676
Log/log_file.log
File diff suppressed because it is too large
Load Diff
212
class_mgt.py
212
class_mgt.py
|
|
@ -8179,4 +8179,214 @@ def Delete_UE_From_Class(diction):
|
|||
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 supprimer L'UE de la formation "
|
||||
return False, " Impossible de supprimer L'UE de la formation "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction met à jour les documents par defaut d'une formation
|
||||
par exemple : la convention par defaut, la convocation par defaut, etc
|
||||
"""
|
||||
|
||||
def Update_Class_Default_Document(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id', 'CONF_INSCRIPTION', 'EMARGEMENT_FORMATION', 'CONVENTION_STAGIAIRE_ENTREPRISE',
|
||||
'CONVENTION_STAGIAIRE_INDIVIDUELLE', 'ATTESTATION_FORMATION', 'CONVOCATION_STAGIAIRE', 'QUESTION_POSITIONNEMENT',
|
||||
'EVAL_FORMATION']
|
||||
|
||||
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'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_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 la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité de la formation
|
||||
"""
|
||||
is_class_valide = MYSY_GV.dbname['myclass'].count_documents({'_id':ObjectId(diction['class_id']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_class_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
verifier que tous les documents envoyés sont valides
|
||||
"""
|
||||
local_keys = ['CONF_INSCRIPTION', 'EMARGEMENT_FORMATION', 'CONVENTION_STAGIAIRE_ENTREPRISE',
|
||||
'CONVENTION_STAGIAIRE_INDIVIDUELLE', 'ATTESTATION_FORMATION', 'CONVOCATION_STAGIAIRE', 'QUESTION_POSITIONNEMENT',
|
||||
'EVAL_FORMATION']
|
||||
|
||||
for tmp in local_keys:
|
||||
if( tmp in diction.keys()):
|
||||
doc_id = diction[str(tmp)]
|
||||
is_doc_valide = MYSY_GV.dbname['courrier_template'].count_documents({'partner_owner_recid':str(diction['recid']),
|
||||
'_id':ObjectId(str(doc_id)),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
if( is_doc_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du document "+str(tmp)+" est invalide ")
|
||||
return False, " L'identifiant du document "+str(tmp)+" est invalide "
|
||||
|
||||
|
||||
updated_type_doc = []
|
||||
|
||||
for tmp in local_keys:
|
||||
if( tmp in diction.keys()):
|
||||
doc_id = diction[str(tmp)]
|
||||
|
||||
now = str(datetime.datetime.now())
|
||||
updata_data = {}
|
||||
updata_data['date_update'] = str(datetime.now())
|
||||
updata_data['update_by'] = str(my_partner['_id'])
|
||||
updata_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
updata_data['class_id'] = str(diction['class_id'])
|
||||
updata_data['valide'] = '1'
|
||||
updata_data['locked'] = '0'
|
||||
updata_data[str(tmp)] = diction[str(tmp)]
|
||||
|
||||
data_cle = {}
|
||||
data_cle[str(tmp)] = diction[str(tmp)]
|
||||
data_cle['class_id'] = str(diction['class_id'])
|
||||
|
||||
ret_val = MYSY_GV.dbname['myclass_default_document'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": updata_data},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=True,
|
||||
)
|
||||
|
||||
updated_type_doc.append(diction[str(tmp)])
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(token)
|
||||
history_event_dict['related_collection'] = "myclass"
|
||||
history_event_dict['related_collection_recid'] = str(diction['class_id'])
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Mise à jour des documents par defaut : "+str(updated_type_doc)
|
||||
|
||||
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, " Les documents par défaut ont été correctement mis à jour"
|
||||
|
||||
|
||||
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 les documents par défaut de la formation "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les documents par défaut d'une formation
|
||||
"""
|
||||
def Get_Given_Class_List_Default_Documents(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id']
|
||||
|
||||
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', 'class_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 la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['class_id'] = str(my_partner['class_id'])
|
||||
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['myclass_default_document'].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 documents par défaut"
|
||||
|
||||
|
|
|
|||
28
main.py
28
main.py
|
|
@ -14447,6 +14447,34 @@ def JMJ_Repise_Factures_Update_Inscription_Status():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour la liste des documents par défaut d'une formation
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Class_Default_Document/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Class_Default_Document():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Class_Default_Document payload = ",payload)
|
||||
status, retval = cm.Update_Class_Default_Document(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des documents par défaut d'une formation
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Class_List_Default_Documents/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Class_List_Default_Documents():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Class_List_Default_Documents payload = ",payload)
|
||||
status, retval = cm.Get_Given_Class_List_Default_Documents(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
|
|||
Loading…
Reference in New Issue