20/04/2024 - 13h
parent
08b720adb6
commit
56b3b734bc
|
@ -1,10 +1,15 @@
|
|||
<?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="18/04/2024 - 21h50">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="19/04/2024 - 22h22">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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_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" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -74,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00222" summary="17/02/2024 - 11h">
|
||||
<created>1708179293702</created>
|
||||
<option name="number" value="00222" />
|
||||
<option name="presentableId" value="LOCAL-00222" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1708179293703</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00223" summary="18/02/2024 - 14h">
|
||||
<created>1708260895527</created>
|
||||
<option name="number" value="00223" />
|
||||
|
@ -417,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1713470069721</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="271" />
|
||||
<task id="LOCAL-00271" summary="19/04/2024 - 22h22">
|
||||
<created>1713558162945</created>
|
||||
<option name="number" value="00271" />
|
||||
<option name="presentableId" value="LOCAL-00271" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713558162945</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="272" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -459,7 +464,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="19/03/2024 - 17h30" />
|
||||
<MESSAGE value="20/03/2024 - 22h30" />
|
||||
<MESSAGE value="20/03/2024 - 22h30d" />
|
||||
<MESSAGE value="20/03/2024 - 22h30dss" />
|
||||
|
@ -484,6 +488,7 @@
|
|||
<MESSAGE value="14/04/2024 - 23h05" />
|
||||
<MESSAGE value="17/04/2024 - 21h04" />
|
||||
<MESSAGE value="18/04/2024 - 21h50" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="18/04/2024 - 21h50" />
|
||||
<MESSAGE value="19/04/2024 - 22h22" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="19/04/2024 - 22h22" />
|
||||
</component>
|
||||
</project>
|
|
@ -24,6 +24,7 @@ if (MYSY_ENV == "PROD"):
|
|||
client = MongoClient(CONNECTION_STRING)
|
||||
dbname = client['cherifdb']
|
||||
CLIENT_URL_BASE = 'https://www.mysy-training.com/'
|
||||
MYSY_DEBUG_LEVEL = 0
|
||||
|
||||
|
||||
elif (MYSY_ENV == "DEV"):
|
||||
|
@ -31,18 +32,21 @@ elif (MYSY_ENV == "DEV"):
|
|||
client = MongoClient(CONNECTION_STRING)
|
||||
dbname = client['cherifdb_dev']
|
||||
CLIENT_URL_BASE = 'http://localhost:3009/'
|
||||
MYSY_DEBUG_LEVEL = 1
|
||||
|
||||
elif (MYSY_ENV == "REC"):
|
||||
CONNECTION_STRING = "mongodb://localhost:27017/cherifdb_rec"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
dbname = client['cherifdb_rec']
|
||||
CLIENT_URL_BASE = 'https://dev.mysy-training.com/'
|
||||
MYSY_DEBUG_LEVEL = 1
|
||||
|
||||
elif (MYSY_ENV == "DEM"):
|
||||
CONNECTION_STRING = "mongodb://localhost:27017/cherifdb_demo"
|
||||
client = MongoClient(CONNECTION_STRING)
|
||||
dbname = client['cherifdb_demo']
|
||||
CLIENT_URL_BASE = 'https://demo.mysy-training.com/'
|
||||
MYSY_DEBUG_LEVEL = 1
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5273,6 +5273,8 @@ def Refuse_List_AttendeeInscription_with_motif(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Fontion de validation / acceptation d'une inscription
|
||||
"""
|
||||
|
@ -8070,7 +8072,6 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
|
|||
|
||||
|
||||
## Creation du mail au format email
|
||||
|
||||
corps_mail_Template = jinja2.Template(str(courrier_template_data['corps_mail']))
|
||||
|
||||
sourceHtml = corps_mail_Template.render(params=body["params"])
|
||||
|
|
1738
Log/log_file.log
1738
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -6434,7 +6434,7 @@ def Prepare_and_Send_Attestation_From_Session_By_Email(tab_files, Folder, dictio
|
|||
'valide':"1",
|
||||
"locked":'0',
|
||||
'_id': { '$in': tab_inscriptions_ids_splited_obj} }
|
||||
print("### qry zzzz = ", qry)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -8287,7 +8287,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
}
|
||||
)
|
||||
|
||||
print(" zzzzz ")
|
||||
|
||||
# CONTROLE : Verification des data client (si tous les clients 'particuliers' sont ok
|
||||
for local_inscription_no_client in liste_inscription_no_client:
|
||||
print(" ### List des inscrit n'ayant pas de 'client_id': ", local_inscription_no_client)
|
||||
|
@ -9138,3 +9138,297 @@ def Audit_Session_Action_Inscrit(diction):
|
|||
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éaliser l'audit de la session"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'envoyer une demande a un client
|
||||
pour mettre à jour la liste de ses apprenant qui sont inscrit à une session.
|
||||
|
||||
Cette fonction s'applique uniquement au preinscrit (status = 0)
|
||||
use case :
|
||||
lorqu'un client valide un devis, les places sont preinscrit sur la session avec des nom par defaut
|
||||
(devis_nom1, devis_nom2, etc).
|
||||
Le gestionnaire de formation, peut ensuire utiliser cette fonction pour demander au client de saisir ou valider
|
||||
les noms et emails definitifs.
|
||||
|
||||
|
||||
/!\ : On traite toute la liste d'un client, pas de traitement partiel
|
||||
|
||||
"""
|
||||
def Prepare_request_presinscription_data_validation(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'list_inscription_id', 'session_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies ne sont pas correctes"
|
||||
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = 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
|
||||
|
||||
partner_recid = my_partner['recid']
|
||||
|
||||
list_client_id = []
|
||||
|
||||
list_inscription_id = []
|
||||
if ("list_inscription_id" in diction.keys()):
|
||||
if diction['list_inscription_id']:
|
||||
list_inscription_id = str(diction['list_inscription_id']).replace(",", ";").split(";")
|
||||
|
||||
for inscription_id in list_inscription_id:
|
||||
"""
|
||||
# Verification que l'inscription existe et qu'elle est valide et qu'elle est au statut 0 (preinscrit)
|
||||
|
||||
"""
|
||||
ret_val2_count = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']),
|
||||
'session_id':diction['session_id'] },
|
||||
)
|
||||
|
||||
if (ret_val2_count != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + "L'identifiant de l'inscription " + str(
|
||||
inscription_id) + " n'est pas valide ")
|
||||
return False, " L'identifiant de l'inscription " + str(inscription_id) + " n'est pas valide "
|
||||
|
||||
inscription_id_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(inscription_id)), 'partner_owner_recid': str(my_partner['recid']), 'session_id':diction['session_id']
|
||||
},
|
||||
)
|
||||
|
||||
if ("status" not in inscription_id_data.keys() or inscription_id_data['status'] != "0"):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " Toutes les inscriptions doivent être au statut : 'preinscription' ")
|
||||
return False, " Toutes les inscriptions doivent être au statut : preinscription "
|
||||
|
||||
|
||||
|
||||
# On enregistre le client dans la table "list_client_id"
|
||||
if ("client_rattachement_id" in inscription_id_data.keys() and inscription_id_data[
|
||||
'client_rattachement_id'] and inscription_id_data['client_rattachement_id'] not in list_client_id):
|
||||
list_client_id.append(str(inscription_id_data['client_rattachement_id']))
|
||||
|
||||
# Verifier que la session de formation concernée est valide
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'_id': ObjectId(str(inscription_id_data['session_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1'})
|
||||
|
||||
if (is_valide_session != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session de formation " + str(
|
||||
inscription_id_data['session_id']) + " n'est pas valide ")
|
||||
return False, " L'identifiant de la session de formation " + str(
|
||||
inscription_id_data['session_id']) + " n'est pas valide "
|
||||
|
||||
mycommon.myprint_debug(" list_client_id = " + str(list_client_id))
|
||||
|
||||
|
||||
|
||||
# A present les controles sont ok sur la liste on peut valide la liste des inscription
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
|
||||
for client_id in list_client_id:
|
||||
mycommon.myprint_debug(" Traitement du client client_id = " + str(client_id))
|
||||
|
||||
new_local_diction = {}
|
||||
new_local_diction['client_id'] = str(client_id)
|
||||
new_local_diction['session_id'] = str(diction['session_id'] )
|
||||
new_local_diction['partner_recid'] = str(my_partner['recid'])
|
||||
new_local_diction['token'] = str(diction['token'])
|
||||
|
||||
local_send_status, local_retval = Send_Email_request_presinscription_data_validation(new_local_diction)
|
||||
if (local_send_status is False):
|
||||
is_warning = "1"
|
||||
warning_msg = warning_msg + "\n" + str(local_retval)
|
||||
|
||||
|
||||
if (is_warning == "1"):
|
||||
return True, str(warning_msg)
|
||||
|
||||
return True, "Les demandes de mise à jour ont été envoyées"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer les demandes de mise à jour"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction envoi l'email de demande de validation/maj
|
||||
de la liste des preinscrits à une session de formation
|
||||
"""
|
||||
def Send_Email_request_presinscription_data_validation(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['client_id', 'session_id', 'partner_recid', '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 liste ")
|
||||
return False, " Les informations fournies ne sont pas correctes"
|
||||
|
||||
|
||||
|
||||
# A present les controles sont ok sur la liste on peut valide la liste des inscription
|
||||
warning_msg = ""
|
||||
is_warning = ""
|
||||
|
||||
|
||||
|
||||
# Recuperation des données des stagiaires
|
||||
tab_stagiaire = []
|
||||
for inscription_id_data in MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']), 'partner_owner_recid': str(diction['partner_recid']), 'status': '1', 'client_rattachement_id': str(diction['client_id'])}):
|
||||
|
||||
if (inscription_id_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du stagiaire est invalide ")
|
||||
return False, " L'identifiant du stagiaire est invalide "
|
||||
tab_stagiaire.append(inscription_id_data['_id'])
|
||||
|
||||
|
||||
# Recuperation des données du client
|
||||
tab_client = []
|
||||
for client_id_data in MYSY_GV.dbname['partner_client'].find(
|
||||
{'_id': ObjectId(str(diction['client_id'])), 'partner_recid': str(diction['partner_recid']),
|
||||
'valide': '1', 'locked':'0'}):
|
||||
|
||||
if (client_id_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du client est invalide ")
|
||||
return False, " L'identifiant du client est invalide "
|
||||
tab_client.append(client_id_data['_id'])
|
||||
|
||||
# Recuperation des contacts de communucation du client
|
||||
local_diction = {}
|
||||
local_diction['token'] = diction['token']
|
||||
local_diction['_id'] = str(diction['client_id'])
|
||||
|
||||
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction)
|
||||
if( local_status is False ):
|
||||
return local_status, partner_client_contact_communication
|
||||
|
||||
|
||||
tab_email_contact_client_destinataire = []
|
||||
for tmp_val in partner_client_contact_communication:
|
||||
tmp_val_JSON = ast.literal_eval(tmp_val)
|
||||
if( "email" in tmp_val_JSON.keys() and tmp_val_JSON['email']):
|
||||
tab_email_contact_client_destinataire.append(str(tmp_val_JSON['email']))
|
||||
|
||||
# Recuperation des données de la session
|
||||
tab_session = []
|
||||
class_internal_url = ""
|
||||
for session_id_data in MYSY_GV.dbname['session_formation'].find(
|
||||
{'_id': ObjectId(str(diction['session_id'])), 'partner_owner_recid': str(diction['partner_recid']),
|
||||
'valide': '1', }):
|
||||
|
||||
if (session_id_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
tab_session.append(session_id_data['_id'])
|
||||
class_internal_url = session_id_data['class_internal_url']
|
||||
|
||||
# Recuperation des données de la formation
|
||||
tab_class = []
|
||||
for class_id_data in MYSY_GV.dbname['myclass'].find(
|
||||
{'internal_url': str(class_internal_url), 'partner_owner_recid': str(diction['partner_recid']),
|
||||
'valide': '1', }):
|
||||
|
||||
if (class_id_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide "
|
||||
tab_class.append(class_id_data['_id'])
|
||||
|
||||
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
new_diction['list_stagiaire_id'] = tab_stagiaire
|
||||
new_diction['list_session_id'] = tab_session
|
||||
new_diction['list_class_id'] = tab_class
|
||||
new_diction['list_client_id'] = tab_client
|
||||
new_diction['list_apprenant_id'] = []
|
||||
new_diction['list_sequence_session_id'] = []
|
||||
|
||||
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||
convention_dictionnary_data = local_retval
|
||||
|
||||
body = {
|
||||
"params": convention_dictionnary_data,
|
||||
}
|
||||
"""
|
||||
Recuperation du modele de courrier
|
||||
"""
|
||||
# field_list = ['token', "courrier_template_id", "courrier_template_ref_interne", "partner_recid"]
|
||||
new_local_diction = {}
|
||||
new_local_diction['courrier_template_id'] = ""
|
||||
new_local_diction['courrier_template_ref_interne'] = "PARTICIPANT_LIST_UPDATE"
|
||||
new_local_diction['partner_recid'] = str(diction['partner_recid'])
|
||||
|
||||
|
||||
status_courrier_template_data , retval_courrier_template_data = mycommon.Get_Partner_Courrier_Model(new_local_diction)
|
||||
if( status_courrier_template_data is False):
|
||||
return status_courrier_template_data , retval_courrier_template_data
|
||||
|
||||
courrier_template_data = retval_courrier_template_data
|
||||
|
||||
|
||||
|
||||
## Creation du mail au format email
|
||||
corps_mail_Template = jinja2.Template(str(courrier_template_data['contenu_doc']))
|
||||
sourceHtml = corps_mail_Template.render(params=body["params"])
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
# Recuperation des donnes smpt
|
||||
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
|
||||
diction['partner_recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return local_stpm_status, partner_own_smtp_value
|
||||
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = courrier_template_data['sujet']
|
||||
# msg['to'] = "billardman01@hotmail.com"
|
||||
toaddrs = ", ".join(tab_email_contact_client_destinataire)
|
||||
msg['to'] = str(toaddrs)
|
||||
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
print(" ### smtpserver = ", smtpserver)
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
|
||||
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email envoyé " + str(val))
|
||||
|
||||
return True, "Les demandes de mise à jour ont été envoyées"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer les demandes de mise à jour"
|
||||
|
||||
|
|
17
main.py
17
main.py
|
@ -3574,6 +3574,23 @@ def Refuse_List_AttendeeInscription_with_motif():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'envoyer une demande a un client
|
||||
pour mettre à jour la liste de ses apprenant qui sont inscrit à une session.
|
||||
"""
|
||||
@app.route('/myclass/api/Prepare_request_presinscription_data_validation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Prepare_request_presinscription_data_validation():
|
||||
# On CancelAttendeeInscription le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### send_request_presinscription_data_validation : payload = ",payload)
|
||||
localStatus, message= SF.Prepare_request_presinscription_data_validation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de validation d'une inscription d'un stagiaire
|
||||
"""
|
||||
|
|
|
@ -1007,7 +1007,7 @@ def Add_Partner_Quotation(diction):
|
|||
data['locked'] = '0'
|
||||
data['date_update'] = str(datetime.now())
|
||||
|
||||
print(" ### add_partner_order data = ", data)
|
||||
#print(" ### add_partner_order data = ", data)
|
||||
inserted_id = ""
|
||||
inserted_id = MYSY_GV.dbname['partner_order_header'].insert_one(data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
|
168
prj_common.py
168
prj_common.py
|
@ -62,6 +62,12 @@ def myprint(message = ""):
|
|||
print(Fore.RED+str(datetime.now()) + " : " + str(message)+Style.RESET_ALL)
|
||||
|
||||
|
||||
def myprint_debug(message = ""):
|
||||
if( MYSY_GV.MYSY_DEBUG_LEVEL > 0 ):
|
||||
logging.info("DEBUG : "+str(datetime.now()) + " : "+str(message) )
|
||||
print(Fore.RED+"DEBUG : "+str(datetime.now()) + " : " + str(message)+Style.RESET_ALL)
|
||||
|
||||
|
||||
def create_order_id():
|
||||
return secrets.token_urlsafe(3)
|
||||
|
||||
|
@ -4810,12 +4816,12 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
list_contact_communication = []
|
||||
if(local_status is True):
|
||||
print(" partner_client_contact_communication = ", partner_client_contact_communication)
|
||||
#print(" partner_client_contact_communication = ", partner_client_contact_communication)
|
||||
for contact_communication_str in partner_client_contact_communication :
|
||||
print(" contact_communication_str = ", contact_communication_str)
|
||||
#print(" contact_communication_str = ", contact_communication_str)
|
||||
|
||||
contact_communication = ast.literal_eval(contact_communication_str)
|
||||
print(" my_json = ", contact_communication)
|
||||
#print(" my_json = ", contact_communication)
|
||||
|
||||
contact_communication_node = {}
|
||||
contact_communication_node['civilite'] = contact_communication['civilite']
|
||||
|
@ -4868,7 +4874,7 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
])
|
||||
|
||||
print( " ### pipe_qry select sequence = ", pipe_qry)
|
||||
#print( " ### pipe_qry select sequence = ", pipe_qry)
|
||||
for sequence_session_data in MYSY_GV.dbname['session_formation_sequence'].aggregate(pipe_qry):
|
||||
|
||||
|
||||
|
@ -5365,8 +5371,6 @@ def Get_Competence_Level():
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
|
||||
|
@ -5377,3 +5381,155 @@ def Get_Competence_Level():
|
|||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les niveaux de compétence"
|
||||
|
||||
"""
|
||||
Recuperation des coordonnées SMTP
|
||||
"""
|
||||
def Get_Partner_SMTP_Param(partner_recid):
|
||||
try:
|
||||
"""
|
||||
Recuperation des parametre SMTP du partner si le client a decidé d'utiliser son propre smpt
|
||||
"""
|
||||
partner_own_smtp_value = "0"
|
||||
partner_SMTP_COUNT_smtpsrv = ""
|
||||
partner_SMTP_COUNT_password = ""
|
||||
partner_SMTP_COUNT_user = ""
|
||||
partner_SMTP_COUNT_From_User = ""
|
||||
partner_SMTP_COUNT_port = ""
|
||||
|
||||
|
||||
partner_own_smtp = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'partner_smtp',
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (partner_own_smtp and "config_value" in partner_own_smtp.keys()):
|
||||
partner_own_smtp_value = partner_own_smtp['config_value']
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
partner_SMTP_COUNT_password = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'smtp_user_pwd',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_smtpsrv = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'smtp_server',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_user = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'smtp_user',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_From_User = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'smtp_count_from_name',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
partner_SMTP_COUNT_port = str(MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(partner_recid),
|
||||
'config_name': 'smtp_count_port',
|
||||
'valide': '1',
|
||||
'locked': '0'}, {'config_value': 1})['config_value'])
|
||||
|
||||
else:
|
||||
# On recuperer les parametre de mysy qui sont stocké dans le fichier : MYSY_GV
|
||||
partner_SMTP_COUNT_smtpsrv = MYSY_GV.O365_SMTP_COUNT_smtpsrv
|
||||
partner_SMTP_COUNT_password = MYSY_GV.O365_SMTP_COUNT_password
|
||||
partner_SMTP_COUNT_user = MYSY_GV.O365_SMTP_COUNT_user
|
||||
partner_SMTP_COUNT_From_User = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
partner_SMTP_COUNT_port = MYSY_GV.O365_SMTP_COUNT_port
|
||||
|
||||
|
||||
return True, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les paramettres smtp du partenaire ", False, False, False, False
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de recuperer les données d'un modele de courrier
|
||||
"""
|
||||
def Get_Partner_Courrier_Model(diction):
|
||||
try:
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list = [ "courrier_template_id", "courrier_template_ref_interne", "partner_recid"]
|
||||
|
||||
filt_courrier_template_id = {}
|
||||
filt_courrier_template_ref_interne = {}
|
||||
|
||||
is_one_filter = 0
|
||||
|
||||
if("courrier_template_id" in diction.keys() and diction['courrier_template_id']):
|
||||
filt_courrier_template_id = {'_id':ObjectId(str(diction['courrier_template_id']))}
|
||||
is_one_filter = 1
|
||||
|
||||
if ("courrier_template_ref_interne" in diction.keys() and diction['courrier_template_ref_interne']):
|
||||
filt_courrier_template_ref_interne = {'ref_interne': str(diction['courrier_template_ref_interne'])}
|
||||
is_one_filter = 1
|
||||
|
||||
if( is_one_filter == 0 ):
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " Vous devez fournir au moins un filter pour identifier le modèle de courrier ")
|
||||
return False, " Vous devez fournir au moins un filter pour identifier le modèle de courrier "
|
||||
|
||||
query_filter_partner_owner_recid = {'$and': [
|
||||
{'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(diction['partner_recid'])},
|
||||
filt_courrier_template_id,
|
||||
filt_courrier_template_ref_interne,]
|
||||
}
|
||||
|
||||
query_filter_default = {'$and': [
|
||||
{'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': "default"},
|
||||
filt_courrier_template_id,
|
||||
filt_courrier_template_ref_interne, ]
|
||||
}
|
||||
|
||||
is_courrier_found = 0
|
||||
|
||||
is_courrier_template_id_valide = MYSY_GV.dbname['courrier_template'].count_documents(query_filter_partner_owner_recid)
|
||||
|
||||
|
||||
|
||||
if (is_courrier_template_id_valide == 1):
|
||||
courrier_template_id_data = MYSY_GV.dbname['courrier_template'].find_one(query_filter_partner_owner_recid)
|
||||
is_courrier_found = 1
|
||||
|
||||
|
||||
else:
|
||||
is_courrier_template_id_valide = MYSY_GV.dbname['courrier_template'].count_documents(
|
||||
query_filter_default)
|
||||
|
||||
if (is_courrier_template_id_valide == 1):
|
||||
courrier_template_id_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
query_filter_default)
|
||||
is_courrier_found = 1
|
||||
|
||||
|
||||
|
||||
if( is_courrier_found != 1 ):
|
||||
myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Aucun modèle de courrier n'a été trouvé ")
|
||||
return False, " Aucun modèle de courrier n'a été trouvé "
|
||||
|
||||
|
||||
|
||||
return True, courrier_template_id_data
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer le modèle de courrier "
|
Loading…
Reference in New Issue