parent
ff43eee51e
commit
333bcf9d98
|
@ -4,59 +4,31 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/07/2025 - 19h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06/07/2025 - 12h">
|
||||
<change afterPath="$PROJECT_DIR$/email_queu/email_queu_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$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/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$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/appel_offre.py" beforeDir="false" afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/articles_avis.py" beforeDir="false" afterPath="$PROJECT_DIR$/articles_avis.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attestation_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/attestation_formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_document_automatic_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_document_automatic_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_index_bdd_classes.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_index_bdd_classes.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/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$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_produit_service_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_produit_service_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/purchase_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/purchase_prices.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -103,7 +75,7 @@
|
|||
"git-widget-placeholder": "master__Elyos__FI",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"last_opened_file_path": "C:/Users/Cherif/Documents/myclass.com/Siteweb/Elyos_Ftion_Initiale/Ela_back/Back_Office_FI/tools_cherif",
|
||||
"settings.editor.selected.configurable": "project.propVCSSupport.CommitDialog"
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
|
@ -499,7 +471,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="487" />
|
||||
<option name="localTasksCounter" value="489" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -541,7 +513,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/05/2025 - 19" />
|
||||
<MESSAGE value="13/05/2025 - 17h" />
|
||||
<MESSAGE value="13/05/2025 - 20h" />
|
||||
<MESSAGE value="14/05/2025 - 20h" />
|
||||
|
@ -566,6 +537,18 @@
|
|||
<MESSAGE value="ss" />
|
||||
<MESSAGE value="ssss" />
|
||||
<MESSAGE value="03/07/2025 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/07/2025 - 19h30" />
|
||||
<MESSAGE value="06/07/2025 - 12h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="06/07/2025 - 12h" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/partner_client.py</url>
|
||||
<line>526</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
12
Contact.py
12
Contact.py
|
@ -151,6 +151,8 @@ def Add_Contact(diction):
|
|||
if( civilite not in MYSY_GV.CIVILITE ):
|
||||
civilite = "neutre"
|
||||
|
||||
if(str(civilite).strip() == ""):
|
||||
civilite = "neutre"
|
||||
|
||||
data['civilite'] = civilite
|
||||
|
||||
|
@ -303,6 +305,7 @@ Mise à jour d'un contact en se basant sur :
|
|||
- related_collection
|
||||
|
||||
"""
|
||||
|
||||
def Update_Contact(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
@ -398,6 +401,9 @@ def Update_Contact(diction):
|
|||
|
||||
data_update['civilite'] = str(diction['civilite']).lower()
|
||||
|
||||
if( str(diction['civilite']).strip() == ""):
|
||||
data_update['civilite'] = "neutre"
|
||||
|
||||
include_com = ""
|
||||
if ("include_com" in diction.keys()):
|
||||
include_com = diction['include_com']
|
||||
|
@ -425,6 +431,9 @@ def Update_Contact(diction):
|
|||
if (civilite not in MYSY_GV.CIVILITE):
|
||||
civilite = "neutre"
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
civilite = "neutre"
|
||||
|
||||
data_update['civilite'] = str(civilite)
|
||||
|
||||
adr_adresse = ""
|
||||
|
@ -683,6 +692,9 @@ def Get_Given_Contact(diction):
|
|||
if( local_civilite not in MYSY_GV.CIVILITE ):
|
||||
local_civilite = "neutre"
|
||||
|
||||
if( str(local_civilite).strip() == ""):
|
||||
local_civilite = "neutre"
|
||||
|
||||
user['civilite'] = local_civilite
|
||||
|
||||
|
||||
|
|
|
@ -1250,7 +1250,7 @@ def Create_E_Signature_For_E_Document(file_img=None, Folder=None, diction=None):
|
|||
|
||||
quotation_client_data = None
|
||||
quotation_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': local_partner_owner_recid,
|
||||
{'partner_owner_recid': local_partner_owner_recid,
|
||||
'_id': ObjectId(str(quotation_data['order_header_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
@ -1827,7 +1827,7 @@ def Create_E_Signature_For_E_Invoice(file_img=None, Folder=None, diction=None):
|
|||
|
||||
quotation_client_data = None
|
||||
quotation_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': local_partner_owner_recid,
|
||||
{'partner_owner_recid': local_partner_owner_recid,
|
||||
'_id': ObjectId(str(quotation_data['order_header_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
|
|
@ -133,7 +133,7 @@ Au dela de 300 caractère, le système rame
|
|||
MAX_CARACT = 300 # Celui est utilisé pour les affichage courts et tronqués, comme sur la page principale du moteur
|
||||
MAX_CARACT_DEDUIT = 150
|
||||
TOKEN_SIZE = 25
|
||||
MAX_CARACT_DETAIL = 1000 # Celui est utilisé pour les affichage globaux (si le texte est trop long, il va tronquer un peut mais cela permet de cadrer un peu les choses
|
||||
MAX_CARACT_DETAIL = 1200 # Celui est utilisé pour les affichage globaux (si le texte est trop long, il va tronquer un peut mais cela permet de cadrer un peu les choses
|
||||
|
||||
|
||||
|
||||
|
@ -444,9 +444,9 @@ Limite des zones de texte des formation
|
|||
- objectif
|
||||
- description
|
||||
"""
|
||||
CLASS_ZONE_PROGRAM_LIMIT = 1300
|
||||
CLASS_ZONE_DESCRIP_LIMIT = 2000
|
||||
CLASS_ZONE_OBJECTIF_LIMIT = 2000
|
||||
CLASS_ZONE_PROGRAM_LIMIT = 1200
|
||||
CLASS_ZONE_DESCRIP_LIMIT = 1200
|
||||
CLASS_ZONE_OBJECTIF_LIMIT = 1200
|
||||
|
||||
|
||||
"""
|
||||
|
@ -530,8 +530,8 @@ elif (MYSY_ENV == "DEM"):
|
|||
MYSY_MARIADB_PORT = 3306
|
||||
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
|
||||
MYSY_LMS_URL = "https://demolms.mysy-training.com/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_demo/"
|
||||
LMS_BAS_URL = "mysy-hosting.fr/"
|
||||
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_demo/"
|
||||
LMS_BAS_URL = "mysytraining.fr/"
|
||||
MYSY_ENV_API = "https://demoapi.mysy-training.com/myclass/api/"
|
||||
|
||||
|
||||
|
|
|
@ -272,6 +272,9 @@ def AddStagiairetoClass(diction):
|
|||
if (str(civilite) not in MYSY_GV.CIVILITE):
|
||||
civilite = "neutre"
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
civilite = "neutre"
|
||||
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
|
||||
|
@ -325,7 +328,7 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents( {'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'valide': '1','locked': '0', 'partner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
'valide': '1','locked': '0', 'partner_owner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
|
||||
if( local_client_retval_count != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -342,7 +345,7 @@ def AddStagiairetoClass(diction):
|
|||
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents( {'_id': ObjectId(diction['facture_client_rattachement_id']),
|
||||
'valide': '1','locked': '0', 'partner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
'valide': '1','locked': '0', 'partner_owner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
|
||||
if( local_client_retval_count != 1 ):
|
||||
mycommon.myprint(
|
||||
|
@ -376,7 +379,7 @@ def AddStagiairetoClass(diction):
|
|||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(diction['financeur_rattachement_id']),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(my_session_data['partner_owner_recid'])})
|
||||
|
||||
if (local_client_retval_count != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -389,17 +392,17 @@ def AddStagiairetoClass(diction):
|
|||
mydata['financeur_rattachement_id'] = ""
|
||||
|
||||
if ("tuteur1_civilite" not in diction.keys()):
|
||||
mydata['tuteur1_civilite'] = ""
|
||||
mydata['tuteur1_civilite'] = "neutre"
|
||||
|
||||
elif (diction['tuteur1_civilite'] not in MYSY_GV.CIVILITE):
|
||||
# la civilité n'est pas une de celle autorisée, alors je renvoie vide
|
||||
mydata['tuteur1_civilite'] = ""
|
||||
mydata['tuteur1_civilite'] = "neutre"
|
||||
|
||||
if ("tuteur2_civilite" not in diction.keys()):
|
||||
mydata['tuteur2_civilite'] = ""
|
||||
mydata['tuteur2_civilite'] = "neutre"
|
||||
elif (diction['tuteur2_civilite'] not in MYSY_GV.CIVILITE):
|
||||
# la civilité n'est pas une de celle autorisée, alors je renvoie vide
|
||||
mydata['tuteur2_civilite'] = ""
|
||||
mydata['tuteur2_civilite'] = "neutre"
|
||||
|
||||
|
||||
if ("ville" in diction.keys()):
|
||||
|
@ -1013,6 +1016,8 @@ def UpdateStagiairetoClass(diction):
|
|||
if (str(mydata['civilite']) not in MYSY_GV.CIVILITE):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
if( str(mydata['civilite']).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
if ("date_naissance" in diction.keys()):
|
||||
if diction['date_naissance']:
|
||||
|
@ -1154,7 +1159,7 @@ def UpdateStagiairetoClass(diction):
|
|||
if(len(str(diction['client_rattachement_id']).strip()) > 0 ):
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)})
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
if (local_client_retval_count != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -1168,7 +1173,7 @@ def UpdateStagiairetoClass(diction):
|
|||
if(len(str(diction['facture_client_rattachement_id']).strip()) > 0 ):
|
||||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['facture_client_rattachement_id']),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)})
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
if (local_client_retval_count != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -1184,7 +1189,7 @@ def UpdateStagiairetoClass(diction):
|
|||
## Verifier l'existance du client de rattachement
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(diction['financeur_rattachement_id']),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)})
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
if (local_client_retval_count != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -1673,6 +1678,9 @@ def GetAllClassStagiaire(diction):
|
|||
if( str( user['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if( str(user['civilite']).strip() == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
lms_account_expiration_date = ""
|
||||
if ("lms_account_expiration_date" in retval.keys()):
|
||||
lms_account_expiration_date = retval['lms_account_expiration_date']
|
||||
|
@ -2772,6 +2780,11 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
civilite = str(df['civilite'].values[n]).lower()
|
||||
|
||||
mydata['civilite'] = str(civilite).lower()
|
||||
if( str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
|
||||
|
||||
if( civilite not in MYSY_GV.CIVILITE):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ligne : " + str(
|
||||
|
@ -2833,7 +2846,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
|
||||
if( client_rattachement_email and client_rattachement_nom ):
|
||||
local_client_retval_qry = {'email':str(client_rattachement_email), 'nom':str(client_rattachement_nom), 'valide':'1',
|
||||
'locked':'0', 'partner_recid' :str(partner_recid)}
|
||||
'locked':'0', 'partner_owner_recid' :str(partner_recid)}
|
||||
|
||||
print(" ### local_client_retval_qry = ", local_client_retval_qry)
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(local_client_retval_qry)
|
||||
|
@ -3204,7 +3217,7 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
|
|||
if (client_rattachement_email and client_rattachement_nom):
|
||||
local_client_retval_qry = {'email': str(client_rattachement_email),
|
||||
'nom': str(client_rattachement_nom), 'valide': '1',
|
||||
'locked': '0', 'partner_recid': str(partner_recid)}
|
||||
'locked': '0', 'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
print(" ### local_client_retval_qry = ", local_client_retval_qry)
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
|
@ -3621,7 +3634,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
client_rattachement_nom = str(df['client_rattachement_nom'].values[n]).strip()
|
||||
if (client_rattachement_email and client_rattachement_nom):
|
||||
local_client_retval_qry = {'email':str(client_rattachement_email), 'nom':str(client_rattachement_nom),
|
||||
'valide':'1', 'locked':'0', 'partner_recid' :str(partner_recid)}
|
||||
'valide':'1', 'locked':'0', 'partner_owner_recid' :str(partner_recid)}
|
||||
print(" ### local_client_retval_qry = ", local_client_retval_qry)
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(local_client_retval_qry)
|
||||
|
||||
|
@ -3668,7 +3681,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
|
|||
|
||||
if (facture_client_rattachement_email and facture_client_rattachement_nom):
|
||||
local_client_retval_qry = {'email': str(facture_client_rattachement_email), 'nom': str(facture_client_rattachement_nom),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)}
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
print(" ### local_client_retval_qry = ", local_client_retval_qry)
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(local_client_retval_qry)
|
||||
|
@ -3996,6 +4009,10 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
|
|||
if (str(df['civilite'].values[n])):
|
||||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = str(civilite).lower()
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
if( civilite not in MYSY_GV.CIVILITE):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Ligne : " + str(
|
||||
|
@ -4061,7 +4078,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
|
|||
if (facture_client_rattachement_email and facture_client_rattachement_nom):
|
||||
local_client_retval_qry = {'email': str(facture_client_rattachement_email),
|
||||
'nom': str(facture_client_rattachement_nom),
|
||||
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)}
|
||||
'valide': '1', 'locked': '0', 'partner_owner_recid': str(partner_recid)}
|
||||
|
||||
print(" ### local_client_retval_qry = ", local_client_retval_qry)
|
||||
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents(local_client_retval_qry)
|
||||
|
@ -6602,25 +6619,48 @@ def AcceptAttendeeInscription(diction):
|
|||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " TOP, l'inscription dans le LMS a ete correctement faite")
|
||||
|
||||
""" Vu que l'inscription est ok, on va envoyer les credentials à l'inscrit
|
||||
"""
|
||||
11/07/2025 :
|
||||
Vu que l'inscription est ok, on va envoyer les credentials à l'inscrit
|
||||
si et seulement local_session['lms_account_automatic'] == "1"
|
||||
"""
|
||||
if( local_session and "lms_account_automatic" in local_session.keys() and local_session['lms_account_automatic'] == "1"):
|
||||
|
||||
print(" ### AUTOMATIC INSCRIPTION LMS a faire zzzzzz")
|
||||
local_node_send_credential = {}
|
||||
local_node_send_credential['token'] = diction['token']
|
||||
local_node_send_credential['class_internal_url'] = local_ret_val['class_internal_url']
|
||||
local_node_send_credential['session_id'] = local_ret_val['session_id']
|
||||
local_node_send_credential['email'] = local_ret_val['email']
|
||||
local_node_send_credential['nom'] = local_ret_val['nom']
|
||||
local_node_send_credential['prenom'] = local_ret_val['prenom']
|
||||
|
||||
local_node_send_credential['date_du'] = local_ret_val['date_du']
|
||||
local_node_send_credential['date_au'] = local_ret_val['date_au']
|
||||
local_node_send_credential['title'] = str(class_title)
|
||||
|
||||
local_node_send_credential['login'] = local_ret_val['email']
|
||||
local_node_send_credential['pwd'] = local_ret_val['lms_pwd']
|
||||
local_node_send_credential['lms_url'] = str(my_partner['lms_virtualhost_url'])
|
||||
|
||||
local_node_send_credential['course_owner_email'] = my_partner['email']
|
||||
local_node_send_credential['partner_recid'] = my_partner['recid']
|
||||
|
||||
local_node_send_credential['inscription_id'] = str(local_ret_val['_id'])
|
||||
local_node_send_credential['session_code'] = str(local_session['code_session'])
|
||||
|
||||
# split_mail_tab = str(email).split('@')
|
||||
# email_data['login'] = split_mail_tab[0]
|
||||
print(" ### local_node_send_credential = ", local_node_send_credential)
|
||||
send_credential_status, send_credential_retval = SendInscriptionConfirmation(local_node_send_credential)
|
||||
if( send_credential_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - WARNING : Impossible d'envoyer les accès du compte LMS à l'utilisateur "+str(local_ret_val['email']))
|
||||
return_message = return_message + " -Impossible d'envoyer les accès du compte LMS à l'utilisateur "+str(local_ret_val['email'])+". \n"
|
||||
is_warning_message = 1
|
||||
|
||||
local_status, local_message = email_session.LMS_Credential_Sending_mail(local_node_send_credential)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " - WARNING : Impossible d'envoyer le mail de notification pour " + str(
|
||||
diction['email']))
|
||||
return_message = return_message + str(
|
||||
" Impossible d'envoyer le mail de notification pour : " + str(diction['email']))
|
||||
|
||||
|
||||
else:
|
||||
|
@ -6746,6 +6786,7 @@ def AcceptAttendeeInscription(diction):
|
|||
new_apprenant_diction['nom'] = inscription_data['nom']
|
||||
new_apprenant_diction['email'] = inscription_data['email']
|
||||
new_apprenant_diction['prenom'] = inscription_data['prenom']
|
||||
new_apprenant_diction['civilite'] = ""
|
||||
|
||||
if( "civilite" in inscription_data.keys()):
|
||||
new_apprenant_diction['civilite'] = str(inscription_data['civilite']).lower()
|
||||
|
@ -6755,6 +6796,10 @@ def AcceptAttendeeInscription(diction):
|
|||
if (str(new_apprenant_diction['civilite']) not in MYSY_GV.CIVILITE):
|
||||
new_apprenant_diction['civilite'] = "neutre"
|
||||
|
||||
if( str(new_apprenant_diction['civilite']).strip() == ""):
|
||||
new_apprenant_diction['civilite'] = "neutre"
|
||||
|
||||
|
||||
if("telephone" in inscription_data.keys()):
|
||||
new_apprenant_diction['telephone'] = inscription_data['telephone']
|
||||
else:
|
||||
|
@ -6812,15 +6857,22 @@ def AcceptAttendeeInscription(diction):
|
|||
else:
|
||||
new_apprenant_diction['tuteur1_telephone'] = ""
|
||||
|
||||
new_apprenant_diction['tuteur1_civilite'] = ""
|
||||
if ("tuteur1_civilite" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur1_civilite'] = inscription_data['tuteur1_civilite']
|
||||
else:
|
||||
new_apprenant_diction['tuteur1_civilite'] = ""
|
||||
|
||||
if( str(new_apprenant_diction['tuteur1_civilite']).strip() == ""):
|
||||
new_apprenant_diction['tuteur1_civilite'] = "neutre"
|
||||
|
||||
new_apprenant_diction['tuteur2_civilite'] = ""
|
||||
if ("tuteur2_civilite" in inscription_data.keys()):
|
||||
new_apprenant_diction['tuteur2_civilite'] = inscription_data['tuteur2_civilite']
|
||||
else:
|
||||
new_apprenant_diction['tuteur2_civilite'] = ""
|
||||
if (str(new_apprenant_diction['tuteur2_civilite']).strip() == ""):
|
||||
new_apprenant_diction['tuteur2_civilite'] = "neutre"
|
||||
|
||||
|
||||
if("tuteur2_nom" in inscription_data.keys()):
|
||||
|
@ -7926,8 +7978,6 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
filt_session_id = {'session_id': {'$in': list_session_id, }}
|
||||
|
||||
|
||||
#print(" ### filt_session_id zzzzzzzzz = ", filt_session_id)
|
||||
|
||||
filt_class_title = {}
|
||||
if ("class_title" in diction.keys()):
|
||||
filt_class_title = {'title': {'$regex': str(diction['class_title']), "$options": "i"}}
|
||||
|
@ -7956,7 +8006,6 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
if ("session_id" in diction.keys()):
|
||||
filt_session_id = {'session_id': str(diction['session_id'])}
|
||||
"""
|
||||
#print(" ### filt_session_id 0222 zzzzzzzzz = ", filt_session_id)
|
||||
# -----
|
||||
|
||||
filt_client_nom = {}
|
||||
|
@ -7964,7 +8013,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
Lists_partner_client_id = []
|
||||
if ("client_nom" in diction.keys()):
|
||||
sub_filt_client_nom = {'nom': {'$regex': str(diction['client_nom']), "$options": "i"},
|
||||
'partner_recid': str(partner_recid), 'valide': '1', 'locked': '0'}
|
||||
'partner_owner_recid': str(partner_recid), 'valide': '1', 'locked': '0'}
|
||||
# Recuperation des '_id' des clients dont le nom match en regexp
|
||||
# print(" ### sub_filt_client_nom = ", sub_filt_client_nom)
|
||||
for List_Client_Data in MYSY_GV.dbname['partner_client'].find(sub_filt_client_nom, {'_id': 1}):
|
||||
|
@ -8039,6 +8088,10 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
if (str(val['civilite']) not in MYSY_GV.CIVILITE):
|
||||
val['civilite'] = "neutre"
|
||||
|
||||
if( str(val['civilite']).strip() == ""):
|
||||
val['civilite'] = "neutre"
|
||||
|
||||
|
||||
|
||||
if( "modefinancement" in retVal.keys()):
|
||||
val['modefinancement'] = retVal['modefinancement']
|
||||
|
@ -8554,6 +8607,7 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
else:
|
||||
my_retrun_dict['apprenant_id'] = ""
|
||||
|
||||
my_retrun_dict['tuteur1_civilite'] = ""
|
||||
if ("tuteur1_civilite" not in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur1_civilite'] = ""
|
||||
elif (local_Insc_retval['tuteur1_civilite'] not in MYSY_GV.CIVILITE):
|
||||
|
@ -8562,6 +8616,11 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
else:
|
||||
my_retrun_dict['tuteur1_civilite'] = local_Insc_retval['tuteur1_civilite']
|
||||
|
||||
|
||||
if( my_retrun_dict['tuteur1_civilite'] == ""):
|
||||
my_retrun_dict['tuteur1_civilite'] = "neutre"
|
||||
|
||||
my_retrun_dict['tuteur2_civilite'] = ""
|
||||
if ("tuteur2_civilite" not in local_Insc_retval.keys()):
|
||||
my_retrun_dict['tuteur2_civilite'] = ""
|
||||
elif (local_Insc_retval['tuteur2_civilite'] not in MYSY_GV.CIVILITE):
|
||||
|
@ -8570,6 +8629,9 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
else:
|
||||
my_retrun_dict['tuteur2_civilite'] = local_Insc_retval['tuteur2_civilite']
|
||||
|
||||
if( my_retrun_dict['tuteur2_civilite'] == ""):
|
||||
my_retrun_dict['tuteur2_civilite'] = "neutre"
|
||||
|
||||
|
||||
if ("code_session" in local_Insc_retval['inscription_collection'][0].keys()):
|
||||
my_retrun_dict['code_session'] = str(local_Insc_retval['inscription_collection'][0]['code_session'])
|
||||
|
@ -8612,6 +8674,8 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
|
|||
if (local_civilite not in MYSY_GV.CIVILITE):
|
||||
local_civilite = "neutre"
|
||||
|
||||
if( str(local_civilite) == ""):
|
||||
local_civilite = "neutre"
|
||||
|
||||
my_retrun_dict['civilite'] = str(local_civilite).lower()
|
||||
|
||||
|
@ -8810,16 +8874,17 @@ def UpdateStagiairetoClass_Tuteurs(diction):
|
|||
|
||||
|
||||
if ("tuteur1_civilite" in data_update.keys() ):
|
||||
if (data_update['tuteur1_civilite'] not in MYSY_GV.CIVILITE):
|
||||
if (data_update['tuteur1_civilite'] not in MYSY_GV.CIVILITE or str(data_update['tuteur1_civilite']).strip() == "" ):
|
||||
# la civilité n'est pas une de celle autorisée, alors je renvoie vide
|
||||
data_update['tuteur1_civilite'] = ""
|
||||
data_update['tuteur1_civilite'] = "neutre"
|
||||
|
||||
|
||||
|
||||
if ("tuteur2_civilite" in data_update.keys() ):
|
||||
if (data_update['tuteur2_civilite'] not in MYSY_GV.CIVILITE):
|
||||
if (data_update['tuteur2_civilite'] not in MYSY_GV.CIVILITE or str(data_update['tuteur2_civilite']).strip() == ""):
|
||||
# la civilité n'est pas une de celle autorisée, alors je renvoie vide
|
||||
data_update['tuteur2_civilite'] = ""
|
||||
data_update['tuteur2_civilite'] = "neutre"
|
||||
|
||||
|
||||
result = MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id':ObjectId(str(my_id)),
|
||||
|
@ -11084,7 +11149,7 @@ def Download_Convention_Stagiaire_PDF_By_Partner_client(diction):
|
|||
partner_client_id_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
tab_client = []
|
||||
tab_client.append(partner_client_id_data['_id'])
|
||||
|
@ -11309,7 +11374,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
# Traitement de l'eventuel fichier joint
|
||||
|
@ -11476,7 +11541,7 @@ def Sent_Convention_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_pat
|
|||
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid': str(my_partner['recid']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
})
|
||||
|
||||
|
||||
|
@ -12584,7 +12649,7 @@ def Get_Statgaire_List_Partner_with_filter_FOR_ONLY_INSCRIPTION_NO_TOKEN(diction
|
|||
else:
|
||||
val['civilite'] = ""
|
||||
|
||||
if (str(val['civilite']) not in MYSY_GV.CIVILITE):
|
||||
if (str(val['civilite']) not in MYSY_GV.CIVILITE or str(val['civilite']).strip() == ""):
|
||||
val['civilite'] = "neutre"
|
||||
|
||||
if ("modefinancement" in retVal.keys()):
|
||||
|
@ -14260,7 +14325,7 @@ def Add_Update_Inscription_Split_Invoice(diction):
|
|||
is_partage_client_valide = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(local_client)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_partage_client_valide != 1):
|
||||
|
|
|
@ -814,7 +814,7 @@ def Invoice_Data_From_Tab(diction):
|
|||
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['list_client'][0])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(str(data_array[0]['partner_owner_recid']))})
|
||||
'partner_owner_recid':str(str(data_array[0]['partner_owner_recid']))})
|
||||
|
||||
if( client_data is None ):
|
||||
mycommon.myprint(
|
||||
|
|
|
@ -3004,3 +3004,77 @@ def Cron_Send_Emargement_By_Date_By_Email_for_not_sent(Folder, diction):
|
|||
return False, " Impossible d'envoyer les demandes d'émargement ", "0"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'envoyer les emails qui sont dans file d'attente
|
||||
collection : 'email_queue'
|
||||
"""
|
||||
def Send_Mail_Queue_Message_With_Filter(diction):
|
||||
try:
|
||||
|
||||
field_list_obligatoire = ['partner_owner_recid',]
|
||||
|
||||
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, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
for email_queue_data in MYSY_GV.dbname['mail_queue'].find({'statut':'0', 'valide':'1', 'locked':'0'}):
|
||||
msg = MIMEMultipart("alternative")
|
||||
msg.attach(email_queue_data['message'])
|
||||
msg['From'] = email_queue_data['from']
|
||||
msg['Cc'] = email_queue_data['cc']
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = email_queue_data['subject']
|
||||
msg['to'] = email_queue_data['to']
|
||||
# Traitement de l'eventuel fichier joint
|
||||
tab_files_to_attache_to_mail = []
|
||||
|
||||
smtpserver = smtplib.SMTP(email_queue_data['smtp_account_smtpsrv'], email_queue_data['smtp_account_port'])
|
||||
|
||||
for myfile in email_queue_data['attached_files_path']:
|
||||
file_to_attache_to_mail = MIMEBase('application', "octet-stream")
|
||||
file_to_attache_to_mail.set_payload(open(myfile, "rb").read())
|
||||
encoders.encode_base64(file_to_attache_to_mail)
|
||||
file_to_attache_to_mail.add_header('Content-Disposition',
|
||||
'attachment; filename="{0}"'.format(os.path.basename(myfile)))
|
||||
|
||||
new_node = {"attached_file": file_to_attache_to_mail}
|
||||
tab_files_to_attache_to_mail.append(new_node)
|
||||
|
||||
# Attacher l'eventuelle pièces jointes
|
||||
for myfile in tab_files_to_attache_to_mail:
|
||||
msg.attach(myfile['attached_file'])
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(email_queue_data['smtp_account_user'], email_queue_data['smtp_account_password'])
|
||||
val = smtpserver.send_message(msg)
|
||||
smtpserver.close()
|
||||
print(" Email envoyé" + str(val))
|
||||
|
||||
"""
|
||||
On met à jour l'email avec le statut d'envoie de l'email
|
||||
"""
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['sent'] = str(datetime.now())
|
||||
new_data['statut'] = "2"
|
||||
new_data['sent_message'] = str(val)
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
{'_id':ObjectId(str(email_queue_data['_id']))},
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return True, "L'emails envoyé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'envoyer les emails "
|
||||
|
|
16389
Log/log_file.log
16389
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -7210,7 +7210,7 @@ def Create_Convention_By_Client_PDF(diction):
|
|||
# Verifier que le client est valide
|
||||
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])), 'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if (client_data is None ):
|
||||
mycommon.myprint(
|
||||
|
@ -9345,7 +9345,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
si non, créer le client
|
||||
"""
|
||||
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email'])})
|
||||
|
||||
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
|
||||
|
@ -9358,7 +9358,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
# Si le client existe, verifier qu'il est valide et pas locké
|
||||
if (is_inscription_no_client_exist == 1):
|
||||
is_inscription_no_client_valide_no_locked = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -9371,7 +9371,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -9475,7 +9475,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
|
||||
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -9737,7 +9737,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
|
|||
si non, créer le client
|
||||
"""
|
||||
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email'])})
|
||||
|
||||
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
|
||||
|
@ -9750,7 +9750,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
|
|||
# Si le client existe, verifier qu'il est valide et pas locké
|
||||
if (is_inscription_no_client_exist == 1):
|
||||
is_inscription_no_client_valide_no_locked = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -9763,7 +9763,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
|
|||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -9867,7 +9867,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
|
|||
|
||||
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -10123,7 +10123,7 @@ def Invoice_Partner_From_Session( diction):
|
|||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
# Recuperation des données du stagiaire
|
||||
|
@ -10500,7 +10500,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
# Traitement de l'eventuel fichier joint
|
||||
|
@ -10667,7 +10667,7 @@ def Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_files_name_full_path,
|
|||
client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['partner_client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid': str(my_partner['recid']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
})
|
||||
|
||||
|
||||
|
@ -11380,7 +11380,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
si non, créer le client
|
||||
"""
|
||||
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email'])})
|
||||
|
||||
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
|
||||
|
@ -11393,7 +11393,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
# Si le client existe, verifier qu'il est valide et pas locké
|
||||
if (is_inscription_no_client_exist == 1):
|
||||
is_inscription_no_client_valide_no_locked = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -11406,7 +11406,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -11509,7 +11509,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
local_inscription_no_client['email']) + " ", False
|
||||
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -11879,10 +11879,15 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
- Verifier s'il y a un client avec la même adresse email,
|
||||
si non, créer le client
|
||||
"""
|
||||
|
||||
|
||||
|
||||
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email'])})
|
||||
|
||||
print(" ### is_inscription_no_client_exist_count =", is_inscription_no_client_exist)
|
||||
|
||||
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
|
||||
if (is_inscription_no_client_exist > 1):
|
||||
mycommon.myprint(" Facturation : L'adresse email : " + str(
|
||||
|
@ -11893,7 +11898,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
# Si le client existe, verifier qu'il est valide et pas locké
|
||||
if (is_inscription_no_client_exist == 1):
|
||||
is_inscription_no_client_valide_no_locked = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -11906,7 +11911,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
|
||||
# Mise à jour de l'inscription avec l'_id du nouveau client pour les champs : client_rattachement_id et facture_client_rattachement_id
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -12017,7 +12022,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
local_inscription_no_client['email']) + " ", False
|
||||
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
@ -12466,7 +12471,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
{'_id': ObjectId(str(diction['partner_client_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
|
@ -13053,7 +13058,7 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
|
|||
{'_id': ObjectId(str(one_tab_split['partner_client'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
tab_inscrit_partial_data = []
|
||||
|
@ -13645,7 +13650,7 @@ def Invoice_Create_Secure_E_Document(diction):
|
|||
if ("order_header_client_id" in Order_header_data.keys()):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
|
||||
if (Order_header_client_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
|
@ -14367,7 +14372,7 @@ def Prepare_request_For_Preinsciption_Creation_By_Customer(diction):
|
|||
"""
|
||||
Verifier la validité du client
|
||||
"""
|
||||
is_client_valide_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_recid':str(my_partner['recid']),
|
||||
is_client_valide_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'_id':ObjectId(str(diction['client_id']))})
|
||||
|
@ -14475,7 +14480,7 @@ def Send_Email_request_presinscription_data_validation(diction):
|
|||
# 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']),
|
||||
{'_id': ObjectId(str(diction['client_id'])), 'partner_owner_recid': str(diction['partner_recid']),
|
||||
'valide': '1', 'locked':'0'}):
|
||||
|
||||
if (client_id_data is None):
|
||||
|
@ -14652,7 +14657,7 @@ def Client_Update_Liste_Attendee_No_Token(diction):
|
|||
is_client_valide_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(diction['partner_recid'])})
|
||||
'partner_owner_recid':str(diction['partner_recid'])})
|
||||
if(is_client_valide_data is None ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide")
|
||||
|
@ -14867,7 +14872,7 @@ def Client_Delete_One_Attendee_No_Token(diction):
|
|||
is_client_valide_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(diction['client_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(diction['partner_recid'])})
|
||||
'partner_owner_recid':str(diction['partner_recid'])})
|
||||
if(is_client_valide_data is None ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide")
|
||||
|
|
|
@ -156,7 +156,7 @@ def Add_Apprenant(diction):
|
|||
is_client_rattachement_id_valide = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(diction['client_rattachement_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
if( is_client_rattachement_id_valide <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide")
|
||||
|
@ -349,7 +349,7 @@ def Update_Apprenant(diction):
|
|||
{'_id': ObjectId(str(diction['client_rattachement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
if (is_client_rattachement_id_valide <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du client n'est pas valide")
|
||||
|
@ -841,11 +841,15 @@ def Get_List_Partner_Apprenant(diction):
|
|||
user['is_ent_compte'] = '0'
|
||||
|
||||
|
||||
if( 'civilite' in val.keys() ):
|
||||
if( 'civilite' in val.keys() and val['civilite'] in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(val['civilite']).lower()
|
||||
else:
|
||||
user['civilite'] = ""
|
||||
|
||||
if( str(user['civilite']).strip() == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
|
||||
if ("date_naissance" not in user.keys() or str(user['date_naissance']) == ""):
|
||||
user['date_naissance'] = "01/01/1900"
|
||||
|
||||
|
@ -937,11 +941,14 @@ def Get_Apprenant_List_Partner_with_filter(diction):
|
|||
else:
|
||||
val['is_ent_compte'] = '0'
|
||||
|
||||
if ('civilite' in retVal.keys()):
|
||||
if ('civilite' in retVal.keys() and retVal['civilite'] in MYSY_GV.CIVILITE):
|
||||
val['civilite'] = str(retVal['civilite']).lower()
|
||||
else:
|
||||
val['civilite'] = ""
|
||||
|
||||
if (str(val['civilite']).strip() == ""):
|
||||
val['civilite'] = "neutre"
|
||||
|
||||
if ("date_naissance" not in retVal.keys() or str(retVal['date_naissance']) == ""):
|
||||
val['date_naissance'] = "01/01/1900"
|
||||
|
||||
|
@ -1024,7 +1031,7 @@ def Apprenant_Inscrire_Session(diction):
|
|||
client_rattachement_id = ""
|
||||
if( "client_rattachement_id" in diction.keys() and diction['client_rattachement_id'] ) :
|
||||
is_client_rattachement_id_exist = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'partner_recid': str(
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
@ -1089,6 +1096,10 @@ def Apprenant_Inscrire_Session(diction):
|
|||
new_data['email'] = apprenant_data['email']
|
||||
new_data['nom'] = apprenant_data['nom']
|
||||
new_data['civilite'] = str(apprenant_data['civilite']).lower()
|
||||
if( str(apprenant_data['civilite']).strip() == ""):
|
||||
new_data['civilite'] = "neutre"
|
||||
|
||||
|
||||
new_data['prenom'] = apprenant_data['prenom']
|
||||
new_data['telephone'] = apprenant_data['telephone']
|
||||
new_data['modefinancement'] = str(diction['modefinancement'])
|
||||
|
@ -1235,7 +1246,7 @@ def Apprenant_Inscrire_Session_List(diction):
|
|||
if ("client_rattachement_id" in diction.keys() and diction['client_rattachement_id']):
|
||||
is_client_rattachement_id_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(diction['client_rattachement_id']),
|
||||
'partner_recid': str(
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
@ -1427,7 +1438,7 @@ def Get_Apprenant_List_Inscription(diction):
|
|||
{'_id': ObjectId(str(val['client_rattachement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])},
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{'nom': 1})
|
||||
|
||||
if (client_rattachement_id_data and "nom" in client_rattachement_id_data.keys()):
|
||||
|
@ -1866,6 +1877,10 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
civilite = str(df['civilite'].values[n]).lower()
|
||||
mydata['civilite'] = civilite
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
mydata['civilite'] = "neutre"
|
||||
|
||||
|
||||
telephone = ""
|
||||
if ("telephone" in df.keys()):
|
||||
if (str(df['telephone'].values[n])):
|
||||
|
@ -2030,7 +2045,7 @@ def Add_Apprenant_mass(file=None, Folder=None, diction=None):
|
|||
client_rattachement_data = MYSY_GV.dbname['partner_client'].find_one({'email':str(client_rattachement_email),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])},
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'_id':1})
|
||||
|
||||
if( '_id' in client_rattachement_data.keys()):
|
||||
|
@ -2170,7 +2185,7 @@ def Controle_Add_Apprenant_mass(saved_file=None, Folder=None, diction=None):
|
|||
{'email': str(client_rattachement_email),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (client_rattachement_data_count < 0):
|
||||
mycommon.myprint(
|
||||
|
@ -2444,7 +2459,7 @@ def Print_Apprenant_PDF(diction):
|
|||
for val in MYSY_GV.dbname['partner_client'].find({'_id':ObjectId(str(appenant_data['client_rattachement_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid']) }, {'_id':1}):
|
||||
'partner_owner_recid':str(my_partner['recid']) }, {'_id':1}):
|
||||
tab_client.append(val['_id'])
|
||||
|
||||
|
||||
|
@ -2653,7 +2668,7 @@ def Export_Apprenant_To_Excel_From_from_List_Id(diction):
|
|||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_recid", '$$partner_owner_recid']}
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
|
||||
|
||||
]
|
||||
}
|
||||
|
@ -2892,6 +2907,9 @@ def ENT_Create_Apprenant_Account(diction):
|
|||
new_account['nom'] = local_apprenant_data['nom']
|
||||
new_account['prenom'] = local_apprenant_data['prenom']
|
||||
new_account['civilite'] = local_apprenant_data['civilite']
|
||||
if( str(local_apprenant_data['civilite']).strip() == ""):
|
||||
new_account['civilite'] = "neutre"
|
||||
|
||||
new_account['email'] = local_apprenant_data['email']
|
||||
|
||||
new_account['mob_phone'] = local_apprenant_data['telephone']
|
||||
|
@ -2930,7 +2948,15 @@ def ENT_Create_Apprenant_Account(diction):
|
|||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
convention_dictionnary_data['civilite'] = local_apprenant_data['civilite']
|
||||
civilite = "neutre"
|
||||
if( "civilite" in local_apprenant_data.keys() and local_apprenant_data['civilite']):
|
||||
civilite = local_apprenant_data['civilite']
|
||||
|
||||
if( str(civilite).strip() == ""):
|
||||
civilite = "neutre"
|
||||
|
||||
convention_dictionnary_data['civilite'] = civilite
|
||||
|
||||
convention_dictionnary_data['nom'] = local_apprenant_data['nom']
|
||||
convention_dictionnary_data['prenom'] = local_apprenant_data['prenom']
|
||||
convention_dictionnary_data['email'] = local_apprenant_data['email']
|
||||
|
|
|
@ -1093,7 +1093,7 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
|
|||
if ("filter_nom_client" in diction.keys() and diction['filter_nom_client']):
|
||||
sub_filt_partner_client_nom = {
|
||||
'nom': {'$regex': str(diction['filter_nom_client']), "$options": "i"},
|
||||
'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
# Recuperation des '_id' des session dont le nom match en regexp
|
||||
|
||||
|
||||
|
|
|
@ -114,8 +114,9 @@ def Add_Update_Partner_Catalog_Pub_Config(diction):
|
|||
'indicateur_3_txt', 'indicateur_3_taille', 'indicateur_3_color', 'indicateur_3_gras',
|
||||
'indicateur_4_txt', 'indicateur_4_taille', 'indicateur_4_color', 'indicateur_4_gras',
|
||||
'cgv_pdf', 'cgu_pdf', 'mention_legale_pdf', 'contact_public_email', 'contact_public_telephone',
|
||||
'partner_catalog_pub_url', 'partner_intranet_pub_url', 'partner_ent_student_url'
|
||||
]
|
||||
'partner_catalog_pub_url', 'partner_intranet_pub_url', 'partner_ent_student_url',
|
||||
'affiche_indicateur', 'affiche_raison_sociale', 'affiche_contact']
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
|
@ -136,7 +136,7 @@ def Add_CRM_Opportunite(diction):
|
|||
is_client_id_valide = MYSY_GV.dbname["partner_client"].count_documents({'_id':ObjectId(str(partner_client_id)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_client_id_valide != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -415,7 +415,7 @@ def Update_CRM_Opportunite(diction):
|
|||
is_client_id_valide = MYSY_GV.dbname["partner_client"].count_documents({'_id':ObjectId(str(partner_client_id)),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_client_id_valide != 1):
|
||||
mycommon.myprint(
|
||||
|
@ -670,7 +670,7 @@ def Get_List_CRM_Opportunite_with_filter(diction):
|
|||
if ("partner_client_nom" in diction.keys() and diction['partner_client_nom']):
|
||||
|
||||
qry_sub_filter_client = {'nom': {'$regex': str(diction['partner_client_nom']), "$options": "i"},
|
||||
'partner_recid':my_partner['recid'], 'valide':'1', 'locked':'0'}
|
||||
'partner_owner_recid':my_partner['recid'], 'valide':'1', 'locked':'0'}
|
||||
for tmp_val in MYSY_GV.dbname['partner_client'].find(qry_sub_filter_client):
|
||||
list_client_id.append(str(tmp_val['_id']))
|
||||
|
||||
|
@ -766,7 +766,7 @@ def Get_List_CRM_Opportunite_with_filter(diction):
|
|||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['partner_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if ("nom" in partner_client_data.keys()):
|
||||
client_nom = partner_client_data['nom']
|
||||
|
@ -926,9 +926,9 @@ def Get_List_CRM_Opportunite_no_filter(diction):
|
|||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['partner_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if ("nom" in partner_client_data.keys()):
|
||||
if ( partner_client_data and "nom" in partner_client_data.keys()):
|
||||
client_nom = partner_client_data['nom']
|
||||
|
||||
user['client_nom'] = client_nom
|
||||
|
@ -1067,7 +1067,7 @@ def Get_Given_CRM_Opportunite(diction):
|
|||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['partner_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if ("nom" in partner_client_data.keys()):
|
||||
client_nom = partner_client_data['nom']
|
||||
|
|
|
@ -470,12 +470,14 @@ def incription_training_refused_mail(diction):
|
|||
dictionnary_data = local_retval
|
||||
dictionnary_data['refus_data'] = refus_data
|
||||
|
||||
print(" ### refus_data = ", refus_data)
|
||||
|
||||
|
||||
body = {
|
||||
"params": dictionnary_data,
|
||||
}
|
||||
|
||||
print(" ### refus_data (dictionnary_data) = ", dictionnary_data)
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
|
|
@ -0,0 +1,380 @@
|
|||
"""
|
||||
Ce fichier permet de traiter la file de email.
|
||||
Concretement il met un message dans la file, gere son envoie et les messages d'erreur associé
|
||||
|
||||
Les status des messages sont :
|
||||
0 - Init
|
||||
1 - envoyé
|
||||
2 - erreur
|
||||
"""
|
||||
import ast
|
||||
from calendar import monthrange
|
||||
from zipfile import ZipFile
|
||||
|
||||
import bson
|
||||
import pymongo
|
||||
import xlsxwriter
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime, date, timedelta
|
||||
|
||||
import Session_Formation
|
||||
import module_editique
|
||||
import partner_base_setup
|
||||
import partner_client
|
||||
import partner_order
|
||||
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
|
||||
import survey_mgt as survey_mgt
|
||||
import attached_file_mgt
|
||||
import Inscription_mgt as Inscription_mgt
|
||||
|
||||
|
||||
|
||||
def Add_Message_To_Mail_Queue(tab_files, diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'from', 'cc', 'bcc', 'subject', 'to', 'message',
|
||||
'smtp_account_password', 'smtp_account_smtpsrv', 'smtp_account_user', 'smtp_account_From_User', 'smtp_account_port']
|
||||
|
||||
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', 'from', 'cc', 'bcc', 'subject', 'to', 'message']
|
||||
|
||||
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
|
||||
|
||||
# Sauvegarde des fichiers joints depuis le front
|
||||
if (len(tab_files) > MYSY_GV.EMAIL_MAX_PJ):
|
||||
mycommon.myprint("Vous ne pouvez pas envoyer plus de " + str(MYSY_GV.EMAIL_MAX_PJ) + " pièces jointes.")
|
||||
return False, "Vous ne pouvez pas envoyer plus de " + str(MYSY_GV.EMAIL_MAX_PJ) + " pièces jointes. "
|
||||
|
||||
tab_saved_file_full_path = []
|
||||
for file in tab_files:
|
||||
status, saved_file_full_path = mycommon.Upload_Save_PDF_IMG_File(file, MYSY_GV.TEMPORARY_DIRECTORY_V2)
|
||||
if (status is False):
|
||||
mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
|
||||
return False, "Impossible de récupérer correctement le fichier à importer"
|
||||
|
||||
tab_saved_file_full_path.append(saved_file_full_path)
|
||||
|
||||
|
||||
|
||||
new_data = diction
|
||||
del diction['token']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
new_data[str(val)] = ""
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
new_data['statut'] = "0"
|
||||
new_data['attached_files_path'] = tab_saved_file_full_path
|
||||
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['mail_queue'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible d'ajouter le message dans le file d'attente (2) ")
|
||||
return False, " Impossible d'ajouter le message dans le file d'attente (2) "
|
||||
|
||||
|
||||
message_id = ""
|
||||
return True, str(message_id)
|
||||
|
||||
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'ajouter le message dans le file d'attente "
|
||||
|
||||
"""
|
||||
Mise à jour d'un message, par exemple les status
|
||||
"""
|
||||
|
||||
def Update_Message_To_Mail_Queue(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'from', 'cc', 'bcc', 'subject', 'to', 'message', 'status', 'message_id',
|
||||
'smtp_account_password', 'smtp_account_smtpsrv', 'smtp_account_user', 'smtp_account_From_User', 'smtp_account_port']
|
||||
|
||||
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', 'status', 'message_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité du message
|
||||
"""
|
||||
is_massage_valide = MYSY_GV.dbname['mail_queue'].count_documents({'_id':ObjectId(str(diction['message_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'statut':{'$ne':'1'}})
|
||||
|
||||
if( is_massage_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du message n'est pas valide ")
|
||||
return False, " L'identifiant du message n'est pas valide "
|
||||
|
||||
|
||||
local_id = str(diction['_id'])
|
||||
|
||||
del diction['token']
|
||||
del diction['_id']
|
||||
|
||||
new_data = diction
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
data_cle = {}
|
||||
data_cle['mail_queue'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['statut'] = {'$ne': '1'}
|
||||
|
||||
|
||||
result = MYSY_GV.dbname['mail_queue'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
return True, "Le message a été 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 message "
|
||||
|
||||
"""
|
||||
Supprimer un message donnée
|
||||
"""
|
||||
def Delete_Message_To_Mail_Queue(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'tab_message_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_message_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
|
||||
|
||||
tab_message_id_work = str(diction['tab_message_id']).split(",")
|
||||
tab_message_id_ObjectId = []
|
||||
for tmp in tab_message_id_work:
|
||||
if( tmp ):
|
||||
tab_message_id_ObjectId.append(ObjectId(str(tmp)))
|
||||
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['mail_queue'].delete_many({'_id': {'$in':tab_message_id_ObjectId},
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, str(delete.deleted_count)+" message(s) 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 les messages "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des message d'un partenaire
|
||||
"""
|
||||
def Get_List_Message_To_Mail_Queue(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'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['mail_queue'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des messages "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction envoie les emails d'un avec des filtrer données
|
||||
filt_type_session = {}
|
||||
if ("type_session" in diction.keys()):
|
||||
filt_type_session = {'type_session': str(diction['type_session']).strip()}
|
||||
"""
|
|
@ -873,7 +873,8 @@ Cette fonction genere un fichier pdf pour les liste d'emargement
|
|||
|
||||
def GerneratePDFEmargementList(diction):
|
||||
try:
|
||||
field_list = ['session_id', 'email', 'date', 'token', 'class_internal_url', 'courrier_template_id']
|
||||
field_list = ['session_id', 'email', 'date', 'token', 'class_internal_url', 'courrier_template_id',
|
||||
'tab_inscrit_ids']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
@ -909,6 +910,21 @@ def GerneratePDFEmargementList(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'imprimer la liste d'emargement ")
|
||||
return False, " Impossible d'imprimer la liste d'emargement"
|
||||
|
||||
|
||||
tab_inscrit_ids = []
|
||||
if ("tab_inscrit_ids" in diction.keys() and diction['tab_inscrit_ids']):
|
||||
tab_inscrit_ids_work = str(diction['tab_inscrit_ids']).split(",")
|
||||
|
||||
for tmp in tab_inscrit_ids_work:
|
||||
if(tmp):
|
||||
tab_inscrit_ids.append(tmp)
|
||||
|
||||
|
||||
filt_inscrit = {}
|
||||
if(len(tab_inscrit_ids) > 0 ):
|
||||
filt_inscrit = {'inscription_id':{'$in':tab_inscrit_ids}}
|
||||
|
||||
|
||||
"""
|
||||
28/03/2024 :
|
||||
Verifier que le modele de courrier est valide
|
||||
|
@ -962,13 +978,9 @@ def GerneratePDFEmargementList(diction):
|
|||
mydate = diction['date']
|
||||
query_get_data['date'] = diction['date']
|
||||
|
||||
## Recuperation des données
|
||||
coll_emargement = MYSY_GV.dbname['emargement']
|
||||
|
||||
print("### query_get_data = " + str(query_get_data))
|
||||
|
||||
tab_users = []
|
||||
for val_tmp in coll_emargement.find(query_get_data).sort([("date", pymongo.ASCENDING), ("sequence_start", pymongo.ASCENDING), ("sequence_end", pymongo.ASCENDING)]):
|
||||
for val_tmp in MYSY_GV.dbname['emargement'].find({"$and":[query_get_data, filt_inscrit]}).sort([("date", pymongo.ASCENDING), ("sequence_start", pymongo.ASCENDING), ("sequence_end", pymongo.ASCENDING)]):
|
||||
local_tmp = {}
|
||||
local_tmp['email'] = val_tmp['email']
|
||||
local_tmp['nom'] = val_tmp['nom']
|
||||
|
|
|
@ -2294,7 +2294,7 @@ def LMS_Create_VirtualHost(diction):
|
|||
full_url = unidecode(full_url)
|
||||
|
||||
virtualHost_url = full_url
|
||||
my_query = " INSERT INTO access_url (url, description, active, creation_by, tms, url_type) "\
|
||||
my_query = " INSERT INTO access_url (url, description, active, created_by, tms, url_type) "\
|
||||
" VALUES('"+str(full_url)+"', 'Url pour "+str(part_nom)+"', '1', '1', '"+str(registration_date)+"', NULL);"
|
||||
|
||||
try:
|
||||
|
|
67
main.py
67
main.py
|
@ -102,6 +102,7 @@ import financial_caracteristique_mgt as financial_caracteristique_mgt
|
|||
import reference_pedagogique_mgt as reference_pedagogique_mgt
|
||||
import ent_student_common as ent_student_common
|
||||
import groupe_client_mgt as groupe_client_mgt
|
||||
import email_queu.email_queu_mgt as email_queu_mgt
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -2210,7 +2211,7 @@ API de recuperation de la liste de tous les stagaires d'une formation
|
|||
def GetAllClassStagiaire():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### GetAllClassStagiaire : payload = ",payload)
|
||||
print(" ### GetAllClassStagiaire ii : payload = ",payload)
|
||||
localStatus, message= inscription.GetAllClassStagiaire(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
@ -2720,9 +2721,9 @@ def Prepare_and_Send_Default_Convention_From_Session_By_PDF(token, session_id, c
|
|||
"""
|
||||
API de generation de liste PDF des liste d'emargement
|
||||
"""
|
||||
@app.route('/myclass/api/GerneratePDFEmargementList/<token>/<session_id>/<internal_url>/<courrier_modele_id>', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/GerneratePDFEmargementList/<token>/<session_id>/<internal_url>/<courrier_modele_id>/<tab_inscrit_ids>', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GerneratePDFEmargementList(token, session_id, internal_url, courrier_modele_id):
|
||||
def GerneratePDFEmargementList(token, session_id, internal_url, courrier_modele_id, tab_inscrit_ids):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
payload = {}
|
||||
|
@ -2731,6 +2732,12 @@ def GerneratePDFEmargementList(token, session_id, internal_url, courrier_modele_
|
|||
payload['class_internal_url'] = str(internal_url)
|
||||
payload['courrier_template_id'] = str(courrier_modele_id)
|
||||
|
||||
local_tab_inscrt = ""
|
||||
if( tab_inscrit_ids and str(tab_inscrit_ids) != "-"):
|
||||
local_tab_inscrt = str(tab_inscrit_ids)
|
||||
|
||||
payload['tab_inscrit_ids'] = str(local_tab_inscrt)
|
||||
|
||||
print(" ### GerneratePDFEmargementList : payload = ",str(payload))
|
||||
|
||||
localStatus, response= emargement.GerneratePDFEmargementList(payload)
|
||||
|
@ -13449,6 +13456,60 @@ def Get_Given_Groupe_Client():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un message dans la file d'attente des emails
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Message_To_Mail_Queue/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Message_To_Mail_Queue():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Message_To_Mail_Queue payload = ",payload)
|
||||
status, retval = email_queu_mgt.Add_Message_To_Mail_Queue(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un message dans la file d'attente des emails
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Message_To_Mail_Queue/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Message_To_Mail_Queue():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Message_To_Mail_Queue payload = ",payload)
|
||||
status, retval = email_queu_mgt.Update_Message_To_Mail_Queue(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer une liste de messages dans la file d'attente des emails
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Message_To_Mail_Queue/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Message_To_Mail_Queue():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Message_To_Mail_Queue payload = ",payload)
|
||||
status, retval = email_queu_mgt.Delete_Message_To_Mail_Queue(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des message d'un partenaire sans filter
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Message_To_Mail_Queue/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Message_To_Mail_Queue():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Message_To_Mail_Queue payload = ",payload)
|
||||
status, retval = email_queu_mgt.Get_List_Message_To_Mail_Queue(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -49,8 +49,15 @@ def Add_Partner_Client(diction):
|
|||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company', 'invoice_automatique',
|
||||
'type_financeur_id', 'type_pouvoir_public_id', 'partner_groupe_client_id'
|
||||
]
|
||||
'type_financeur_id', 'type_pouvoir_public_id', 'partner_groupe_client_id',
|
||||
|
||||
'is_compagnie',
|
||||
'contact_civilite', 'contact_nom', 'contact_prenom', 'contact_email', 'is_contact_communication',
|
||||
'contact_fonction', 'contact_mobile', 'contact_phone', 'contact_adresse', 'contact_code_postal',
|
||||
'contact_ville',
|
||||
'contact_pays', 'contact_siret', 'contact_tva']
|
||||
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -98,7 +105,7 @@ def Add_Partner_Client(diction):
|
|||
|
||||
|
||||
"""
|
||||
Verification s'il n'existe pas un cient du partenaire qui perte le meme
|
||||
Verification s'il n'existe pas un client du partenaire qui porte le meme
|
||||
nom, ou la meme adresse email
|
||||
"""
|
||||
|
||||
|
@ -424,6 +431,87 @@ def Add_Partner_Client(diction):
|
|||
return False, " Impossible de créer le client "
|
||||
|
||||
|
||||
"""
|
||||
Si l'ajout du client a réussi, alors on ajoute le contact s'il y a un contact fourni
|
||||
"""
|
||||
if(inserted_id and "contact_email" in diction.keys() and diction['contact_email'] and
|
||||
"contact_nom" in diction.keys() and diction['contact_nom'] ):
|
||||
|
||||
new_contact_diction = {}
|
||||
new_contact_diction['email'] = diction['contact_email']
|
||||
new_contact_diction['nom'] = diction['contact_nom']
|
||||
new_contact_diction['token'] = diction['token']
|
||||
|
||||
new_contact_diction['related_collection'] = "partner_client"
|
||||
new_contact_diction['related_collection_owner_id'] = str(inserted_id)
|
||||
|
||||
|
||||
if( "contact_civilite" in diction.keys() ):
|
||||
new_contact_diction['civilite'] = diction['contact_civilite']
|
||||
else:
|
||||
new_contact_diction['civilite'] = ""
|
||||
|
||||
if ("contact_prenom" in diction.keys()):
|
||||
new_contact_diction['prenom'] = diction['contact_prenom']
|
||||
else:
|
||||
new_contact_diction['prenom'] = ""
|
||||
|
||||
if ("is_contact_communication" in diction.keys()):
|
||||
new_contact_diction['include_com'] = diction['is_contact_communication']
|
||||
else:
|
||||
new_contact_diction['include_com'] = ""
|
||||
|
||||
if ("contact_fonction" in diction.keys()):
|
||||
new_contact_diction['fonction'] = diction['contact_fonction']
|
||||
else:
|
||||
new_contact_diction['fonction'] = ""
|
||||
|
||||
if ("contact_mobile" in diction.keys()):
|
||||
new_contact_diction['telephone_mobile'] = diction['contact_mobile']
|
||||
else:
|
||||
new_contact_diction['telephone_mobile'] = ""
|
||||
|
||||
|
||||
if ("contact_phone" in diction.keys()):
|
||||
new_contact_diction['telephone'] = diction['contact_phone']
|
||||
else:
|
||||
new_contact_diction['telephone'] = ""
|
||||
|
||||
if ("contact_code_postal" in diction.keys()):
|
||||
new_contact_diction['adr_code_postal'] = diction['contact_code_postal']
|
||||
else:
|
||||
new_contact_diction['adr_code_postal'] = ""
|
||||
|
||||
if ("contact_ville" in diction.keys()):
|
||||
new_contact_diction['adr_ville'] = diction['contact_ville']
|
||||
else:
|
||||
new_contact_diction['adr_ville'] = ""
|
||||
|
||||
if ("contact_pays" in diction.keys()):
|
||||
new_contact_diction['adr_pays'] = diction['contact_pays']
|
||||
else:
|
||||
new_contact_diction['adr_pays'] = ""
|
||||
|
||||
if ("contact_siret" in diction.keys()):
|
||||
new_contact_diction['siret'] = diction['contact_siret']
|
||||
else:
|
||||
new_contact_diction['siret'] = ""
|
||||
|
||||
|
||||
if ("contact_tva" in diction.keys()):
|
||||
new_contact_diction['tva'] = diction['contact_tva']
|
||||
else:
|
||||
new_contact_diction['tva'] = ""
|
||||
|
||||
|
||||
local_add_contact_status, local_add_contact_retval = contact.Add_Contact(new_contact_diction)
|
||||
|
||||
if( local_add_contact_status is False ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " WARNING : Impossible d'ajouter le contact au nouveau client " + str(
|
||||
inserted_id))
|
||||
|
||||
|
||||
return True, " Le client a été correctement créé"
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1802,6 +1890,12 @@ def Get_Given_Partner_Client_From_Id(diction):
|
|||
|
||||
""""
|
||||
Cette fonction permet d'importer des clients de partner en masse avec un fichier excel
|
||||
|
||||
|
||||
IMPORTANT : Cette fonction n'accepte pas les mise à jour en masse.
|
||||
Donc s'il ya un client avec la meme adresse principale, le système va
|
||||
rejeter l'import
|
||||
|
||||
"""
|
||||
def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
||||
try:
|
||||
|
@ -1844,6 +1938,15 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
mycommon.myprint("Impossible de récupérer correctement le fichier à importer")
|
||||
return False, "Impossible de récupérer correctement le fichier à importer"
|
||||
|
||||
local_controle_status, local_controle_message = Controle_Add_Partner_Client_mass(
|
||||
saved_file,
|
||||
Folder,
|
||||
diction)
|
||||
|
||||
if (local_controle_status is False):
|
||||
return local_controle_status, local_controle_message
|
||||
|
||||
print(" #### local_controle_message = ", local_controle_message)
|
||||
|
||||
df = pd.read_csv(saved_file, encoding='utf8', on_bad_lines='skip', sep=';', encoding_errors='ignore')
|
||||
df = df.fillna('')
|
||||
|
@ -1853,7 +1956,14 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['nom', 'raison_sociale', 'email', 'adresse', 'code_postal', 'ville', 'pays', 'siret', 'telephone', 'tva', 'website', 'invoice_adresse',
|
||||
'invoice_code_postal', 'invoice_email', 'invoice_nom', 'invoice_siret', 'invoice_tva', 'invoice_ville', 'invoice_pays']
|
||||
'invoice_code_postal', 'invoice_email', 'invoice_nom', 'invoice_siret', 'invoice_tva', 'invoice_ville',
|
||||
'invoice_pays', 'condition_paiement_code', 'is_compagnie', 'partner_groupe_client_code',
|
||||
'contact_civilite', 'contact_nom', 'contact_prenom', 'contact_email', 'is_contact_communication',
|
||||
'contact_fonction', 'contact_mobile', 'contact_phone', 'contact_adresse', 'contact_code_postal',
|
||||
'contact_ville',
|
||||
'contact_pays', 'contact_siret', 'contact_tva',
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code']
|
||||
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
total_rows = len(df)
|
||||
|
@ -1886,15 +1996,17 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
x = range(0, total_rows)
|
||||
for n in x:
|
||||
mydata = {}
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
mydata['adr_adresse'] = str(df['adresse'].values[n])
|
||||
mydata['adr_code_postal'] = str(df['code_postal'].values[n])
|
||||
mydata['adr_ville'] = str(df['ville'].values[n])
|
||||
mydata['adr_pays'] = str(df['pays'].values[n])
|
||||
mydata['telephone'] = str(df['telephone'].values[n])
|
||||
mydata['nom'] = str(df['nom'].values[n]).strip()
|
||||
mydata['email'] = str(df['email'].values[n]).strip()
|
||||
mydata['adr_adresse'] = str(df['adresse'].values[n]).strip()
|
||||
mydata['adr_code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
mydata['adr_ville'] = str(df['ville'].values[n]).strip()
|
||||
mydata['adr_pays'] = str(df['pays'].values[n]).strip()
|
||||
mydata['telephone'] = str(df['telephone'].values[n]).strip()
|
||||
mydata['token'] = str(my_token)
|
||||
|
||||
|
||||
|
||||
raison_sociale = ""
|
||||
if ("raison_sociale" in df.keys()):
|
||||
if (str(df['raison_sociale'].values[n])):
|
||||
|
@ -1967,6 +2079,184 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
invoice_pays = str(df['invoice_pays'].values[n])
|
||||
mydata['invoice_pays'] = invoice_pays
|
||||
|
||||
# Controle des conditions de paiement : condition_paiement_code
|
||||
invoice_condition_paiement_id = ""
|
||||
if ("condition_paiement_code" in df.keys()):
|
||||
condition_paiement_code = str(df['condition_paiement_code'].values[n]).strip()
|
||||
|
||||
is_valide_cond_paiement_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'code': re.compile(condition_paiement_code,
|
||||
re.IGNORECASE),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
if (is_valide_cond_paiement_data ):
|
||||
invoice_condition_paiement_id = str(is_valide_cond_paiement_data['_id'])
|
||||
|
||||
mydata['invoice_condition_paiement_id'] = invoice_condition_paiement_id
|
||||
|
||||
# groupe de client : partner_groupe_client_code
|
||||
partner_groupe_client_id = ""
|
||||
if ("partner_groupe_client_code" in df.keys()):
|
||||
condition_paiement_code = str(df['partner_groupe_client_code'].values[n]).strip()
|
||||
|
||||
is_valide_partner_groupe_client_data = MYSY_GV.dbname[
|
||||
'partner_groupe_client'].find_one(
|
||||
{'code': re.compile(condition_paiement_code,
|
||||
re.IGNORECASE),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
if (is_valide_partner_groupe_client_data ):
|
||||
partner_groupe_client_id = str(is_valide_partner_groupe_client_data['_id'])
|
||||
mydata['partner_groupe_client_id'] = partner_groupe_client_id
|
||||
|
||||
# type de client : client_type_code
|
||||
client_type_id = ""
|
||||
if ("client_type_code" in df.keys()):
|
||||
client_type_code = str(df['client_type_code'].values[n]).strip()
|
||||
|
||||
is_valide_type_client_data = MYSY_GV.dbname[
|
||||
'partner_client_type'].find_one(
|
||||
{'code': re.compile(client_type_code,
|
||||
re.IGNORECASE),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
if (is_valide_type_client_data):
|
||||
client_type_id = str(is_valide_type_client_data['_id'])
|
||||
mydata['client_type_id'] = client_type_id
|
||||
|
||||
is_compagnie = ""
|
||||
if ("is_compagnie" in df.keys()):
|
||||
if (str(df['is_compagnie'].values[n])):
|
||||
is_compagnie = str(df['is_compagnie'].values[n])
|
||||
mydata['is_compagnie'] = is_compagnie
|
||||
|
||||
is_fournisseur = ""
|
||||
if ("is_fournisseur" in df.keys()):
|
||||
if (str(df['is_fournisseur'].values[n])):
|
||||
is_fournisseur = str(df['is_fournisseur'].values[n])
|
||||
mydata['is_fournisseur'] = is_fournisseur
|
||||
|
||||
is_client = ""
|
||||
if ("is_client" in df.keys()):
|
||||
if (str(df['is_client'].values[n])):
|
||||
is_client = str(df['is_client'].values[n])
|
||||
mydata['is_client'] = is_client
|
||||
|
||||
is_financeur = ""
|
||||
if ("is_financeur" in df.keys()):
|
||||
if (str(df['is_financeur'].values[n])):
|
||||
is_financeur = str(df['is_financeur'].values[n])
|
||||
mydata['is_financeur'] = is_financeur
|
||||
|
||||
|
||||
contact_civilite = ""
|
||||
if ("contact_civilite" in df.keys()):
|
||||
if (str(df['contact_civilite'].values[n])):
|
||||
contact_civilite = str(df['contact_civilite'].values[n])
|
||||
mydata['contact_civilite'] = contact_civilite
|
||||
|
||||
|
||||
|
||||
contact_nom = ""
|
||||
if ("contact_nom" in df.keys()):
|
||||
if (str(df['contact_nom'].values[n])):
|
||||
contact_nom = str(df['contact_nom'].values[n])
|
||||
mydata['contact_nom'] = contact_nom
|
||||
|
||||
|
||||
|
||||
contact_email = ""
|
||||
if ("contact_email" in df.keys()):
|
||||
if (str(df['contact_email'].values[n])):
|
||||
contact_email = str(df['contact_email'].values[n])
|
||||
mydata['contact_email'] = contact_email
|
||||
|
||||
|
||||
|
||||
contact_prenom = ""
|
||||
if ("contact_prenom" in df.keys()):
|
||||
if (str(df['contact_prenom'].values[n])):
|
||||
contact_prenom = str(df['contact_prenom'].values[n])
|
||||
mydata['contact_prenom'] = contact_prenom
|
||||
|
||||
|
||||
contact_email = ""
|
||||
if ("contact_email" in df.keys()):
|
||||
if (str(df['contact_email'].values[n])):
|
||||
contact_email = str(df['contact_email'].values[n])
|
||||
mydata['contact_email'] = contact_email
|
||||
|
||||
|
||||
is_contact_communication = ""
|
||||
if ("is_contact_communication" in df.keys()):
|
||||
if (str(df['is_contact_communication'].values[n])):
|
||||
is_contact_communication = str(df['is_contact_communication'].values[n])
|
||||
mydata['is_contact_communication'] = is_contact_communication
|
||||
|
||||
|
||||
contact_fonction = ""
|
||||
if ("contact_fonction" in df.keys()):
|
||||
if (str(df['contact_fonction'].values[n])):
|
||||
contact_fonction = str(df['contact_fonction'].values[n])
|
||||
mydata['contact_fonction'] = contact_fonction
|
||||
|
||||
|
||||
contact_mobile = ""
|
||||
if ("contact_mobile" in df.keys()):
|
||||
if (str(df['contact_mobile'].values[n])):
|
||||
contact_mobile = str(df['contact_mobile'].values[n])
|
||||
mydata['contact_mobile'] = contact_mobile
|
||||
|
||||
contact_phone = ""
|
||||
if ("contact_phone" in df.keys()):
|
||||
if (str(df['contact_phone'].values[n])):
|
||||
contact_phone = str(df['contact_phone'].values[n])
|
||||
mydata['contact_phone'] = contact_phone
|
||||
|
||||
contact_adresse = ""
|
||||
if ("contact_adresse" in df.keys()):
|
||||
if (str(df['contact_adresse'].values[n])):
|
||||
contact_adresse = str(df['contact_adresse'].values[n])
|
||||
mydata['contact_adresse'] = contact_adresse
|
||||
|
||||
|
||||
contact_code_postal = ""
|
||||
if ("contact_code_postal" in df.keys()):
|
||||
if (str(df['contact_code_postal'].values[n])):
|
||||
contact_code_postal = str(df['contact_code_postal'].values[n])
|
||||
mydata['contact_code_postal'] = contact_code_postal
|
||||
|
||||
|
||||
contact_ville = ""
|
||||
if ("contact_ville" in df.keys()):
|
||||
if (str(df['contact_ville'].values[n])):
|
||||
contact_ville = str(df['contact_ville'].values[n])
|
||||
mydata['contact_ville'] = contact_ville
|
||||
|
||||
contact_pays = ""
|
||||
if ("contact_pays" in df.keys()):
|
||||
if (str(df['contact_pays'].values[n])):
|
||||
contact_pays = str(df['contact_pays'].values[n])
|
||||
mydata['contact_pays'] = contact_pays
|
||||
|
||||
contact_siret = ""
|
||||
if ("contact_siret" in df.keys()):
|
||||
if (str(df['contact_siret'].values[n])):
|
||||
contact_siret = str(df['contact_siret'].values[n])
|
||||
mydata['contact_siret'] = contact_siret
|
||||
|
||||
contact_tva = ""
|
||||
if ("contact_tva" in df.keys()):
|
||||
if (str(df['contact_tva'].values[n])):
|
||||
contact_tva = str(df['contact_tva'].values[n])
|
||||
mydata['contact_tva'] = contact_tva
|
||||
|
||||
|
||||
clean_dict = {k: mydata[k] for k in mydata if (str(mydata[k]) != "nan")}
|
||||
|
||||
print("#### clean_dict ", clean_dict)
|
||||
|
@ -1990,6 +2280,256 @@ def Add_Partner_Client_mass(file=None, Folder=None, diction=None):
|
|||
return False, " Impossible d'importer les client en masse "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de controler le fichier excel avant l'import
|
||||
car si une seule ligne est incohérente, alors il faut annuler l'import
|
||||
"""
|
||||
def Controle_Add_Partner_Client_mass(saved_file=None, Folder=None, diction=None):
|
||||
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'existe pas, Creation participants annulée")
|
||||
return False, " Verifier votre API"
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['token', ]
|
||||
|
||||
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, " Verifier votre API, Toutes les informations techniques ne sont pas fournies"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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
|
||||
|
||||
|
||||
df = pd.read_csv(saved_file, encoding='utf8', on_bad_lines='skip', sep=';', encoding_errors='ignore')
|
||||
df = df.fillna('')
|
||||
df = df.applymap(lambda x: x.strip() if isinstance(x, str) else x)
|
||||
# Dictionnaire des champs utilisables
|
||||
'''
|
||||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['nom', 'raison_sociale', 'email', 'adresse', 'code_postal', 'ville', 'pays', 'siret', 'telephone', 'tva', 'website', 'invoice_adresse',
|
||||
'invoice_code_postal', 'invoice_email', 'invoice_nom', 'invoice_siret', 'invoice_tva', 'invoice_ville', 'invoice_pays',
|
||||
'condition_paiement_code', 'is_compagnie', 'partner_groupe_client_code',
|
||||
'contact_civilite', 'contact_nom', 'contact_prenom', 'contact_email', 'is_contact_communication',
|
||||
'contact_fonction','contact_mobile', 'contact_phone', 'contact_adresse', 'contact_code_postal', 'contact_ville',
|
||||
'contact_pays', 'contact_siret', 'contact_tva',
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'client_type_code']
|
||||
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
total_rows = len(df)
|
||||
if (total_rows > MYSY_GV.MAX_PARTNER_CLIENT_BY_CSV):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le fichier comporte plus de " + str(
|
||||
MYSY_GV.MAX_PARTNER_CLIENT_BY_CSV) + " lignes.")
|
||||
return False, " Le fichier comporte plus de " + str(MYSY_GV.MAX_PARTNER_CLIENT_BY_CSV) + " lignes."
|
||||
|
||||
for val in df.columns:
|
||||
if str(val).lower() not in field_list:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " : entete du fichier csv. '" + val + "' n'est pas acceptée")
|
||||
return False, " Entete du fichier csv. '" + val + "' n'est pas acceptée"
|
||||
|
||||
# Verification des champs obligatoires dans le fichier
|
||||
field_list_obligatoire_file = ['nom', 'email', 'adresse', 'code_postal', 'ville', 'pays', 'telephone', ]
|
||||
|
||||
for val in field_list_obligatoire_file:
|
||||
if val not in df.columns:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " : Le champ '" + val + "' n'est pas présent dans le fichier. Il est obligatoire")
|
||||
return False, " Le champ '" + val + "' n'est pas présent dans le fichier. Il est obligatoire "
|
||||
|
||||
# Traitement des données du fichier
|
||||
|
||||
warning_msg = ""
|
||||
nb_warning_msg = 0
|
||||
x = range(0, total_rows)
|
||||
for n in x:
|
||||
mydata = {}
|
||||
mydata['nom'] = str(df['nom'].values[n])
|
||||
mydata['email'] = str(df['email'].values[n])
|
||||
|
||||
"""
|
||||
important : verifier s'il y a deja un client avec la meme adresse email
|
||||
"""
|
||||
is_existe_client_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{"email": str(str(df['email'].values[n]).strip()),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_client_count != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Ligne " + str(n + 2) + " Il a déjà un client avec le même adresse email.")
|
||||
return False, " Ligne " + str(n + 2) + " Il a déjà un client avec le même adresse email."
|
||||
|
||||
|
||||
# Controler la civilité du contact principale
|
||||
if( "contact_civilite" in df.keys()):
|
||||
contact_civilite = str(df['contact_civilite'].values[n]).strip()
|
||||
if( contact_civilite.lower() not in MYSY_GV.CIVILITE):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'contact_civilite' pour la ligne "+str( n + 2) +" est invalide. Valeur acceptées :"+str(MYSY_GV.CIVILITE))
|
||||
return False, "Le champ 'contact_civilite' pour la ligne "+str( n + 2) +" est invalide. Valeur acceptées :"+str(MYSY_GV.CIVILITE)
|
||||
|
||||
|
||||
# Contoler contact_email
|
||||
if ("contact_email" in df.keys()):
|
||||
contact_email = str(df['contact_email'].values[n]).strip()
|
||||
if (mycommon.isEmailValide(contact_email) is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'contact_email' pour la ligne "+str( n + 2) +" est invalide.")
|
||||
return False, "Le champ 'contact_email' pour la ligne "+str( n + 2) +" est invalide"
|
||||
|
||||
# Contoler is_contact_communication
|
||||
if ("is_contact_communication" in df.keys()):
|
||||
is_contact_communication = str(df['is_contact_communication'].values[n]).strip()
|
||||
if (is_contact_communication not in ['0', '1', '']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'is_contact_communication' pour la ligne "+str( n + 2) +" est invalide. Les valeurs acceptées '0', '1' ou '[vide]' ")
|
||||
return False, "Le champ 'is_contact_communication' pour la ligne "+str( n + 2) +" est invalide. Les valeurs acceptées '0', '1' ou '[vide]'"
|
||||
|
||||
|
||||
# Controle des conditions de paiement : condition_paiement_code
|
||||
if ("condition_paiement_code" in df.keys()):
|
||||
condition_paiement_code = str(df['condition_paiement_code'].values[n]).strip()
|
||||
|
||||
is_valide_cond_paiement_count = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents({'code': re.compile(condition_paiement_code,
|
||||
re.IGNORECASE),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':my_partner['recid']})
|
||||
if( is_valide_cond_paiement_count <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'condition_paiement_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. ")
|
||||
return False, "Le champ 'condition_paiement_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. "
|
||||
|
||||
|
||||
|
||||
# Controle du champ 'is_compagnie':
|
||||
if ("is_compagnie" in df.keys()):
|
||||
is_compagnie = str(df['is_compagnie'].values[n]).strip()
|
||||
if (is_compagnie not in ['0', '1', '2', '']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'is_compagnie' pour la ligne "+str( n + 2) +" est invalide. Les valeurs acceptées '0', '1', '2', ou '[vide]' ")
|
||||
return False, "Le champ 'is_compagnie' pour la ligne "+str( n + 2) +" est invalide. Les valeurs acceptées '0', '1', '2', ou '[vide]'"
|
||||
|
||||
# Controle du champ 'is_fournisseur':
|
||||
if ("is_fournisseur" in df.keys()):
|
||||
is_fournisseur = str(df['is_fournisseur'].values[n]).strip()
|
||||
if (is_fournisseur not in ['0', '1', '']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'is_fournisseur' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]' ")
|
||||
return False, "Le champ 'is_fournisseur' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]'"
|
||||
|
||||
# Controle du champ 'is_client':
|
||||
if ("is_client" in df.keys()):
|
||||
is_client = str(df['is_client'].values[n]).strip()
|
||||
if (is_client not in ['0', '1', '']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'is_client' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]' ")
|
||||
return False, "Le champ 'is_client' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]'"
|
||||
|
||||
|
||||
# Controle du champ 'is_financeur':
|
||||
if ("is_financeur" in df.keys()):
|
||||
is_financeur = str(df['is_financeur'].values[n]).strip()
|
||||
if (is_financeur not in ['0', '1', '']):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'is_financeur' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]' ")
|
||||
return False, "Le champ 'is_financeur' pour la ligne " + str(
|
||||
n + 2) + " est invalide. Les valeurs acceptées '0', '1', ou '[vide]'"
|
||||
|
||||
|
||||
|
||||
# Controle des conditions de paiement : partner_groupe_client_code
|
||||
if ("partner_groupe_client_code" in df.keys()):
|
||||
condition_paiement_code = str(df['partner_groupe_client_code'].values[n]).strip()
|
||||
|
||||
is_valide_partner_groupe_client_code_count = MYSY_GV.dbname[
|
||||
'partner_groupe_client'].count_documents(
|
||||
{'code': re.compile(condition_paiement_code,
|
||||
re.IGNORECASE),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
if (is_valide_partner_groupe_client_code_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'partner_groupe_client_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. ")
|
||||
return False, "Le champ 'partner_groupe_client_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. "
|
||||
|
||||
# Controle des conditions de paiement : client_type_code
|
||||
if ("client_type_code" in df.keys()):
|
||||
client_type_code = str(df['client_type_code'].values[n]).strip()
|
||||
|
||||
|
||||
is_valide_client_type_code_count = MYSY_GV.dbname[
|
||||
'partner_client_type'].count_documents(
|
||||
{'code': re.compile(client_type_code,
|
||||
re.IGNORECASE),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': my_partner['recid']})
|
||||
|
||||
if (is_valide_client_type_code_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + "Le champ 'client_type_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. ")
|
||||
return False, "Le champ 'client_type_code' pour la ligne " + str(
|
||||
n + 2) + " est invalide. "
|
||||
|
||||
|
||||
|
||||
|
||||
return True, str(total_rows)+" client(s) dans le fichier"
|
||||
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'importer les client en masse (controle de cohérence)"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction supprime un client.
|
||||
Avant il faut verifier :
|
||||
|
|
|
@ -124,7 +124,7 @@ def Add_Partner_Order(diction):
|
|||
|
||||
# Verifier que le client existe bien pour ce partner
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents({'_id':ObjectId(str(order_header_client_id)), 'valide':'1',
|
||||
'locked':'0', 'partner_recid':str(my_partner['recid'])})
|
||||
'locked':'0', 'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_client_exist_count <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le client est invalide ")
|
||||
|
@ -668,7 +668,7 @@ def Add_Partner_Quotation(diction):
|
|||
# Verifier que le client existe bien pour ce partner
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(str(order_header_client_id)), 'valide': '1',
|
||||
'locked': '0', 'partner_recid': str(my_partner['recid'])})
|
||||
'locked': '0', 'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_client_exist_count <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le client est invalide ")
|
||||
|
@ -1238,7 +1238,7 @@ def Update_Partner_Order_Header(diction):
|
|||
# Verifier que le client existe bien pour ce partner
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(str(order_header_client_id)), 'valide': '1',
|
||||
'locked': '0', 'partner_recid': str(my_partner['recid'])})
|
||||
'locked': '0', 'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_client_exist_count <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le client est invalide ")
|
||||
|
@ -1736,7 +1736,7 @@ def Update_Partner_Quotation_Header(diction):
|
|||
# Verifier que le client existe bien pour ce partner
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'_id': ObjectId(str(order_header_client_id)), 'valide': '1',
|
||||
'locked': '0', 'partner_recid': str(my_partner['recid'])})
|
||||
'locked': '0', 'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_client_exist_count <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le client est invalide ")
|
||||
|
@ -3537,7 +3537,7 @@ def Get_Given_Partner_Order(diction):
|
|||
if ('order_header_client_id' in retval.keys() and retval['order_header_client_id']):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (Client_data and 'nom' in Client_data.keys()):
|
||||
order_header_client_nom = str(Client_data['nom'])
|
||||
|
@ -4368,7 +4368,7 @@ def Get_Given_Partner_Order_From_Internal_ref(diction):
|
|||
if ('order_header_client_id' in retval.keys() and retval['order_header_client_id']):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (Client_data and 'nom' in Client_data.keys()):
|
||||
order_header_client_nom = str(Client_data['nom'])
|
||||
|
@ -4510,7 +4510,7 @@ def Get_List_Partner_Order_no_filter(diction):
|
|||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if( 'order_header_client_id' in New_retVal.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(New_retVal['order_header_client_id'])), 'valide':'1', 'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( Client_data and 'nom' in Client_data.keys() ):
|
||||
user['order_header_client_nom'] = str(Client_data['nom'])
|
||||
|
@ -4605,7 +4605,7 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
sub_filt_client_nom = {}
|
||||
Lists_partner_client_id = []
|
||||
if ("client_nom" in diction.keys()):
|
||||
sub_filt_client_nom = {'nom': {'$regex': str(diction['client_nom']), "$options": "i"}, 'partner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}
|
||||
sub_filt_client_nom = {'nom': {'$regex': str(diction['client_nom']), "$options": "i"}, 'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}
|
||||
# Recuperation des '_id' des clients dont le nom match en regexp
|
||||
#print(" ### sub_filt_client_nom = ", sub_filt_client_nom)
|
||||
for List_Client_Data in MYSY_GV.dbname['partner_client'].find(sub_filt_client_nom, {'_id':1}):
|
||||
|
@ -4740,7 +4740,7 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
if ('order_header_client_id' in New_retVal.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (Client_data and 'nom' in Client_data.keys()):
|
||||
user['order_header_client_nom'] = str(Client_data['nom'])
|
||||
|
@ -4749,7 +4749,7 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
if ('order_header_vendeur_id' in New_retVal.keys()):
|
||||
Employee_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_vendeur_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
order_header_vendeur_nom_prenom = ""
|
||||
if (Employee_data and 'nom' in Employee_data.keys()):
|
||||
|
@ -5507,7 +5507,7 @@ def GerneratePDF_Partner_Order(diction):
|
|||
if ("order_header_client_id" in Order_header_data.keys()):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
|
||||
if (Order_header_client_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
|
@ -6015,7 +6015,7 @@ def Gernerate_Stock_PDF_Partner_Order(diction):
|
|||
if ("order_header_client_id" in Order_header_data.keys()):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
|
||||
if (Order_header_client_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
|
@ -6519,7 +6519,7 @@ def Send_Partner_Order_By_Email(tab_files, Folder, diction):
|
|||
# Recuperation des données du client
|
||||
if( "order_header_client_id" in Order_header_data.keys() ):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
'partner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'})
|
||||
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'})
|
||||
|
||||
if( Order_header_client_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
|
@ -8465,7 +8465,7 @@ def Send_Quotation_Remind_Level1(diction):
|
|||
if ("order_header_client_id" in Order_header_data.keys()):
|
||||
Order_header_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(Order_header_data['order_header_client_id'])),
|
||||
'partner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'})
|
||||
|
||||
if (Order_header_client_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
|
@ -9091,13 +9091,13 @@ def Create_Automatic_Quotation(diction):
|
|||
client_connu = "0"
|
||||
client_blocked = "0"
|
||||
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_recid':str(valide_lead_website_data['partner_owner_recid']),
|
||||
is_client_exist_count = MYSY_GV.dbname['partner_client'].count_documents({'partner_owner_recid':str(valide_lead_website_data['partner_owner_recid']),
|
||||
'siret':str(valide_lead_website_data['siret'])})
|
||||
|
||||
|
||||
if( is_client_exist_count == 1 ):
|
||||
is_client_exist_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(valide_lead_website_data['partner_owner_recid']),
|
||||
{'partner_owner_recid': str(valide_lead_website_data['partner_owner_recid']),
|
||||
'siret': str(valide_lead_website_data['siret'])})
|
||||
|
||||
|
||||
|
@ -9133,7 +9133,7 @@ def Create_Automatic_Quotation(diction):
|
|||
return local_prospect_status, local_prospect_retval, False
|
||||
|
||||
is_client_exist_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(valide_lead_website_data['partner_owner_recid']),
|
||||
{'partner_owner_recid': str(valide_lead_website_data['partner_owner_recid']),
|
||||
'siret': str(valide_lead_website_data['siret'])})
|
||||
|
||||
"""
|
||||
|
|
|
@ -4893,7 +4893,7 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
client_rattachement_id_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(apprenant_data['client_rattachement_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])},
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'nom':1})
|
||||
|
||||
if(client_rattachement_id_data and "nom" in client_rattachement_id_data.keys() ):
|
||||
|
@ -4917,7 +4917,7 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
{'_id': ObjectId(str(apprenant_data['financeur_rattachement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])},
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{'nom': 1})
|
||||
|
||||
if (client_rattachement_id_data and "nom" in client_rattachement_id_data.keys()):
|
||||
|
@ -5025,7 +5025,7 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
for client_data in MYSY_GV.dbname['partner_client'].find({'_id': {'$in': tab_client_id, },
|
||||
'valide': '1',
|
||||
'partner_recid': str(my_partner['recid'])
|
||||
'partner_owner_recid': str(my_partner['recid'])
|
||||
}):
|
||||
|
||||
new_client_data = {}
|
||||
|
@ -7189,6 +7189,18 @@ def Get_Partner_Data_From_Subdomain(diction):
|
|||
if (config_partner_catalog_data and "contact_public_telephone" in config_partner_catalog_data.keys()):
|
||||
user['catalog_pub_contact_public_telephone'] = config_partner_catalog_data['contact_public_telephone']
|
||||
|
||||
user['affiche_indicateur'] = ""
|
||||
if (config_partner_catalog_data and "affiche_indicateur" in config_partner_catalog_data.keys()):
|
||||
user['affiche_indicateur'] = config_partner_catalog_data['affiche_indicateur']
|
||||
|
||||
user['affiche_raison_sociale'] = ""
|
||||
if (config_partner_catalog_data and "affiche_raison_sociale" in config_partner_catalog_data.keys()):
|
||||
user['affiche_raison_sociale'] = config_partner_catalog_data['affiche_raison_sociale']
|
||||
|
||||
user['affiche_contact'] = ""
|
||||
if (config_partner_catalog_data and "affiche_contact" in config_partner_catalog_data.keys()):
|
||||
user['affiche_contact'] = config_partner_catalog_data['affiche_contact']
|
||||
|
||||
|
||||
|
||||
#-----------
|
||||
|
|
|
@ -1279,6 +1279,16 @@ def Get_List_Ressource_Humaine(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if ("civilite" in retval.keys() and retval['civilite'] in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(retval['civilite']).lower()
|
||||
elif ("civilite" in retval.keys() and str(retval['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
else:
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if( str(user['civilite']) == "" ):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
"""
|
||||
Si l'employé a un superieur_hierarchie_id, alors on va aller récupérer son nom et prenom.
|
||||
ce superieur est une ressource humaime
|
||||
|
@ -1589,10 +1599,17 @@ def Get_List_Ressource_Humaine_with_filter(diction):
|
|||
else:
|
||||
user['prenom'] = ""
|
||||
|
||||
if ("civilite" in New_retVal.keys()):
|
||||
if ("civilite" in New_retVal.keys() and str(New_retVal['civilite']) in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(New_retVal['civilite']).lower()
|
||||
|
||||
elif ("civilite" in New_retVal.keys() and str(New_retVal['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
else:
|
||||
user['civilite'] = ""
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if (str(user['civilite']) == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
|
||||
if( "telephone" in New_retVal.keys()):
|
||||
user['telephone'] = New_retVal['telephone']
|
||||
|
@ -1701,10 +1718,16 @@ def Get_List_Ressource_Humaine_with_filter(diction):
|
|||
else:
|
||||
user['prenom'] = ""
|
||||
|
||||
if ("civilite" in retval.keys()):
|
||||
if ("civilite" in retval.keys() and retval['civilite'] in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(retval['civilite']).lower()
|
||||
|
||||
elif ("civilite" in retval.keys() and str(retval['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
else:
|
||||
user['civilite'] = ""
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if (str(user['civilite']) == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if ("telephone" in retval.keys()):
|
||||
user['telephone'] = retval['telephone']
|
||||
|
@ -1829,10 +1852,15 @@ def Get_List_Ressource_Humaine_no_filter(diction):
|
|||
else:
|
||||
user['prenom'] = ""
|
||||
|
||||
if ("civilite" in retval.keys()):
|
||||
if ("civilite" in retval.keys() and retval['civilite'] in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(retval['civilite']).lower()
|
||||
elif ("civilite" in retval.keys() and str(retval['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
else:
|
||||
user['civilite'] = ""
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if (str(user['civilite']) == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if ("telephone" in retval.keys()):
|
||||
user['telephone'] = retval['telephone']
|
||||
|
@ -1964,11 +1992,18 @@ def Get_Given_Ressource_Humaine(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if ("civilite" not in retval.keys()):
|
||||
user['civilite'] = ""
|
||||
if ("civilite" not in retval.keys() ):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
elif (retval['civilite'] not in MYSY_GV.CIVILITE):
|
||||
# la civilité n'est pas une de celle autorisée, alors je renvoie vide
|
||||
user['civilite'] = ""
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if ("civilite" in retval.keys() and retval['civilite'] in MYSY_GV.CIVILITE ):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if (str(user['civilite']) == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
|
||||
"""
|
||||
|
@ -2369,6 +2404,17 @@ def Get_List_Manager_Ressource_Humaine(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if ("civilite" in retval.keys() and retval['civilite'] in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = str(retval['civilite']).lower()
|
||||
elif ("civilite" in retval.keys() and str(retval['civilite']) not in MYSY_GV.CIVILITE):
|
||||
user['civilite'] = "neutre"
|
||||
else:
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
if (str(user['civilite']) == ""):
|
||||
user['civilite'] = "neutre"
|
||||
|
||||
|
||||
"""
|
||||
Si l'employé a un superieur_hierarchie_id, alors on va aller récupérer son nom et prenom.
|
||||
ce superieur est une ressource humaime
|
||||
|
|
|
@ -522,7 +522,7 @@ def Send_Survey_Alert_Notif(diction):
|
|||
try:
|
||||
field_list_obligatoire = [ 'user_question_reponse', 'partner_owner_recid']
|
||||
|
||||
print(" ### Send_Survey_Alert_Notif diction = ", diction)
|
||||
print(" ### Send_Survey_Alert_Notif diction (trop long) = ")
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
|
|
@ -1741,7 +1741,7 @@ def Delete_Nicole_Account(diction):
|
|||
|
||||
# f - Suppression des clients
|
||||
delete_row = MYSY_GV.dbname['partner_client'].delete_many(
|
||||
{'partner_recid': str(partner_recid)})
|
||||
{'partner_owner_recid': str(partner_recid)})
|
||||
deleted_message = deleted_message + " -- " + str(
|
||||
delete_row.deleted_count) + " Ressource_materielle_affectation(s) Supprimé(s)"
|
||||
|
||||
|
|
Loading…
Reference in New Issue