09/02/2026

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-02-09 20:10:54 +01:00
parent bf8537646c
commit 9f18c092ad
82 changed files with 16541 additions and 462 deletions

View File

@ -4,12 +4,89 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="02/02/2026 - 18h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/02/2026">
<change afterPath="$PROJECT_DIR$/activite_pedagogique.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pole_activite_pedagogique.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/tache_pedagogique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dev_api_functions.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dev_api_functions.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Ela_Spacy.py" beforeDir="false" afterPath="$PROJECT_DIR$/Ela_Spacy.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.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$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/appel_offre.py" beforeDir="false" afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/articles_avis.py" beforeDir="false" afterPath="$PROJECT_DIR$/articles_avis.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/attestation_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/attestation_formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_document_automatic_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_document_automatic_setup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ent_alert_messages.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_alert_messages.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/equipe_team_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/equipe_team_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/financial_caracteristique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/financial_caracteristique_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/groupe_client_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/invoice_paiement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/invoice_paiement_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.py" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/metier_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/metier_formation_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/model_planning_sequence_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/model_planning_sequence_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/paiement_condition.py" beforeDir="false" afterPath="$PROJECT_DIR$/paiement_condition.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_produit_service_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_produit_service_mgt.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$/purchase_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/purchase_prices.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reference_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/reference_pedagogique_mgt.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" />
<change beforePath="$PROJECT_DIR$/site_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/site_formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/stage_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/stage_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_message_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_message_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -55,12 +132,13 @@
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master__Elyos__FI&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/Cherif/Documents/myclass.com/Siteweb/Elyos_Ftion_Initiale/Ela_back/Back_Office_FI/tools_cherif&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/Cherif/Documents/myclass.com/Siteweb/Elyos_Ftion_Initiale/Ela_back/Back_Office_FI&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Cherif\Documents\myclass.com\Siteweb\Elyos_Ftion_Initiale\Ela_back\Back_Office_FI" />
<recent name="C:\Users\Cherif\Documents\myclass.com\Siteweb\Elyos_Ftion_Initiale\Ela_back\Back_Office_FI\tools_cherif" />
<recent name="C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\tools_cherif" />
<recent name="C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office" />
@ -452,7 +530,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="527" />
<option name="localTasksCounter" value="528" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -494,7 +572,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="19/10/2025 - 14h" />
<MESSAGE value="20/10/2025 - 14h" />
<MESSAGE value="20/10/2025 - 14hsd" />
<MESSAGE value="21/10/2025 - 22h" />
@ -519,6 +596,7 @@
<MESSAGE value="09/01/26 - 20h30" />
<MESSAGE value="30/01/2026 - 18h" />
<MESSAGE value="02/02/2026 - 18h" />
<option name="LAST_COMMIT_MESSAGE" value="02/02/2026 - 18h" />
<MESSAGE value="03/02/2026" />
<option name="LAST_COMMIT_MESSAGE" value="03/02/2026" />
</component>
</project>

View File

@ -220,7 +220,7 @@ def Add_activite(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['creation_by'] = str(my_partner['_id'])
@ -411,7 +411,7 @@ def Update_activite(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
"""
Clés de mise à jour
@ -547,7 +547,7 @@ def Update_activite_status(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])

View File

@ -166,7 +166,7 @@ def Add_Historique_Event(diction):
mydata['connected_user_id'] = str(my_partner['_id'])
mydata['valide'] = "1"
mydata['locked'] = "0"
mydata['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['update_by'] = str(my_partner['_id'])

View File

@ -276,7 +276,7 @@ def Add_Contact(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
# Creation du RecId
data['recid'] = mycommon.create_user_recid()
@ -518,7 +518,7 @@ def Update_Contact(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])

View File

@ -156,7 +156,7 @@ def Add_To_User_Dashbord(diction):
my_data['dashbord_internal_code'] = str(diction['dashbord_internal_code'])
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
if("type_event" in diction.keys() ):
my_data['type_event'] = str(diction['type_event'])

View File

@ -77,7 +77,7 @@ def Dev_del_user_token(diction):
email = diction['email']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['indexed'] = '0'
coll_token = MYSY_GV.dbname['user_token']

View File

@ -192,7 +192,7 @@ def Create_E_Document(diction):
new_diction['secret_key_open'] = str(secret_key)
new_diction['email_destinataire'] = str(diction['email_destinataire'])
new_diction['source_document'] = str(diction['source_document'])
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['update_by'] = str(my_partner['_id'])
new_diction['creation_by'] = str(my_partner['_id'])
@ -322,7 +322,7 @@ def Create_E_Invoice(diction):
new_diction['secret_key_open'] = str(secret_key)
new_diction['email_destinataire'] = str(diction['email_destinataire'])
new_diction['source_document'] = str(diction['source_document'])
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['update_by'] = str(my_partner['_id'])
new_diction['creation_by'] = str(my_partner['_id'])
@ -467,7 +467,7 @@ def Get_Given_E_Document_Not_Signed_No_Token(diction):
update_data = {}
update_data['secret_key_signature'] = secret_key_for_sign
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(diction['user_email'])
ret_val2 = MYSY_GV.dbname['e_document_signe'].find_one_and_update(qry,

View File

@ -56,7 +56,7 @@ def correct_fr_word(word):
print(" Fonction : correct_fr_word : '"+word+"' =======> "+MYSY_GV.spell_fr(word))
mydata['mot'] = str(word)
mydata['mot_corrected'] = str(MYSY_GV.spell_fr(word))
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['treated'] = 0
coll_name = MYSY_GV.dbname['correction_ortho']
ret_val_tmp = coll_name.insert_one(mydata)

View File

@ -563,7 +563,7 @@ def AddStagiairetoClass(diction):
if ("email" in diction.keys()):
if diction['email']:
mydata['email'] = str(diction['email']).strip()
mydata['email'] = str(diction['email']).strip().lower()
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str(diction['email']).strip() ) ):
mycommon.myprint(
@ -571,6 +571,8 @@ def AddStagiairetoClass(diction):
return False, " l'adresse email -"+str(diction['email']).strip() +"- est invalide"
if ("modefinancement" in diction.keys() and diction['modefinancement']):
mydata['modefinancement'] = str(diction['modefinancement']).strip()
else:
@ -582,7 +584,7 @@ def AddStagiairetoClass(diction):
mydata['opco'] = ""
mydata['class_id'] = str(is_myclass_valide_data['_id'])
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['date_creation'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['update_by'] = str(connected_user_id)
mydata['creation_by'] = str(connected_user_id)
@ -649,10 +651,10 @@ def AddStagiairetoClass(diction):
## 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']), }
qry_count = {'email':str(mydata['email']).lower(), 'session_id':str( mydata['session_id']), }
#print(" ### qry_count = ", qry_count)
tmp = coll_inscription.count_documents({'email':str(mydata['email']),
tmp = coll_inscription.count_documents({'email':str(mydata['email']).lower(),
'session_id':str( mydata['session_id']),
})
@ -661,8 +663,8 @@ def AddStagiairetoClass(diction):
str(inspect.stack()[0][3]) + " - L'adresse email "+str(mydata['email'])+" est deja inscrite à la session du "
" "+str( mydata['session_id'])+ " ")
return False, "Impossible de créer le stagiaire. l'adresse email "+str(mydata['email'])\
+" est deja inscrite à cette session de formation "
return False, " L'adresse email "+str(mydata['email'])\
+" est deja inscrite à cette formation "
"""
@ -670,7 +672,7 @@ def AddStagiairetoClass(diction):
"""
#print(" #### mydata before inscr = ", mydata)
ret_val = MYSY_GV.dbname['inscription'].find_one_and_update(
{'session_id': str(mydata['session_id']), 'email': str(mydata['email']),},
{'session_id': str(mydata['session_id']), 'email': str(mydata['email']).lower(),},
{"$set": mydata},
return_document=ReturnDocument.AFTER,
upsert=True,
@ -1394,7 +1396,7 @@ def AddStagiairetoClass_from_marketplace(diction):
if ("email" in diction.keys()):
if diction['email']:
mydata['email'] = str(diction['email']).strip()
mydata['email'] = str(diction['email']).strip().lower()
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str(diction['email']).strip())):
mycommon.myprint(
@ -1413,7 +1415,7 @@ def AddStagiairetoClass_from_marketplace(diction):
mydata['opco'] = ""
mydata['class_id'] = str(is_myclass_valide_data['_id'])
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['date_creation'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
mydata['update_by'] = str(connected_user_id)
mydata['creation_by'] = str(connected_user_id)
@ -1476,10 +1478,10 @@ def AddStagiairetoClass_from_marketplace(diction):
## 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']), }
qry_count = {'email': str(mydata['email']).lower(), 'session_id': str(mydata['session_id']), }
# print(" ### qry_count = ", qry_count)
tmp = coll_inscription.count_documents({'email': str(mydata['email']),
tmp = coll_inscription.count_documents({'email': str(mydata['email']).lower(),
'session_id': str(mydata['session_id']),
})
@ -1497,7 +1499,7 @@ def AddStagiairetoClass_from_marketplace(diction):
"""
# print(" #### mydata before inscr = ", mydata)
ret_val = MYSY_GV.dbname['inscription'].find_one_and_update(
{'session_id': str(mydata['session_id']), 'email': str(mydata['email']), },
{'session_id': str(mydata['session_id']), 'email': str(mydata['email']).lower(), },
{"$set": mydata},
return_document=ReturnDocument.AFTER,
upsert=True,
@ -1924,12 +1926,31 @@ def UpdateStagiairetoClass(diction):
myemail = ""
if ("email" in diction.keys()):
if diction['email']:
myemail = str(diction['email']).strip()
myemail = str(diction['email']).strip().lower()
if( mycommon.isEmailValide(myemail)) :
mydata['email'] = str(diction['email']).strip()
mydata['email'] = str(diction['email']).strip().lower()
else:
mycommon.myprint(str(inspect.stack()[0][3]) + " - l'adresse email "+str(myemail)+" n'est pas valide")
return False, "- l'adresse email "+str(myemail)+" n'est pas valide "
mycommon.myprint(str(inspect.stack()[0][3]) + " - l'adresse email "+str(diction['email'])+" n'est pas valide")
return False, " L'adresse email "+str(diction['email'])+" n'est pas valide "
"""
Verifier que cet email n'est pas déjà utilisé par un autre inscrit de la meme session
"""
print(" quryy nb_mail_inscrit_session = ", {'email':str(myemail),
'session_id':str(diction['session_id']),
'_id':{'$ne':ObjectId(diction['_id'])},
'partner_owner_recid':my_partner['recid']})
nb_mail_inscrit_session = MYSY_GV.dbname['inscription'].count_documents({'email':str(myemail),
'session_id':str(diction['session_id']),
'_id':{'$ne':ObjectId(diction['_id'])},
'partner_owner_recid':my_partner['recid']})
if( nb_mail_inscrit_session > 0 ):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Un utilisateur avec cette adresse e-mail est déjà inscrit à cette formation.")
return False, " Un utilisateur avec cette adresse e-mail est déjà inscrit à cette formation. "
object_id = ""
@ -2335,7 +2356,7 @@ def UpdateStagiairetoClass(diction):
mydata['inscription_preinscription_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
message_for_historic = "Préinscription "
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
ret_val2 = coll_inscription.find_one_and_update(query_key,
@ -3821,7 +3842,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
mydata['employeur'] = str(df['employeur'].values[n])
mydata['telephone'] = str(df['telephone'].values[n])
mydata['email'] = str(df['email'].values[n]).strip()
mydata['email'] = str(df['email'].values[n]).strip().lower()
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str(df['email'].values[n]).strip() )):
mycommon.myprint(
@ -4206,7 +4227,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
mydata['employeur'] = str(df['employeur'].values[n])
mydata['telephone'] = str(df['telephone'].values[n])
mydata['email'] = str(df['email'].values[n]).strip()
mydata['email'] = str(df['email'].values[n]).strip().lower()
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str(df['email'].values[n]).strip() )):
mycommon.myprint(
@ -4410,7 +4431,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
mydata['price'] = local_price
## Verifier que le stagiaire n'est pas deja inscrit à cette formation.
qry_count = {'email': str(mydata['email']), 'session_id': str(session_id), 'partner_owner_recid':str(partner_recid) }
qry_count = {'email': str(mydata['email']).lower(), 'session_id': str(session_id), 'partner_owner_recid':str(partner_recid) }
qry_count_result = MYSY_GV.dbname['inscription'].count_documents(qry_count)
if( qry_count_result > 0 ):
@ -4621,7 +4642,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
mydata['employeur'] = str(df['employeur'].values[n]).strip()
mydata['telephone'] = str(df['telephone'].values[n]).strip()
mydata['email'] = str(df['email'].values[n]).strip().strip()
mydata['email'] = str(df['email'].values[n]).strip().strip().lower()
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str(df['email'].values[n]).strip() )):
mycommon.myprint(
@ -5045,7 +5066,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
mydata['employeur'] = str(df['employeur'].values[n])
mydata['telephone'] = str(df['telephone'].values[n])
mydata['email'] = str(df['email'].values[n]).strip()
mydata['email'] = str(df['email'].values[n]).strip().lower()
print(" contole du mail = ", mydata['email'])
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'
if (not re.fullmatch(regex, str( mydata['email']) )):
@ -7281,7 +7302,7 @@ def Init_AcceptAttendeeInscription_For_Initial_Formation(diction):
new_data['inscription_id'] = str(diction['inscription_id'])
new_data['class_id'] = str(diction['class_id'])
new_data['class_eu_id'] = str(local_val['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['valide'] = "1"
@ -7317,7 +7338,7 @@ def Init_AcceptAttendeeInscription_For_Initial_Formation(diction):
new_data['inscription_id'] = str(diction['inscription_id'])
new_data['class_id'] = str(diction['class_id'])
new_data['class_eu_id'] = str(local_val['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['valide'] = "1"
@ -7355,7 +7376,7 @@ def Init_AcceptAttendeeInscription_For_Initial_Formation(diction):
new_data['class_id'] = str(diction['class_id'])
new_data['class_eu_id'] = str(val['class_ue_id'])
new_data['type_evaluation_id'] = str(val['type_evaluation_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['valide'] = "1"
@ -7549,7 +7570,7 @@ def Update_AcceptAttendeeInscription_For_Initial_Formation(diction):
new_data['class_id'] = str(diction['class_id'])
new_data['class_eu_id'] = str(New_retVal['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['valide'] = "1"
@ -7584,7 +7605,7 @@ def Update_AcceptAttendeeInscription_For_Initial_Formation(diction):
new_data['class_eu_id'] = str(val['class_ue_id'])
new_data['type_evaluation_id'] = str(val['type_evaluation_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['valide'] = "1"
@ -9711,7 +9732,7 @@ def Inscription_Recyclage_Management_Done(diction):
for inscription in tab_inscriptions_ids_splited_obj:
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['recyclage_managed'] = "1"
@ -10188,7 +10209,7 @@ def UpdateStagiairetoClass_Tuteurs(diction):
my_id = str(diction['_id'])
del data_update['token']
del data_update['_id']
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
@ -10836,8 +10857,8 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
if(len(tab_emails_destinataire) <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Aucune adresse email n'a pas été fournie. ")
return False, " Aucune adresse email n'a pas été fournie. "
3]) + " Aucune adresse email n'a pas été fournie.02 ")
return False, " Aucune adresse email n'a pas été fournie. 02"
#print(" ### tab_emails_destinataire = ", tab_emails_destinataire)
@ -11452,7 +11473,7 @@ def Sent_Convention_Individuelle_Stagiaire_By_Email(tab_files, Folder, diction):
return local_status, tab_apprenant_contact
tmp_tab = []
# print(" ### tab_apprenant_contact = ", tab_apprenant_contact)
#print(" ### tab_apprenant_contact = ", tab_apprenant_contact)
for tmp in tab_apprenant_contact:
if ("email" in tmp.keys()):
@ -11461,8 +11482,8 @@ def Sent_Convention_Individuelle_Stagiaire_By_Email(tab_files, Folder, diction):
if (len(tab_emails_destinataire) <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Aucune adresse email n'a pas été fournie. ")
return False, " Aucune adresse email n'a pas été fournie. "
3]) + " Aucune adresse email n'a pas été fournie. 01 ")
return False, " Aucune adresse email n'a pas été fournie. 01 "
# print(" ### tab_emails_destinataire = ", tab_emails_destinataire)
@ -13483,6 +13504,10 @@ def Get_Stagiaire_Communication_List_Email_OLD(diction):
return False, " Impossible de récupérer la liste des emails de communication "
"""
On recupere l'adresse email de communication du tuteur +
L'adresse email de l'inscrit
"""
def Get_Stagiaire_Communication_List_Email(diction):
try:
diction = mycommon.strip_dictionary(diction)
@ -13536,16 +13561,24 @@ def Get_Stagiaire_Communication_List_Email(diction):
RetObject = []
val_tmp = 0
collected_email = []
is_inscription_data = MYSY_GV.dbname['inscription'].find_one(
{'_id': ObjectId(str(diction['inscription_id'])),
'partner_owner_recid': str(my_partner['recid'])})
if ("email" in is_inscription_data.keys()):
node = {"email": str(is_inscription_data['email'])}
RetObject.append(mycommon.JSONEncoder().encode(node))
if( str(is_inscription_data['email']) not in collected_email):
collected_email.append(str(is_inscription_data['email']))
node = {"email": str(is_inscription_data['email'])}
RetObject.append(mycommon.JSONEncoder().encode(node))
"""
Recup du mail du tuteur
"""
tab_email = []
for retval in MYSY_GV.dbname['ressource_humaine'].find({'partner_recid': my_partner['recid'],
'tab_inscription_id.inscription_id':str(diction['inscription_id']),
'tab_inscription_id.include_com': "1" } ):
@ -13555,9 +13588,13 @@ def Get_Stagiaire_Communication_List_Email(diction):
if(str(insc_tutore_data['inscription_id']) == str(diction['inscription_id']) and
str(insc_tutore_data['include_com']) == "1"):
node = {"email": str(retval['email'])}
RetObject.append(mycommon.JSONEncoder().encode(node))
if (str(is_inscription_data['email']) not in collected_email):
collected_email.append(str(is_inscription_data['email']))
node = {"email": str(retval['email'])}
RetObject.append(mycommon.JSONEncoder().encode(node))
print(" ### collected_email = ", collected_email)
print(" ### RetObject = ", RetObject)
return True, RetObject
@ -13822,13 +13859,61 @@ def Get_Statgiaire_Communication_Contact(diction):
if (local_status is not True):
return local_status, my_partner
RetObject = []
val_tmp = 0
stagiaire_data = MYSY_GV.dbname['inscription'].find_one(
{'_id': ObjectId(str(diction['_id'])),
'partner_owner_recid': str(my_partner['recid'])})
# Ajout des datas du stagiaire
new_node = {}
if ("nom" in stagiaire_data.keys()):
new_node['nom'] = stagiaire_data['nom']
else:
new_node['nom'] = ""
if ("prenom" in stagiaire_data.keys()):
new_node['prenom'] = stagiaire_data['prenom']
else:
new_node['prenom'] = ""
if ("adresse" in stagiaire_data.keys()):
new_node['adresse'] = stagiaire_data['adresse']
else:
new_node['adresse'] = ""
if ("code_postal" in stagiaire_data.keys()):
new_node['code_postal'] = stagiaire_data['code_postal']
else:
new_node['code_postal'] = ""
if ("ville" in stagiaire_data.keys()):
new_node['ville'] = stagiaire_data['ville']
else:
new_node['ville'] = ""
if ("pays" in stagiaire_data.keys()):
new_node['pays'] = stagiaire_data['pays']
else:
new_node['pays'] = ""
if ("email" in stagiaire_data.keys()):
new_node['email'] = stagiaire_data['email']
else:
new_node['email'] = ""
if ("telephone" in stagiaire_data.keys()):
new_node['telephone'] = stagiaire_data['telephone']
else:
new_node['telephone'] = ""
RetObject.append(new_node)
for retval in MYSY_GV.dbname['ressource_humaine'].find({'partner_recid': my_partner['recid'],
'tab_inscription_id.inscription_id':str(diction['_id'])} ):
'tab_inscription_id.inscription_id':str(diction['_id']), 'tab_inscription_id.include_com':'1'} ):
node_rh_tuteur = {}
node_rh_tuteur['_id'] = str(retval['_id'])
@ -13892,8 +13977,6 @@ def Get_Statgiaire_Communication_Contact(diction):
else:
node_rh_tuteur['date_naissance'] = ""
for insc_tutore_data in retval["tab_inscription_id"]:
if(str(insc_tutore_data['inscription_id']) == str(diction['_id']) ):
@ -16059,7 +16142,7 @@ def Update_Emargement_QR_Code_From_Inscription_No_Token(file_img=None, Folder=No
# Mettre à jour de l'emargement
data_update = {}
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
data_update['date_update'] = now
data_update['update_date'] = now
data_update['statut'] = "2"
data_update['date_emargement'] = now
data_update['update_by'] = str(my_partner['_id'])
@ -16211,7 +16294,7 @@ def Add_Update_Inscription_Split_Invoice(diction):
data_update = {}
data_update['update_by'] = str(my_partner['_id'])
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['invoice_split'] = node_invoice_split
@ -16482,7 +16565,7 @@ def Update_LMS_Inscrition_End_Date(diction):
now = str(datetime.now())
update_data = {}
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update_data['lms_account_expiration_date'] = str(end_date)
@ -16558,7 +16641,7 @@ def archive_stagiaire(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '1'
@ -16651,7 +16734,7 @@ def unarchive_stagiaire(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '0'

View File

@ -188,7 +188,7 @@ def Cron_Send_Survey():
local_status, local_retval = survey_mgt.Automatic_Send_Survey_TabIds(local_dicton)
#data['date_update'] = str(datetime.now())
#data['update_date'] = str(datetime.now())
survey_update_data = {}
sending_status = "0"
@ -1026,7 +1026,7 @@ def Invoice_Data_From_Tab(diction):
partner_invoice_header_data['valide'] = "1"
partner_invoice_header_data['locked'] = "0"
partner_invoice_header_data['partner_owner_recid'] = str(my_partner['recid'])
partner_invoice_header_data['date_update'] = str(datetime.now())
partner_invoice_header_data['update_date'] = str(datetime.now())
ref_interne_facture = retval_sequence_invoice['prefixe'] + str(
current_seq_value)
@ -3928,7 +3928,7 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
On met à jour l'email avec le statut d'envoie de l'email
"""
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['sent'] = str(datetime.now())
new_data['error_message'] = str(error_send_mail)
@ -3947,7 +3947,7 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
On met à jour l'email avec le statut d'envoie de l'email
"""
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['sent'] = str(datetime.now())
error_node = {}
@ -4013,7 +4013,7 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
On met à jour l'email avec le statut d'envoie de l'email
"""
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['sent'] = str(datetime.now())
new_data['error_message'] = str(error_send_mail)
@ -4032,7 +4032,7 @@ def Cron_Send_Mail_Queue_Message_With_Filter(diction):
On met à jour l'email avec le statut d'envoie de l'email
"""
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['sent'] = str(datetime.now())
new_data['statut'] = "2"
new_data['sent_message'] = str(val)

View File

@ -1970,7 +1970,7 @@ def Cron_Init_Attestation_Formation_With_Template(diction):
if( is_init_attestation_exist_count == 0 ):
# Aucune attestation (ni initialisée, ni envoyé), on peut donc initialiser l'attestation
new_attestation_data = {}
new_attestation_data['date_update'] = str(datetime.now())
new_attestation_data['update_date'] = str(datetime.now())
new_attestation_data['update_by'] = str(my_partner['_id'])
new_attestation_data['partner_owner_recid'] = str(my_partner['recid'])
new_attestation_data['valide'] = "1"
@ -2119,7 +2119,7 @@ def Cron_Send_Attestation_From_Session_By_Email_for_not_sent(Folder, diction):
# Mettre à jour avec la date d'envoi de l'attestation
updata_data = {}
updata_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_by'] = str(my_partner['recid'])
updata_data['statut'] = "1"
updata_data['date_envoie'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
@ -2956,7 +2956,7 @@ def Cron_Init_Emargement_By_Date_With_Template(diction):
new_my_local_data['prenom'] = my_inscription['prenom']
new_my_local_data['session_id'] = my_inscription['session_id']
new_my_local_data['class_internal_url'] = my_inscription['class_internal_url']
new_my_local_data['date_update'] = str(datetime.now())
new_my_local_data['update_date'] = str(datetime.now())
new_my_local_data['is_present'] = False
new_my_local_data['matin'] = False
new_my_local_data['apresmidi'] = False
@ -2964,7 +2964,7 @@ def Cron_Init_Emargement_By_Date_With_Template(diction):
new_my_local_data['statut'] = "0"
new_my_local_data['date_envoi'] = ""
new_my_local_data['date_update'] = str(datetime.now())
new_my_local_data['update_date'] = str(datetime.now())
new_my_local_data['update_by'] = str(my_partner['recid'])
new_my_local_data['valide'] = "1"
new_my_local_data['locked'] = "0"

File diff suppressed because one or more lines are too long

View File

@ -446,7 +446,7 @@ def Add_Update_SessionFormation(diction):
mydata[str(val)] = diction[str(val)]
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['valide'] = "1"
@ -828,7 +828,7 @@ def Update_SessionFormation_Only_Step(diction):
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['valide'] = "1"
new_data['session_etape'] = str(diction['session_etape'])
@ -5792,6 +5792,8 @@ def Duplicate_List_Session_Formation(diction):
if ("relance_automation" in duplicated_session):
del duplicated_session['relance_automation']
if ("archive" in duplicated_session):
del duplicated_session['archive']
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
@ -8370,7 +8372,7 @@ def Prepare_and_Send_Attestation_From_Session_By_PDF( diction):
list_file_name_to_zip.append(str(local_full_file_name))
# Mettre à jour avec la date d'envoi de l'attestation
updata_data = {}
updata_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_by'] = str(my_partner['recid'])
updata_data['statut'] = "1"
updata_data['date_envoie'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
@ -8753,7 +8755,7 @@ def Create_Attestation_By_Stagiaire_PDF(diction):
# Mettre à jour avec la date d'envoi de l'attestation
updata_data = {}
updata_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_by'] = str(my_partner['recid'])
updata_data['statut'] = "1"
updata_data['date_envoie'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
@ -9858,7 +9860,7 @@ def Prepare_and_Send_Attestation_From_Session_By_Email(tab_files, Folder, dictio
# Mettre à jour avec la date d'envoi de l'attestation
updata_data = {}
updata_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
updata_data['update_by'] = str(my_partner['recid'])
updata_data['statut'] = "1"
updata_data['date_envoie'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
@ -10767,7 +10769,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid':str(my_partner['recid']),
@ -11159,7 +11161,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid':str(my_partner['recid']),
@ -11541,7 +11543,7 @@ def Invoice_Partner_From_Session( diction):
partner_invoice_header_data['valide'] = "1"
partner_invoice_header_data['locked'] = "0"
partner_invoice_header_data['partner_owner_recid'] = str(my_partner['recid'])
partner_invoice_header_data['date_update'] = str(datetime.now())
partner_invoice_header_data['update_date'] = str(datetime.now())
print(" #### partner_invoice_header_data = ", partner_invoice_header_data)
@ -12260,7 +12262,8 @@ def Invoice_Inscrption_With_Split_Session_By_Inscription_Id( tab_files, diction)
no_split_tab_inscription_ids = ""
for tmp in tab_inscrit_for_NOT_splited_invoice:
if( "inscription_id" in tmp.keys() ):
local_tmp_tab.append(tmp['inscription_id'])
if( tmp['inscription_id']):
local_tmp_tab.append(tmp['inscription_id'])
no_split_tab_inscription_ids = ",".join(local_tmp_tab)
@ -12578,6 +12581,9 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
{'partner_owner_recid': str(my_partner['recid']),
'email': str(local_inscription_no_client['email'])})
print(" ### sssss = ", {'partner_owner_recid': str(my_partner['recid']),
'email': str(local_inscription_no_client['email'])})
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
if (is_inscription_no_client_exist > 1):
mycommon.myprint(" Facturation : L'adresse email : " + str(
@ -12696,6 +12702,13 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
new_client_data['is_client'] = "1"
new_client_data['is_company'] = "0"
inscription_no_client_valide_no_locked_count = MYSY_GV.dbname['partner_client'].count_documents(
{'partner_owner_recid': str(my_partner['recid']),
'email': str(local_inscription_no_client['email']),
'valide': "1",
'locked': '0'})
new_client_status, new_client_retval = partner_client.Add_Partner_Client(new_client_data)
if (new_client_status is False):
mycommon.myprint(" Facturation : Impossible de créer un client associé à l'adresse email : " + str(
@ -12811,7 +12824,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),
@ -12879,7 +12892,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),
@ -13046,8 +13059,8 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
print(" ### la liste des liste_client_rattachement_id (client à facturer) : AVANT GESTION inscriptions SANS CLIENT = ", liste_client_rattachement_id)
"""
Gestion des inscriptions n'ayant pas de client à facturer ID
"""
Gestion des inscriptions n'ayant pas de client à facturer ID
"""
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find(
{"$or": [{'session_id': str(diction['session_id']),
'status': '1',
@ -13075,7 +13088,8 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
si non, créer le client
"""
print(" ### sdsd = ", {'partner_owner_recid': str(my_partner['recid']),
'email': str(local_inscription_no_client['email'])})
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
{'partner_owner_recid': str(my_partner['recid']),
@ -13328,7 +13342,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),
@ -13518,7 +13532,7 @@ def Prepare_and_Send_SPLITED_Facture_From_Session_By_Inscription_Id(tab_files, F
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
update_data['invoiced_date'] = now
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),
@ -13970,7 +13984,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
partner_invoice_header_data['valide'] = "1"
partner_invoice_header_data['locked'] = "0"
partner_invoice_header_data['partner_owner_recid'] = str(my_partner['recid'])
partner_invoice_header_data['date_update'] = str(datetime.now())
partner_invoice_header_data['update_date'] = str(datetime.now())
print(" #### partner_invoice_header_data = ", partner_invoice_header_data)
@ -14577,7 +14591,7 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
partner_invoice_header_data['valide'] = "1"
partner_invoice_header_data['locked'] = "0"
partner_invoice_header_data['partner_owner_recid'] = str(my_partner['recid'])
partner_invoice_header_data['date_update'] = str(datetime.now())
partner_invoice_header_data['update_date'] = str(datetime.now())
print(" #### partner_invoice_header_data = ", partner_invoice_header_data)
@ -14757,7 +14771,7 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = ",".join(tab_invoice)
update_data['invoiced_date'] = ",".join(tab_date_invoice)
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_one({'partner_owner_recid': str(my_partner['recid']),
@ -15022,7 +15036,7 @@ def Invoice_Create_Secure_E_Document(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
@ -15192,7 +15206,7 @@ def Invoice_Create_Secure_E_Document(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -15486,14 +15500,14 @@ def Audit_Session_Action_Inscrit(diction):
email_exist = 1
sub_node['_id'] = val['_id']
sub_node['email_inscrit'] = val['local_target_collection_name']
sub_node['date_update'] = val['date_update']
sub_node['update_date'] = val['update_date']
sub_node['local_update_by_email'] = val['local_update_by_email']
sub_node['statut'] = "1"
if( email_exist == 0 ):
sub_node['email_inscrit'] = local_email
sub_node['date_update'] = ""
sub_node['update_date'] = ""
sub_node['local_update_by_email'] = ""
sub_node['statut'] = "0"
@ -15713,7 +15727,7 @@ def Prepare_request_For_Preinsciption_Creation_By_Customer(diction):
"""
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['max_presinscrit'] = str(diction['max_presinscrit'])
update_data['session_id'] = str(diction['session_id'])
@ -15903,14 +15917,16 @@ def Send_Email_request_presinscription_data_validation(diction):
if (local_stpm_status is False):
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
msg.attach(html_mime)
if (str(partner_own_smtp_value) == "1"):
msg['From'] = partner_SMTP_COUNT_From_User
else:
if (company_name):
msg['From'] = str(company_name) + " <" + str(partner_SMTP_COUNT_From_User) + ">"
else:
msg['From'] = str(partner_SMTP_COUNT_From_User)
msg['From'] = str(partner_SMTP_COUNT_From_User)
msg['Bcc'] = 'contact@mysy-training.com'
@ -15929,7 +15945,7 @@ def Send_Email_request_presinscription_data_validation(diction):
val = smtpserver.send_message(msg)
smtpserver.close()
print(" Email envoyé " + str(val))
print(" Email envoyé icii" + str(val))
"""
Gestion des emails via mail_queu et internal email
@ -16164,7 +16180,7 @@ def Client_Update_Liste_Attendee_No_Token(diction):
# Verifier qu'on mettre à jour tous les participants
if (str(val['_id']) != "new" and len(str(val['_id'])) > 5):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = "Client"
update_data['nom'] = str(val['nom'])
@ -16439,7 +16455,7 @@ def Add_SessionFormation_From_Quotation_Line(diction):
mydata['date_debut_inscription'] = str(mydata['date_debut'])
mydata['date_fin_inscription'] = str(mydata['date_fin'])
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
@ -17242,7 +17258,7 @@ def archive_session(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '1'
@ -17340,7 +17356,7 @@ def unarchive_session(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '0'
@ -17559,7 +17575,7 @@ def Add_Update_UE_To_Session(diction):
# l'UE n'existe pas pour cette session, on fait une creation
# Il s'agit de la creation d'une competence
new_data = {}
new_data['date_update'] = str(now)
new_data['update_date'] = str(now)
new_data['valide'] = "1"
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"

View File

@ -343,7 +343,7 @@ def Add_Session_Sequence(diction):
# Programmation de la nouvelle
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['session_formation_sequence_id'] = str(new_session_formation_sequence_id)
@ -685,7 +685,7 @@ def Add_Session_Sequence_Return_New_Seq_Data(diction):
if (ue_planif_line_id):
# Programmation de la nouvelle
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['session_formation_sequence_id'] = str(new_session_formation_sequence_id)
@ -1596,7 +1596,7 @@ def Update_Session_Sequence(diction):
update_data['valide'] = "1"
update_data['locked'] = "0"
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
@ -1627,7 +1627,7 @@ def Update_Session_Sequence(diction):
if( new_unite_enseignement_planif_id != old_unite_enseignement_planif_id ):
# Deprogrammation de l'ancien
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['session_formation_sequence_id'] = ""
@ -1642,7 +1642,7 @@ def Update_Session_Sequence(diction):
# Programmation de la nouvelle
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['session_formation_sequence_id'] = str(diction['_id'])
@ -2213,7 +2213,7 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
my_data['update_by'] = str(my_partner_data['_id'])
inserted_data = MYSY_GV.dbname['session_formation_sequence_affectation'].insert_one(my_data)
@ -2390,7 +2390,7 @@ def Add_Note_Evaluation_Affectation_Ressource_Poste(diction):
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
my_data['update_by'] = str(my_partner_data['_id'])
inserted_data = MYSY_GV.dbname['note_evaluation_affectation_ressource'].insert_one(my_data)
@ -2554,7 +2554,7 @@ def Update_Note_Evaluation_Affectation_Ressource_Poste(diction):
update_data['valide'] = "1"
update_data['locked'] = "0"
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner_data['_id'])
inserted_data = MYSY_GV.dbname['note_evaluation_affectation_ressource'].find_one_and_update(
@ -2810,7 +2810,7 @@ def Update_Sequence_Affectation_Ressource_Poste(diction):
update_data['valide'] = "1"
update_data['locked'] = "0"
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner_data['_id'])
inserted_data = MYSY_GV.dbname['session_formation_sequence_affectation'].find_one_and_update(
@ -4215,7 +4215,7 @@ def Decale_Session_Sequence_X_days(diction):
new_data = {}
new_data['sequence_start'] = str(new_current_start.strftime("%d/%m/%Y %H:%M"))
new_data['sequence_end'] = str(new_current_end.strftime("%d/%m/%Y %H:%M"))
new_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data['update_by'] = str(my_partner['recid'])
#print(" ### new_data = ", new_data)
@ -4249,7 +4249,7 @@ def Decale_Session_Sequence_X_days(diction):
new_data_agenda = {}
new_data_agenda['event_start'] = str(new_current_start.strftime("%Y-%m-%dT%H:%M"))
new_data_agenda['event_end'] = str(new_current_end.strftime("%Y-%m-%dT%H:%M"))
new_data_agenda['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data_agenda['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data_agenda['update_by'] = str(my_partner['recid'])
@ -4308,7 +4308,7 @@ def Decale_Session_Sequence_X_days(diction):
new_data = {}
new_data['sequence_start'] = str(new_current_start.strftime("%d/%m/%Y %H:%M"))
new_data['sequence_end'] = str(new_current_end.strftime("%d/%m/%Y %H:%M"))
new_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data['update_by'] = str(my_partner['recid'])
#print(" ### new_data MINUS = ", new_data)
@ -4339,7 +4339,7 @@ def Decale_Session_Sequence_X_days(diction):
new_data_agenda = {}
new_data_agenda['event_start'] = str(new_current_start.strftime("%Y-%m-%dT%H:%M"))
new_data_agenda['event_end'] = str(new_current_end.strftime("%Y-%m-%dT%H:%M"))
new_data_agenda['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data_agenda['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
new_data_agenda['update_by'] = str(my_partner['recid'])
@ -4356,7 +4356,7 @@ def Decale_Session_Sequence_X_days(diction):
new_data = {}
new_data['date_debut'] = str(session_new_start_date.strftime("%d/%m/%Y"))
new_data['date_fin'] = str(session_new_end_date.strftime("%d/%m/%Y"))
new_data['date_update'] = datetime.now()
new_data['update_date'] = datetime.now()
new_data['update_by'] = str(my_partner['recid'])
@ -4374,7 +4374,7 @@ def Decale_Session_Sequence_X_days(diction):
new_inscription_data = {}
new_inscription_data['date_au'] = str(session_new_start_date.strftime("%d/%m/%Y"))
new_inscription_data['date_du'] = str(session_new_end_date.strftime("%d/%m/%Y"))
new_inscription_data['date_update'] = datetime.now()
new_inscription_data['update_date'] = datetime.now()
new_inscription_data['update_by'] = str(my_partner['recid'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),

743
activite_pedagogique.py Normal file
View File

@ -0,0 +1,743 @@
"""
Ce document permet de gerer les activite_pedagogique
- code
- description
- commentaire
"""
from operator import itemgetter
import bson
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
import prj_common as mycommon
import secrets
import inspect
import sys, os
import csv
import pandas as pd
from pymongo import ReturnDocument
import GlobalVariable as MYSY_GV
from math import isnan
import GlobalVariable as MYSY_GV
import ela_index_bdd_classes as eibdd
import email_mgt as email
import jinja2
from flask import send_file
from xhtml2pdf import pisa
from email.message import EmailMessage
from email.mime.text import MIMEText
from email import encoders
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
"""
Fonction d'ajout d'une activite pedagogique
"""
def Add_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'commentaire', 'code',
'moyen_ressource', 'resultat', 'niveau_autonomie',
'aide', 'contraintes', 'divers', ]
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', 'code' ]
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 que ce code de l'activité n'est pas déjà utilisé
"""
is_activite_pedagogique_code_used = MYSY_GV.dbname['activite_pedagogique'].count_documents({'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_activite_pedagogique_code_used != 0 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code "+str(diction['code'])+" est déjà utilisé ")
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
mydata = {}
mydata = diction
del mydata['token']
# Initialisation des champs non envoyés à vide
for val in field_list:
if val not in diction.keys():
mydata[str(val)] = ""
mydata['creation_date'] = str(datetime.now())
mydata['creation_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
mydata['locked'] = "0"
mydata['tab_tache_pedagogique'] = []
inserted_id = MYSY_GV.dbname['activite_pedagogique'].insert_one(mydata).inserted_id
if (not inserted_id):
mycommon.myprint(" Impossible de créer l'activité pédagogique (2) ")
return False, " Impossible de créer l'activité pédagogique (2) "
return True, " L'activité pédagogique a été correctement ajoutée "
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 créer l'activité pédagogique "
"""
Fonction de mise à jour d'une activité pédagogique
"""
def Update_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'activite_pedagogique_id', 'commentaire', 'code',
'moyen_ressource', 'resultat', 'niveau_autonomie',
'aide', 'contraintes', 'divers'
]
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', 'activite_pedagogique_id', 'code']
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 que le code de compétence n'est pas utilisé par une autre compétence autre que celle ci
"""
is_competence_code_used = MYSY_GV.dbname['activite_pedagogique'].count_documents({'code': str(diction['code']),
'valide': '1',
'_id':{'$ne':ObjectId(str(diction['activite_pedagogique_id']))},
'partner_owner_recid': str(
my_partner['recid'])})
if (is_competence_code_used != 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code " + str(diction['code']) + " est déjà utilisé ")
return False, " Le code " + str(diction['code']) + " est déjà utilisé "
# Verifier que la compétence existe et est valide
is_valide_activite_pedagogique_id = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_activite_pedagogique_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'activité est invalide ")
return False, " L'identifiant de l'activité est invalide "
mydata = {}
mydata = diction
del mydata['token']
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['activite_pedagogique'].find_one_and_update(
{'_id':ObjectId(str(diction['activite_pedagogique_id'])),
'partner_owner_recid':str(my_partner['recid'])},
{"$set": mydata},
upsert=False,
return_document=ReturnDocument.AFTER
)
if ("_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour l'activité pédagogique (2) ")
return False, " Impossible de mettre à jour l'activité pédagogique (2) "
return True, " L'activité pédagogique a été correctement mise à 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 de mettre à jour l'activité pédagogique "
"""
Recuperer la liste des activite pedagogique d'un partenaire, sans filtres
"""
def Get_activite_pedagogique_no_filter(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'est pas autorisé")
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 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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
for New_retVal in MYSY_GV.dbname['activite_pedagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
user = New_retVal
if( "code" not in user.keys() ):
user["code"] = "--"
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 activités pédagogiques "
"""
Recuperer les données d'une activite pedagogique donnée
"""
def Get_Given_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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'est pas autorisé")
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 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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', '_id':ObjectId(str(diction['_id']))}
for New_retVal in MYSY_GV.dbname['activite_pedagogique'].find(qry):
user = New_retVal
if( "code" not in user.keys() ):
user["code"] = "--"
tab_tache_pedagogique_with_code = []
if( "tab_tache_pedagogique" in New_retVal.keys() ):
for tache_pedago in New_retVal['tab_tache_pedagogique']:
tache_pedago_data = MYSY_GV.dbname['tache_pedagogique'].find_one({'_id':ObjectId(str(tache_pedago['_id'])), 'valide':'1'}, {'_id':1, 'code':1, 'description':1, })
if("rang" in tache_pedago.keys()):
tache_pedago_data['rang'] = str(tache_pedago['rang'])
else:
tache_pedago_data['rang'] = "99"
if ("obligatoire" in tache_pedago.keys()):
tache_pedago_data['obligatoire'] = str(tache_pedago['obligatoire'])
else:
tache_pedago_data['obligatoire'] = "0"
tab_tache_pedagogique_with_code.append(tache_pedago_data)
ss = sorted(tab_tache_pedagogique_with_code, key=itemgetter('rang'))
user['tab_tache_pedagogique_with_code'] = tab_tache_pedagogique_with_code
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
print("user = ", user)
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 activités pédagogiques "
"""
Suppression d'une activite pedagogique
"""
def Delete_Given_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'activite_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'activite_pedagogique_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
qry = {'_id':ObjectId(str(diction['activite_pedagogique_id'])), 'partner_owner_recid':str(my_partner['recid'])}
ret_del_competence = MYSY_GV.dbname['activite_pedagogique'].delete_many(qry)
return True, "L'activité pédagogique 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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer l'activité pédagogique "
"""
Ajouter une liste de tache pédagogique à l'activité
"""
def Add_Update_tab_Tache_To_Activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'activite_id', 'tache_pedagogique_id', 'rang', 'obligatoire']
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', 'activite_id', 'tache_pedagogique_id', 'rang', 'obligatoire']
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
if( diction['obligatoire'] not in ['0', '1']):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La notion d'obligation est invalide ")
return False, " La notion d'obligation est invalide "
if ("rang" in diction.keys()):
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
if (local_status is False):
mycommon.myprint(
" Le rang doit être un nombre entier ")
return False, " Le rang doit être un nombre entier"
"""
Verifier la validité de l'activité
"""
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(diction['activite_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de l'activité est invalide ")
return False, " L'identifiant de l'activité est invalide "
is_valide_tache = MYSY_GV.dbname['tache_pedagogique'].count_documents({'_id':ObjectId(str(diction['tache_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_tache != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de la tâche "+str(diction['tache_pedagogique_id'])+" est invalide ")
return False, " L'identifiant de la tâche "+str(diction['tache_pedagogique_id'])+" est invalide "
tab_tache_pedagogique = []
tab_tache_pedagogique.append(str(diction['tache_pedagogique_id']))
for tache_id in tab_tache_pedagogique:
"""
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
si non on fait une insertion
"""
is_tache_existe_in_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['activite_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid']),
'tab_tache_pedagogique._id': ObjectId(str(tache_id))
})
if( is_tache_existe_in_activite == 1):
print(" OUII existe, donc update")
update = MYSY_GV.dbname['activite_pedagogique'].update_one({'_id': ObjectId(str(diction['activite_id'])),
'valide': '1',
'locked':'0',
'partner_owner_recid': str(my_partner['recid']),
'tab_tache_pedagogique._id': ObjectId(str(tache_id))
},
{'$set':
{
'tab_tache_pedagogique.$[xxx].rang': str( diction['rang']),
'tab_tache_pedagogique.$[xxx].obligatoire': str( diction['obligatoire']),
'tab_tache_pedagogique.$[xxx].update_date': str( datetime.now()),
'tab_tache_pedagogique.$[xxx].update_by': str(my_partner['_id']),
}
},
upsert=False,
array_filters=[
{"xxx._id": ObjectId(str(tache_id))},
]
)
elif( is_tache_existe_in_activite == 0):
print(" NOOO existe, donc insert")
new_data = {}
new_data['_id'] = ObjectId(str(tache_id))
new_data['rang'] = str(diction['rang'])
new_data['obligatoire'] = str(diction['obligatoire'])
new_data['valide'] = "1"
new_data['creation_by'] = str(my_partner['_id'])
new_data['creation_date'] = str(datetime.now())
new_data['locked'] = "0"
insert = MYSY_GV.dbname['activite_pedagogique'].update_one({'_id': ObjectId(str(diction['activite_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid']),
},
{
'$push': {
"tab_tache_pedagogique": {
'$each': [new_data]
}
}
},
)
return True, " La mise à jour a été correctement faite "
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 faire la mise à jour "
"""
Supprimer une tache pédagogique d'une activité pédagogique
"""
def Delete_Tache_From_Activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'activite_id', 'tache_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'activite_id', 'tache_pedagogique_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 l'activité
"""
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(diction['activite_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de l'activité est invalide ")
return False, " L'identifiant de l'activité est invalide "
is_valide_tache = MYSY_GV.dbname['tache_pedagogique'].count_documents({'_id':ObjectId(str(diction['tache_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_tache != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de la tâche "+str(diction['tache_pedagogique_id'])+" est invalide ")
return False, " L'identifiant de la tâche "+str(diction['tache_pedagogique_id'])+" est invalide "
tab_tache_pedagogique = []
tab_tache_pedagogique.append(str(diction['tache_pedagogique_id']))
for tache_id in tab_tache_pedagogique:
"""
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
si non on fait une insertion
"""
is_tache_existe_in_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['activite_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid']),
'tab_tache_pedagogique._id': ObjectId(str(tache_id))
})
if( is_tache_existe_in_activite == 1):
print(" OUII existe, donc update")
update = MYSY_GV.dbname['activite_pedagogique'].update_one({'_id': ObjectId(str(diction['activite_id'])),
'valide': '1',
'locked':'0',
'partner_owner_recid': str(my_partner['recid']),
'tab_tache_pedagogique._id': ObjectId(str(tache_id))
},
{'$pull': {"tab_tache_pedagogique": {"_id": ObjectId(str(tache_id)) }}},
)
return True, " La tâche 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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer la tâche "

View File

@ -178,7 +178,7 @@ def Add_Update_Agenda_Event(diction):
if( is_event_exist > 0 ):
# L'eventement existe est valide, on autorise la mise à jour
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
update = MYSY_GV.dbname['agenda'].update_one({'_id':ObjectId(str(diction['_id'])),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
@ -372,7 +372,7 @@ def Add_Update_Agenda_Event_Stagiaire(diction):
if( is_event_exist > 0 ):
# L'eventement existe est valide, on autorise la mise à jour
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['agenda'].update_one({'_id':ObjectId(str(diction['_id'])),
'partner_owner_recid':str(my_partner['recid']),

View File

@ -588,7 +588,7 @@ def Update_Appel_Offre(diction):
data_update['date_deliberation'] = diction['date_deliberation']
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
"""
Controle cohérence des dates debut et la date de deliberation
"""

View File

@ -205,7 +205,7 @@ def Add_Apprenant(diction):
new_data['locked'] = '0'
new_data['archive'] = '0'
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
todays_date = str(date.today().strftime("%d/%m/%Y"))
@ -380,7 +380,7 @@ def Update_Apprenant(diction):
new_data['valide'] = '1'
new_data['locked'] = '0'
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
ret_val = MYSY_GV.dbname['apprenant'].find_one_and_update(
@ -2319,7 +2319,7 @@ def Update_Apprenant_Tuteurs(diction):
my_id = str(diction['_id'])
del data_update['token']
del data_update['_id']
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
@ -3133,7 +3133,7 @@ def ENT_Disable_Apprenant_Account(diction):
new_account['active'] = '0'
new_account['locked'] = '1'
new_account['date_update'] = str(datetime.now())
new_account['update_date'] = str(datetime.now())
new_account['update_by'] = str(my_partner['_id'])
data_key = {}
@ -3245,7 +3245,7 @@ def ENT_Enable_Apprenant_Account(diction):
new_account['active'] = '1'
new_account['locked'] = '0'
new_account['date_update'] = str(datetime.now())
new_account['update_date'] = str(datetime.now())
new_account['update_by'] = str(my_partner['_id'])
data_key = {}
@ -3327,7 +3327,7 @@ def archive_apprenant(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '1'
@ -3420,7 +3420,7 @@ def unarchive_apprenant(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '0'

View File

@ -916,7 +916,7 @@ def add_articles_avis(diction):
mydata['locked'] = '0'
mydata['indexed'] = '0'
mydata['indexed'] = '0'
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['date_avis'] = str(datetime.now())
mydata['isalaune'] = "0"
@ -1136,12 +1136,12 @@ def update_articles_avis(diction):
mydata['locked'] = '1'
mydata['indexed'] = '0'
mydata['indexed'] = '0'
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['isalaune'] = "0"
mydata['valide'] = "1"
mydata['locked'] = "0"
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
@ -1257,7 +1257,7 @@ def recherche_articles_avis(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
#if ("_id" in mydict_combined.keys()):
@ -1372,7 +1372,7 @@ def store_recherche_article_avis(diction, user_recid=""):
if diction['id']:
mydata_id = diction['id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['valide'] = "1" # By default
if ("valide" in diction.keys()):

View File

@ -208,7 +208,7 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
mydata = {}
mydata['file_business_object'] = file_business_object
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['file_name'] = file.filename
mydata['type_document'] = type_document
mydata['metadata_field'] = metadata_field
@ -390,7 +390,7 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
mydata = {}
mydata['file_business_object'] = file_business_object
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['file_name'] = partial_file_name_without_folder
mydata['full_path'] = Global_file_name
mydata['type_document'] = type_document

View File

@ -139,7 +139,7 @@ def Init_Attestation_Formation_With_Template(diction):
'partner_owner_recid':str(my_partner['recid'])})
new_attestation_data = {}
new_attestation_data['date_update'] = str(datetime.now())
new_attestation_data['update_date'] = str(datetime.now())
new_attestation_data['update_by'] = str(my_partner['_id'])
new_attestation_data['partner_owner_recid'] = str(my_partner['recid'])
new_attestation_data['valide'] = "1"
@ -257,7 +257,7 @@ def Init_Attestation_Formation_With_Template_For_All_Inscription(diction):
new_attestation_data = {}
new_attestation_data['date_update'] = str(datetime.now())
new_attestation_data['update_date'] = str(datetime.now())
new_attestation_data['update_by'] = str(my_partner['_id'])
new_attestation_data['partner_owner_recid'] = str(my_partner['recid'])
new_attestation_data['valide'] = "1"
@ -614,7 +614,7 @@ def Send_Attestation_Formation_With_Template(diction):
'partner_owner_recid':str(my_partner['recid'])})
new_attestation_data = {}
new_attestation_data['date_update'] = str(datetime.now())
new_attestation_data['update_date'] = str(datetime.now())
new_attestation_data['update_by'] = str(my_partner['_id'])
new_attestation_data['partner_owner_recid'] = str(my_partner['recid'])
new_attestation_data['valide'] = "1"

View File

@ -301,7 +301,7 @@ def run_ue_pre_calcul_moyenne_somme(diction):
qry_key['ue_id'] = note_finale['ue_id']
new_data = note_finale
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -2680,7 +2680,7 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
qry_key['ue_id'] = note_finale['ue_id']
new_data = note_finale
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['valide'] = "1"
new_data['locked'] = "0"

View File

@ -115,7 +115,7 @@ def Add_Update_Modele_Journee(diction):
return False, " L'identifiant du modèle est invalide "
# Il s'agit d'une mise à jour
my_data_JSON['date_update'] = str(datetime.now())
my_data_JSON['update_date'] = str(datetime.now())
my_data_JSON['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['base_config_modele_journee'].find_one_and_update(

View File

@ -132,7 +132,7 @@ def Add_Update_base_document_automatic_setup(diction):
if (my_id):
diction['date_update'] = str(datetime.now())
diction['update_date'] = str(datetime.now())
diction['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['base_document_automatic_setup'].find_one_and_update(
{'courrier_template_type_document_ref_interne': str(diction['courrier_template_type_document_ref_interne']),
@ -154,7 +154,7 @@ def Add_Update_base_document_automatic_setup(diction):
diction['valide'] = "1"
diction['locked'] = "0"
diction['partner_owner_recid'] = str(my_partner['recid'])
diction['date_update'] = str(datetime.now())
diction['update_date'] = str(datetime.now())
diction['creation_date'] = str(datetime.now())
diction['update_by'] = str(my_partner['_id'])

View File

@ -155,7 +155,7 @@ def Add_Update_Partner_Catalog_Pub_Config(diction):
del diction['token']
if( my_id ):
diction['date_update'] = str(datetime.now())
diction['update_date'] = str(datetime.now())
diction['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['config_partner_catalog'].find_one_and_update(
{'_id': ObjectId(str(my_id)),
@ -175,7 +175,7 @@ def Add_Update_Partner_Catalog_Pub_Config(diction):
diction['valide'] = "1"
diction['locked'] = "0"
diction['partner_owner_recid'] = str(my_partner['recid'])
diction['date_update'] = str(datetime.now())
diction['update_date'] = str(datetime.now())
diction['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['config_partner_catalog'].insert_one(diction)

View File

@ -103,7 +103,7 @@ def Add_Update_Partner_session_step(diction):
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
# La clé de la mise à jour est :
# my_data['partner_owner_recid']

View File

@ -85,7 +85,7 @@ def Add_specific_field(diction):
data['partner_owner_recid'] = str(my_partner['recid'])
data['valide'] = "1"
data['locked'] = "0"
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['field_value'] = ""
@ -311,7 +311,7 @@ def Update_specific_field(diction):
data['partner_owner_recid'] = str(my_partner['recid'])
data['valide'] = "1"
data['locked'] = "0"
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['field_value'] = ""
related_collection = ""

View File

@ -128,7 +128,7 @@ def add_business_price(diction):
mydata['client_recid'] = client_recid
mydata['client_nom'] = client_nom
mydata['valide'] = "1"
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y")
mydata['update_date'] = datetime.now().strftime("%d/%m/%Y")
ret_val = MYSY_GV.dbname['business_prices'].insert_one(mydata)
if (ret_val.acknowledged is None):
@ -213,7 +213,7 @@ def update_business_price(diction):
mydata['date_du'] = date_du
mydata['date_au'] = date_au
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y")
mydata['update_date'] = datetime.now().strftime("%d/%m/%Y")
if ("class" in diction.keys()):
if diction['class']:
@ -283,7 +283,7 @@ def delete_business_price(diction):
str(inspect.stack()[0][3]) + " - Impossible de récupérer les donnees du partnaire ")
return False, "Impossible de récupérer les donnees du partnaire "
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y")
mydata['update_date'] = datetime.now().strftime("%d/%m/%Y")
mydata['valide'] = "0"
ret_val = MYSY_GV.dbname['business_prices'].find_one_and_update(

View File

@ -1329,7 +1329,7 @@ def update_class(diction):
mydata['zone_diffusion'] = {'country':tab_country, 'city':tab_city}
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = 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_'
@ -1357,7 +1357,7 @@ def update_class(diction):
mydata['indexed_title'] = '0'
mydata['indexed_desc'] = '0'
mydata['indexed_obj'] = '0'
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
""" Gestion des ajout pr les compte utilisateur de type demo """
@ -1523,7 +1523,7 @@ def disable_class(diction):
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['valide'] = '0'
coll_name = MYSY_GV.dbname['myclass']
@ -1628,7 +1628,7 @@ def archive_class(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '1'
@ -1726,7 +1726,7 @@ def unarchive_class(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '0'
@ -1837,7 +1837,7 @@ def enable_class(diction):
if diction['internal_url']:
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['valide'] = '1'
@ -1952,7 +1952,7 @@ def unlock_class(diction):
if diction['internal_url']:
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['locked'] = '0'
@ -2069,7 +2069,7 @@ def lock_class(diction):
if diction['internal_url']:
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['locked'] = '1'
@ -2187,7 +2187,7 @@ def pusblish_class(diction):
if diction['internal_url']:
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['published'] = '1'
@ -2306,7 +2306,7 @@ def unpublish_class(diction):
if diction['internal_url']:
my_internal_url = diction['internal_url']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['published'] = '0'
@ -2610,7 +2610,7 @@ def get_class(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **retVal, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "detail"
if ("_id" in mydict_combined.keys()):
@ -3081,7 +3081,7 @@ def get_class_without_marketplace_check(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **retVal, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "detail"
if ("_id" in mydict_combined.keys()):
@ -3534,7 +3534,7 @@ def get_class_for_partner_catalog(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **retVal, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "detail"
if ("_id" in mydict_combined.keys()):
@ -6638,7 +6638,7 @@ def RenseignementClass(diction):
new_lead_data = diction
new_lead_data['valide'] = "1"
new_lead_data['locked'] = "0"
new_lead_data['date_update'] = str(datetime.now())
new_lead_data['update_date'] = str(datetime.now())
new_lead_data['update_by'] = "auto"
inserted_invoice_id = MYSY_GV.dbname['lead_website'].insert_one(new_lead_data).inserted_id
@ -8030,7 +8030,7 @@ def Add_Update_UE_To_Class(diction):
# l'UE n'existe pas pour cette formation, on fait une creation
# Il s'agit de la creation d'une competence
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['valide'] = "1"
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
@ -8350,7 +8350,7 @@ def Update_Class_Default_Document(diction):
doc_id = diction[str(tmp)]
updata_data = {}
updata_data['date_update'] = str(datetime.now())
updata_data['update_date'] = 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'])

View File

@ -255,7 +255,7 @@ def Update_Competence(diction):
del mydata['competence_id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['competence_liste'].find_one_and_update(

View File

@ -163,7 +163,7 @@ def Add_CRM_Opportunite(diction):
str(inspect.stack()[0][3]) + " L'identifiant du vendeur_id est invalide ")
return False, " L'identifiant du vendeur_id est invalide "
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['creation_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
@ -450,7 +450,7 @@ def Update_CRM_Opportunite(diction):
str(inspect.stack()[0][3]) + " L'identifiant du vendeur_id est invalide ")
return False, " L'identifiant du vendeur_id est invalide "
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['crm_opportunite'].find_one_and_update(
@ -1267,7 +1267,7 @@ def Add_CRM_Opportunite_Etape(diction):
del new_data['token']
new_data['code'] = str(diction['code']).lower()
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
if( "gagne" in diction.keys() and diction['gagne'] in ['0', '1']):

View File

@ -203,7 +203,7 @@ def Update_Class_domaine(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -211,7 +211,7 @@ def add_payement_mode(diction):
new_data = {}
new_data['valide'] = "1"
now = datetime.now()
new_data['date_update'] = str(now)
new_data['update_date'] = str(now)
# initialisation pr nettoyer l'existant (faire comme un delete)
new_data['nom_carte'] = ""
@ -839,7 +839,7 @@ def createOrder(diction):
now = datetime.now()
new_data['date_update'] = str(now)
new_data['update_date'] = str(now)
new_data['order_date'] = str(now.strftime("%d/%m/%Y %H:%M:%S"))
new_data['order_id'] = "MySy_00"+str(mycommon.create_order_id())

View File

@ -196,7 +196,7 @@ def desable_user_objectif(diction):
myobjectif['user_recid'] = user_recid
myobjectif['name'] = name
myobjectif['active'] = '-1'
myobjectif['date_update'] = str(datetime.now())
myobjectif['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_objectif']
@ -303,7 +303,7 @@ def add_update_user_objectif(diction):
myobjectif['domaine'] = domaine
myobjectif['niveau'] = niveau
myobjectif['active'] = '1'
myobjectif['date_update'] = str(now)
myobjectif['update_date'] = str(now)
coll_name = MYSY_GV.dbname['user_objectif']
@ -412,7 +412,7 @@ def add_update_user_profile(diction):
my_data['user_recid'] = user_recid
my_data['active'] = '1'
my_data['date_update'] = str(now)
my_data['update_date'] = str(now)
coll_name = MYSY_GV.dbname['user_profil']
@ -672,7 +672,7 @@ def update_user_account(diction):
now = datetime.now()
dictionnary = {}
dictionnary['active'] = "1"
dictionnary['date_update'] = str(now)
dictionnary['update_date'] = str(now)
mytoken =""
myemail = ""
@ -945,7 +945,7 @@ def change_user_pwd(diction):
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_account']
@ -1051,7 +1051,7 @@ def Reset_user_pwd_by_token(diction):
return False, " Impossible de mettre à jour le mot de passe"
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_account']
@ -1110,7 +1110,7 @@ def Reset_user_pwd_by_token(diction):
# Recuperation du recid du user
user_email = tmp_retval[0]['email']
mydata = {}
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['pwd'] = new_pwd
mydata['tmp_token_pwd'] = ""
@ -1207,7 +1207,7 @@ def change_uer_email(diction):
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_account']
@ -1315,7 +1315,7 @@ def send_mail_delete_user(diction):
if diction['user_ip']:
mydata['delete_ip_1'] = diction['user_ip']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_account']
ret_val = coll_name.find_one_and_update({'recid': str(user_recid), 'locked': '0'},
@ -1405,7 +1405,7 @@ def delete_user_account(diction):
return False, " Impossible de supprimer le compte utilisateur"
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['pwd'] = user_recid
mydata['email'] = "Anonyme@"+user_recid[:5]
mydata['last_name'] = "name_"+user_recid[:5]
@ -1510,7 +1510,7 @@ def lock_user_account(diction):
now = datetime.now()
dictionnary = {}
dictionnary['locked'] = "1"
dictionnary['date_update'] = str(now)
dictionnary['update_date'] = str(now)
myemail = ""
@ -1583,7 +1583,7 @@ def desable_user_account(diction):
dictionnary = {}
dictionnary['active'] = "0"
dictionnary['locked'] = "1"
dictionnary['date_update'] = str(now)
dictionnary['update_date'] = str(now)
myemail = ""
@ -1811,7 +1811,7 @@ def InitUserPasswd(diction):
new_token = {}
new_token['email'] = retVal[0]['email']
new_token['recid'] = retVal[0]['recid']
new_token['date_update'] = str(datetime.now())
new_token['update_date'] = str(datetime.now())
new_token['valide'] = '1'
# Creation du token
mynewtoken = mycommon.create_token_urlsafe()
@ -1857,7 +1857,7 @@ def InitUserPasswd(diction):
"""
new_token = {}
new_token['date_update'] = str(datetime.now())
new_token['update_date'] = str(datetime.now())
# Creation du token
mynewtoken = mycommon.create_token_urlsafe()
new_token['tmp_token_pwd'] = mynewtoken

View File

@ -1701,7 +1701,7 @@ def Evaluation_training_confirmation_mail(diction):
new_data = {}
new_data['eval_status'] = "0"
new_data['date_demande_eval'] = str(now)
new_data['date_update'] = str(now)
new_data['update_date'] = str(now)
new_data['update_by'] = str(my_partner['_id'])

View File

@ -2225,7 +2225,7 @@ def SendEmargementMail( diction):
"""
now = str(datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
updata_data = {}
updata_data['date_update'] = now
updata_data['update_date'] = now
updata_data['update_by'] = str(my_partner['_id'])
updata_data['statut'] = "1"

View File

@ -231,7 +231,7 @@ def Update_Message_To_Mail_Queue(diction):
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -538,7 +538,7 @@ def Resend_List_Mail_Queue(diction):
On met à jour l'email avec le statut d'envoie de l'email
"""
new_data = diction
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['sent'] = str(datetime.now())
error_node = {}

View File

@ -175,7 +175,7 @@ def CreateTableauEmargement(diction):
my_local_data['prenom'] = tmp_val['prenom']
my_local_data['session_id'] = tmp_val['session_id']
my_local_data['class_internal_url'] = tmp_val['class_internal_url']
my_local_data['date_update'] = str(datetime.now())
my_local_data['update_date'] = str(datetime.now())
for local_date in liste_date :
query_key = {}
@ -190,7 +190,7 @@ def CreateTableauEmargement(diction):
new_my_local_data['prenom'] = tmp_val['prenom']
new_my_local_data['session_id'] = tmp_val['session_id']
new_my_local_data['class_internal_url'] = tmp_val['class_internal_url']
new_my_local_data['date_update'] = str(datetime.now())
new_my_local_data['update_date'] = str(datetime.now())
new_my_local_data['date'] = str(local_date)
new_my_local_data['matin'] = False
new_my_local_data['apresmidi'] = False
@ -429,7 +429,7 @@ def CreateTableauEmargement_From_Sequence(diction):
my_local_data['prenom'] = tmp_val['prenom']
my_local_data['session_id'] = tmp_val['session_id']
my_local_data['class_internal_url'] = tmp_val['class_internal_url']
my_local_data['date_update'] = str(datetime.now())
my_local_data['update_date'] = str(datetime.now())
# Recuperation de liste des sequences
for session_sequence in MYSY_GV.dbname['session_formation_sequence'].find({"$and":[{'session_id':str(session_id),
@ -454,7 +454,7 @@ def CreateTableauEmargement_From_Sequence(diction):
new_my_local_data['prenom'] = tmp_val['prenom']
new_my_local_data['session_id'] = tmp_val['session_id']
new_my_local_data['class_internal_url'] = tmp_val['class_internal_url']
new_my_local_data['date_update'] = str(datetime.now())
new_my_local_data['update_date'] = str(datetime.now())
query_key['date'] = str(session_sequence['sequence_start'])[0:10]
new_my_local_data['is_present'] = False
new_my_local_data['matin'] = False
@ -476,7 +476,7 @@ def CreateTableauEmargement_From_Sequence(diction):
new_my_local_data['statut'] = "0"
new_my_local_data['date_envoi'] = ""
new_my_local_data['date_update'] = str(datetime.now())
new_my_local_data['update_date'] = str(datetime.now())
new_my_local_data['update_by'] = str(my_partner['recid'])
new_my_local_data['valide'] = "1"
new_my_local_data['locked'] = "0"
@ -679,7 +679,7 @@ def UpdateUserEmargementDate(diction):
mydata = {}
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['date_update'] = now
mydata['update_date'] = now
if (is_present == "1"):
mydata['is_present'] = True
@ -805,7 +805,7 @@ def Update_Given_Emargement_Data(diction):
mydata = {}
mydata['comment'] = str(comment)
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
query_key = {}

View File

@ -283,7 +283,7 @@ def Update_Ent_Alert_Message(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -1805,7 +1805,7 @@ def Get_Ent_Student_update_user_account(diction):
now = datetime.now()
dictionnary = {}
dictionnary['active'] = "1"
dictionnary['date_update'] = str(now)
dictionnary['update_date'] = str(now)
mytoken =""
myemail = ""
@ -2003,7 +2003,7 @@ def Get_Ent_Student_change_user_pwd(diction):
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['user_account']

View File

@ -123,7 +123,7 @@ def Add_Equipe_Team(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['date_creation'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -147,7 +147,7 @@ def Add_Equipe_Team(diction):
mytoday = datetime.today()
new_data['date_ajout_equipe'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -301,7 +301,7 @@ def Add_Update_Equipe_Team_Membres(diction):
mytoday = datetime.today()
new_data['date_ajout_equipe'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -628,7 +628,7 @@ def Update_Equipe_Team(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -661,7 +661,7 @@ def Update_Equipe_Team(diction):
mytoday = datetime.today()
new_data['date_ajout_equipe'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"

View File

@ -240,7 +240,7 @@ def Update_Financial_Caracteristique(diction):
del mydata['_id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['financial_caracteristic'].find_one_and_update(

View File

@ -247,7 +247,7 @@ def Add_Update_Question_Formulaire(diction):
"""
new_data = {}
new_data['_id'] = str(diction['question_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['valide'] = "1"
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
@ -361,7 +361,7 @@ def Add_Update_Question_Formulaire(diction):
# field_list = ['token', 'form_id', 'question_id', 'question', 'type', 'commentaire', 'list_choix', 'max_note' ]
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['valide'] = "1"
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
@ -1002,7 +1002,7 @@ def Update_Formulaire(diction):
MYSY_GV.FORM_TYPE)
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
data_cle = {'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0', '_id': ObjectId(str(diction['form_id']))}

View File

@ -194,7 +194,7 @@ def Update_Groupe_Client(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -158,7 +158,7 @@ def Add_Groupe_Inscrit(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -313,7 +313,7 @@ def Update_Groupe_Inscrit(diction):
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -856,7 +856,7 @@ def Add_Update_Groupe_Inscrit_Membres(diction):
mytoday = datetime.today()
new_data['date_ajout_groupe'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -957,7 +957,7 @@ def Update_Groupe_Inscrit_Membres_From_Id(diction):
new_data = {}
new_data['delegue_level'] = str(diction['delegue_level'])
new_data['date_update'] = now
new_data['update_date'] = now
new_data['update_by'] = str(my_partner['_id'])
ret_val = MYSY_GV.dbname['groupe_inscription_membre'].update_many(
@ -1664,7 +1664,7 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -1680,7 +1680,7 @@ def Automatic_Creation_Groupe_Member_Inscrit(diction):
new_data['date_ajout_groupe'] = str(mytoday)
now = str(datetime.now())
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -1995,7 +1995,7 @@ def Automatic_Split_Member_Inscrit_To_Grps(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -2011,7 +2011,7 @@ def Automatic_Split_Member_Inscrit_To_Grps(diction):
new_data['date_ajout_groupe'] = str(mytoday)
now = str(datetime.now())
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -388,7 +388,7 @@ def Update_Message_To_Internal_Mail(tab_files, Folder, diction):
new_data['from'] = str(my_partner['email'])
new_data['sent'] = str(datetime.now())
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -223,7 +223,7 @@ def Add_Invoice_Paiement(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -256,7 +256,7 @@ def Add_Invoice_Paiement(diction):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['partner_owner_recid'] = str(my_partner['recid'])
@ -497,7 +497,7 @@ def Update_Invoice_Paiement(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -534,7 +534,7 @@ def Update_Invoice_Paiement(diction):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['partner_owner_recid'] = str(my_partner['recid'])
@ -1196,7 +1196,7 @@ def Delete_Given_Invoice_Paiement(diction):
total_relicat = total_header_toutes_taxes_float - total_payed_amount_float
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -260,7 +260,7 @@ def Add_Jury(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -557,7 +557,7 @@ def Add_Conseil_Class(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -711,7 +711,7 @@ def Add_Update_Jury_Membres(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -848,7 +848,7 @@ def Update_Jury_Membres_Presence(diction):
new_data = {}
new_data['is_present'] = str(diction['is_present'])
new_data['date_update'] = now
new_data['update_date'] = now
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -996,7 +996,7 @@ def Add_Update_Jury_Delegue_Membres(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -1399,7 +1399,7 @@ def Update_Jury(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -1432,7 +1432,7 @@ def Update_Jury(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -1698,7 +1698,7 @@ def Update_Conseil_Class(diction):
del diction['token']
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -1731,7 +1731,7 @@ def Update_Conseil_Class(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -3241,7 +3241,7 @@ def Add_Update_Apprenant_To_Jury(diction):
new_soutenance_data['jury_soutenance_pays'] = ""
new_soutenance_data['date_update'] = str(datetime.now())
new_soutenance_data['update_date'] = str(datetime.now())
new_soutenance_data['update_by'] = str(my_partner['_id'])
ret_val2 = MYSY_GV.dbname['jury_soutenance'].find_one_and_update(
@ -3299,7 +3299,7 @@ def Add_Update_Apprenant_To_Jury(diction):
my_even_data['partner_owner_recid'] = str(my_partner['recid'])
if ("agenda_id" in diction.keys() and diction['agenda_id']):
my_even_data['date_update'] = str(datetime.now())
my_even_data['update_date'] = str(datetime.now())
my_even_data['update_by'] = str(my_partner['_id'])
update_agenda = MYSY_GV.dbname['agenda'].find_one_and_update(
@ -3324,7 +3324,7 @@ def Add_Update_Apprenant_To_Jury(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -3468,7 +3468,7 @@ def Add_Update_Apprenant_To_Conseil_Class(diction):
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -3884,7 +3884,7 @@ def Add_Update_Jury_Soutenance(diction):
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['update_by'] = str(my_partner['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
result = MYSY_GV.dbname['jury_soutenance'].find_one_and_update(
{'_id':ObjectId(str(local_jury_soutenance_id)),
@ -5301,7 +5301,7 @@ def Send_Jury_Apprenant_Soutenance_Convocation_By_Email(tab_files, Folder, dicti
"""
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['convocation_apprenant_send'] = "1"
update_data['convocation_apprenant_date_sending'] = str(datetime.now())
@ -6892,7 +6892,7 @@ def Add_Update_Inscrit_Jury_Promo_Decision(diction):
tab_inscriptions_ids_ObjectId.append(ObjectId(str(my_inscription)))
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['jury_observation'] = str(diction['jury_observation'])
update_data['jury_note'] = str(diction['jury_note'])
@ -6981,7 +6981,7 @@ def Add_Update_Candidat_Jury_Admission_Decision(diction):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['jury_observation'] = str(diction['jury_observation'])
update_data['jury_note'] = str(diction['jury_note'])
@ -7068,7 +7068,7 @@ def Add_Update_UE_Jury_Observation(diction):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['jury_observation'] = str(diction['jury_observation'])
update_data['jury_note'] = str(diction['jury_note'])
@ -7191,7 +7191,7 @@ def Add_Groupe_Apprenant_To_Jury(diction):
now = str(datetime.now())
mytoday = datetime.today()
new_data['date_ajout_jury'] = str(mytoday)
new_data['date_update'] = now
new_data['update_date'] = now
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -7334,7 +7334,7 @@ def Add_Update_Conseil_Class_Apprenant_Observation(diction):
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['jury_apprenant_observation'] = observlation_500_catactere
update_data['observation_date'] = datetime.today().strftime("%d/%m/%Y")

View File

@ -1246,7 +1246,7 @@ def Check_MySy_LMS_Account(diction):
# Apres la creation du compte LSM, on met à jour le compte mysy avec la valeur du champs : mysy_lms_user_id
mysy_coll_query = {}
mysy_coll_query['mysy_lms_user_id'] = str(new_lms_use_id)
mysy_coll_query['date_update'] = str(datetime.now())
mysy_coll_query['update_date'] = str(datetime.now())
ret_val = MYSY_GV.dbname['partnair_account'].find_one_and_update(
{'recid': my_partner['recid'], 'active': '1', 'locked': '0'},
{"$set": mysy_coll_query},
@ -2320,7 +2320,7 @@ def LMS_Create_VirtualHost(diction):
mysy_coll_query = {}
mysy_coll_query['lms_virtualhost_id'] = str(virtualHost_Id)
mysy_coll_query['lms_virtualhost_url'] = str(virtualHost_url)
mysy_coll_query['date_update'] = str(datetime.now())
mysy_coll_query['update_date'] = str(datetime.now())
mysy_coll_query['lms_username'] = str(lms_username)
ret_val = MYSY_GV.dbname['partnair_account'].find_one_and_update(
@ -3715,7 +3715,7 @@ def Unpublish_Class_From_Lms(diction):
#return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire",
mydata = {}
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['published'] = '0'
ret_val = MYSY_GV.dbname['myclass'].update_many(
@ -4111,7 +4111,7 @@ def Push_Class_To_MySy_LMS(diction):
data_update = {}
data_update['lms_class_code'] = lms_class_code
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_cle = {}
data_cle['internal_url'] = str(Class_To_Push['internal_url'])
@ -4582,7 +4582,7 @@ def Disable_MySy_LMS_Account(diction):
conn.close()
update_account = {}
update_account['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
update_account['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
update_account['update_by'] = str(my_partner['_id'])
update_account['lms_account_disable'] = "1"

337
main.py
View File

@ -107,6 +107,9 @@ import internal_email_mgt as internal_email_mgt
import ent_alert_messages as ent_alert_messages
import admission_mgt as admission_mgt
import session_admission_fi as session_admission_fi
import activite_pedagogique as activite_pedagogique
import tache_pedagogique as tache_pedagogique
import pole_activite_pedagogique as pole_activite_pedagogique
import base_document_automatic_setup as base_document_automatic_setup
@ -15697,6 +15700,337 @@ def Get_Synthese_Candidat_Process_Admission():
return jsonify(status=status, message=retval)
"""
Cette API permet de Récuperer la liste des partenaires de la plateforme avec des filtres
"""
@app.route('/myclass/api/Get_List_Plateforme_Partnaire_With_Filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Plateforme_Partnaire_With_Filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Plateforme_Partnaire_With_Filter payload = ",payload)
status, retval = pa.Get_List_Plateforme_Partnaire_With_Filter(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de recuperer la liste des connexions liée à un partenaire
(que soit lui ou des utilisateur de partenaire)
"""
@app.route('/myclass/api/Get_Given_Plateforme_Partnaire_Connexion_Login_With_Filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_Plateforme_Partnaire_Connexion_Login_With_Filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_Plateforme_Partnaire_Connexion_Login_With_Filter payload = ",payload)
status, retval = pa.Get_Given_Plateforme_Partnaire_Connexion_Login_With_Filter(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de recuperer les données d'un partenaire de la plateforme en partant de son ID
"""
@app.route('/myclass/api/get_partner_account_from_id/', methods=['POST','GET'])
@crossdomain(origin='*')
def get_partner_account_from_id():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### get_partner_account_from_id payload = ",payload)
status, retval = pa.get_partner_account_from_id(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Verrouiller un partenaire, ainsi que les sous comptes associés ainsi que les formations associées
"""
@app.route('/myclass/api/Lock_PF_partner_account_And_Sub_Accound_from_id/', methods=['POST','GET'])
@crossdomain(origin='*')
def Lock_PF_partner_account_And_Sub_Accound_from_id():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Lock_PF_partner_account_And_Sub_Accound_from_id payload = ",payload)
status, retval = pa.Lock_PF_partner_account_And_Sub_Accound_from_id(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de déverrouiller un partenaire, ainsi que les sous comptes associés ainsi que les formations associées
"""
@app.route('/myclass/api/UnLock_PF_partner_account_And_Sub_Accound_from_id/', methods=['POST','GET'])
@crossdomain(origin='*')
def UnLock_PF_partner_account_And_Sub_Accound_from_id():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### UnLock_PF_partner_account_And_Sub_Accound_from_id payload = ",payload)
status, retval = pa.UnLock_PF_partner_account_And_Sub_Accound_from_id(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de passer un compte de 'formation continue' a 'formation initiale' ou inversement
"""
@app.route('/myclass/api/Change_PF_partner_account_Type_Licence_from_id/', methods=['POST','GET'])
@crossdomain(origin='*')
def Change_PF_partner_account_Type_Licence_from_id():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Change_PF_partner_account_Type_Licence_from_id payload = ",payload)
status, retval = pa.Change_PF_partner_account_Type_Licence_from_id(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet d'ajouter une activité pédagogique
"""
@app.route('/myclass/api/Add_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Add_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de mettre à jour d'une activité pédagogique
"""
@app.route('/myclass/api/Update_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Update_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Recuperer la liste des activite pedagogique d'un partenaire, sans filtres
"""
@app.route('/myclass/api/Get_activite_pedagogique_no_filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_activite_pedagogique_no_filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_activite_pedagogique_no_filter payload = ",payload)
status, retval = activite_pedagogique.Get_activite_pedagogique_no_filter(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Recuperer les données d'une activite pedagogique donnée
"""
@app.route('/myclass/api/Get_Given_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Get_Given_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet la Suppression d'une activite pedagogique
"""
@app.route('/myclass/api/Delete_Given_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Given_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Given_activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Delete_Given_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet d'Ajouter une liste de tache pédagogique à l'activité
"""
@app.route('/myclass/api/Add_Update_tab_Tache_To_Activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_Update_tab_Tache_To_Activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_Update_tab_Tache_To_Activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Add_Update_tab_Tache_To_Activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Supprimer une tache pédagogique d'une activité pédagogique
"""
@app.route('/myclass/api/Delete_Tache_From_Activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Tache_From_Activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Tache_From_Activite_pedagogique payload = ",payload)
status, retval = activite_pedagogique.Delete_Tache_From_Activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet d'ajout d'une tache pedagogique
"""
@app.route('/myclass/api/Add_tache_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_tache_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_tache_pedagogique payload = ",payload)
status, retval = tache_pedagogique.Add_tache_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de mettre à jour d'une activité pédagogique
"""
@app.route('/myclass/api/Update_tache_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_tache_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_tache_pedagogique payload = ",payload)
status, retval = tache_pedagogique.Update_tache_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Recuperer la liste des activite pedagogique d'un partenaire, sans filtres
"""
@app.route('/myclass/api/Get_tache_pedagogique_no_filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_tache_pedagogique_no_filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_tache_pedagogique_no_filter payload = ",payload)
status, retval = tache_pedagogique.Get_tache_pedagogique_no_filter(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet la Suppression d'une activite pedagogique
"""
@app.route('/myclass/api/Delete_Given_tache_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Given_tache_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Given_tache_pedagogique payload = ",payload)
status, retval = tache_pedagogique.Delete_Given_tache_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet d'ajouter un pole d'activité pedagogique ou fonction
"""
@app.route('/myclass/api/Add_pole_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_pole_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_pole_activite_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Add_pole_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de mettre à jour d'un pole d'activité pedagogique ou fonction
"""
@app.route('/myclass/api/Update_pole_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_pole_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_pole_activite_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Update_pole_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Recuperer la liste des pole d'activite pedagogique d'un partenaire, sans filtres
"""
@app.route('/myclass/api/Get_pole_activite_pedagogique_no_filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_pole_activite_pedagogique_no_filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_pole_activite_pedagogique_no_filter payload = ",payload)
status, retval = pole_activite_pedagogique.Get_pole_activite_pedagogique_no_filter(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Recuperer les données d'un pole d'activite pedagogique donné
"""
@app.route('/myclass/api/Get_Given_pole_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_pole_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_pole_activite_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Get_Given_pole_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Supprimer d'un pole activite pedagogique
"""
@app.route('/myclass/api/Delete_Given_pole_activite_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Given_pole_activite_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Given_pole_activite_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Delete_Given_pole_activite_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet d'Ajouter une liste d'activités pédagogiques à un pole d'activité
"""
@app.route('/myclass/api/Add_Update_tab_Activite_To_Pole_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Add_Update_tab_Activite_To_Pole_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Add_Update_tab_Activite_To_Pole_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Add_Update_tab_Activite_To_Pole_pedagogique(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet Supprimer une activité d'un pole d'activité
"""
@app.route('/myclass/api/Delete_Activite_From_Pole_pedagogique/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_Activite_From_Pole_pedagogique():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_Activite_From_Pole_pedagogique payload = ",payload)
status, retval = pole_activite_pedagogique.Delete_Activite_From_Pole_pedagogique(payload)
return jsonify(status=status, message=retval)
if __name__ == '__main__':
print(" debut api")
@ -15823,6 +16157,7 @@ if __name__ == '__main__':
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_XCELIA_DEM) + " ++")
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
"""
scheduler = BackgroundScheduler()
scheduler.start()
@ -15840,7 +16175,7 @@ if __name__ == '__main__':
# WARNING IMPORTANT WARNING : Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())
"""
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_XCELIA_DEM, debug=True, threaded=True)

View File

@ -124,7 +124,7 @@ def Add_class_metier(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -208,7 +208,7 @@ def Update_class_metier(diction):
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -100,7 +100,7 @@ def Add_Sequence_Planning_Model(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_create'] = str(datetime.now())
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
if( "token" in new_data.keys() ):
@ -131,7 +131,7 @@ def Add_Sequence_Planning_Model(diction):
user['planning_model_header_id'] = str(planning_model_header_inserted_id)
user['valide'] = "1"
user['locked'] = "0"
user['date_update'] = str(datetime.now())
user['update_date'] = str(datetime.now())
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = str(my_partner['recid'])
planning_model_line_inserted_id = MYSY_GV.dbname['planning_model_line'].insert_one(user).inserted_id
@ -781,7 +781,7 @@ def Apply_Planning_Model_To_Session(diction):
local_node['locked'] = "0"
local_node['partner_owner_recid'] = str(my_partner['recid'])
local_node['update_by'] = str(my_partner['_id'])
local_node['date_update'] = str(datetime.now())
local_node['update_date'] = str(datetime.now())
local_node['grp_apprenant_id'] = ""

View File

@ -859,9 +859,9 @@ def Get_Editable_History_Document_By_Partner_By_Collection(diction):
if ('courrier_template_tracking_id' in New_retVal.keys()):
user['courrier_template_tracking_id'] = str(New_retVal['courrier_template_tracking_id'])
user['date_update'] = ""
user['update_date'] = ""
if ('date_update' in New_retVal.keys()):
user['date_update'] = str(New_retVal['date_update'])
user['update_date'] = str(New_retVal['update_date'])
user['update_by'] = ""
if ('update_by' in New_retVal.keys()):
@ -998,7 +998,7 @@ def Init_And_Update_courrier_template_tracking(diction):
"""
# Mise à jour du courrier_template pour mettre 'tracked':'1'
update_data = {}
update_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
update_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
update_data['update_by'] = str(my_partner['_id'])
update_data['tracked'] = "1"
@ -1066,7 +1066,7 @@ def Init_And_Update_courrier_template_tracking_With_Partner_Data(my_partner):
"""
# Mise à jour du courrier_template pour mettre 'tracked':'1'
update_data = {}
update_data['date_update'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
update_data['update_date'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
update_data['update_by'] = str(my_partner['_id'])
update_data['tracked'] = "1"
@ -1132,7 +1132,7 @@ def Editic_Log_History_Action(my_partner, courrier_template_data, related_collec
history_data_to_log['related_collection_recid'] = related_collection_recid
history_data_to_log['courrier_template_tracking_id'] = courrier_template_tracking_id
history_data_to_log['courrier_template_id'] = str(courrier_template_id)
history_data_to_log['date_update'] = str(datetime.now())
history_data_to_log['update_date'] = str(datetime.now())
history_data_to_log['update_by'] = str(my_partner['_id'])
history_data_to_log['valide'] = "1"
history_data_to_log['locked'] = "0"
@ -1210,7 +1210,7 @@ def Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(m
history_data_to_log['courrier_template_tracking_id'] = courrier_template_tracking_id
history_data_to_log['courrier_template_id'] = str(courrier_template_id)
history_data_to_log['comment'] = str(commentaire)
history_data_to_log['date_update'] = str(datetime.now())
history_data_to_log['update_date'] = str(datetime.now())
history_data_to_log['update_by'] = str(my_partner['_id'])
history_data_to_log['valide'] = "1"
history_data_to_log['locked'] = "0"
@ -1262,7 +1262,7 @@ def Account_Migration_to_delete(diction):
new_data = val_tmp
del new_data['_id']
new_data['config_value'] = ""
new_data['date_update'] = ""
new_data['update_date'] = ""
new_data['partner_owner_recid'] = str(val['recid'])
key_data = {}

View File

@ -426,7 +426,7 @@ def Update_Evaluation_Planification(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -1197,7 +1197,7 @@ def Record_Participant_To_Evaluation(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
ret_val = MYSY_GV.dbname['note_evaluation_participant'].find_one_and_update(
@ -1224,7 +1224,7 @@ def Record_Participant_To_Evaluation(diction):
new_data['note'] = ""
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -2085,7 +2085,7 @@ def Update_Participant_Evaluation_Note(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -2194,7 +2194,7 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
is_warning = ""
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['publish'] = str(diction['publish_status'])

View File

@ -109,7 +109,7 @@ def Add_Evaluation_Type(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -193,7 +193,7 @@ def Update_Evaluation_Type(diction):
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}
@ -531,7 +531,7 @@ def Add_Class_UE_Evaluation(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -618,7 +618,7 @@ def Update_Class_UE_Evaluation(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -119,7 +119,7 @@ def Add_Paiement_Condition(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -225,7 +225,7 @@ def Update_Paiement_Condition(diction):
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -119,7 +119,7 @@ def Add_Update_Partner_Basic_Setup(diction):
my_data['related_collection'] = str(diction['related_collection'])
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
if( 'config_id' in diction.keys() and diction['config_id']):
config_id_count = MYSY_GV.dbname['base_partner_setup'].count_documents({'_id':ObjectId(str(diction['config_id'])),

View File

@ -487,7 +487,7 @@ def Add_Partner_Client(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
# Creation du RecId
@ -988,7 +988,7 @@ def Add_Partner_Prospect(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
# Creation du RecId
@ -1480,7 +1480,7 @@ def Update_Partner_Client(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
"""
@ -3096,7 +3096,7 @@ def Add_Client_Type(diction):
new_data = diction
del new_data['token']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['update_by'] = str(my_partner['_id'])
new_data['valide'] = "1"
@ -3202,7 +3202,7 @@ def Update_Client_Type(diction):
del new_data['token']
del new_data['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['partner_client_type'].update_one({'_id': ObjectId(str(local_id)),
@ -3615,7 +3615,7 @@ def Create_Partner_Client_Intranet_Account(diction):
new_client_data = {}
new_client_data['intranet_account_id'] = str(inserted_id)
new_client_data['date_update'] = str(now)
new_client_data['update_date'] = str(now)
new_client_data['update_by'] = str(my_partner['_id'])
ret_val = MYSY_GV.dbname['partner_client'].find_one_and_update(
@ -3848,7 +3848,7 @@ def Update_Pwd_Partner_Client_Intranet_Account(diction):
now = str(datetime.now())
new_data = {}
new_data['date_update'] = now
new_data['update_date'] = now
new_data['update_by'] = str(my_partner['_id'])
new_data['pwd'] = str(client_pwd)
@ -3954,7 +3954,7 @@ def Disable_Partner_Client_Intranet_Account(diction):
now = str(datetime.now())
new_data = {}
new_data['date_update'] = now
new_data['update_date'] = now
new_data['update_by'] = str(my_partner['_id'])
new_data['active'] = "0"
@ -4058,7 +4058,7 @@ def Enable_Partner_Client_Intranet_Account(diction):
now = str(datetime.now())
new_data = {}
new_data['date_update'] = now
new_data['update_date'] = now
new_data['update_by'] = str(my_partner['_id'])
new_data['active'] = "1"
@ -4132,7 +4132,7 @@ def archive_partner_client(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '1'
@ -4228,7 +4228,7 @@ def unarchive_partner_client(diction):
if (local_status is not True):
return local_status, my_partner
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['archive'] = '0'

View File

@ -289,7 +289,7 @@ def Add_Partner_Document(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
inserted_id = ""
@ -492,7 +492,7 @@ def Update_Partner_Document(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
"""
@ -742,7 +742,7 @@ def Update_Partner_Document_Super_Admin(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
"""
@ -2114,7 +2114,7 @@ def Duplicate_Given_Partner_Document(diction):
new_document = is_document_data
del new_document['_id']
new_document['date_update'] = str(datetime.now())
new_document['update_date'] = str(datetime.now())
new_document['update_by'] = str(my_partner['_id'])
new_document['type_doc'] = str(diction['type_doc'])
new_document['nom'] = str(diction['nom'])

View File

@ -531,7 +531,7 @@ def Invoice_Partner_Order(diction):
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(new_invoice_data_header['invoice_header_ref_interne'])
update_data['invoiced_date'] = new_invoice_data_header['invoice_date']
update_data['date_update'] = str(now)
update_data['update_date'] = str(now)
update_data['update_by'] = str(my_partner['_id'])
@ -1091,7 +1091,7 @@ def Invoice_Partner_Quotation(diction):
update_data['invoiced'] = "1"
update_data['invoiced_ref'] = str(new_invoice_data_header['invoice_header_ref_interne'])
update_data['invoiced_date'] = new_invoice_data_header['invoice_date']
update_data['date_update'] = str(now)
update_data['update_date'] = str(now)
update_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid': str(my_partner['recid']),
@ -1421,7 +1421,7 @@ def Get_Given_Partner_Invoice_Lines(diction):
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -1606,7 +1606,7 @@ def Get_Given_Partner_Invoice_Lines(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -1793,7 +1793,7 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -1975,7 +1975,7 @@ def Get_Given_Partner_Invoice_Lines_From_Invoice_ref_interne(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -2788,7 +2788,7 @@ def Get_Given_Line_Of_Partner_Invoice_Lines(diction):
user['valide'] = retval['valide']
user['locked'] = retval['locked']
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
@ -2940,7 +2940,7 @@ def Get_Given_Line_Of_Partner_Invoice_Lines(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -3275,7 +3275,7 @@ def GerneratePDF_Partner_Invoice(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
@ -3463,7 +3463,7 @@ def GerneratePDF_Partner_Invoice(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -3832,7 +3832,7 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
@ -4016,7 +4016,7 @@ def Send_Partner_Invoice_By_Email(tab_files, Folder, diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['update_by'] = str(my_partner['_id'])
user['partner_owner_recid'] = retval['partner_owner_recid']
user['invoice_line_type'] = retval['invoice_line_type']
@ -4687,7 +4687,7 @@ def Compute_Invoice_Order_Data(diction):
header_computed_data['order_header_tax_amount'] = str(round(line_sum_invoice_line_tax_amount, 3))
header_computed_data['total_header_toutes_taxes'] = str(round(global_order_amount_ttc, 3))
header_computed_data['date_update'] = str(datetime.now())
header_computed_data['update_date'] = str(datetime.now())
header_computed_data['update_by'] = str(my_partner['recid'])
@ -4776,7 +4776,7 @@ def Add_Update_Invoice_Annotation(diction):
return False, " L'identifiant de la facture est invalide ",
update_data = {}
update_data['date_update'] = str(datetime.now())
update_data['update_date'] = str(datetime.now())
update_data['update_by'] = str(my_partner['_id'])
update_data['partner_owner_recid'] = str(my_partner['recid'])
@ -4943,7 +4943,7 @@ def Create_Invoice_Avoir_Total(diction):
local_credit_note['invoice_header_ref_interne'] = credit_notes_reference
local_credit_note['invoice_header_type'] = "avoir"
local_credit_note['invoice_date'] = invoice_date_time
local_credit_note['date_update'] = str(datetime.now())
local_credit_note['update_date'] = str(datetime.now())
local_credit_note['update_by'] = str(my_partner['_id'])
local_credit_note['partner_owner_recid'] = str(my_partner['recid'])
@ -5021,7 +5021,7 @@ def Create_Invoice_Avoir_Total(diction):
local_credit_note_line['invoice_line_type'] = "avoir"
local_credit_note_line['invoice_date'] = invoice_date_time
local_credit_note_line['date_update'] = str(datetime.now())
local_credit_note_line['update_date'] = str(datetime.now())
local_credit_note_line['update_by'] = str(my_partner['_id'])
local_credit_note_line['partner_owner_recid'] = str(my_partner['recid'])
@ -5059,7 +5059,7 @@ def Create_Invoice_Avoir_Total(diction):
local_credit_note_line_detail['invoice_line_type'] = "avoir"
local_credit_note_line_detail['invoice_date'] = invoice_date_time
local_credit_note_line_detail['date_update'] = str(datetime.now())
local_credit_note_line_detail['update_date'] = str(datetime.now())
local_credit_note_line_detail['update_by'] = str(my_partner['_id'])
local_credit_note_line_detail['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -530,7 +530,7 @@ def Add_Partner_Order(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
print(" ### add_partner_order data = ", data)
@ -566,7 +566,7 @@ def Add_Partner_Order(diction):
order_line['order_header_ref_interne'] = str(data['order_header_ref_interne'])
order_line['valide'] = '1'
order_line['locked'] = '0'
order_line['date_update'] = str(datetime.now())
order_line['update_date'] = str(datetime.now())
order_line['partner_owner_recid'] = my_partner['recid']
order_line['order_line_type'] = "commande"
order_line['order_line_status'] = data['order_header_status']
@ -1088,7 +1088,7 @@ def Add_Partner_Quotation(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['is_validated'] = '0'
data['update_by'] = str(my_partner['recid'])
@ -1125,7 +1125,7 @@ def Add_Partner_Quotation(diction):
order_line['order_header_ref_interne'] = str(data['order_header_ref_interne'])
order_line['valide'] = '1'
order_line['locked'] = '0'
order_line['date_update'] = str(datetime.now())
order_line['update_date'] = str(datetime.now())
order_line['partner_owner_recid'] = my_partner['recid']
order_line['order_line_type'] = "devis"
order_line['order_line_status'] = data['order_header_status']
@ -1594,7 +1594,7 @@ def Update_Partner_Order_Header(diction):
### 1 - Mise à jour de l'entete
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
print(" ### Update_partner_order data = ", data)
@ -1633,7 +1633,7 @@ def Update_Partner_Order_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update':str(data['date_update'])}
'date_update':str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -1646,7 +1646,7 @@ def Update_Partner_Order_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -2111,7 +2111,7 @@ def Update_Partner_Quotation_Header(diction):
### 1 - Mise à jour de l'entete
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
print(" ### Update_partner_order data = ", data)
@ -2152,7 +2152,7 @@ def Update_Partner_Quotation_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -2166,7 +2166,7 @@ def Update_Partner_Quotation_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -2292,7 +2292,7 @@ def Closure_Partner_Quotation_Header(diction):
### 1 - Mise à jour de l'entete
data['order_header_status'] = str(diction['order_header_status'])
data['closure_reason'] = str(diction['closure_reason'])
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
print(" ### Update_partner_order data = ", data)
@ -2335,7 +2335,7 @@ def Closure_Partner_Quotation_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -2349,7 +2349,7 @@ def Closure_Partner_Quotation_Header(diction):
},
{
"$set": {"order_line_status": str(order_header_status), "order_line_type": str(my_order_data_previous_information['order_header_type']),
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -2667,7 +2667,7 @@ def Add_Update_Partner_Order_Line(diction):
str(inspect.stack()[0][3]) + " - La ligne à mettre à jour est invalide")
return False, "La ligne à mettre à jour est invalide",
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
inserted_data = MYSY_GV.dbname['partner_order_line'].find_one_and_update(
@ -2689,7 +2689,7 @@ def Add_Update_Partner_Order_Line(diction):
"""
local_update_data = {}
local_update_data['date_update'] = str(datetime.now())
local_update_data['update_date'] = str(datetime.now())
local_update_data['update_by'] = str(my_partner['_id'])
local_update_data['order_header_status'] = "0"
@ -2702,7 +2702,7 @@ def Add_Update_Partner_Order_Line(diction):
)
local_update_data = {}
local_update_data['date_update'] = str(datetime.now())
local_update_data['update_date'] = str(datetime.now())
local_update_data['update_by'] = str(my_partner['_id'])
local_update_data['order_line_status'] = "0"
@ -2718,7 +2718,7 @@ def Add_Update_Partner_Order_Line(diction):
# Il s'agit d'une creation d'une nouvelle ligne
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['partner_owner_recid'] = my_partner['recid']
data['update_by'] = str(my_partner['_id'])
@ -2737,7 +2737,7 @@ def Add_Update_Partner_Order_Line(diction):
local_update_data = {}
local_update_data['date_update'] = str(datetime.now())
local_update_data['update_date'] = str(datetime.now())
local_update_data['update_by'] = str(my_partner['_id'])
local_update_data['order_header_status'] = "0"
@ -2750,7 +2750,7 @@ def Add_Update_Partner_Order_Line(diction):
)
local_update_data = {}
local_update_data['date_update'] = str(datetime.now())
local_update_data['update_date'] = str(datetime.now())
local_update_data['update_by'] = str(my_partner['_id'])
local_update_data['order_line_status'] = "0"
@ -2909,7 +2909,7 @@ def Confirm_Partner_Order_Header_And_Lines(diction):
### 1 - Mise à jour de l'entete
# Recuperation des champs
data = {}
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['order_header_status'] = "1"
data['update_by'] = str(my_partner['_id'])
@ -2946,7 +2946,7 @@ def Confirm_Partner_Order_Header_And_Lines(diction):
},
{
"$set": {"order_line_status": "1",
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -3069,7 +3069,7 @@ def Annule_Partner_Order_Header_And_Lines(diction):
### 1 - Mise à jour de l'entete
# Recuperation des champs
data = {}
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['order_header_status'] = "-1"
print(" ### Update_partner_order data = ", data)
@ -3105,7 +3105,7 @@ def Annule_Partner_Order_Header_And_Lines(diction):
},
{
"$set": {"order_line_status": "-1",
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
print("acknowledged:", inserted_data_line.acknowledged)
@ -3832,7 +3832,7 @@ def Get_Given_Partner_Order_Lines(diction):
user['order_line_taux_taxe'] = "20"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -4003,7 +4003,7 @@ def Get_Given_Partner_Order_Lines(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -4184,7 +4184,7 @@ def Get_Given_Partner_Order_Lines_From_order_ref_interne(diction):
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -4349,7 +4349,7 @@ def Get_Given_Partner_Order_Lines_From_order_ref_interne(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -5070,7 +5070,7 @@ def Get_Given_Line_Of_Partner_Order_Lines(diction):
user['valide'] = retval['valide']
user['locked'] = retval['locked']
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -5242,7 +5242,7 @@ def Get_Given_Line_Of_Partner_Order_Lines(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -5506,7 +5506,7 @@ def Compute_Order_Header(diction):
header_computed_data['order_header_tax_amount'] = str(round(line_sum_order_line_tax_amount, 2))
header_computed_data['total_header_toutes_taxes'] = str(round(global_order_amount_ttc, 2))
header_computed_data['date_update'] = str(datetime.now())
header_computed_data['update_date'] = str(datetime.now())
#print(" ### header_computed_data = ", header_computed_data)
@ -5770,7 +5770,7 @@ def GerneratePDF_Partner_Order(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -5946,7 +5946,7 @@ def GerneratePDF_Partner_Order(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -6302,7 +6302,7 @@ def Gernerate_Stock_PDF_Partner_Order(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -6477,7 +6477,7 @@ def Gernerate_Stock_PDF_Partner_Order(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -6811,7 +6811,7 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -6984,7 +6984,7 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -7390,7 +7390,7 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
Mettre à jour la commande /devis pour dire que quand le document a été envoyé
"""
updata_data = {}
updata_data['date_update'] = str(datetime.now())
updata_data['update_date'] = str(datetime.now())
updata_data['update_by'] = str(my_partner['recid'])
updata_data['date_envoi_quotation'] = str(datetime.now())
@ -7614,7 +7614,7 @@ def Convert_Quotation_to_Order(diction):
On met la ref de nouvelle commande dans le champs 'related_order_internal_ref' = new_created_order['order_header_ref_interne']
"""
data_update = {}
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
data_update['order_header_status'] = "3"
data_update['related_order_internal_ref'] = new_created_order['order_header_ref_interne']
@ -7633,7 +7633,7 @@ def Convert_Quotation_to_Order(diction):
)
data_update = {}
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
data_update['order_line_status'] = "3"
data_update['related_order_internal_ref'] = new_created_order['order_header_ref_interne']
@ -7753,7 +7753,7 @@ def Order_Ready_To_Invoice(diction):
### 1 - Mise à jour de l'entete
# Recuperation des champs
data = {}
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['order_header_status'] = "2"
print(" ### Update_partner_order data = ", data)
@ -7789,7 +7789,7 @@ def Order_Ready_To_Invoice(diction):
},
{
"$set": {"order_line_status": "2",
'date_update': str(data['date_update'])}
'date_update': str(data['update_date'])}
})
"""print("raw:", inserted_data_line.raw_result)
@ -8032,7 +8032,7 @@ def Insert_Quotation_To_Session(diction):
"""
now = str(datetime.now())
update_data = {}
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = str(my_partner['_id'])
update_data['date_validation'] = now
update_data['date_reservation'] = now
@ -8374,7 +8374,7 @@ def Insert_Quotation_To_Session_From_Partner_Owner_Recid(diction):
"""
now = str(datetime.now())
update_data = {}
update_data['date_update'] = now
update_data['update_date'] = now
update_data['update_by'] = "client"
update_data['date_validation'] = now
update_data['date_reservation'] = now
@ -8799,7 +8799,7 @@ def Send_Quotation_Remind_Level1(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']
@ -8973,7 +8973,7 @@ def Send_Quotation_Remind_Level1(diction):
else:
user['order_line_montant_hors_taxes'] = "0"
user['date_update'] = retval['date_update']
user['update_date'] = retval['update_date']
user['partner_owner_recid'] = retval['partner_owner_recid']
user['order_line_type'] = retval['order_line_type']
user['order_line_status'] = retval['order_line_status']

View File

@ -118,7 +118,7 @@ def Add_Partner_Produit_Service(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -210,7 +210,7 @@ def Update_Partner_Produit_Service(diction):
del diction['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
data_cle = {}

View File

@ -279,14 +279,13 @@ def update_partner_main_mail(diction):
if (is_count_valide <= 0):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le compte partner_account_id :" + str(
partner_account_id) + " est invalide")
return False, " Le compte partner_account_id :" + str(partner_account_id) + " est invalide "
return False, " Le compte :" + str(partner_account_id) + " est invalide "
if (is_count_valide > 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le compte partner_account_id :" + str(
partner_account_id) + " correspond à plusieurs utilisateurs (" + str(is_count_valide) + ")")
return False, " Le compte partner_account_id :" + str(
partner_account_id) + " correspond à plusieurs utilisateurs "
return False, " Le compte : " + str(
partner_account_id) + " correspond à plusieurs utilisateurs. Veuillez contacter votre administrateur pour résoudre le problème. "
@ -318,7 +317,7 @@ def update_partner_main_mail(diction):
return False, " Les emails ne sont pas identiques"
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
coll_name = MYSY_GV.dbname['partnair_account']
@ -333,16 +332,16 @@ def update_partner_main_mail(diction):
if (ret_val and ret_val['_id']):
mycommon.myprint(str(inspect.stack()[0][3]) + "L'adresse mail du partenaire a bien ete mis à jour =" + str(ret_val['_id']))
return True, "L'adresse mail du partenaire a bien ete mis à jour"
return True, "Adresse e-mail du compte mise à jour avec succès."
else:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour l'adresse mail du partenaire recid= : " +str(partner_recid) )
return False, " Impossible de mettre à jour l'adresse mail du partenaire"
return False, " Impossible de mettre à jour l'adresse mail du compte"
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 mettre à jour l'adresse mail du partenaire"
return False, "Impossible de mettre à jour l'adresse mail du compte"
@ -424,7 +423,7 @@ def update_partner_pwd(diction):
return False, " Les mots de passe ne sont pas identiques "
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
#print(" ### QRY for update_partner_pwd ", {'_id':ObjectId(str(my_partner['_id'])), 'locked': '0', 'active': '1', 'pwd':mypwd})
@ -446,7 +445,7 @@ def update_partner_pwd(diction):
else:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour le mot de passe du partenaire recid= : " +str(partner_recid) )
return False, " Impossible de mettre à jour le mot de passe. Vérifiez les informations saisies"
return False, " Le mot de passe na pas pu être mis à jour. Merci de vérifier les informations renseignées et de réessayer.s"
"""
pres la modification du mot de passe dans Mysy, il faut voir si le partenaire
@ -475,12 +474,12 @@ def update_partner_pwd(diction):
3]) + " - La mise à jour du mot de passe dans le LMS a été faite également ")
return True, " Le mot de passe a bien été changé"
return True, " Mot de passe mis à jour avec succès."
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 mettre à jour le mot de passe du partenaire"
return False, "Le mot de passe na pas pu être mis à jour. Merci de vérifier les informations renseignées et de réessayer."
@ -580,7 +579,7 @@ def update_partner_insert_key(diction):
return False, "La nouvelle clé et la confirmation ne sont pas identiques"
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
#print(mydata)
@ -802,7 +801,7 @@ def update_partner_account(file_logo=None, file_cachet=None, Folder=None, dictio
if ("invoice_telephone" in diction.keys()):
mydata['invoice_telephone'] = diction['invoice_telephone']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
#print(str(datetime.now()) + " webservice : diction = " + str(mydata))
@ -1037,7 +1036,7 @@ def valide_partnair_account(value):
new_data = val_tmp
del new_data['_id']
new_data['config_value'] = ""
new_data['date_update'] = ""
new_data['update_date'] = ""
new_data['partner_owner_recid'] = str(ret_val['recid'])
key_data = {}
@ -1161,6 +1160,31 @@ def get_partner_account(diction):
user = retVal
"""
On va aller recuperer le nombre de compte utilisateur (partner_account), de formations , de session, d'inscrit
"""
nb_count_partner = MYSY_GV.dbname['partnair_account'].count_documents(
{'partner_owner_recid': str(retVal['recid'])})
nb_count_user = MYSY_GV.dbname['user_account'].count_documents(
{'partner_owner_recid': str(retVal['recid'])})
nb_count_class = MYSY_GV.dbname['myclass'].count_documents(
{'partner_owner_recid': str(retVal['recid'])})
nb_count_session = MYSY_GV.dbname['session_formation'].count_documents(
{'partner_owner_recid': str(retVal['recid']), })
nb_count_inscrit = MYSY_GV.dbname['inscription'].count_documents(
{'partner_owner_recid': str(retVal['recid']),
'status': {'$ne': '-1'}})
user['nb_partner_account'] = str(nb_count_partner)
user['nb_user_account'] = str(nb_count_user)
user['nb_class'] = str(nb_count_class)
user['nb_session'] = str(nb_count_session)
user['nb_inscrit'] = str(nb_count_inscrit)
lms_virtualhost_url = ""
if( "lms_virtualhost_url" in retVal.keys() ):
lms_virtualhost_url = retVal['lms_virtualhost_url']
@ -1232,6 +1256,12 @@ def get_partner_account(diction):
user['document_super_admin'] = document_super_admin
plateforme_super_admin = "0"
if (plateforme_super_admin and "plateforme_super_admin" in admin_partnair_account.keys()):
plateforme_super_admin = str(admin_partnair_account['plateforme_super_admin'])
user['plateforme_super_admin'] = plateforme_super_admin
RetObject.append(JSONEncoder().encode(user))
@ -1448,7 +1478,7 @@ def partner_login(diction):
tokenfield['partner_account_id'] = str(my_partner['_id'])
tokenfield['email'] = email
tokenfield['recid'] = partner_recid
tokenfield['date_update'] = str(datetime.now())
tokenfield['update_date'] = str(datetime.now())
tokenfield['valide'] = '1'
tokenfield['locked'] = '0'
tokenfield['start_date'] = str(datetime.now())
@ -1481,7 +1511,7 @@ def partner_login(diction):
mydata['valide'] = "1"
mydata['date_update'] = now
mydata['update_date'] = now
partner_key_secrete_key = ""
@ -1781,7 +1811,7 @@ def Lock_partner_account(diction):
return False, " L'identifiant du compte est invalide "
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "1"
new_data['active'] = "0"
@ -1846,7 +1876,7 @@ def UnLock_partner_account(diction):
return False, " L'identifiant du compte est invalide "
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
new_data['active'] = "1"
@ -2011,3 +2041,745 @@ def Update_Context_Partner_Account(diction):
return False, "Impossible de mettre à jour le contexte de connexion "
"""
Récuperer la liste des partenaires de la plateforme avec des filtres
"""
def Get_List_Plateforme_Partnaire_With_Filter(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'email', 'nom', '_id',
'locked', 'active']
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 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
is_plateforme_super_admin = "0"
if( "plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if( is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
filt_nom = {}
if ("nom" in diction.keys()):
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
filt_email = {}
if ("nom" in diction.keys()):
filt_email = {'email': {'$regex': str(diction['email']), "$options": "i"}}
filt_id = {}
if ("_id" in diction.keys()):
filt_id = {'_id': ObjectId(str(diction['_id']))}
filt_locked = {}
if ("locked" in diction.keys()):
filt_locked = {'locked': str(diction['locked'])}
filt_active = {}
if ("active" in diction.keys()):
filt_active = {'active': str(diction['active'])}
RetObject = []
val_tmp = 0
find_qry = {
'$and': [filt_nom,
filt_email, filt_id, filt_locked, filt_active, {'is_partner_admin_account':'1'}]}
print("### Get_List_Partnaire_With_Filter find_qry = ", find_qry)
exported_fields = {'nom':1, 'email':1, 'telephone':1, 'invoice_nom':1, 'invoice_email':1, 'invoice_telephone':1,
'contact_nom':1, 'contact_prenom':1, 'contact_tel':1, 'contact_mail':1, 'active':1, 'locked':1,
'lms_virtualhost_url':1, 'date_update':1, 'formation_initiale':1, 'adr_street':1, 'adr_zip':1,
'adr_city':1, 'adr_country':1, 'invoice_adr_street':1, 'invoice_adr_zip':1,
'invoice_adr_city':1, 'invoice_adr_country':1, 'pack_service':1, 'recid':1}
for retval in MYSY_GV.dbname['partnair_account'].find(find_qry, exported_fields).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
"""
On va aller recuperer le nombre de compte utilisateur (partner_account), de formations , de session, d'inscrit
"""
nb_count_partner = MYSY_GV.dbname['partnair_account'].count_documents(
{'partner_owner_recid': str(retval['recid'])})
nb_count_user = MYSY_GV.dbname['user_account'].count_documents(
{'partner_owner_recid': str(retval['recid'])})
nb_count_class = MYSY_GV.dbname['myclass'].count_documents(
{'partner_owner_recid': str(retval['recid'])})
nb_count_session = MYSY_GV.dbname['session_formation'].count_documents(
{'partner_owner_recid': str(retval['recid'])})
nb_count_inscrit = MYSY_GV.dbname['inscription'].count_documents(
{'partner_owner_recid': str(retval['recid'])})
user['nb_partner_account'] = str(nb_count_partner)
user['nb_user_account'] = str(nb_count_user)
user['nb_class'] = str(nb_count_class)
user['nb_session'] = str(nb_count_session)
user['nb_inscrit'] = str(nb_count_inscrit)
formation_initiale = "0"
formation_initiale_code = ""
if ("formation_initiale" in user.keys()):
if (user['formation_initiale'] == "1"):
formation_initiale_code = "F. Initiale"
formation_initiale = user['formation_initiale']
else:
formation_initiale_code = "F. Continue"
user['formation_initiale'] = formation_initiale
user['formation_initiale_code'] = formation_initiale_code
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 partenaires "
"""
Cette fonction permet de recuperer la liste des connexions liée à un partenaire
(que soit lui ou des utilisateur de partenaire)"""
def Get_Given_Plateforme_Partnaire_Connexion_Login_With_Filter(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'email', ]
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 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
is_plateforme_super_admin = "0"
if( "plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if( is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
filt_email = {}
if ("nom" in diction.keys()):
filt_email = {'email': {'$regex': str(diction['email']), "$options": "i"}}
RetObject = []
val_tmp = 0
find_qry = {
'$and': [filt_email, ]}
print("### Get_List_Partnaire_With_Filter find_qry = ", find_qry)
exported_fields = {'token':0, 'partner_account_id':0}
for retval in MYSY_GV.dbname['partnair_account'].find(find_qry, exported_fields).sort([("_id", pymongo.DESCENDING), ]):
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 connexions "
"""
Recuperer les données d'un partenaire à partir de son ID
"""
def get_partner_account_from_id(diction):
try:
# Dictionnaire des champs utilisables
field_list = ['token', '_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, requete annulée")
return False, " Impossible de récupérer les informations"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
On controle que les champs obligatoires sont presents dans la liste
'''
field_list_obligatoire = ['token', '_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, " Impossible de récupérer les informations"
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
is_plateforme_super_admin = "0"
if ("plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if (is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
# recuperation des paramettre
email_value = ""
token_value = ""
if diction['token']:
token_value = diction['token']
coll_name = MYSY_GV.dbname['partnair_account']
# Verification de la validité du token/mail dans le cas des user en mode connecté
retval = mycommon.check_partner_token_validity(email_value, token_value)
coll_token = MYSY_GV.dbname['partner_token']
tmp = coll_token.find({'token': str(token_value), 'valide': '1'})
partnere_recid = tmp[0]['recid']
parnter_account_id = tmp[0]['partner_account_id']
# print(" #### parters RECID = "+str(partnere_recid))
RetObject = []
for retVal in MYSY_GV.dbname['partnair_account'].find({'_id': ObjectId(str(diction['_id'])),}):
user = retVal
"""
On va aller recuperer le nombre de compte utilisateur (partner_account), de formations , de session, d'inscrit
"""
nb_count_partner = MYSY_GV.dbname['partnair_account'].count_documents({'partner_owner_recid':str(retVal['recid'])})
nb_count_user = MYSY_GV.dbname['user_account'].count_documents(
{'partner_owner_recid': str(retVal['recid'])})
nb_count_class = MYSY_GV.dbname['myclass'].count_documents(
{'partner_owner_recid': str(retVal['recid'])})
nb_count_session = MYSY_GV.dbname['session_formation'].count_documents(
{'partner_owner_recid': str(retVal['recid']),})
nb_count_inscrit = MYSY_GV.dbname['inscription'].count_documents(
{'partner_owner_recid': str(retVal['recid']),
'status':{'$ne':'-1'}})
user['nb_partner_account'] = str(nb_count_partner)
user['nb_user_account'] = str(nb_count_user)
user['nb_class'] = str(nb_count_class)
user['nb_session'] = str(nb_count_session)
user['nb_inscrit'] = str(nb_count_inscrit)
formation_initiale = "0"
formation_initiale_code = ""
if( "formation_initiale" in user.keys()):
if( user['formation_initiale'] == "1"):
formation_initiale_code = "F. Initiale"
formation_initiale = user['formation_initiale']
else:
formation_initiale_code = "F. Continue"
user['formation_initiale'] = formation_initiale
user['formation_initiale_code'] = formation_initiale_code
RetObject.append(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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer les informations"
"""
Verrouiller un partenaire, ainsi que les sous comptes associés ainsi que les formations associées
"""
def Lock_PF_partner_account_And_Sub_Accound_from_id(diction):
try:
# Dictionnaire des champs utilisables
field_list = ['token', '_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, requete annulée")
return False, " Impossible de récupérer les informations"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
On controle que les champs obligatoires sont presents dans la liste
'''
field_list_obligatoire = ['token', '_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, " Impossible de récupérer les informations"
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
is_plateforme_super_admin = "0"
if ("plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if (is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
"""
Le système ne permettra pas de verrouiller un compte 'is_plateforme_super_admin'.
On va donc verifier que le compte à verrouiller n'est pas un compte 'is_plateforme_super_admin'
"""
local_pf_partner_count = MYSY_GV.dbname['partnair_account'].count_documents(
{'_id': ObjectId(diction['_id']), 'is_partner_admin_account': '1'})
if( local_pf_partner_count != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du compte partenaire est invalide ")
return False, " L'identifiant du compte partenaire est invalide "
local_pf_partner_data = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(diction['_id']), 'is_partner_admin_account':'1'})
if( "plateforme_super_admin" in local_pf_partner_data.keys() and local_pf_partner_data['plateforme_super_admin'] == "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Ce compte est un super-administrateur de la plateforme et ne peut pas être verrouillé. ")
return False, " Ce compte est un super-administrateur de la plateforme et ne peut pas être verrouillé. ",
new_data = {}
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['lock_raison'] = "plateforme_admin"
new_data['locked'] = "1"
new_data['locked_date'] = str(datetime.now())
updated_partnair_account = MYSY_GV.dbname['partnair_account'].update_many(
{"$or": [ { 'partner_owner_recid': local_pf_partner_data['recid'], },
{'recid': local_pf_partner_data['recid'], }]},
{'$set': new_data}
)
if (updated_partnair_account.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise (partnair_account) à jour n'a été faite")
"""
Verrouiller les compte utilisateurs rattachés à ce compte user_account
"""
updated_user_account = MYSY_GV.dbname['user_account'].update_many(
{'partner_owner_recid': local_pf_partner_data['recid'], },
{'$set': new_data}
)
if (updated_user_account.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise à jour (user_account) n'a été faite")
"""
Verrouillage des formations
"""
updated_class = MYSY_GV.dbname['myclass'].update_many(
{'partner_owner_recid': local_pf_partner_data['recid'], },
{'$set': new_data}
)
if (updated_class.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise à jour (myclass) n'a été faite")
"""
# Ajout de l'evenement dans l'historique
"""
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'] = "partnair_account"
history_event_dict['related_collection_recid'] = str(diction['_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Compte verrouillé par ladministrateur de la plateforme. "
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, "Tous les comptes associés à ce partenaire ont été verrouillés."
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 verrouiller ce compte "
"""
Déverrouiller un partenaire, ainsi que les sous comptes associés ainsi que les formations associées
"""
def UnLock_PF_partner_account_And_Sub_Accound_from_id(diction):
try:
# Dictionnaire des champs utilisables
field_list = ['token', '_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, requete annulée")
return False, " Impossible de récupérer les informations"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
On controle que les champs obligatoires sont presents dans la liste
'''
field_list_obligatoire = ['token', '_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, " Impossible de récupérer les informations"
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
is_plateforme_super_admin = "0"
if ("plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if (is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
"""
Le système ne permettra pas de déverrouiller un compte 'is_plateforme_super_admin'.
On va donc verifier que le compte à verrouiller n'est pas un compte 'is_plateforme_super_admin'
"""
local_pf_partner_count = MYSY_GV.dbname['partnair_account'].count_documents(
{'_id': ObjectId(diction['_id']), 'is_partner_admin_account': '1'})
if( local_pf_partner_count != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du compte partenaire est invalide ")
return False, " L'identifiant du compte partenaire est invalide "
local_pf_partner_data = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(diction['_id']), 'is_partner_admin_account':'1'})
if( "plateforme_super_admin" in local_pf_partner_data.keys() and local_pf_partner_data['plateforme_super_admin'] == "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Ce compte est un super-administrateur de la plateforme et ne peut pas être verrouillé. ")
return False, " Ce compte est un super-administrateur de la plateforme et ne peut pas être verrouillé. ",
new_data = {}
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['lock_raison'] = ""
new_data['locked'] = "0"
new_data['locked_date'] = ""
updated_partnair_account = MYSY_GV.dbname['partnair_account'].update_many(
{"$or": [{'partner_owner_recid': local_pf_partner_data['recid'], },
{'recid': local_pf_partner_data['recid'], }]},
{'$set': new_data}
)
if (updated_partnair_account.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise à jour (updated_partnair_account) n'a été faite")
"""
Verrouiller les compte utilisateurs rattachés à ce compte user_account
"""
updated_user_account = MYSY_GV.dbname['user_account'].update_many(
{'partner_owner_recid': local_pf_partner_data['recid'], 'lock_raison':'plateforme_admin'},
{'$set': new_data}
)
if (updated_user_account.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise à jour (user_account) n'a été faite")
"""
Verrouillage des formations
"""
updated_class = MYSY_GV.dbname['myclass'].update_many(
{'partner_owner_recid': local_pf_partner_data['recid'], 'lock_raison':'plateforme_admin'},
{'$set': new_data}
)
if (updated_class.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise à jour (myclass) n'a été faite")
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'] = "partnair_account"
history_event_dict['related_collection_recid'] = str(diction['_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Compte déverrouillé par ladministrateur de la plateforme. "
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, "Tous les comptes associés à ce partenaire ont été déverrouillés."
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 verrouiller ce compte "
"""
Cette fonction permet de passer un compte de 'formation continue' a 'formation initiale' ou inversement
"""
def Change_PF_partner_account_Type_Licence_from_id(diction):
try:
# Dictionnaire des champs utilisables
field_list = ['token', '_id', 'formation_initiale']
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, requete annulée")
return False, " Impossible de récupérer les informations"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
On controle que les champs obligatoires sont presents dans la liste
'''
field_list_obligatoire = ['token', '_id', 'formation_initiale']
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, " Impossible de récupérer les informations"
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
if( diction['formation_initiale'] not in ['0', '1']):
mycommon.myprint(str(inspect.stack()[0][
3]) + " Impossible de determiner l'action à réaliser ")
return False, " Impossible de determiner l'action à réaliser "
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
is_plateforme_super_admin = "0"
if ("plateforme_super_admin" in my_partner.keys()):
is_plateforme_super_admin = my_partner['plateforme_super_admin']
if (is_plateforme_super_admin != "1"):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ")
return False, " Vous ne disposez pas des droits nécessaires pour accéder à cette fonctionnalité. ",
"""
Le système de changer de type de licence uniquement au niveau d'un compte "is_partner_admin_account"
"""
local_pf_partner_count = MYSY_GV.dbname['partnair_account'].count_documents(
{'_id': ObjectId(diction['_id']), 'is_partner_admin_account': '1'})
if( local_pf_partner_count != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du compte partenaire est invalide ")
return False, " L'identifiant du compte partenaire est invalide "
new_data = {}
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['formation_initiale'] = diction['formation_initiale']
updated_partnair_account = MYSY_GV.dbname['partnair_account'].update_many(
{'_id': ObjectId(diction['_id']) },
{'$set': new_data}
)
if (updated_partnair_account.modified_count <= 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " WARNING - Aucune mise (partnair_account) à jour n'a été faite")
"""
# Ajout de l'evenement dans l'historique
"""
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'] = "partnair_account"
history_event_dict['related_collection_recid'] = str(diction['_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = " Changement de licence : 'formation_initiale' = "+str(diction['formation_initiale'])+" "
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, "Tous les comptes associés à ce partenaire ont été verrouillés."
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 changer le type de licence de ce compte "

View File

@ -0,0 +1,751 @@
"""
Ce document permet de gerer les pole d'activité pédagogique
Un pole dactivité, assimilé à la notion de fonction est définit par :
- Code,
- Description,
- Commentaire,
- Liste des activités pédagogiques associées,
"""
from operator import itemgetter
import bson
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
import prj_common as mycommon
import secrets
import inspect
import sys, os
import csv
import pandas as pd
from pymongo import ReturnDocument
import GlobalVariable as MYSY_GV
from math import isnan
import GlobalVariable as MYSY_GV
import ela_index_bdd_classes as eibdd
import email_mgt as email
import jinja2
from flask import send_file
from xhtml2pdf import pisa
from email.message import EmailMessage
from email.mime.text import MIMEText
from email import encoders
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
"""
Fonction d'ajouter un pole d'activité pedagogique ou fonction
"""
def Add_pole_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'commentaire', 'code',]
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', 'code' ]
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 que ce code de tache n'est pas déjà utilisé
"""
is_pole_activite_pedagogique_code_used = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_pole_activite_pedagogique_code_used != 0 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code "+str(diction['code'])+" est déjà utilisé ")
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
mydata = {}
mydata = diction
del mydata['token']
# Initialisation des champs non envoyés à vide
for val in field_list:
if val not in diction.keys():
mydata[str(val)] = ""
mydata['creation_date'] = str(datetime.now())
mydata['creation_by'] = str(my_partner['_id'])
mydata['creation_by'] = str(my_partner['_id'])
mydata['tab_bloc_competence'] = []
mydata['tab_bloc_activite'] = []
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
mydata['locked'] = "0"
inserted_id = MYSY_GV.dbname['pole_activite_pedagogique'].insert_one(mydata).inserted_id
if (not inserted_id):
mycommon.myprint(" Impossible de créer la tâche pédagogique (2) ")
return False, " Impossible de créer la tâche pédagogique (2) "
return True, " Le pôle d'activité pédagogique a été correctement ajouté "
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 créer le pôle d'activité pédagogique "
"""
Fonction de mise à jour d'un pole d'activité pedagogique ou fonction
"""
def Update_pole_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'pole_activite_pedagogique_id', 'commentaire', 'code',
]
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', 'pole_activite_pedagogique_id', 'code']
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 que le code du pole d'activité n'est pas utilisé par une autre compétence autre que celle ci
"""
is_competence_code_used = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'code': str(diction['code']),
'valide': '1',
'_id':{'$ne':ObjectId(str(diction['pole_activite_pedagogique_id']))},
'partner_owner_recid': str(
my_partner['recid'])})
if (is_competence_code_used != 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code " + str(diction['code']) + " est déjà utilisé ")
return False, " Le code " + str(diction['code']) + " est déjà utilisé "
# Verifier que la compétence existe et est valide
is_valide_pole_activite_pedagogique_id = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['pole_activite_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_pole_activite_pedagogique_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du pôle d'activité est invalide ")
return False, " L'identifiant du pôle d'activité est invalide "
mydata = {}
mydata = diction
del mydata['token']
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['pole_activite_pedagogique'].find_one_and_update(
{'_id':ObjectId(str(diction['pole_activite_pedagogique_id'])),
'partner_owner_recid':str(my_partner['recid'])},
{"$set": mydata},
upsert=False,
return_document=ReturnDocument.AFTER
)
if ("_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour le pôle d'activité pédagogique (2) ")
return False, " Impossible de mettre à jour le pôle d'activité pédagogique (2) "
return True, " Le pôle d'activité pédagogique a é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 de mettre à jour le pôle d'activité pédagogique "
"""
Recuperer la liste des pole d'activite pedagogique d'un partenaire, sans filtres
"""
def Get_pole_activite_pedagogique_no_filter(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'est pas autorisé")
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 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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
for New_retVal in MYSY_GV.dbname['pole_activite_pedagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
user = New_retVal
if( "code" not in user.keys() ):
user["code"] = "--"
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 pôle d'activités pédagogiques "
"""
Recuperer les données d'un pole d'activite pedagogique d'un partenaire,
"""
def Get_Given_pole_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'pole_activite_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'pole_activite_pedagogique_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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', '_id':ObjectId(str(diction['pole_activite_pedagogique_id']))}
for New_retVal in MYSY_GV.dbname['pole_activite_pedagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
user = New_retVal
if( "code" not in user.keys() ):
user["code"] = "--"
tab_activite_pedagogique_with_code = []
if ("tab_activite_pedagogique" in New_retVal.keys()):
for activite_pedago in New_retVal['tab_activite_pedagogique']:
activite_pedago_data = MYSY_GV.dbname['activite_pedagogique'].find_one(
{'_id': ObjectId(str(activite_pedago['_id'])), 'valide': '1'},
{'_id': 1, 'code': 1, 'description': 1, })
if ("rang" in activite_pedago.keys()):
activite_pedago_data['rang'] = str(activite_pedago['rang'])
else:
activite_pedago_data['rang'] = "99"
tab_activite_pedagogique_with_code.append(activite_pedago_data)
print("tab_activite_pedagogique_with_code = ", tab_activite_pedagogique_with_code)
ss = sorted(tab_activite_pedagogique_with_code, key=itemgetter('rang'))
user['tab_activite_pedagogique_with_code'] = tab_activite_pedagogique_with_code
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 les données du pôle d'activités pédagogiques "
"""
Suppression d'un pole activite pedagogique
"""
def Delete_Given_pole_activite_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'pole_activite_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'pole_activite_pedagogique_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
qry = {'_id':ObjectId(str(diction['pole_activite_pedagogique_id'])), 'partner_owner_recid':str(my_partner['recid'])}
ret_del_competence = MYSY_GV.dbname['pole_activite_pedagogique'].delete_many(qry)
return True, "la tâche pédagogique 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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer le pôle d'activité pédagogique "
"""
Ajouter une liste d'activités pédagogiques à un pole d'activité
"""
def Add_Update_tab_Activite_To_Pole_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'pole_activite_id', 'activite_pedagogique_id', 'rang', ]
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', 'pole_activite_id', 'activite_pedagogique_id', 'rang',]
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
if ("rang" in diction.keys()):
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
if (local_status is False):
mycommon.myprint(
" Le rang doit être un nombre entier ")
return False, " Le rang doit être un nombre entier"
"""
Verifier la validité du pole d'activité
"""
is_valide_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id':ObjectId(diction['pole_activite_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_pole_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du pôle d'activité est invalide ")
return False, " L'identifiant du pôle d'activité est invalide "
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de l'activité "+str(diction['tache_pedagogique_id'])+" est invalide ")
return False, " L'identifiant de l'actvité "+str(diction['tache_pedagogique_id'])+" est invalide "
tab_tache_pedagogique = []
tab_tache_pedagogique.append(str(diction['activite_pedagogique_id']))
for activite_id in tab_tache_pedagogique:
"""
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
si non on fait une insertion
"""
is_activite_existe_in_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['pole_activite_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid']),
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
})
if( is_activite_existe_in_pole_activite == 1):
print(" OUII existe, donc update")
update = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
'valide': '1',
'locked':'0',
'partner_owner_recid': str(my_partner['recid']),
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
},
{'$set':
{
'tab_activite_pedagogique.$[xxx].rang': str( diction['rang']),
'tab_activite_pedagogique.$[xxx].update_date': str( datetime.now()),
'tab_activite_pedagogique.$[xxx].update_by': str(my_partner['_id']),
}
},
upsert=False,
array_filters=[
{"xxx._id": ObjectId(str(activite_id))},
]
)
elif( is_activite_existe_in_pole_activite == 0):
print(" NOOO existe, donc insert")
new_data = {}
new_data['_id'] = ObjectId(str(activite_id))
new_data['rang'] = str(diction['rang'])
new_data['valide'] = "1"
new_data['creation_by'] = str(my_partner['_id'])
new_data['creation_date'] = str(datetime.now())
new_data['locked'] = "0"
insert = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid']),
},
{
'$push': {
"tab_activite_pedagogique": {
'$each': [new_data]
}
}
},
)
return True, " La mise à jour a été correctement faite "
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 faire la mise à jour "
"""
Supprimer une activité d'un pole
"""
def Delete_Activite_From_Pole_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'pole_activite_id', 'activite_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'pole_activite_id', 'activite_pedagogique_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
if ("rang" in diction.keys()):
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
if (local_status is False):
mycommon.myprint(
" Le rang doit être un nombre entier ")
return False, " Le rang doit être un nombre entier"
"""
Verifier la validité du pole d'activité
"""
is_valide_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id':ObjectId(diction['pole_activite_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_pole_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du pôle d'activité est invalide ")
return False, " L'identifiant du pôle d'activité est invalide "
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_activite != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant de l'activité "+str(diction['tache_pedagogique_id'])+" est invalide ")
return False, " L'identifiant de l'actvité "+str(diction['tache_pedagogique_id'])+" est invalide "
tab_tache_pedagogique = []
tab_tache_pedagogique.append(str(diction['activite_pedagogique_id']))
for activite_id in tab_tache_pedagogique:
"""
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
si non on fait une insertion
"""
is_activite_existe_in_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['pole_activite_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid']),
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
})
if( is_activite_existe_in_pole_activite == 1):
print(" OUII existe, donc update")
update = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
'valide': '1',
'locked':'0',
'partner_owner_recid': str(my_partner['recid']),
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
},
{'$pull': {"tab_activite_pedagogique": {
"_id": ObjectId(str(activite_id))}}},
)
return True, " L'activité a été correctement supprimé "
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'activité du pôle "

View File

@ -1861,7 +1861,7 @@ def recordImage(file=None, Folder=None, diction=None):
new_diction['type'] = 'profil'
new_diction['recid'] = myuserrecid
new_diction['valide'] = '1'
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['locked'] = "0"
ret_val = coll_name.find_one_and_update({"recid":myuserrecid, "valide":"1", "locked":"0"},
@ -1966,7 +1966,7 @@ def recordClassImage(file=None, Folder=None, diction=None):
new_diction['recid'] = myuserrecid
new_diction['class_external_code'] = myclassexternalcode
new_diction['valide'] = '1'
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['locked'] = "0"
new_diction['partner_owner_recid'] = str(my_partner['recid'])
@ -2098,7 +2098,7 @@ def recordClassImage_v2(file=None, Folder=None, diction=None):
new_diction['related_collection'] = related_collection
new_diction['related_collection_recid'] = related_collection_recid
new_diction['valide'] = '1'
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['locked'] = "0"
new_diction['recid'] = image_recid
new_diction['type_img'] = type_img
@ -2283,7 +2283,14 @@ def getRecodedImage(diction=None):
for retVal in coll_name.find({'recid':myuserrecid, "type":"profil"} ):
user2={}
user2['date_update'] = retVal['date_update']
if ("date_update" in retVal.keys()):
user2['update_date'] = retVal['date_update']
if( "update_date" in retVal.keys()):
user2['update_date'] = retVal['update_date']
decode = retVal['img'].decode()
user2['img'] = decode
data1 = json.loads(json.dumps(user2))
@ -2386,7 +2393,7 @@ def getRecodedClassImage(diction=None):
'related_collection_recid':str(diction['related_collection_recid']),
"related_collection":str(diction['related_collection'])} ):
user2={}
user2['date_update'] = retVal['date_update']
user2['update_date'] = retVal['update_date']
decode = retVal['img'].decode()
user2['img'] = decode
data1 = json.loads(json.dumps(user2))
@ -2463,7 +2470,7 @@ def getRecodedClassImage_no_token(diction=None):
'related_collection_recid':str(diction['related_collection_recid']),
"related_collection":str(diction['related_collection'])} ):
user2={}
user2['date_update'] = retVal['date_update']
user2['update_date'] = retVal['update_date']
decode = retVal['img'].decode()
user2['img'] = decode
data1 = json.loads(json.dumps(user2))
@ -2617,7 +2624,7 @@ def getRecodedClassImage_from_front(diction=None):
for retVal in coll_name.find({"type":"profil_class", "class_external_code":str(myclassexternalcode)} ):
user2={}
user2['date_update'] = retVal['date_update']
user2['update_date'] = retVal['update_date']
decode = retVal['img'].decode()
user2['img'] = decode
data1 = json.loads(json.dumps(user2))
@ -2945,11 +2952,11 @@ def InsertStatistic(diction_class, type_view, user_location):
mydata = {}
mydata['internal_url'] = diction_class['internal_url']
mydata['date_update'] = datetime.now()
mydata['update_date'] = datetime.now()
mydata['type_view'] = str(type_view)
mydict_combined = {**diction_class, **mydata, **user_location}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
@ -3147,7 +3154,7 @@ def UserEmargementValidation(diction):
now = datetime.now()
mydata = {}
mydata['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['statut'] = "2"
mydata['is_present'] = True
mydata['date_emargement'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
@ -5690,7 +5697,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
'partner_owner_recid':'default', 'valide':'1',
'locked':'0'}, ):
new_courrier = my_courrier_data
new_courrier['date_update'] = str(datetime.now())
new_courrier['update_date'] = 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'])
@ -5718,7 +5725,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
'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_date'] = 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'])
@ -5747,7 +5754,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -5775,7 +5782,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = 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'])
@ -5798,7 +5805,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_paiement_cdtion['update_by'] = str(my_partner_data['_id'])
new_paiement_cdtion['partner_owner_recid'] = str(my_partner_data['recid'])
@ -5817,7 +5824,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
cpt = 0
new_site_formation_default = {}
new_site_formation_default['date_update'] = str(datetime.now())
new_site_formation_default['update_date'] = 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'])
@ -5905,7 +5912,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -5930,7 +5937,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -5955,7 +5962,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -5980,7 +5987,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -6005,7 +6012,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
{'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_date'] = str(datetime.now())
new_step_session['update_by'] = str(my_partner_data['_id'])
new_step_session['partner_owner_recid'] = str(my_partner_data['recid'])
@ -7755,7 +7762,7 @@ def Add_Update_Email_To_Newsletter(diction):
new_data = {}
new_data['email'] = str(diction['email']).strip()
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['creation_date'] = str(datetime.now())
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -8218,10 +8225,7 @@ def Push_Document_To_ENT_For_Inscrit(tab_files, Folder, diction):
if (my_company_data and "nom" in my_company_data.keys() and my_company_data['nom']):
company_name = my_company_data['nom']
if (company_name):
msg['From'] = str(company_name) + " <" + str(partner_SMTP_COUNT_From_User) + ">"
else:
msg['From'] = str(partner_SMTP_COUNT_From_User)
msg['From'] = str(partner_SMTP_COUNT_From_User)
msg['Bcc'] = "contact@mysy-training.com"

View File

@ -130,7 +130,7 @@ def Add_Group_Purchase_Price(diction):
new_data['locked'] = "0"
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['update_by'] = str(my_partner['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
inserted_id = ""
inserted_id = MYSY_GV.dbname['purchase_prices'].insert_one(new_data).inserted_id
@ -242,7 +242,7 @@ def Update_Group_Purchase_Price(diction):
del new_data['token']
del new_data['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
update = MYSY_GV.dbname['purchase_prices'].update_one({'_id': ObjectId(str(local_id)),

View File

@ -209,7 +209,7 @@ def Update_Ref_Pedagogique(diction):
del mydata['_id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['referentiel_padagogique'].find_one_and_update(

View File

@ -138,7 +138,7 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
inserted_id = ""
@ -169,7 +169,7 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
data_to_add['write'] = True
data_to_add['valide'] = "1"
data_to_add['locked'] = "0"
data_to_add['date_update'] = str(datetime.now())
data_to_add['update_date'] = str(datetime.now())
@ -282,7 +282,7 @@ def PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
inserted_id = ""
@ -314,7 +314,7 @@ def PROD_Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
data_to_add['write'] = True
data_to_add['valide'] = "1"
data_to_add['locked'] = "0"
data_to_add['date_update'] = str(datetime.now())
data_to_add['update_date'] = str(datetime.now())
@ -690,7 +690,7 @@ def Add_Ressource_Humaine(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
data['is_partner_admin_account'] = "0"
@ -1077,7 +1077,7 @@ def Update_Ressource_Humaine(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
"""
@ -3396,7 +3396,7 @@ def Add_Affectation_Ressource_Humaine_Poste(diction):
my_data['date_au'] = str(date_au)
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
my_data['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
my_data['update_by'] = str(my_partner_data['_id'])
@ -3562,7 +3562,7 @@ def Update_Affectation_Ressource_Humaine_Poste(diction):
update_data['related_target_collection_id'] = str(related_target_collection_id)
update_data['related_target_collection'] = str(related_target_collection)
update_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
update_data['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
update_data['update_by'] = str(my_partner_data['_id'])
@ -4011,7 +4011,7 @@ def Add_Update_Employee_Login_Pass(diction):
else:
mydata['mysy_lms_user_id'] = ""
"""
mydata['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
mydata['active'] = '1'
@ -4420,7 +4420,7 @@ def Add_Employee_Contrat(diction):
new_data = diction
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -4701,7 +4701,7 @@ def Update_Employee_Contrat(diction):
del new_data['_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['recid'])
@ -5563,7 +5563,7 @@ def Add_Update_RH_Competence(diction):
else:
# Il s'agit de la creation d'une competence
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['valide'] = "1"
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"

View File

@ -322,7 +322,7 @@ def Add_Ressource_Materielle(diction):
data['valide'] = '1'
data['locked'] = '0'
data['date_update'] = str(datetime.now())
data['update_date'] = str(datetime.now())
data['update_by'] = str(my_partner['_id'])
# Creation du RecId
@ -652,7 +652,7 @@ def Update_Ressource_Materielle(diction):
data_update['valide'] = '1'
data_update['locked'] = '0'
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
"""
Clés de mise à jour
@ -1552,7 +1552,7 @@ def Add_Affectation_Ressource_Materielle_Poste(diction):
my_data['date_au'] = str(date_au)
my_data['valide'] = "1"
my_data['locked'] = "0"
my_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
my_data['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
inserted_data = MYSY_GV.dbname['ressource_materielle_affectation'].insert_one(my_data)
@ -1714,7 +1714,7 @@ def Update_Affectation_Ressource_Materielle_Poste(diction):
update_data['related_target_collection_id'] = str(related_target_collection_id)
update_data['related_target_collection'] = str(related_target_collection)
update_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
update_data['update_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
# Verifier l'existance de l'affectation

View File

@ -119,7 +119,7 @@ def Add_Site_Formation(diction):
mydata[str(val)] = ""
mydata['code_site'] = str(diction['code_site']).lower()
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
@ -221,7 +221,7 @@ def Update_Site_Formation(diction):
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
print(" ### mydata = ", mydata)

View File

@ -515,7 +515,7 @@ def Update_Stage_Inscrit(diction):
del diction['stage_id']
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
@ -630,8 +630,8 @@ def Lock_Unlock_Stage_Inscrit(diction):
stage_id = str(diction['stage_id'])
new_data = {}
new_data['date_update'] = str(datetime.now())
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['statut'] = str(diction['statut'])

View File

@ -686,7 +686,7 @@ def create_subscription(diction):
abonnement_data['status'] = subscription['status']
now = datetime.now()
abonnement_data['date_update'] = str(now)
abonnement_data['update_date'] = str(now)
ret_val_abonnement = MYSY_GV.dbname['abonnement'].find_one_and_update(
{'stripe_subscription_id': str(ret_val['_id']), },

View File

@ -270,7 +270,7 @@ def Add_Suivi_Pedagogique(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -628,7 +628,7 @@ def Update_Suivi_Pedagogique(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -523,7 +523,7 @@ def Record_Survey_Data_No_Token(diction):
On va enregister les reponse et changer le statut
"""
mydata = {}
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['date_reponse'] = str(datetime.now())
mydata['statut'] = "2"
mydata['user_response'] = global_response
@ -6085,7 +6085,7 @@ def Create_Evaluation_QR_Code_From_Survey(diction):
data_update = {}
data_update['update_by'] = str(my_partner['_id'])
data_update['date_update'] = str(datetime.now())
data_update['update_date'] = str(datetime.now())
data_update['statut'] = "1"
data_update['date_envoi'] = now
data_update['mode_envoi'] = "qr"

364
tache_pedagogique.py Normal file
View File

@ -0,0 +1,364 @@
"""
Ce document permet de gerer les taches_pedagogique
- code
- description
- commentaire
"""
import bson
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
import prj_common as mycommon
import secrets
import inspect
import sys, os
import csv
import pandas as pd
from pymongo import ReturnDocument
import GlobalVariable as MYSY_GV
from math import isnan
import GlobalVariable as MYSY_GV
import ela_index_bdd_classes as eibdd
import email_mgt as email
import jinja2
from flask import send_file
from xhtml2pdf import pisa
from email.message import EmailMessage
from email.mime.text import MIMEText
from email import encoders
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
"""
Fonction d'ajouter d'une tache pedagogique
"""
def Add_tache_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'commentaire', 'code',]
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', 'code' ]
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 que ce code de tache n'est pas déjà utilisé
"""
is_tache_pedagogique_code_used = MYSY_GV.dbname['tache_pedagogique'].count_documents({'code':str(diction['code']),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_tache_pedagogique_code_used != 0 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code "+str(diction['code'])+" est déjà utilisé ")
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
mydata = {}
mydata = diction
del mydata['token']
# Initialisation des champs non envoyés à vide
for val in field_list:
if val not in diction.keys():
mydata[str(val)] = ""
mydata['creation_date'] = str(datetime.now())
mydata['creation_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
mydata['locked'] = "0"
inserted_id = MYSY_GV.dbname['tache_pedagogique'].insert_one(mydata).inserted_id
if (not inserted_id):
mycommon.myprint(" Impossible de créer la tâche pédagogique (2) ")
return False, " Impossible de créer la tâche pédagogique (2) "
return True, " la tâche pédagogique a été correctement ajoutée "
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 créer la tâche pédagogique "
"""
Fonction de mise à jour d'une activité pédagogique
"""
def Update_tache_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'description', 'tache_pedagogique_id', 'commentaire', 'code',
]
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', 'tache_pedagogique_id', 'code']
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 que le code de compétence n'est pas utilisé par une autre compétence autre que celle ci
"""
is_competence_code_used = MYSY_GV.dbname['tache_pedagogique'].count_documents({'code': str(diction['code']),
'valide': '1',
'_id':{'$ne':ObjectId(str(diction['tache_pedagogique_id']))},
'partner_owner_recid': str(
my_partner['recid'])})
if (is_competence_code_used != 0):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le code " + str(diction['code']) + " est déjà utilisé ")
return False, " Le code " + str(diction['code']) + " est déjà utilisé "
# Verifier que la compétence existe et est valide
is_valide_tache_pedagogique_id = MYSY_GV.dbname['tache_pedagogique'].count_documents({'_id':ObjectId(str(diction['tache_pedagogique_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_tache_pedagogique_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'activité est invalide ")
return False, " L'identifiant de l'activité est invalide "
mydata = {}
mydata = diction
del mydata['token']
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['tache_pedagogique'].find_one_and_update(
{'_id':ObjectId(str(diction['tache_pedagogique_id'])),
'partner_owner_recid':str(my_partner['recid'])},
{"$set": mydata},
upsert=False,
return_document=ReturnDocument.AFTER
)
if ("_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour la tâche pédagogique (2) ")
return False, " Impossible de mettre à jour la tâche pédagogique (2) "
return True, " la tâche pédagogique a été correctement mise à 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 de mettre à jour la tâche pédagogique "
"""
Recuperer la liste des activite pedagogique d'un partenaire, sans filtres
"""
def Get_tache_pedagogique_no_filter(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'est pas autorisé")
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 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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
for New_retVal in MYSY_GV.dbname['tache_pedagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
user = New_retVal
if( "code" not in user.keys() ):
user["code"] = "--"
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 tâches pédagogiques "
"""
Suppression d'une activite pedagogique
"""
def Delete_Given_tache_pedagogique(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'tache_pedagogique_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'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'tache_pedagogique_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
qry = {'_id':ObjectId(str(diction['tache_pedagogique_id'])), 'partner_owner_recid':str(my_partner['recid'])}
ret_del_competence = MYSY_GV.dbname['tache_pedagogique'].delete_many(qry)
return True, "la tâche pédagogique 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) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer la tâche pédagogique "

View File

@ -455,7 +455,7 @@ def mysy_openai_insert_voice_to_collection(diction):
new_data['valide'] = '1'
new_data['locked'] = '0'
new_data['date_create'] = str(datetime.now())
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
if( local_status):
new_data['action'] = str(local_retval_action)
@ -712,7 +712,7 @@ def mysy_openai_confirme_voice_instruction(diction):
new_data['valide'] = '0'
new_data['locked'] = '0'
new_data['update_by'] = str(my_partner['_id'])
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
result = MYSY_GV.dbname['voice_instruction'].find_one_and_update(
{'_id': ObjectId(str(diction['instruction_id'])),

View File

@ -2211,7 +2211,7 @@ def JMJ_Repise_Factures(diction):
partner_invoice_header_data['valide'] = "1"
partner_invoice_header_data['locked'] = "0"
partner_invoice_header_data['partner_owner_recid'] = str(diction['partner_owner_recid'])
partner_invoice_header_data['date_update'] = str(datetime.now())
partner_invoice_header_data['update_date'] = str(datetime.now())
print(" #### partner_invoice_header_data = ", partner_invoice_header_data)
inserted_invoice_id = MYSY_GV.dbname['partner_invoice_header'].insert_one(partner_invoice_header_data).inserted_id

View File

@ -149,7 +149,7 @@ def Add_Unite_Enseignement(diction):
3]) + " L'identifiant de la règle de calcul de la note de l'UE est invalide ")
return False, " L'identifiant de la règle de calcul de la note de l'UE est invalide "
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
mydata['partner_owner_recid'] = str(my_partner['recid'])
mydata['valide'] = "1"
@ -276,7 +276,7 @@ def Update_Unite_Enseignement(diction):
del mydata['_id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['unite_enseignement'].find_one_and_update(
@ -1237,7 +1237,7 @@ def Add_Update_Unite_Enseignement_Planif(diction):
return False, "Le volume horaire est invalide "
now = str(datetime.now())
mydata['date_update'] = now
mydata['update_date'] = now
mydata['valide'] = "1"
mydata['locked'] = "0"
mydata['partner_owner_recid'] = str(my_partner['recid'])

View File

@ -133,7 +133,7 @@ def Add_Update_User_Access_Right(diction):
my_data['valide'] = '1'
my_data['update_by'] = str(my_partner['_id'])
my_data['date_update'] = str(datetime.now())
my_data['update_date'] = str(datetime.now())
my_data['module'] = module_access['module_name']
@ -568,7 +568,7 @@ def Add_Update_User_Access_Scope(diction):
new_data['scope']['class_id'] = tab_scope_class
new_data['scope']['session_id'] =tab_scope_session
new_data['date_update'] = str(datetime.now())
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])

View File

@ -178,7 +178,7 @@ def add_user_message(diction):
new_diction['user_recid'] = user_recid
new_diction['sent'] = '0'
new_diction['valide'] = '1'
new_diction['date_update'] = str(datetime.now())
new_diction['update_date'] = str(datetime.now())
new_diction['locked'] = "0"

View File

@ -122,7 +122,7 @@ def login(diction):
tokenfield['token'] = my_token
tokenfield['email'] = email
tokenfield['recid'] = user_recid
tokenfield['date_update'] = str(datetime.now())
tokenfield['update_date'] = str(datetime.now())
tokenfield['start_date'] = str(datetime.now())
tokenfield['valide'] = '1'
tokenfield['locked'] = '0'
@ -275,7 +275,7 @@ def login_intranet_client(diction):
tokenfield['token'] = my_token
tokenfield['email'] = email
tokenfield['recid'] = user_recid
tokenfield['date_update'] = str(datetime.now())
tokenfield['update_date'] = str(datetime.now())
tokenfield['start_date'] = str(datetime.now())
tokenfield['valide'] = '1'
tokenfield['locked'] = '0'
@ -434,7 +434,7 @@ def Ent_Student_login(diction):
tokenfield['token'] = my_token
tokenfield['email'] = email
tokenfield['recid'] = user_recid
tokenfield['date_update'] = str(datetime.now())
tokenfield['update_date'] = str(datetime.now())
tokenfield['start_date'] = str(datetime.now())
tokenfield['valide'] = '1'
tokenfield['locked'] = '0'

View File

@ -248,10 +248,11 @@ def get_all_class(diction):
connected_client_recid = user_recid
pipe = [{'$match':
{"$and": [{"$or": [{'valide': '1', 'locked': '0', 'isalaune': '1', 'published': '1'},
{'coeur': 1, 'published': '1'}]},
{'external_code': {'$nin': alread_found}},
{'display_rank': {'$nin': []}}
{"$and": [{"$or": [{'valide': '1', 'locked': '0', 'isalaune': '1', 'published': '1', 'locked':{'$ne':'1'}},
{'coeur': 1, 'published': '1', 'locked':{'$ne':'1'}}]},
{'external_code': {'$nin': alread_found}, 'locked':{'$ne':'1'}},
{'display_rank': {'$nin': []}},
{'locked':{'$ne':'1'}}
]}
},
{'$project': { 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0,
@ -969,7 +970,7 @@ def recherche_text_simple(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
if ("_id" in mydict_combined.keys()):
@ -1018,7 +1019,7 @@ def recherche_text_simple(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
@ -1063,7 +1064,7 @@ def recherche_text_simple(diction):
pipe = [
{ '$match': {'external_code': {"$in": tab_training}, 'published':'1'} },
{ '$match': {'external_code': {"$in": tab_training}, 'published':'1', 'locked':{'$ne':'1'} }},
{ '$project': { 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0, "valide": 0, "locked": 0} },
{ '$lookup':
{
@ -1126,7 +1127,7 @@ def recherche_text_simple(diction):
#print(" XXXXXXXXXX = "+str(x))
mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
#print( "mydict_combined YYYYYYYYY = "+str(mydict_combined))
@ -1216,7 +1217,7 @@ def recherche_text_simple(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
'''
@ -1464,7 +1465,7 @@ def recherche_text_simple_for_partner_catalog(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
if ("_id" in mydict_combined.keys()):
@ -1497,7 +1498,7 @@ def recherche_text_simple_for_partner_catalog(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
'''
@ -1618,7 +1619,7 @@ def recherche_text_simple_for_partner_catalog(diction):
# print(" XXXXXXXXXX = "+str(x))
mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
# print( "mydict_combined YYYYYYYYY = "+str(mydict_combined))
@ -1689,7 +1690,7 @@ def recherche_text_simple_for_partner_catalog(diction):
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **my_recid}
mydict_combined['date_update'] = str(datetime.now())
mydict_combined['update_date'] = str(datetime.now())
mydict_combined['type_view'] = "summary"
'''
@ -1836,7 +1837,7 @@ def store_recherche(diction, user_recid=""):
if diction['id']:
mydata_id = diction['id']
mydata['date_update'] = str(datetime.now())
mydata['update_date'] = str(datetime.now())
mydata['valide'] = "1" # By default
if ("valide" in diction.keys()):