05/06/2024 - 23h

master
cherif 2024-06-05 22:58:49 +02:00
parent 946f6e6289
commit e8eb55a5cc
6 changed files with 1399 additions and 26 deletions

View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsdsq">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsdsqsqdsq">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -79,13 +77,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00274" summary="sss">
<created>1713719597944</created>
<option name="number" value="00274" />
<option name="presentableId" value="LOCAL-00274" />
<option name="project" value="LOCAL" />
<updated>1713719597944</updated>
</task>
<task id="LOCAL-00275" summary="22/04/2024 - 17h30">
<created>1713799833124</created>
<option name="number" value="00275" />
@ -422,7 +413,14 @@
<option name="project" value="LOCAL" />
<updated>1717577652191</updated>
</task>
<option name="localTasksCounter" value="323" />
<task id="LOCAL-00323" summary="qsdsqsqdsq">
<created>1717601060943</created>
<option name="number" value="00323" />
<option name="presentableId" value="LOCAL-00323" />
<option name="project" value="LOCAL" />
<updated>1717601060943</updated>
</task>
<option name="localTasksCounter" value="324" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -464,7 +462,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="gdf" />
<MESSAGE value="dd" />
<MESSAGE value="ddsdfsd" />
<MESSAGE value="12/05/2024 - 21h30" />
@ -489,6 +486,7 @@
<MESSAGE value="sss" />
<MESSAGE value="01/06/2024 - 14h30" />
<MESSAGE value="qsdsq" />
<option name="LAST_COMMIT_MESSAGE" value="qsdsq" />
<MESSAGE value="qsdsqsqdsq" />
<option name="LAST_COMMIT_MESSAGE" value="qsdsqsqdsq" />
</component>
</project>

View File

@ -570,7 +570,7 @@ Pour mettre en place un système de configuration global, on va definir les vale
"""
PARTNER_BASE_CONFIG_NAME = ['tva', 'smtp_server', 'smtp_user', 'smtp_user_pwd', 'smtp_count_from_name',
'smtp_count_port', 'partner_smtp', 'partner_jour_heure', 'nb_relance_auto',
'relance_auto', 'frequence_relance_auto']
'relance_auto', 'frequence_relance_auto', 'session_warning', 'session_warning_lead_time']
"""
@ -718,4 +718,12 @@ Statut de paiement des factures
1 - partiellement payé
2 - entièrement payé
"""
INVOICE_PAIEMENT_STATUS = ['0', '1', '2']
INVOICE_PAIEMENT_STATUS = ['0', '1', '2']
"""
Completude des etapes d'une session de formation : "statut_completude"
- 2 = "Oui", Etape completé
- 1 = "Part", Etape partiellement effectué
- 0 = "Non", Etape non demarré
"""

File diff suppressed because it is too large Load Diff

View File

@ -1440,6 +1440,26 @@ def GetAllValideSessionPartner_List(diction):
val['qty_in_quotation'] = str(total_qty)
val['qty_in_quotation_list_quotation'] = ', '.join(tab_quotation_ref)
"""
Pour chaque session recuperer le statut de controle d'alert
"""
local_diction = {}
local_diction['token'] = str(diction['token'])
local_diction['session_id'] = str(retVal['_id'])
local_check_session_alert_status, local_check_session_alert_retval, local_check_session_alert_is_warning = mycommon.Check_Partner_Session_Alert(local_diction)
is_session_alert = ""
session_alert_message = ""
if( local_check_session_alert_status ):
is_session_alert = local_check_session_alert_is_warning
session_alert_message = local_check_session_alert_retval
val['is_session_alert'] = is_session_alert
val['session_alert_message'] = session_alert_message
RetObject.append(mycommon.JSONEncoder().encode(val))
return True, RetObject

14
main.py
View File

@ -9864,6 +9864,20 @@ def Export_To_Excel_List_Groupe_Membres(token, _id):
return False
"""
API pour tester la recuperation des element d'alerte d'une session de formation
"""
@app.route('/myclass/api/Check_Partner_Session_Alert/', methods=['POST','GET'])
@crossdomain(origin='*')
def Check_Partner_Session_Alert():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Check_Partner_Session_Alert payload = ",payload)
status, retval , is_warning = mycommon.Check_Partner_Session_Alert(payload)
return jsonify(status=status, message=retval, is_warning=is_warning)
if __name__ == '__main__':

View File

@ -47,6 +47,7 @@ import Collection_Historique as Collection_Historique
import partner_client
import partners
import math
import module_editique as module_editique
class JSONEncoder(json.JSONEncoder):
def default(self, o):
@ -5995,7 +5996,7 @@ def Check_Partner_Session_Alert(diction):
if val not in field_list and val.startswith('my_') is False:
myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
return False, " Les informations fournies sont incorrectes"
return False, " Les informations fournies sont incorrectes ", False
"""
Verification des champs obligatoires
@ -6006,7 +6007,7 @@ def Check_Partner_Session_Alert(diction):
if val not in diction:
myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes"
return False, " Les informations fournies sont incorrectes ", False
"""
Verification de l'identité et autorisation de l'entité qui
@ -6019,13 +6020,37 @@ def Check_Partner_Session_Alert(diction):
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
return local_status, my_partner, False
"""
Verifier la validité de la session
"""
is_session_valide_cout = MYSY_GV.dbname["session_formation"].count_documents({'_id':ObjectId(str(diction['session_id'])),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])})
if( is_session_valide_cout != 1):
myprint(
str(inspect.stack()[0][3]) + " L'identifiant de session est invalide ")
return False, " L'identifiant de session est invalide ", False
is_session_valide_data = MYSY_GV.dbname["session_formation"].find_one(
{'_id': ObjectId(str(diction['session_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
mytoday = datetime.today().strftime("%d/%m/%Y")
delta_day = datetime.strptime(str(is_session_valide_data['date_debut'])[0:10], '%d/%m/%Y') - datetime.strptime(str(mytoday).strip(), '%d/%m/%Y')
delta_day_INT = delta_day.days
"""
Recuperer les paramettres de controle du partenaire
"""
session_warning = ""
tmp_val = MYSY_GV.dbname["base_partner_setup"].find({'partner_owner_recid': str(my_partner['recid']),
tmp_val = MYSY_GV.dbname["base_partner_setup"].find_one({'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0',
'config_name': 'session_warning'
@ -6036,7 +6061,7 @@ def Check_Partner_Session_Alert(diction):
session_warning_lead_time = ""
session_warning_lead_time_INT = 0
tmp_val = MYSY_GV.dbname["base_partner_setup"].find({'partner_owner_recid':str(my_partner['recid']),
tmp_val = MYSY_GV.dbname["base_partner_setup"].find_one({'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'config_name':'session_warning_lead_time'
@ -6046,11 +6071,21 @@ def Check_Partner_Session_Alert(diction):
session_warning_lead_time_INT = tryInt(session_warning_lead_time)
make_ctl = 0
if(session_warning == "1" and session_warning_lead_time_INT > 0 ):
if(session_warning == "1" and session_warning_lead_time_INT >= delta_day_INT ):
make_ctl = 1
if( make_ctl == 0 ):
return True, "OK"
return True, "OK", "0"
print(" ## session_warning_lead_time_INT = ", session_warning_lead_time_INT)
"""
Pour la liste des étapes à controler, on prent : 'courrier_template_ref_interne'
"""
list_etape_a_controler = ['CONF_INSCRIPTION', 'CONVENTION_STAGIAIRE_ENTREPRISE',
'CONVENTION_STAGIAIRE_INDIVIDUELLE', 'QUESTION_POSITIONNEMENT',
'CONVOCATION_STAGIAIRE']
is_warning = 0
warning_message = ""
@ -6063,14 +6098,46 @@ def Check_Partner_Session_Alert(diction):
- si les questionnaire de positionnement n'ont pas été envoyés
"""
diction_list_tracked_doc = {}
diction_list_tracked_doc['token'] = str(diction['token'])
diction_list_tracked_doc['related_collection'] = "session_formation"
diction_list_tracked_doc['related_collection_recid'] = str(diction['session_id'])
diction_list_tracked_doc['session_id'] = str(diction['session_id'])
local_status, local_retval = module_editique.Get_Editable_Document_By_Partner_By_Collection(
diction_list_tracked_doc)
if (local_status is False):
return local_status, local_retval, False
json_formatted_str = json.dumps(local_retval, indent=2)
#print(" ### AFFICHAGE dU data Check_Partner_Session_Alert ")
#print(json_formatted_str)
for val_str in local_retval:
val = ast.literal_eval(val_str)
local_courrier_template_ref_interne = val['courrier_template_ref_interne']
if( local_courrier_template_ref_interne in list_etape_a_controler ):
if( str(val['statut_completude']) == "1"):
is_warning = 1
warning_message = warning_message + "<br/> "+str(val['courrier_template_nom'])+ " Partiel"
if (str(val['statut_completude']) == "0"):
is_warning = 1
warning_message = warning_message + "<br/> " + str(val['courrier_template_nom']) + " Non Commencé"
#print(" is_warning = ", is_warning)
#print(" warning_message = ", warning_message)
if( is_warning == 1 ):
return True, warning_message, str(is_warning)
return True, "OK"
return True, "OK", str(is_warning)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de verifier si la session est ok "
return False, " Impossible de verifier si la session est ok ", False