parent
eba5e2a16a
commit
8b0f29583a
|
@ -4,15 +4,30 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="Init - 29/05/2025 - FI">
|
||||
<change afterPath="$PROJECT_DIR$/financial_caracteristique_mgt.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="31/05/2025 - 20h">
|
||||
<change afterPath="$PROJECT_DIR$/reference_pedagogique_mgt.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$/Doc_tech/spec.txt" beforeDir="false" afterPath="$PROJECT_DIR$/Doc_tech/spec.txt" 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$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.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$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.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$/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$/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$/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$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -453,7 +468,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="464" />
|
||||
<option name="localTasksCounter" value="465" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -495,7 +510,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/02/205 - 22h30" />
|
||||
<MESSAGE value="10/02/205 - 21h" />
|
||||
<MESSAGE value="11/02/2025 - 15h30" />
|
||||
<MESSAGE value="11/02/2025 - 21h" />
|
||||
|
@ -520,6 +534,7 @@
|
|||
<MESSAGE value="14/05/2025 - 20h" />
|
||||
<MESSAGE value="Init - 29/05/2025" />
|
||||
<MESSAGE value="Init - 29/05/2025 - FI" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Init - 29/05/2025 - FI" />
|
||||
<MESSAGE value="31/05/2025 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="31/05/2025 - 20h" />
|
||||
</component>
|
||||
</project>
|
|
@ -219,7 +219,7 @@ def Add_activite(diction):
|
|||
data['valide'] = '1'
|
||||
data['locked'] = '0'
|
||||
data['date_update'] = str(datetime.now())
|
||||
data['created_by'] = str(my_partner['_id'])
|
||||
data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
print(" ### my_partner = ", my_partner)
|
||||
|
@ -666,7 +666,7 @@ def Get_List_Entity_Activite(diction):
|
|||
data_cle['related_collection_recid'] = str(local_tmp_val['recid'])
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['created_by'] = str(my_partner['_id'])
|
||||
data_cle['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ Les attributs d'un cours :
|
|||
- prix (gratuit, y euro)
|
||||
- url
|
||||
- Durée_formation
|
||||
- created_datetime
|
||||
- creation_datetime
|
||||
- modified_datetime
|
||||
- created_by
|
||||
- creation_by
|
||||
- modifed_by
|
||||
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ def Create_E_Document(diction):
|
|||
new_diction['source_document'] = str(diction['source_document'])
|
||||
new_diction['date_update'] = str(datetime.now())
|
||||
new_diction['update_by'] = str(my_partner['_id'])
|
||||
new_diction['created_by'] = str(my_partner['_id'])
|
||||
new_diction['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
if( "type" in diction.keys() ):
|
||||
new_diction['type'] = str(diction['type'])
|
||||
|
@ -299,7 +299,7 @@ def Create_E_Invoice(diction):
|
|||
new_diction['source_document'] = str(diction['source_document'])
|
||||
new_diction['date_update'] = str(datetime.now())
|
||||
new_diction['update_by'] = str(my_partner['_id'])
|
||||
new_diction['created_by'] = str(my_partner['_id'])
|
||||
new_diction['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
if( "type" in diction.keys() ):
|
||||
new_diction['type'] = str(diction['type'])
|
||||
|
@ -874,7 +874,7 @@ def Create_E_Signature_For_E_Document(file_img=None, Folder=None, diction=None):
|
|||
|
||||
e_document_date_2 = MYSY_GV.dbname['e_document_signe'].find_one(qry_key)
|
||||
|
||||
user_created_e_document = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(e_document_date_2['created_by']),
|
||||
user_created_e_document = MYSY_GV.dbname['partnair_account'].find_one({'_id':ObjectId(e_document_date_2['creation_by']),
|
||||
'active':'1',
|
||||
'locked':'0',
|
||||
})
|
||||
|
@ -1557,7 +1557,7 @@ def Create_E_Signature_For_E_Invoice(file_img=None, Folder=None, diction=None):
|
|||
e_document_date_2 = MYSY_GV.dbname['e_document_signe'].find_one(qry_key)
|
||||
|
||||
user_created_e_document = MYSY_GV.dbname['partnair_account'].find_one(
|
||||
{'_id': ObjectId(e_document_date_2['created_by']),
|
||||
{'_id': ObjectId(e_document_date_2['creation_by']),
|
||||
'active': '1',
|
||||
'locked': '0',
|
||||
})
|
||||
|
|
|
@ -461,7 +461,7 @@ def AddStagiairetoClass(diction):
|
|||
mydata['date_update'] = 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['created_by'] = str(connected_user_id)
|
||||
mydata['creation_by'] = str(connected_user_id)
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
||||
|
@ -4231,7 +4231,7 @@ def PrintAttendeeDetail_perSession(diction):
|
|||
my_retrun_dict['date_eval'] = str(local_Insc_retval['eval_date'])[0:10]
|
||||
|
||||
v = local_Insc_retval['_id'].generation_time
|
||||
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
my_retrun_dict['creation_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
|
||||
my_retrun_dict['date_impression'] = str(datetime.today().strftime("%d/%m/%Y"))
|
||||
|
||||
|
@ -8602,7 +8602,7 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
my_retrun_dict['facture_client_rattachement_id'] = ""
|
||||
|
||||
v = local_Insc_retval['_id'].generation_time
|
||||
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
my_retrun_dict['creation_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
|
||||
# Recuperation des informations de la formation
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(local_Insc_retval['class_internal_url'])})
|
||||
|
|
|
@ -1363,7 +1363,7 @@ def Cron_Create_One_Survey_To_Inscrit(diction):
|
|||
new_survey_data['type'] = "1"
|
||||
new_survey_data['date_update'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['created_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
print(" ~~~~ A inserer = new_survey_data = ", new_survey_data)
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
|
|
@ -111,13 +111,6 @@ def Add_Update_SessionFormation(diction):
|
|||
"""
|
||||
Verifier la validité de la formation
|
||||
"""
|
||||
print(" session check QRY = ", {'internal_url':str(diction['class_internal_url']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'_id': {
|
||||
'$in': user_scope_class_id_ObjectId}
|
||||
})
|
||||
|
||||
is_class_valide = MYSY_GV.dbname['myclass'].count_documents({'internal_url':str(diction['class_internal_url']),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
|
@ -230,7 +223,6 @@ def Add_Update_SessionFormation(diction):
|
|||
mydata['session_ondemande'] = "0"
|
||||
|
||||
|
||||
|
||||
if ("nb_participant" in diction.keys()):
|
||||
nb_particants = str(mycommon.tryInt(str(diction['nb_participant'])))
|
||||
if( nb_particants == "0" ):
|
||||
|
@ -498,6 +490,9 @@ def Add_Update_SessionFormation(diction):
|
|||
.
|
||||
|
||||
"""
|
||||
|
||||
session_formtion_inserted_id = "" # J'aurais besoin de recuperer cette information après la creation de la session
|
||||
|
||||
Warning_Message = ""
|
||||
if(len(str(session_id)) > 0 ):
|
||||
# Il s'agit d'une mise à jour
|
||||
|
@ -512,10 +507,6 @@ def Add_Update_SessionFormation(diction):
|
|||
existing_class_id = local_retval1['class_id']
|
||||
current_step = local_retval1['session_etape']
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local_retval = MYSY_GV.dbname['inscription'].count_documents({'session_id':str(existing_session_code),
|
||||
'class_id':str(existing_class_id)})
|
||||
|
||||
|
@ -578,7 +569,7 @@ def Add_Update_SessionFormation(diction):
|
|||
if (len(str(session_id)) <= 0):
|
||||
# La promotion n'existe pas, on fait une simple creation
|
||||
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
|
||||
"""
|
||||
21/02/2025
|
||||
|
@ -598,8 +589,8 @@ def Add_Update_SessionFormation(diction):
|
|||
for base_document_automatic_setup_for_partner in MYSY_GV.dbname['base_document_automatic_setup'].find(qry_automatic_setup):
|
||||
new_local_data = base_document_automatic_setup_for_partner
|
||||
new_local_data['statut'] = "0"
|
||||
new_local_data['created_date'] = str(datetime.now())
|
||||
new_local_data['created_by'] = str(my_partner['_id'])
|
||||
new_local_data['creation_date'] = str(datetime.now())
|
||||
new_local_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
mydata['automatic_traitement'].append(new_local_data)
|
||||
|
||||
|
@ -608,6 +599,7 @@ def Add_Update_SessionFormation(diction):
|
|||
ret_val = coll_name.insert_one(mydata)
|
||||
|
||||
local_inserted_id = ret_val.inserted_id
|
||||
session_formtion_inserted_id = ret_val.inserted_id
|
||||
|
||||
if (ret_val is None or not hasattr(ret_val, 'inserted_id') ):
|
||||
mycommon.myprint(
|
||||
|
@ -615,6 +607,25 @@ def Add_Update_SessionFormation(diction):
|
|||
diction['code_session']) + "' ")
|
||||
return False, "Impossible d'ajouter La promotion '" + str(diction['code_session']) + "' "
|
||||
|
||||
|
||||
"""
|
||||
01/06/2025 - recuperer la configuration financière de la formation et la mettre sur la session
|
||||
"""
|
||||
for financial_data in MYSY_GV.dbname['financial_caracteristic'].find({'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'related_collection':'myclass',
|
||||
'related_collection_id':str(is_class_data['_id'])}):
|
||||
del financial_data['_id']
|
||||
financial_data['related_collection'] = "session_formation"
|
||||
financial_data['related_collection_id'] = str(session_formtion_inserted_id)
|
||||
financial_data['creation_date'] = str(datetime.now())
|
||||
financial_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
MYSY_GV.dbname['financial_caracteristic'].insert_one(financial_data)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
# Ajout de l'evenement dans l'historique
|
||||
"""
|
||||
|
@ -4833,6 +4844,12 @@ def Delete_List_SessionFormation(diction):
|
|||
deleted_session_qry = {'_id':ObjectId(str(session_id)), 'partner_owner_recid':str(partner_recid)}
|
||||
deleted_data = MYSY_GV.dbname['session_formation'].delete_many(deleted_session_qry)
|
||||
|
||||
# Supprimer les financial_caracteristic
|
||||
delete_financial_data = MYSY_GV.dbname['financial_caracteristic'].delete_many({'related_collection':'session_formation',
|
||||
'related_collection_id':str(session_id),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + str(deleted_data.deleted_count)+" Document supprimé. La session_id " + str(
|
||||
session_id) + " a été correctement supprimée ")
|
||||
cpt = cpt + 1
|
||||
|
|
|
@ -194,8 +194,8 @@ def Store_User_Downloaded_File(file=None, Folder=None, diction=None):
|
|||
mydata['valide'] = "1"
|
||||
mydata['status'] = "0"
|
||||
mydata['locked'] = "0"
|
||||
mydata['created_date'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
ret_val = MYSY_GV.dbname['download_files'].find_one_and_update({'file_business_object': str(file_business_object),
|
||||
'object_owner_collection':str(object_owner_collection),
|
||||
|
@ -339,8 +339,8 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None):
|
|||
mydata['valide'] = "1"
|
||||
mydata['status'] = "0"
|
||||
mydata['locked'] = "0"
|
||||
mydata['created_date'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
ret_val = MYSY_GV.dbname['download_files'].find_one_and_update({'file_business_object': str(file_business_object),
|
||||
'object_owner_collection':str(object_owner_collection),
|
||||
|
@ -683,10 +683,10 @@ def Get_List_object_owner_collection_Stored_Files(diction):
|
|||
|
||||
ret_file['file_business_object'] = retval['file_business_object']
|
||||
|
||||
if ("created_date" in retval.keys()):
|
||||
ret_file['created_date'] = retval['created_date']
|
||||
if ("creation_date" in retval.keys()):
|
||||
ret_file['creation_date'] = retval['creation_date']
|
||||
else:
|
||||
ret_file['created_date'] = "9999-99-99"
|
||||
ret_file['creation_date'] = "9999-99-99"
|
||||
|
||||
|
||||
if ("file_business_object" in retval.keys()):
|
||||
|
@ -1141,7 +1141,7 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
|
|||
new_query = ([ {"$addFields": {
|
||||
"mysy_download_files_date_creation": {
|
||||
'$dateFromString': {
|
||||
'dateString': {"$substr": ["$created_date", 0, 10]},
|
||||
'dateString': {"$substr": ["$creation_date", 0, 10]},
|
||||
"format": "%Y-%m-%d"
|
||||
}
|
||||
}
|
||||
|
@ -1168,10 +1168,10 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
|
|||
|
||||
ret_file['file_business_object'] = retval['file_business_object']
|
||||
|
||||
if ("created_date" in retval.keys()):
|
||||
ret_file['created_date'] = retval['created_date']
|
||||
if ("creation_date" in retval.keys()):
|
||||
ret_file['creation_date'] = retval['creation_date']
|
||||
else:
|
||||
ret_file['created_date'] = "9999-99-99"
|
||||
ret_file['creation_date'] = "9999-99-99"
|
||||
|
||||
if ("file_business_object" in retval.keys()):
|
||||
ret_file['file_business_object'] = retval['file_business_object']
|
||||
|
|
|
@ -755,7 +755,7 @@ def Cacul_UE_Note_Finale_For_calcul_mode_1(diction):
|
|||
local_node['note_finale'] = str(note_finale_ue)
|
||||
|
||||
local_node['create_date'] = str(datetime.now())
|
||||
local_node['created_by'] = str(my_partner['_id'])
|
||||
local_node['creation_by'] = str(my_partner['_id'])
|
||||
local_node['valide'] = "1"
|
||||
local_node['locked'] = "0"
|
||||
local_node['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
|
|
@ -155,7 +155,7 @@ def Add_Update_base_document_automatic_setup(diction):
|
|||
diction['locked'] = "0"
|
||||
diction['partner_owner_recid'] = str(my_partner['recid'])
|
||||
diction['date_update'] = str(datetime.now())
|
||||
diction['date_created'] = str(datetime.now())
|
||||
diction['creation_date'] = str(datetime.now())
|
||||
diction['update_by'] = str(my_partner['_id'])
|
||||
|
||||
result = MYSY_GV.dbname['base_document_automatic_setup'].insert_one(diction)
|
||||
|
|
320
class_mgt.py
320
class_mgt.py
|
@ -60,7 +60,7 @@ def add_class(diction):
|
|||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert',
|
||||
'contenu_attestation', 'note_finale_calculation_rule_id']
|
||||
'contenu_attestation', 'note_finale_calculation_rule_id', 'referentiel_padagogique_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -281,6 +281,24 @@ def add_class(diction):
|
|||
mydata['note_finale_calculation_rule_id'] = str(note_finale_calculation_rule_id)
|
||||
|
||||
|
||||
referentiel_padagogique_id = ""
|
||||
if( "referentiel_padagogique_id" in diction.keys() and diction['referentiel_padagogique_id']):
|
||||
is_valide_referentiel_padagogique_id_count = MYSY_GV.dbname['referentiel_padagogique'].count_documents({'_id':ObjectId(str(diction['referentiel_padagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if(is_valide_referentiel_padagogique_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant du référentiel pédagogique est invalide ")
|
||||
return False, " L'identifiant du référentiel pédagogique est invalide ", False
|
||||
|
||||
referentiel_padagogique_id = str(diction['referentiel_padagogique_id'])
|
||||
|
||||
mydata['referentiel_padagogique_id'] = str(referentiel_padagogique_id)
|
||||
|
||||
|
||||
|
||||
class_level = "0"
|
||||
if ("class_level" in diction.keys()):
|
||||
if diction['class_level']:
|
||||
|
@ -314,6 +332,10 @@ def add_class(diction):
|
|||
certif = diction['certif']
|
||||
mydata['certif'] = certif
|
||||
|
||||
|
||||
# Gestion archive
|
||||
mydata['archive'] = "0"
|
||||
|
||||
objectif = ""
|
||||
if ("objectif" in diction.keys()):
|
||||
if diction['objectif']:
|
||||
|
@ -808,7 +830,7 @@ def update_class(diction):
|
|||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation',
|
||||
'note_finale_calculation_rule_id']
|
||||
'note_finale_calculation_rule_id', 'referentiel_padagogique_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -949,6 +971,27 @@ def update_class(diction):
|
|||
else:
|
||||
mydata['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
|
||||
if ("referentiel_padagogique_id" in diction.keys() ):
|
||||
if( diction['referentiel_padagogique_id'] ):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['referentiel_padagogique'].count_documents(
|
||||
{'_id': ObjectId(str(diction['referentiel_padagogique_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_calculation_rule_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant du référentiel pédagogique est invalide ")
|
||||
return False, " L'identifiant du référentiel pédagogique est invalide ", False
|
||||
|
||||
mydata['referentiel_padagogique_id']= str(diction['referentiel_padagogique_id'])
|
||||
|
||||
else:
|
||||
mydata['referentiel_padagogique_id'] = ""
|
||||
|
||||
|
||||
|
||||
source = ""
|
||||
if ("source" in diction.keys()):
|
||||
mydata['source'] = diction['source']
|
||||
|
@ -1395,10 +1438,8 @@ def update_class(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Desactivation d'une formation
|
||||
|
||||
Disable a training, set mydata['valide'] = '0'
|
||||
'''
|
||||
def disable_class(diction):
|
||||
|
@ -1515,6 +1556,202 @@ def disable_class(diction):
|
|||
return False, " Impossible de desactivier la formation "
|
||||
|
||||
|
||||
"""
|
||||
02/06/2025 : Archivage d'une formation
|
||||
"""
|
||||
def archive_class(diction):
|
||||
try:
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['tab_class_id', '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'existe pas, Creation formation annulée")
|
||||
return False, " Impossible de mettre à jour la formation"
|
||||
|
||||
'''
|
||||
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 = ['tab_class_id', '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, " Impossible de mettre à jour la formation"
|
||||
|
||||
# recuperation des paramettre
|
||||
mydata = {}
|
||||
my_internal_url = ""
|
||||
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mydata['token'] = diction['token']
|
||||
|
||||
# Verification de la validité du token
|
||||
tab_class_ids = []
|
||||
tab_class_ids_ObjectId = []
|
||||
if ("tab_class_id" in diction.keys()):
|
||||
tab_class_ids = str(diction['tab_class_id']).split(",")
|
||||
|
||||
for tmp in tab_class_ids:
|
||||
if (tmp):
|
||||
tab_class_ids_ObjectId.append(ObjectId(tmp))
|
||||
|
||||
# Verification de la validité du token
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
mydata['archive'] = '1'
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
# seules les formations avec locked = 0 et valide=1 sont modifiables
|
||||
ret_val = coll_name.update_many(
|
||||
{'_id': {'$in': tab_class_ids_ObjectId}, 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{"$set": mydata},
|
||||
|
||||
)
|
||||
|
||||
for class_id in tab_class_ids:
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "myclass"
|
||||
history_event_dict['related_collection_recid'] = str(class_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Archivage "
|
||||
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, " Formation(s) archivée(s) "
|
||||
|
||||
|
||||
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 d'archiver les formations "
|
||||
|
||||
"""
|
||||
02/06/2025 : Dearchivage d'une formation
|
||||
"""
|
||||
|
||||
def unarchive_class(diction):
|
||||
try:
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['tab_class_id', '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'existe pas, Creation formation annulée")
|
||||
return False, " Impossible de mettre à jour la formation"
|
||||
|
||||
'''
|
||||
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 = ['tab_class_id', '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, " Impossible de mettre à jour la formation"
|
||||
|
||||
# recuperation des paramettre
|
||||
mydata = {}
|
||||
my_internal_url = ""
|
||||
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mydata['token'] = diction['token']
|
||||
|
||||
tab_class_ids = []
|
||||
tab_class_ids_ObjectId = []
|
||||
if ("tab_class_id" in diction.keys()):
|
||||
tab_class_ids = str(diction['tab_class_id']).split(",")
|
||||
|
||||
for tmp in tab_class_ids:
|
||||
if( tmp ):
|
||||
tab_class_ids_ObjectId.append(ObjectId(tmp))
|
||||
|
||||
|
||||
# Verification de la validité du token
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
||||
mydata['archive'] = '0'
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
# seules les formations avec locked = 0 et valide=1 sont modifiables
|
||||
ret_val = coll_name.update_many(
|
||||
{'_id':{'$in':tab_class_ids_ObjectId}, 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": mydata}
|
||||
)
|
||||
|
||||
for class_id in tab_class_ids :
|
||||
|
||||
# pour la collection 'myclass'
|
||||
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
# print(" ####### laaaa diction = ", diction)
|
||||
|
||||
history_event_dict = {}
|
||||
history_event_dict['token'] = str(diction['token'])
|
||||
history_event_dict['related_collection'] = "myclass"
|
||||
history_event_dict['related_collection_recid'] = str(class_id)
|
||||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
history_event_dict['action_description'] = "Desarchivage "
|
||||
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, " Formation(s) desarchivée(s) "
|
||||
|
||||
|
||||
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 désarchiver les formations "
|
||||
|
||||
|
||||
|
||||
'''
|
||||
reactivation d'une formation
|
||||
|
||||
|
@ -3102,7 +3339,7 @@ def get_partner_class(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code']
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
@ -3217,7 +3454,15 @@ def get_partner_class(diction):
|
|||
filt_internal_url = {}
|
||||
if ("internal_url" in diction.keys()):
|
||||
filt_internal_url = {'internal_url': str(diction['internal_url'])}
|
||||
#print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
|
||||
|
||||
filt_archive = {}
|
||||
if( "archive" in diction.keys() and ( diction["archive"] == "0" or diction["archive"] == "") ):
|
||||
filt_archive = {'archive':{'$ne':'1'}}
|
||||
|
||||
elif( "archive" in diction.keys() and diction["archive"] == "1"):
|
||||
filt_archive = {'archive':'1'}
|
||||
|
||||
|
||||
|
||||
"""
|
||||
print(" ATTTTENNTION : GESTION DU CAS OU LA PERSONNE QUI CHERCHE LE COURS EST UN UTILISATEUR : PB avec : partner_owner_recid ")
|
||||
|
@ -3249,10 +3494,9 @@ def get_partner_class(diction):
|
|||
filt_scope_class_id['_id'] = {'$in':tab_class_id_ObjectId}
|
||||
|
||||
|
||||
|
||||
for retVal in coll_name.find( {"$and":[ {'valide':'1'},{'locked':'0'},
|
||||
{'partner_owner_recid':user_recid} ,
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id]},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_scope_class_id, filt_archive]},
|
||||
{ 'indexed':0, 'indexed_desc':0,
|
||||
'indexed_obj':0, 'indexed_title':0, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
|
@ -3262,7 +3506,9 @@ def get_partner_class(diction):
|
|||
#print(" #### retVal = ", retVal)
|
||||
if ("title" not in retVal.keys()):
|
||||
retVal['title'] = ""
|
||||
|
||||
|
||||
if ("referentiel_padagogique_id" not in retVal.keys()):
|
||||
retVal['referentiel_padagogique_id'] = ""
|
||||
|
||||
if ("domain" not in retVal.keys()):
|
||||
retVal['domain'] = ""
|
||||
|
@ -3299,7 +3545,10 @@ def get_partner_class(diction):
|
|||
|
||||
if ("published" not in retVal.keys()):
|
||||
retVal['published'] = "0"
|
||||
|
||||
|
||||
|
||||
if ("archive" not in retVal.keys()):
|
||||
retVal['archive'] = "0"
|
||||
|
||||
if ("lms_class_code" not in retVal.keys()):
|
||||
retVal['lms_class_code'] = "0"
|
||||
|
@ -3409,7 +3658,7 @@ def find_partner_class_like(diction):
|
|||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code']
|
||||
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'external_code', 'archive']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
@ -3466,6 +3715,8 @@ def find_partner_class_like(diction):
|
|||
if diction['title']:
|
||||
title_crit['title'] = diction['title']
|
||||
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
# verifier que le token et l'email sont ok
|
||||
|
@ -3512,6 +3763,15 @@ def find_partner_class_like(diction):
|
|||
if ("title" in diction.keys()):
|
||||
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
|
||||
|
||||
|
||||
filt_archive = {}
|
||||
if ("archive" in diction.keys() and str(diction['archive']) == "1" ):
|
||||
filt_archive = {'archive':'1'}
|
||||
|
||||
elif ("archive" in diction.keys() and (str(diction['archive']) == "0" or str(diction['archive']) == "") ):
|
||||
filt_archive = {'archive':{'$ne':'1'}}
|
||||
|
||||
|
||||
filt_internal_url = {}
|
||||
if ("internal_url" in diction.keys()):
|
||||
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
|
||||
|
@ -3519,9 +3779,9 @@ def find_partner_class_like(diction):
|
|||
|
||||
find_partner_class_like_local_qry = {"$and": [{'valide': '1'}, {'locked': '0'},
|
||||
{'partner_owner_recid': user_recid},
|
||||
filt_external_code, filt_title, filt_internal_url]}
|
||||
filt_external_code, filt_title, filt_internal_url, filt_archive]}
|
||||
|
||||
#print(" ##### find_partner_class_like_local_qry = ", find_partner_class_like_local_qry)
|
||||
#print(" ### find_partner_class_like_local_qry = ", find_partner_class_like_local_qry)
|
||||
|
||||
"""
|
||||
Recuperation du nombre d'heure par jour depuis la confif du partner
|
||||
|
@ -3536,20 +3796,25 @@ def find_partner_class_like(diction):
|
|||
currency = ""
|
||||
|
||||
|
||||
|
||||
val_tmp = 1
|
||||
for retVal in coll_name.find({"$and": [{'valide': '1'}, {'locked': '0'},
|
||||
{'partner_owner_recid': user_recid},
|
||||
filt_external_code, filt_title, filt_internal_url]},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_archive]},
|
||||
{'programme':0, 'objectif': 0, 'indexed': 0, 'indexed_desc': 0,
|
||||
'indexed_obj': 0, 'indexed_title': 0, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
#mycommon.myprint(str(retVal))
|
||||
|
||||
#mycommon.myprint("retValretValretVal = "+ str(retVal))
|
||||
user = retVal
|
||||
|
||||
|
||||
if ("title" not in retVal.keys()):
|
||||
retVal['title'] = ""
|
||||
|
||||
|
||||
|
||||
if ("referentiel_padagogique_id" not in retVal.keys()):
|
||||
retVal['referentiel_padagogique_id'] = ""
|
||||
|
||||
if ("domain" not in retVal.keys()):
|
||||
retVal['domain'] = ""
|
||||
|
@ -3563,11 +3828,13 @@ def find_partner_class_like(diction):
|
|||
if ("pourqui" not in retVal.keys()):
|
||||
retVal['pourqui'] = ""
|
||||
|
||||
if ("archive" not in retVal.keys()):
|
||||
retVal['archive'] = "0"
|
||||
|
||||
if ("presentiel" not in retVal.keys()):
|
||||
retVal['presentiel'] = {'presentiel':'0', 'distantiel':'0'}
|
||||
|
||||
|
||||
|
||||
if ("metier" not in retVal.keys()):
|
||||
retVal['metier'] = ""
|
||||
|
||||
|
@ -3590,6 +3857,10 @@ def find_partner_class_like(diction):
|
|||
retVal['published'] = "0"
|
||||
|
||||
|
||||
if ("archive" not in retVal.keys()):
|
||||
retVal['archive'] = "0"
|
||||
|
||||
|
||||
if ("lms_class_code" not in retVal.keys()):
|
||||
retVal['lms_class_code'] = "0"
|
||||
|
||||
|
@ -3665,6 +3936,8 @@ d'un parenaire mais seulement les champs :
|
|||
- external_code,
|
||||
- internal_code
|
||||
- internal_url
|
||||
|
||||
formation non archivée
|
||||
"""
|
||||
|
||||
|
||||
|
@ -3719,13 +3992,12 @@ def Get_Partner_All_Class_Few_Fields(diction):
|
|||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
|
||||
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
||||
for retVal in MYSY_GV.dbname['myclass'].find( {"$and":[
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0'},filt_scope_class_id]},
|
||||
'locked':'0'},filt_scope_class_id, filt_archive]},
|
||||
{'_id': 1, 'external_code': 1, 'internal_code': 1, 'internal_url': 1, }
|
||||
).sort([("_id", pymongo.DESCENDING), ]):
|
||||
# mycommon.myprint(str(retVal))
|
||||
|
@ -3865,6 +4137,8 @@ def get_partner_class_external_code(diction):
|
|||
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
|
||||
# print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
|
||||
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
||||
print(
|
||||
" ATTTTENNTION : GESTION DU CAS OU LA PERSONNE QUI CHERCHE LE COURS EST UN UTILISATEUR : PB avec : partner_owner_recid ")
|
||||
print(" #### avant requete get partner_owner_recid =" + str(user_recid) +
|
||||
|
@ -3875,7 +4149,7 @@ def get_partner_class_external_code(diction):
|
|||
val_tmp = 1
|
||||
for retVal in coll_name.find_one({"$and": [{'valide': '1'}, {'locked': '0'},
|
||||
{'partner_owner_recid': user_recid},
|
||||
filt_external_code, filt_title, filt_internal_url]},
|
||||
filt_external_code, filt_title, filt_internal_url, filt_archive]},
|
||||
{'external_code':1, 'internal_url':1},
|
||||
).sort([("external_code",pymongo.ASCENDING),]).sort([("_id", pymongo.DESCENDING), ]):
|
||||
# mycommon.myprint(str(retVal))
|
||||
|
@ -3933,7 +4207,7 @@ def get_class_global_search(search_string):
|
|||
my_regex = "/.*"+search_string+".*/"
|
||||
|
||||
insertObject = []
|
||||
for x in coll_name.find({'myindex': { '$regex': re.compile(r".*"+search_string+".*") }}):
|
||||
for x in coll_name.find({'myindex': { '$regex': re.compile(r".*"+search_string+".*") }, 'archive':{'$ne':'1'}}):
|
||||
mycommon.myprint(x)
|
||||
user = x
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
|
@ -3954,7 +4228,7 @@ def get_all_class_by_attribut(attribut, value):
|
|||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
insertObject = []
|
||||
for x in coll_name.find({attribut: value}, {"_id": 0}):
|
||||
for x in coll_name.find({attribut: value, 'archive':{'$ne':'1'}}, {"_id": 0}):
|
||||
mycommon.myprint(x)
|
||||
user = x
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
|
|
|
@ -110,8 +110,8 @@ def Add_Competence(diction):
|
|||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
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"
|
||||
|
|
|
@ -165,7 +165,7 @@ def Add_CRM_Opportunite(diction):
|
|||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
|
|
|
@ -129,8 +129,8 @@ def Add_Financial_Caracteristique(diction):
|
|||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['created_by'] = str(my_partner['_id'])
|
||||
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"
|
||||
|
@ -316,6 +316,8 @@ def Get_Financial_Caracteristique_no_filter(diction):
|
|||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0',
|
||||
'related_collection':str(diction['related_collection']), 'related_collection_id':str(diction['related_collection_id'])}
|
||||
|
||||
print(" ### Get_Financial_Caracteristique_no_filter QRY = ", qry)
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['financial_caracteristic'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
|
@ -331,11 +333,11 @@ def Get_Financial_Caracteristique_no_filter(diction):
|
|||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des caractéristique financières "
|
||||
return False, " Impossible de récupérer la liste des caractéristiques financières "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une compétence
|
||||
Suppression d'une liste de Financial_Caracteristique
|
||||
"""
|
||||
def Delete_List_Financial_Caracteristique(diction):
|
||||
try:
|
||||
|
@ -389,7 +391,7 @@ def Delete_List_Financial_Caracteristique(diction):
|
|||
|
||||
ret_del_ca_fin = MYSY_GV.dbname['financial_caracteristic'].delete_many(qry)
|
||||
|
||||
return True, "La caractéristique financière a été correctement supprimée"
|
||||
return True, "Caractéristique financière supprimée(s)"
|
||||
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -116,7 +116,7 @@ def Add_Formulaire(diction):
|
|||
mycommon.myprint(" Un formulaire avec le même code existe déjà ")
|
||||
return False, " Un formulaire avec le même code existe déjà "
|
||||
|
||||
mydata['date_created'] = str(datetime.now())
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
|
|
|
@ -184,7 +184,7 @@ def Add_Jury(diction):
|
|||
new_data['locked'] = "0"
|
||||
|
||||
new_data['create_date'] = str(datetime.now())
|
||||
new_data['created_by'] = str(my_partner['_id'])
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['jury'].insert_one(new_data).inserted_id
|
||||
|
@ -1711,7 +1711,7 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
new_soutenance_data['convocation_apprenant_send'] = "0"
|
||||
new_soutenance_data['convocation_apprenant_date_sending'] = ""
|
||||
new_soutenance_data['create_date'] = str(datetime.now())
|
||||
new_soutenance_data['created_by'] = str(my_partner['_id'])
|
||||
new_soutenance_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
soutenance_inserted_id = MYSY_GV.dbname['jury_soutenance'].insert_one(new_soutenance_data).inserted_id
|
||||
|
@ -1746,7 +1746,7 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
|
||||
|
||||
my_even_data['create_date'] = str(datetime.now())
|
||||
my_even_data['created_by'] = str(my_partner['_id'])
|
||||
my_even_data['creation_by'] = str(my_partner['_id'])
|
||||
agenda_inserted_id = MYSY_GV.dbname['agenda'].insert_one(my_even_data).inserted_id
|
||||
|
||||
|
||||
|
|
|
@ -2297,7 +2297,7 @@ def LMS_Create_VirtualHost(diction):
|
|||
full_url = unidecode(full_url)
|
||||
|
||||
virtualHost_url = full_url
|
||||
my_query = " INSERT INTO access_url (url, description, active, created_by, tms, url_type) "\
|
||||
my_query = " INSERT INTO access_url (url, description, active, creation_by, tms, url_type) "\
|
||||
" VALUES('"+str(full_url)+"', 'Url pour "+str(part_nom)+"', '1', '1', '"+str(registration_date)+"', NULL);"
|
||||
|
||||
try:
|
||||
|
|
88
main.py
88
main.py
|
@ -99,6 +99,7 @@ import equipe_team_mgt as equipe_team_mgt
|
|||
import base_class_calcul_note as base_class_calcul_note
|
||||
import jury_mgt as jury_mgt
|
||||
import financial_caracteristique_mgt as financial_caracteristique_mgt
|
||||
import reference_pedagogique_mgt as reference_pedagogique_mgt
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -562,10 +563,37 @@ Desactivé une formation - disable training
|
|||
def disable_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### payload = ",payload)
|
||||
print(" ### disable_class payload = ",payload)
|
||||
status, retval = cm.disable_class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour archiver une formation
|
||||
"""
|
||||
@app.route('/myclass/api/archive_class/', methods=['POST'])
|
||||
@crossdomain(origin='*')
|
||||
def archive_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### archive_class payload = ",payload)
|
||||
status, retval = cm.archive_class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour desarchiver une formation
|
||||
"""
|
||||
@app.route('/myclass/api/unarchive_class/', methods=['POST'])
|
||||
@crossdomain(origin='*')
|
||||
def unarchive_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### unarchive_class payload = ",payload)
|
||||
status, retval = cm.unarchive_class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
'''
|
||||
Reactivation d'une formation - enable training
|
||||
'''
|
||||
|
@ -574,7 +602,7 @@ Reactivation d'une formation - enable training
|
|||
def enable_class():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### payload = ",payload)
|
||||
print(" ### enable_class payload = ",payload)
|
||||
status, retval = cm.enable_class(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
@ -12821,6 +12849,62 @@ def Delete_List_Financial_Caracteristique():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un référentiel pédagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Ref_Pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Ref_Pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Ref_Pedagogique : payload = ",str(payload))
|
||||
status, retval = reference_pedagogique_mgt.Add_Ref_Pedagogique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un référentiel pédagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Ref_Pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Ref_Pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Ref_Pedagogique : payload = ",str(payload))
|
||||
status, retval = reference_pedagogique_mgt.Update_Ref_Pedagogique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une liste des caractéristiques financières d'un couple related_collection / related_collection_id
|
||||
"""
|
||||
|
||||
@app.route('/myclass/api/Delete_List_Ref_Pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_List_Ref_Pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_List_Ref_Pedagogique : payload = ",str(payload))
|
||||
status, retval = reference_pedagogique_mgt.Delete_List_Ref_Pedagogique( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des caractéristiques financières d'un couple related_collection / related_collection_id
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Ref_Pedagogique_no_filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Ref_Pedagogique_no_filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Ref_Pedagogique_no_filter : payload = ",str(payload))
|
||||
status, retval = reference_pedagogique_mgt.Get_Ref_Pedagogique_no_filter( payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -204,7 +204,7 @@ def Add_Evaluation_Planification(diction):
|
|||
new_data['locked'] = "0"
|
||||
|
||||
new_data['create_date'] = str(datetime.now())
|
||||
new_data['created_by'] = str(my_partner['_id'])
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['note_evaluation'].insert_one(new_data).inserted_id
|
||||
|
@ -555,7 +555,7 @@ def Duplicate_Evaluation_Planification(diction):
|
|||
new_data['locked'] = "0"
|
||||
|
||||
new_data['create_date'] = str(datetime.now())
|
||||
new_data['created_by'] = str(my_partner['_id'])
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
|
|
|
@ -2643,7 +2643,7 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
new_data['locked'] = "0"
|
||||
new_data['active'] = "1"
|
||||
new_data['date_creation'] = now
|
||||
new_data['created_by'] = str(my_partner['_id'])
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['type'] = "user"
|
||||
new_data['lastconnexion'] = ""
|
||||
new_data['firstconnexion'] = "1"
|
||||
|
|
|
@ -3632,7 +3632,7 @@ def GetAttendeeDetail_perSession(diction):
|
|||
|
||||
|
||||
v = local_Insc_retval['_id'].generation_time
|
||||
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
my_retrun_dict['creation_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
|
||||
# Recuperation des informations de la formation
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(local_Insc_retval['class_internal_url'])})
|
||||
|
@ -4740,6 +4740,16 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
new_field_logo = {'societe_logo': "data:image/png;base64,"+local_JSON['logo_img']}
|
||||
new_field_cachet = {'societe_cachet': "data:image/png;base64,"+local_JSON['cachet_img']}
|
||||
if ("logo_img" in local_JSON.keys() and local_JSON['logo_img']):
|
||||
new_field_logo = {'societe_logo': "data:image/png;base64," + local_JSON['logo_img']}
|
||||
else:
|
||||
new_field_logo = {'societe_logo': "data:image/png;base64,"}
|
||||
|
||||
if ("cachet_img" in local_JSON.keys() and local_JSON['cachet_img']):
|
||||
new_field_cachet = {'societe_cachet': "data:image/png;base64," + local_JSON['cachet_img']}
|
||||
else:
|
||||
new_field_cachet = {'societe_cachet': "data:image/png;base64,"}
|
||||
|
||||
company_data.update(new_field_logo)
|
||||
company_data.update(new_field_cachet)
|
||||
|
||||
|
@ -5682,7 +5692,7 @@ def Configure_Partner_Init_Setup_No_Token(diction):
|
|||
'locked': '0'}, ):
|
||||
new_courrier_for_automation = my_courrier_data
|
||||
new_courrier_for_automation['actif'] = "0"
|
||||
new_courrier_for_automation['date_created'] = str(datetime.now())
|
||||
new_courrier_for_automation['creation_date'] = str(datetime.now())
|
||||
new_courrier_for_automation['update_by'] = str(my_partner_data['_id'])
|
||||
new_courrier_for_automation['partner_owner_recid'] = str(my_partner_data['recid'])
|
||||
|
||||
|
@ -7457,12 +7467,12 @@ 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['date_created'] = str(datetime.now())
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['update_by'] = ""
|
||||
new_data['created_by'] = ""
|
||||
new_data['creation_by'] = ""
|
||||
|
||||
ret_val = MYSY_GV.dbname['newsletter_email'].find_one_and_update(
|
||||
{'email': str(diction['email']).strip(), },
|
||||
|
|
|
@ -0,0 +1,383 @@
|
|||
"""
|
||||
Ce fichier permet de gerer le referentiel pédagogique.
|
||||
la V1 contient juste les info basiques comme : code, description, comment...
|
||||
"""
|
||||
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'un referentiel
|
||||
"""
|
||||
def Add_Ref_Pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code' , 'description', 'commentaire' ]
|
||||
|
||||
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 la cara fin n'est pas déjà utilisé
|
||||
"""
|
||||
is_competence_code_used = MYSY_GV.dbname['referentiel_padagogique'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'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é "
|
||||
|
||||
|
||||
|
||||
|
||||
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['referentiel_padagogique'].insert_one(mydata).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer le référentiel pédagogique (2) ")
|
||||
return False, " Impossible de créer le référentiel pédagogique (2) "
|
||||
|
||||
return True, " Le référentiel 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 référentiel pédagogique "
|
||||
|
||||
|
||||
"""
|
||||
Fonction de mise à jour d'un référentiel pédagogique
|
||||
"""
|
||||
def Update_Ref_Pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'code' , 'description', 'commentaire',]
|
||||
|
||||
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', '_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']
|
||||
|
||||
fin_ca_id = ""
|
||||
if ("_id" in diction.keys()):
|
||||
if diction['_id']:
|
||||
fin_ca_id = diction['_id']
|
||||
|
||||
|
||||
|
||||
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ée par une autre compétence autre que celle ci
|
||||
"""
|
||||
|
||||
is_fiance_ca_code_used = MYSY_GV.dbname['referentiel_padagogique'].count_documents({'code': str(diction['code']),
|
||||
'valide': '1',
|
||||
'_id':{'$ne':ObjectId(str(diction['_id']))},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_fiance_ca_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 caracteristique existe et est valide
|
||||
is_valide_fin_ca = MYSY_GV.dbname['referentiel_padagogique'].count_documents({'_id':ObjectId(str(fin_ca_id)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_valide_fin_ca != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du référentiel pédagogique est invalide ")
|
||||
return False, " L'identifiant du référentiel pédagogique est invalide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
del mydata['_id']
|
||||
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
||||
result = MYSY_GV.dbname['referentiel_padagogique'].find_one_and_update(
|
||||
{'_id':ObjectId(str(fin_ca_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 référentiel pédagogique (2) ")
|
||||
return False, " Impossible de mettre à jour le référentiel pédagogique (2) "
|
||||
|
||||
|
||||
|
||||
return True, " Le référentiel 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 référentiel pédagogique "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste desréférentiel pédagogique d'un partner, sans filtres
|
||||
"""
|
||||
def Get_Ref_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['referentiel_padagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
#print(" #### RetObject = ", RetObject)
|
||||
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 référentiels pédagogiques "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une list de référentiel pédagogique
|
||||
regle : verifier qu'il n'est pas utilisé dans une formation
|
||||
"""
|
||||
def Delete_List_Ref_Pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'tab_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', 'tab_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
|
||||
|
||||
|
||||
local_tab_ids = str(diction['tab_id']).split(",")
|
||||
tab_ids_ObjectID = []
|
||||
tab_ids = []
|
||||
for tmp in local_tab_ids:
|
||||
if( tmp ):
|
||||
tab_ids_ObjectID.append(ObjectId(str(tmp)))
|
||||
tab_ids.append(str(tmp))
|
||||
|
||||
is_used_in_class = []
|
||||
for val in MYSY_GV.dbname['myclass'].find({'referentiel_padagogique_id':{'$in':tab_ids},
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1'}).limit(3):
|
||||
is_used_in_class.append(str(val['external_code']))
|
||||
|
||||
|
||||
if(len(is_used_in_class) > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le referentiel est utilisé dans "+str(len(is_used_in_class))+" formation (s). Par exemple "+str(is_used_in_class))
|
||||
return False, " Le référentiel est utilisé dans "+str(len(is_used_in_class))+" formation (s). Par exemple "+str(is_used_in_class)+". Suppression annulée "
|
||||
|
||||
|
||||
qry = {'_id':{'$in':tab_ids_ObjectID}, 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
ret_del_ca_fin = MYSY_GV.dbname['referentiel_padagogique'].delete_many(qry)
|
||||
|
||||
return True, "Référentiel pédagogique supprimé(s)"
|
||||
|
||||
|
||||
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 référentiel pédagogique"
|
||||
|
|
@ -931,7 +931,7 @@ def Create_One_Survey_To_Inscrit(diction):
|
|||
new_survey_data['type'] = "1"
|
||||
new_survey_data['date_update'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['created_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
@ -1069,7 +1069,7 @@ def Create_One_Survey_To_Except_Inscrit(diction):
|
|||
new_survey_data['type'] = "1"
|
||||
new_survey_data['date_update'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['created_by'] = str(my_partner['_id'])
|
||||
new_survey_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
print(" ### new_survey_data = ", new_survey_data)
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
|
Loading…
Reference in New Issue