master
cherif 2024-04-21 13:54:29 +02:00
parent 0b5db3b6d7
commit e32e0457d5
8 changed files with 2364 additions and 24 deletions

View File

@ -1,13 +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="20/04/2024 - 13h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/04/2024 - 20h44">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/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" />
@ -77,13 +79,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00224" summary="ddr">
<created>1708698485603</created>
<option name="number" value="00224" />
<option name="presentableId" value="LOCAL-00224" />
<option name="project" value="LOCAL" />
<updated>1708698485604</updated>
</task>
<task id="LOCAL-00225" summary="23/02/2024 - 22h30">
<created>1708724600232</created>
<option name="number" value="00225" />
@ -420,7 +415,14 @@
<option name="project" value="LOCAL" />
<updated>1713610715822</updated>
</task>
<option name="localTasksCounter" value="273" />
<task id="LOCAL-00273" summary="20/04/2024 - 20h44">
<created>1713638681958</created>
<option name="number" value="00273" />
<option name="presentableId" value="LOCAL-00273" />
<option name="project" value="LOCAL" />
<updated>1713638681959</updated>
</task>
<option name="localTasksCounter" value="274" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -462,7 +464,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="20/03/2024 - 22h30d" />
<MESSAGE value="20/03/2024 - 22h30dss" />
<MESSAGE value="25/03/2024 - 18h30" />
<MESSAGE value="26/03/2024 - 21h30" />
@ -487,6 +488,7 @@
<MESSAGE value="18/04/2024 - 21h50" />
<MESSAGE value="19/04/2024 - 22h22" />
<MESSAGE value="20/04/2024 - 13h" />
<option name="LAST_COMMIT_MESSAGE" value="20/04/2024 - 13h" />
<MESSAGE value="20/04/2024 - 20h44" />
<option name="LAST_COMMIT_MESSAGE" value="20/04/2024 - 20h44" />
</component>
</project>

View File

@ -10993,6 +10993,12 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
else:
val['code_session'] = ""
if ("titre" in session_retval.keys()):
val['session_titre'] = str(session_retval['titre'])
else:
val['session_titre'] = ""
if ("date_debut" in session_retval.keys()):
val['date_du'] = str(session_retval['date_debut'])[0:10]
else:

File diff suppressed because it is too large Load Diff

View File

@ -4308,7 +4308,7 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
local_diction['token'] = diction['token']
local_diction['_id'] = str(single_client)
print(" ##### local_diction = ", local_diction)
#print(" ##### local_diction = ", local_diction)
local_status, partner_client_contact_communication = partner_client.Get_Partner_Client_Communication_Contact(local_diction)
@ -4316,7 +4316,7 @@ def Prepare_and_Send_Convention_From_Session_By_Email(tab_files, Folder, diction
mycommon.myprint(" Impossible de récupérer les contacts de communication du client ")
return False, " Impossible de récupérer les contacts de communication du client "
print(" ### partner_client_contact_communication = ", partner_client_contact_communication)
#print(" ### partner_client_contact_communication = ", partner_client_contact_communication)
tab_local_email_production = []
for tmp in partner_client_contact_communication:
tmp_JSON = ast.literal_eval(tmp)
@ -9371,6 +9371,8 @@ def Send_Email_request_presinscription_data_validation(diction):
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
convention_dictionnary_data = local_retval
convention_dictionnary_data['attendeelist_url'] = MYSY_GV.CLIENT_URL_BASE+"UpadateAttendeeList/"+str(diction['client_id'])+"/"+str(diction['session_id'])+"/"+str(diction['partner_recid'])+"/"
body = {
"params": convention_dictionnary_data,
}
@ -9397,6 +9399,10 @@ def Send_Email_request_presinscription_data_validation(diction):
sourceHtml = corps_mail_Template.render(params=body["params"])
html_mime = MIMEText(sourceHtml, 'html')
# Traitement du sujet du mail
sujet_mail_Template = jinja2.Template(str(courrier_template_data['sujet']))
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Creation de l'email à enoyer
msg = MIMEMultipart("alternative")
@ -9410,13 +9416,13 @@ def Send_Email_request_presinscription_data_validation(diction):
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = courrier_template_data['sujet']
msg['Subject'] = sujetHtml
# 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)
@ -9496,7 +9502,7 @@ def Client_Update_Liste_Attendee_No_Token(diction):
for val in JSON_attendee_response:
# Verifier qu'on mettre à jour tous les participants
# Verifier que les données envoyées sont valide avant de mettre à jour tous les participants
is_valide_attendee = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(val['_id'])),
'status':'0',
'session_id':str(diction['session_id']),
@ -9508,6 +9514,18 @@ def Client_Update_Liste_Attendee_No_Token(diction):
inspect.stack()[0][3]) + " Le participant "+str(val['_id'])+" n'est pas valide ou n'est pas au statut PREINSCRIT")
return False, " Le participant "+str(val['_id'])+" n'est pas valide ou n'est pas au statut PREINSCRIT"
if ("civilite" in val.keys() and str(val['civilite']).lower().strip() not in MYSY_GV.CIVILITE):
mycommon.myprint(
str(inspect.stack()[0][3]) + "La civlité " +str(val['civilite']).lower().strip() + " n'est pas valide. Les valeurs autorisées sont "+str(MYSY_GV.CIVILITE))
return False, " La civlité " +str(val['civilite']).lower().strip() + " n'est pas valide. Les valeurs autorisées sont "+str(MYSY_GV.CIVILITE)
# Verifier la validité du mail
if ("email" in val.keys()):
local_email = str(val['email']).strip()
if (mycommon.isEmailValide(local_email) is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - l'adresse email " + str(local_email) + " n'est pas valide")
return False, "- l'adresse email " + str(local_email) + " n'est pas valide "
"""
A présent toutes les données sont valide, on fait la mise à jour
@ -9520,7 +9538,20 @@ def Client_Update_Liste_Attendee_No_Token(diction):
update_data['nom'] = str(val['nom'])
update_data['prenom'] = str(val['prenom'])
update_data['email'] = str(val['email'])
if( "civilite" in val.keys() and str(val['civilite']).lower().strip() in MYSY_GV.CIVILITE):
update_data['civilite'] = str(val['civilite']).lower().strip()
# Verifier la validité du mail
if ("email" in val.keys() ):
local_email = str(val['email']).strip()
if (mycommon.isEmailValide(local_email)):
update_data['email'] = local_email
else:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - l'adresse email " + str(local_email) + " n'est pas valide")
return False, "- l'adresse email " + str(local_email) + " n'est pas valide "
update_attendee_data = MYSY_GV.dbname['inscription'].find_one_and_update({'_id':ObjectId(str(val['_id'])),
'status':'0',
@ -9532,7 +9563,7 @@ def Client_Update_Liste_Attendee_No_Token(diction):
return_document=ReturnDocument.AFTER
)
return True, "Les mise à jour ont été correctement faite"
return True, "Les mises à jour ont été correctement faites"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()

17
main.py
View File

@ -4254,6 +4254,23 @@ def Get_Partner_Client_Communication_Contact():
"""
API de recuperation des contacts d'un client inclus dans la communication en mode non connecté
donc NO_TOKEN, mais avec le partner_owner_recid
"""
@app.route('/myclass/api/Get_Partner_Client_Communication_Contact_NO_TOKEN/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Partner_Client_Communication_Contact_NO_TOKEN():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Partner_Client_Communication_Contact_NO_TOKEN : payload = ",payload)
localStatus, message = partner_client.Get_Partner_Client_Communication_Contact_NO_TOKEN(payload)
return jsonify(status=localStatus, message=message)
"""
API qui permet de modifier un contact donnée (nested list) d'un client de partenaire
"""

View File

@ -1937,3 +1937,77 @@ def Get_Partner_Client_Communication_Contact(diction):
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 contacts du client inclus dans la communication "
"""
Cette fonction retourne les contact d'un client qui
doivent etre inlus dans les communication, ceci en mode non connecté.
donc avec en input le partner_owner_recid et non le token
"""
def Get_Partner_Client_Communication_Contact_NO_TOKEN(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['partner_owner_recid','_id']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list and val.startswith('my_') is False:
mycommon.myprint(str(
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
return False, " Les informations fournies sont incorrectes",
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['partner_owner_recid','_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 sont incorrectes",
# Verifier la validité du client
is_client_exist_valide = MYSY_GV.dbname['partner_client'].count_documents({"_id":ObjectId(str(diction['_id'])),
'valide': '1',
'locked':'0',
'partner_recid':str(diction['partner_owner_recid'])})
if( is_client_exist_valide <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - L'identifiant du client est invalide ")
return False, " L'identifiant du client est invalide ",
# field_list = ['token', 'related_collection', 'related_collection_owner_id']
new_diction = {}
new_diction['related_collection'] = "partner_client"
new_diction['related_collection_recid'] = diction['_id']
new_diction['partner_recid'] = str(diction['partner_owner_recid'])
new_diction['valide'] = "1"
new_diction['locked'] = "0"
new_diction['include_com'] = "1"
RetObject = []
val_tmp = 1
for retval in MYSY_GV.dbname['contact'].find(new_diction):
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récupérer la liste des contacts du client inclus dans la communication "

View File

@ -194,12 +194,12 @@ def Add_Partner_Document(diction):
if ("contenu_doc" in diction.keys()):
if diction['contenu_doc']:
contenu_doc = diction['contenu_doc']
if (len(str(contenu_doc)) > 20000):
if (len(str(contenu_doc)) > 30000):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Le champ 'contenu_doc' fait plus de 20000 caractères ")
3]) + " Le champ 'contenu_doc' fait "+str(len(str(contenu_doc)))+" cartactères. Limite 30000 caractères ")
return False, " - Le champ 'contenu_doc' fait plus de 20000 caractères "
return False, " Le champ 'contenu_doc' fait "+str(len(str(contenu_doc)))+" cartactères. Limite 30000 caractères "
data['contenu_doc'] = contenu_doc

View File

@ -4806,7 +4806,7 @@ def Get_Dictionnary_data_For_Template(diction):
new_client_data.update(new_field)
# Recuperation des contacts de communucation du client
# Recuperation des contacts de communication du client
local_diction = {}
local_diction['token'] = diction['token']
local_diction['_id'] = str(client_data['_id'])
@ -4907,7 +4907,7 @@ def Get_Dictionnary_data_For_Template(diction):
json_formatted_str = json.dumps(dictionnary_data, indent=2)
print(" ### AFFICHAGE dU data dictionnary ")
#print(" ### AFFICHAGE dU data dictionnary ")
#print(json_formatted_str)