28/09/2023 - 15h40
parent
e7bed218dd
commit
8c5bbc4532
|
@ -3,9 +3,13 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/09/23 - 23h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.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_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
|
|
@ -1875,6 +1875,16 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
if ("code_postal" in df.keys()):
|
||||
if (str(df['code_postal'].values[n])):
|
||||
code_postal = str(df['code_postal'].values[n])
|
||||
|
||||
if ("." in str(code_postal)):
|
||||
# /!\ : l'utilisateur envoie un code poster au format entier, plutot que string.
|
||||
code_postal = str(code_postal).split(".")[0]
|
||||
elif ("." in str(code_postal)):
|
||||
# /!\ : l'utilisateur envoie un code poster au format entier, plutot que string.
|
||||
code_postal = str(code_postal).split(",")[0]
|
||||
else:
|
||||
code_postal = str(code_postal)
|
||||
|
||||
mydata['code_postal'] = code_postal
|
||||
|
||||
ville = ""
|
||||
|
@ -1927,17 +1937,21 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
if( local_client_retval_data is not None ):
|
||||
mydata['client_rattachement_id'] = local_client_retval_data['_id']
|
||||
|
||||
status = str(df['status'].values[n]).strip()
|
||||
status = str(mycommon.tryInt(status))
|
||||
|
||||
mydata['status'] = str(df['status'].values[n]).strip()
|
||||
if( str(mydata['status']) != "0" and str(mydata['status']) != "1" and str(mydata['status']) != "2"):
|
||||
if (str(status) != "0" and str(status) != "1" and str(status) != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'status' de ligne " + str(n) + " est incorrecte. Valeurs acceptées : 0,1,2")
|
||||
str(inspect.stack()[0][3]) + " Le champ 'status' de ligne " + str(
|
||||
n) + " est incorrecte. Valeurs acceptées : 0,1,2")
|
||||
return False, " Le champ status de la ligne " + str(n) + " est incorrecte. Valeurs acceptées : 0,1,2"
|
||||
|
||||
|
||||
if( str(df['status'].values[n]).strip() == "1"):
|
||||
mydata['status'] = str(df['status'].values[n]).strip()
|
||||
if (status == "1"):
|
||||
mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
|
||||
|
||||
mydata['class_internal_url'] = str(class_internal_url)
|
||||
|
||||
|
||||
|
@ -2192,9 +2206,21 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
|
|||
code_postal = ""
|
||||
if ("code_postal" in df.keys()):
|
||||
if (str(df['code_postal'].values[n])):
|
||||
code_postal = str(df['code_postal'].values[n])
|
||||
code_postal = str(df['code_postal'].values[n]).strip()
|
||||
|
||||
if ("." in str(code_postal)):
|
||||
# /!\ : l'utilisateur envoie un code poster au format entier, plutot que string.
|
||||
code_postal = str(code_postal).split(".")[0]
|
||||
elif ("." in str(code_postal)):
|
||||
# /!\ : l'utilisateur envoie un code poster au format entier, plutot que string.
|
||||
code_postal = str(code_postal).split(",")[0]
|
||||
else:
|
||||
code_postal = str(code_postal)
|
||||
|
||||
mydata['code_postal'] = code_postal
|
||||
|
||||
|
||||
|
||||
ville = ""
|
||||
if ("ville" in df.keys()):
|
||||
if (str(df['ville'].values[n])):
|
||||
|
@ -2251,15 +2277,22 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
|
|||
if (local_client_retval_data is not None):
|
||||
mydata['client_rattachement_id'] = local_client_retval_data['_id']
|
||||
|
||||
mydata['status'] = str(df['status'].values[n]).strip()
|
||||
if (str(mydata['status']) != "0" and str(mydata['status']) != "1" and str(mydata['status']) != "2"):
|
||||
|
||||
status = str(df['status'].values[n]).strip()
|
||||
status = str(mycommon.tryInt(status))
|
||||
|
||||
|
||||
if (str(status) != "0" and str(status) != "1" and str(status) != "2"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le champ 'status' de ligne " + str(
|
||||
n) + " est incorrecte. Valeurs acceptées : 0,1,2")
|
||||
return False, " Le champ status de la ligne " + str(
|
||||
n) + " est incorrecte. Valeurs acceptées : 0,1,2"
|
||||
|
||||
if (str(df['status'].values[n]).strip() == "1"):
|
||||
mydata['status'] = status
|
||||
|
||||
|
||||
if (str(status).strip() == "1"):
|
||||
mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
mydata['class_internal_url'] = str(class_internal_url)
|
||||
|
|
1346
Log/log_file.log
1346
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -147,6 +147,9 @@ def Add_Update_SessionFormation(diction):
|
|||
|
||||
|
||||
if ("nb_participant" in diction.keys()):
|
||||
nb_particants = str(mycommon.tryInt(str(diction['nb_participant'])))
|
||||
if( nb_particants == "0" ):
|
||||
nb_particants = "1"
|
||||
mydata['nb_participant'] = str(mycommon.tryInt(str(diction['nb_participant'])))
|
||||
|
||||
if ("prix_session" in diction.keys()):
|
||||
|
@ -719,7 +722,7 @@ def GetAllValideSessionPartner_List(diction):
|
|||
val['distantiel'] = retVal['distantiel']
|
||||
val['formateur'] = retVal['formateur']
|
||||
|
||||
nb_participant = "0"
|
||||
nb_participant = "1"
|
||||
if( "nb_participant" in retVal.keys()):
|
||||
nb_participant = retVal['nb_participant']
|
||||
|
||||
|
@ -770,7 +773,7 @@ def GetAllValideSessionPartner_List(diction):
|
|||
val['nb_preinscrit'] = str(Count_Preinscrit)
|
||||
|
||||
taux_remplissage = "0"
|
||||
if( str(nb_participant) != "0"):
|
||||
if( str(nb_participant) != "0" and str(nb_participant).strip() != ""):
|
||||
taux_remplissage = round(int(mycommon.tryInt(Count_Inscrit)) / int(mycommon.tryInt(nb_participant)), 2)
|
||||
|
||||
val['taux_remplissage'] = str(taux_remplissage)
|
||||
|
@ -884,7 +887,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
nb_participant = "0"
|
||||
nb_participant = "1"
|
||||
if ("nb_participant" in retVal.keys()):
|
||||
nb_participant = retVal['nb_participant']
|
||||
|
||||
|
@ -1049,7 +1052,7 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
|||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
nb_participant = "0"
|
||||
nb_participant = "1"
|
||||
if ("nb_participant" in retVal.keys()):
|
||||
nb_participant = retVal['nb_participant']
|
||||
|
||||
|
@ -1340,7 +1343,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
" est postérieure à la date de fin " + str(mydata['date_fin']) + " pour la ligne "+str(n+2)+" "
|
||||
|
||||
|
||||
local_nb_participants = "0"
|
||||
local_nb_participants = "1"
|
||||
if ("nb_participant" in df.keys()):
|
||||
if (str(df['nb_participant'].values[n])):
|
||||
local_nb_participants = str(df['nb_participant'].values[n]).strip()
|
||||
|
@ -1812,7 +1815,7 @@ def Controle_Add_Update_SessionFormation_mass(saved_file=None, Folder=None, dict
|
|||
" est postérieure à la date de fin " + str(mydata['date_fin']) + " pour la ligne " + str(
|
||||
n + 2) + " "
|
||||
|
||||
local_nb_participants = "0"
|
||||
local_nb_participants = "1"
|
||||
if ("nb_participant" in df.keys()):
|
||||
if (str(df['nb_participant'].values[n])):
|
||||
local_nb_participants = str(df['nb_participant'].values[n]).strip()
|
||||
|
@ -2214,7 +2217,7 @@ def Add_Update_SessionFormation_mass_for_many_class(file=None, Folder=None, dict
|
|||
" est postérieure à la date de fin " + str(mydata['date_fin']) + " pour la ligne " + str(
|
||||
n + 2) + " "
|
||||
|
||||
local_nb_participants = "0"
|
||||
local_nb_participants = "1"
|
||||
if ("nb_participant" in df.keys()):
|
||||
if (str(df['nb_participant'].values[n])):
|
||||
local_nb_participants = str(df['nb_participant'].values[n]).strip()
|
||||
|
|
|
@ -1367,12 +1367,13 @@ def Pro_Account_Token_Pass(account_mail, my_token):
|
|||
data_employe_admin['email'] = str(account_mail)
|
||||
data_employe_admin['comment'] = "Compte Administrateur"
|
||||
data_employe_admin['is_partner_admin_account'] = "1"
|
||||
data_employe_admin['account_partner_id'] = str(my_partner['_id'])
|
||||
|
||||
print(" #### data_employe_admin = ", str(data_employe_admin))
|
||||
local_status, local_retval = ressources_humaines.Add_Partner_Admin_Ressource_Humaine_No_Toke(data_employe_admin)
|
||||
local_status, local_retval_inserted_id = ressources_humaines.Add_Partner_Admin_Ressource_Humaine_No_Toke(data_employe_admin)
|
||||
|
||||
if( local_status is False):
|
||||
mycommon.myprint(str(local_retval))
|
||||
mycommon.myprint(str(local_retval_inserted_id))
|
||||
return True
|
||||
|
||||
return True
|
||||
|
|
|
@ -154,7 +154,8 @@ def Add_Partner_Document(diction):
|
|||
|
||||
# Verifier qu'il n'existe pas un document avec le meme code code interne
|
||||
exist_doc_count = MYSY_GV.dbname['courrier_template'].count_documents({'ref_interne':str(ref_interne), 'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'type_doc':str(diction['type_doc'])})
|
||||
|
||||
if( exist_doc_count > 0 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Il existe déjà un document avec la meme reference interne ")
|
||||
|
|
|
@ -3965,6 +3965,7 @@ def Compute_Order_Header(diction):
|
|||
print(" ###### header_reduction_type_value = ", header_reduction_type_value)
|
||||
"""
|
||||
|
||||
|
||||
global_order_taxe_amount = 0
|
||||
global_order_amount_ht_before_header_reduction = line_sum_order_line_montant_hors_taxes_after_reduction
|
||||
global_order_amount_ht_after_header_reduction = 0
|
||||
|
@ -3974,6 +3975,13 @@ def Compute_Order_Header(diction):
|
|||
header_reduction_type_value_total_amount = mycommon.tryFloat(header_reduction_type_value)
|
||||
global_order_amount_ht_after_header_reduction = line_sum_order_line_montant_hors_taxes_after_reduction - mycommon.tryFloat(header_reduction_type_value)
|
||||
|
||||
"""print(" GRRRR 022 header_reduction_type_value_total_amount = ",
|
||||
header_reduction_type_value_total_amount)
|
||||
|
||||
print(" GRRRR 022 global_order_amount_ht_after_header_reduction = ",
|
||||
global_order_amount_ht_after_header_reduction)
|
||||
"""
|
||||
|
||||
elif( str(header_reduction_type) == "percent" ):
|
||||
print(" GRRRR line_sum_order_line_montant_hors_taxes_after_reduction = ", line_sum_order_line_montant_hors_taxes_after_reduction)
|
||||
print(" GRRRR mycommon.tryFloat(header_reduction_type_value)/100 = ",
|
||||
|
|
30
partners.py
30
partners.py
|
@ -31,7 +31,7 @@ from datetime import datetime
|
|||
import GlobalVariable as MYSY_GV
|
||||
import strype_payement as Stripe
|
||||
import lms_chamilo.mysy_lms as mysy_lms
|
||||
|
||||
import ressources_humaines as ressources_humaines
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
|
@ -777,6 +777,34 @@ def update_partner_account(file_logo=None, file_cachet=None, Folder=None, dictio
|
|||
return local_status, local_message
|
||||
|
||||
|
||||
"""
|
||||
Update du 28/09/2023 :
|
||||
On verifie le compte a un 'ressource_humaine_id', si ce n'est pas le cas,
|
||||
cela veut dire le compte RH associé au compte admin n'a pas été crée.
|
||||
Il faut donc le faire.
|
||||
|
||||
"""
|
||||
is_valide_rh_compte = False
|
||||
Parnter_Data = MYSY_GV.dbname['partnair_account'].find_one( {'recid': str(partner_recid), 'locked': '0', 'active': '1'},)
|
||||
if( "ressource_humaine_id" in Parnter_Data.keys() ):
|
||||
if(len(str(Parnter_Data['ressource_humaine_id'])) > 2 ):
|
||||
is_valide_rh_compte = True
|
||||
|
||||
if( is_valide_rh_compte is False):
|
||||
data_employe_admin = {}
|
||||
data_employe_admin['partner_recid'] = str(Parnter_Data['recid'])
|
||||
data_employe_admin['nom'] = str(Parnter_Data['nom'])
|
||||
data_employe_admin['email'] = str(Parnter_Data['email'])
|
||||
data_employe_admin['comment'] = "Compte Administrateur"
|
||||
data_employe_admin['is_partner_admin_account'] = "1"
|
||||
data_employe_admin['account_partner_id'] = str(Parnter_Data['_id'])
|
||||
|
||||
print(" #### data_employe_admin = ", str(data_employe_admin))
|
||||
local_status, local_retval_inserted_id = ressources_humaines.Add_Partner_Admin_Ressource_Humaine_No_Toke(
|
||||
data_employe_admin)
|
||||
|
||||
|
||||
|
||||
return True, "Le partenaire a bien ete mise à jour"
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -41,7 +41,7 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_recid', "nom", "email", "comment"]
|
||||
field_list = ['partner_recid', "nom", "email", "comment", 'is_partner_admin_account', 'account_partner_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -104,6 +104,13 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
|
|||
comment = diction['comment']
|
||||
data['comment'] = diction['comment']
|
||||
|
||||
account_partner_id = ""
|
||||
if ("account_partner_id" in diction.keys()):
|
||||
if diction['account_partner_id']:
|
||||
account_partner_id = diction['account_partner_id']
|
||||
data['account_partner_id'] = diction['account_partner_id']
|
||||
|
||||
|
||||
|
||||
data['profil'] = "partner_admin"
|
||||
|
||||
|
@ -119,8 +126,14 @@ def Add_Partner_Admin_Ressource_Humaine_No_Toke(diction):
|
|||
" Impossible de créer la compte adminstrateur du partenaire ")
|
||||
return False, " Impossible de créer la compte adminstrateur du partenaire "
|
||||
|
||||
"""
|
||||
Un fois le compte rh créer, on met à jour la collection partner_account, champ : 'ressource_humaine_id' avec le bon is
|
||||
"""
|
||||
MYSY_GV.dbname['partnair_account'].update_one({'recid': str(diction['partner_recid'])},
|
||||
{'$set': {'ressource_humaine_id': str(inserted_id)}})
|
||||
|
||||
return True, " Le compte administrateur du partenaire a été correctement crée"
|
||||
|
||||
return True, str(inserted_id)
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
Loading…
Reference in New Issue