parent
1cf583de78
commit
14c1dabc39
|
|
@ -4,16 +4,16 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="30/06/26 - 20h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/07/26 - 20h">
|
||||
<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$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.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$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.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" />
|
||||
|
|
@ -457,7 +457,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="604" />
|
||||
<option name="localTasksCounter" value="605" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -499,7 +499,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="qsd" />
|
||||
<MESSAGE value="13/05/26 - 17h" />
|
||||
<MESSAGE value="15/05/2026 - 17h30" />
|
||||
<MESSAGE value="16/05/2026 - 13h30" />
|
||||
|
|
@ -524,6 +523,7 @@
|
|||
<MESSAGE value="27/06/26 - 18h" />
|
||||
<MESSAGE value="27/06/26 - 18hs" />
|
||||
<MESSAGE value="30/06/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="30/06/26 - 20h" />
|
||||
<MESSAGE value="03/07/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/07/26 - 20h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -21505,3 +21505,496 @@ def Internal_Get_Inscrit_Absence_Pourcentage_By_BC_For_Given_Session(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Internal Impossible de calculer les pourcentage d'absence "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'identifier les conflits d'inscription
|
||||
Par exemple est une personne est inscrite à plusieurs sessions de formation qui se deroulent en meme temps
|
||||
"""
|
||||
|
||||
def Get_Inscription_Conflit(diction):
|
||||
try:
|
||||
field_list = ['token', 'data_from', 'date_to' ]
|
||||
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é, Creation partenaire annulée")
|
||||
return False, "de récupérer la liste des stagiaires . Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste 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, "Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token': str(diction['token'])})
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
filt_date_from_ISODATE = ""
|
||||
if ("date_echeance_from" in diction.keys() and diction['date_from']):
|
||||
filt_date_from = str(diction['date_echeance_from'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_date_from)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date du' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date du' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_date_from_ISODATE = datetime.strptime(str(filt_date_from), '%d/%m/%Y')
|
||||
|
||||
filt_date_to_ISODATE = ""
|
||||
if ("date_to" in diction.keys() and diction['date_to']):
|
||||
filt_date_to = str(diction['date_to'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_date_to)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date au' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date au' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_date_to_ISODATE = datetime.strptime(str(filt_date_to), '%d/%m/%Y')
|
||||
|
||||
today = datetime.today()
|
||||
date_from = ""
|
||||
if( "date_from" in diction.keys() ):
|
||||
date_from = diction['date_from']
|
||||
|
||||
date_to = ""
|
||||
if ("date_to" in diction.keys()):
|
||||
date_to = diction['date_to']
|
||||
|
||||
if not date_from:
|
||||
date_from = (today - relativedelta(months=2)).strftime("%d/%m/%Y")
|
||||
|
||||
if not date_to:
|
||||
date_to = (today + relativedelta(months=2)).strftime("%d/%m/%Y")
|
||||
|
||||
try:
|
||||
date_from_dt = datetime.strptime(date_from, "%d/%m/%Y")
|
||||
date_to_dt = datetime.strptime(date_to, "%d/%m/%Y")
|
||||
except ValueError:
|
||||
raise ValueError("Les dates doivent être au format JJ/MM/AAAA")
|
||||
|
||||
if date_from_dt > date_to_dt:
|
||||
raise ValueError("date_from doit être inférieure ou égale à date_to")
|
||||
|
||||
pipeline = [
|
||||
{
|
||||
"$match": {
|
||||
"valide": "1",
|
||||
"locked": "0",
|
||||
"partner_owner_recid": str(my_partner['recid']),
|
||||
"session_id": {
|
||||
"$exists": True,
|
||||
"$ne": ""
|
||||
},
|
||||
"$or": [
|
||||
{
|
||||
"apprenant_id": {
|
||||
"$exists": True,
|
||||
"$ne": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"email": {
|
||||
"$exists": True,
|
||||
"$ne": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$addFields": {
|
||||
"email_normalized": {
|
||||
"$toLower": {
|
||||
"$trim": {
|
||||
"input": {
|
||||
"$ifNull": ["$email", ""]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"apprenant_key": {
|
||||
"$cond": [
|
||||
{
|
||||
"$and": [
|
||||
{
|
||||
"$ne": [
|
||||
{
|
||||
"$ifNull": ["$apprenant_id", ""]
|
||||
},
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ne": ["$apprenant_id", None]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"$concat": [
|
||||
"apprenant_id:",
|
||||
"$apprenant_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$concat": [
|
||||
"email:",
|
||||
{
|
||||
"$toLower": {
|
||||
"$trim": {
|
||||
"input": {
|
||||
"$ifNull": ["$email", ""]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"session_object_id": {
|
||||
"$convert": {
|
||||
"input": "$session_id",
|
||||
"to": "objectId",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
|
||||
"date_from_filter": {
|
||||
"$dateFromString": {
|
||||
"dateString": date_from,
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
|
||||
"date_to_filter": {
|
||||
"$dateFromString": {
|
||||
"dateString": date_to,
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$match": {
|
||||
"session_object_id": {
|
||||
"$ne": None
|
||||
},
|
||||
"apprenant_key": {
|
||||
"$ne": "email:"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$lookup": {
|
||||
"from": "session_formation",
|
||||
"let": {
|
||||
"session_id": "$session_object_id",
|
||||
"partner_owner_recid": "$partner_owner_recid",
|
||||
"date_from_filter": "$date_from_filter",
|
||||
"date_to_filter": "$date_to_filter"
|
||||
},
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$and": [
|
||||
{
|
||||
"$eq": [
|
||||
"$_id",
|
||||
"$$session_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$eq": [
|
||||
"$partner_owner_recid",
|
||||
"$$partner_owner_recid"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$eq": [
|
||||
"$valide",
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ne": [
|
||||
"$archive",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$addFields": {
|
||||
"date_debut_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
"date_fin_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_fin",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$and": [
|
||||
{
|
||||
"$ne": [
|
||||
"$date_debut_date",
|
||||
None
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ne": [
|
||||
"$date_fin_date",
|
||||
None
|
||||
]
|
||||
},
|
||||
|
||||
# La session touche la période demandée :
|
||||
# date_debut_session <= date_to
|
||||
# date_fin_session >= date_from
|
||||
{
|
||||
"$lte": [
|
||||
"$date_debut_date",
|
||||
"$$date_to_filter"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$gte": [
|
||||
"$date_fin_date",
|
||||
"$$date_from_filter"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"as": "session"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$unwind": "$session"
|
||||
},
|
||||
|
||||
{
|
||||
"$group": {
|
||||
"_id": "$apprenant_key",
|
||||
|
||||
"apprenant": {
|
||||
"$first": {
|
||||
"apprenant_id": "$apprenant_id",
|
||||
"email": "$email",
|
||||
"nom": "$nom",
|
||||
"prenom": "$prenom",
|
||||
"telephone": "$telephone"
|
||||
}
|
||||
},
|
||||
|
||||
"inscriptions": {
|
||||
"$push": {
|
||||
"inscription_id": "$_id",
|
||||
"inscription_id_str": {
|
||||
"$toString": "$_id"
|
||||
},
|
||||
|
||||
"session_id": "$session_id",
|
||||
"code_session": "$session.code_session",
|
||||
|
||||
"class_id": "$class_id",
|
||||
"class_internal_url": "$class_internal_url",
|
||||
|
||||
"date_debut": "$session.date_debut",
|
||||
"date_fin": "$session.date_fin",
|
||||
"date_debut_date": "$session.date_debut_date",
|
||||
"date_fin_date": "$session.date_fin_date",
|
||||
|
||||
"mode_animation": "$session.mode_animation",
|
||||
"ville": "$session.ville",
|
||||
"adresse": "$session.adresse",
|
||||
"code_postal": "$session.code_postal",
|
||||
"pays": "$session.pays"
|
||||
}
|
||||
},
|
||||
|
||||
"nb_inscriptions": {
|
||||
"$sum": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$match": {
|
||||
"nb_inscriptions": {
|
||||
"$gt": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$project": {
|
||||
"apprenant": 1,
|
||||
"inscriptions_a": "$inscriptions",
|
||||
"inscriptions_b": "$inscriptions"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$unwind": "$inscriptions_a"
|
||||
},
|
||||
|
||||
{
|
||||
"$unwind": "$inscriptions_b"
|
||||
},
|
||||
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$and": [
|
||||
# Évite les doublons A/B et B/A
|
||||
{
|
||||
"$lt": [
|
||||
"$inscriptions_a.inscription_id_str",
|
||||
"$inscriptions_b.inscription_id_str"
|
||||
]
|
||||
},
|
||||
|
||||
# Évite de comparer deux inscriptions liées à la même session
|
||||
{
|
||||
"$ne": [
|
||||
"$inscriptions_a.session_id",
|
||||
"$inscriptions_b.session_id"
|
||||
]
|
||||
},
|
||||
|
||||
# Règle de chevauchement :
|
||||
# début A <= fin B
|
||||
# fin A >= début B
|
||||
{
|
||||
"$lte": [
|
||||
"$inscriptions_a.date_debut_date",
|
||||
"$inscriptions_b.date_fin_date"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$gte": [
|
||||
"$inscriptions_a.date_fin_date",
|
||||
"$inscriptions_b.date_debut_date"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$project": {
|
||||
"_id": 0,
|
||||
|
||||
"date_from_filter": date_from,
|
||||
"date_to_filter": date_to,
|
||||
|
||||
"apprenant_id": "$apprenant.apprenant_id",
|
||||
"apprenant_email": "$apprenant.email",
|
||||
"apprenant_nom": "$apprenant.nom",
|
||||
"apprenant_prenom": "$apprenant.prenom",
|
||||
"apprenant_telephone": "$apprenant.telephone",
|
||||
|
||||
"sessions_en_conflit": [
|
||||
{
|
||||
"inscription_id": "$inscriptions_a.inscription_id",
|
||||
"session_id": "$inscriptions_a.session_id",
|
||||
"code_session": "$inscriptions_a.code_session",
|
||||
"class_id": "$inscriptions_a.class_id",
|
||||
"class_internal_url": "$inscriptions_a.class_internal_url",
|
||||
"date_debut": "$inscriptions_a.date_debut",
|
||||
"date_fin": "$inscriptions_a.date_fin",
|
||||
"mode_animation": "$inscriptions_a.mode_animation",
|
||||
"ville": "$inscriptions_a.ville",
|
||||
"adresse": "$inscriptions_a.adresse",
|
||||
"code_postal": "$inscriptions_a.code_postal",
|
||||
"pays": "$inscriptions_a.pays"
|
||||
},
|
||||
{
|
||||
"inscription_id": "$inscriptions_b.inscription_id",
|
||||
"session_id": "$inscriptions_b.session_id",
|
||||
"code_session": "$inscriptions_b.code_session",
|
||||
"class_id": "$inscriptions_b.class_id",
|
||||
"class_internal_url": "$inscriptions_b.class_internal_url",
|
||||
"date_debut": "$inscriptions_b.date_debut",
|
||||
"date_fin": "$inscriptions_b.date_fin",
|
||||
"mode_animation": "$inscriptions_b.mode_animation",
|
||||
"ville": "$inscriptions_b.ville",
|
||||
"adresse": "$inscriptions_b.adresse",
|
||||
"code_postal": "$inscriptions_b.code_postal",
|
||||
"pays": "$inscriptions_b.pays"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"$sort": {
|
||||
"apprenant_nom": 1,
|
||||
"apprenant_prenom": 1,
|
||||
"apprenant_email": 1,
|
||||
"sessions_en_conflit.0.date_debut": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
for conflit_data in MYSY_GV.dbname['inscription'].aggregate(pipeline):
|
||||
print(" ### conflit_data = ", conflit_data)
|
||||
conflit_data['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(conflit_data))
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de récupérer la liste des conflits"
|
||||
|
|
|
|||
7721
Log/log_file.log
7721
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -2713,9 +2713,6 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Filter sur le client donner d'ordre
|
||||
"""
|
||||
|
|
@ -18790,3 +18787,474 @@ def Get_List_UE_Given_SessionFormation(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la list des UE de la promotion / session ", False
|
||||
|
||||
|
||||
""""
|
||||
04/07/2026 - Pour récuperer les session avec formation pouratelier et café creat pour France Active
|
||||
"""
|
||||
|
||||
|
||||
def GetAllValideSessionPartner_List_filter_like_With_Class_Categorie(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'class_title', 'code_session', 'class_external_code',
|
||||
'session_start_date', 'session_end_date',
|
||||
'class_internal_url', 'archive', 'type_session', 'class_id', 'session_etape', 'client_name',
|
||||
'inscrit_name']
|
||||
|
||||
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é, Creation partenaire annulée")
|
||||
return False, " Impossible de récupérer la liste des session de formation"
|
||||
|
||||
"""
|
||||
Verification de la liste 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, "Impossible de récupérer la liste des session de formation"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
||||
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
|
||||
|
||||
nb_hour_per_day = mycommon.Get_Partner_Hour_Per_Day(str(my_partner['recid']))
|
||||
if (nb_hour_per_day is False):
|
||||
nb_hour_per_day = "7"
|
||||
|
||||
filt_class_title = {}
|
||||
filt_class_title_v2 = {}
|
||||
tab_class_id = []
|
||||
|
||||
if ("class_title" in diction.keys()):
|
||||
filt_class_title = {
|
||||
'title': {'$regex': mycommon.regex_replace_cartere(str(diction['class_title'])), "$options": "i"}}
|
||||
for tmp in MYSY_GV.dbname['myclass'].find(filt_class_title, {'_id': 1}):
|
||||
if (str(tmp['_id']) not in tab_class_id):
|
||||
tab_class_id.append(str(tmp['_id']))
|
||||
|
||||
filt_class_id = {}
|
||||
if ("class_id" in diction.keys() and diction['class_id']):
|
||||
if (str(diction['class_id']) not in tab_class_id):
|
||||
tab_class_id.append(str(diction['class_id']))
|
||||
|
||||
filt_class_internal_url = {}
|
||||
if ("class_internal_url" in diction.keys()):
|
||||
filt_class_internal_url = {
|
||||
'internal_url': {'$regex': mycommon.regex_replace_cartere(str(diction['class_internal_url'])),
|
||||
"$options": "i"}}
|
||||
for tmp in MYSY_GV.dbname['myclass'].find(filt_class_internal_url, {'_id': 1}):
|
||||
if (str(tmp['_id']) not in tab_class_id):
|
||||
tab_class_id.append(str(tmp['_id']))
|
||||
|
||||
filt_class_external_code = {}
|
||||
if ("class_external_code" in diction.keys()):
|
||||
filt_class_external_code = {
|
||||
'external_code': {'$regex': mycommon.regex_replace_cartere(str(diction['class_external_code'])),
|
||||
"$options": "i"}}
|
||||
for tmp in MYSY_GV.dbname['myclass'].find(filt_class_external_code, {'_id': 1}):
|
||||
if (str(tmp['_id']) not in tab_class_id):
|
||||
tab_class_id.append(str(tmp['_id']))
|
||||
|
||||
if (len(tab_class_id) > 0):
|
||||
filt_class_title_v2 = {'class_id': {'$in': tab_class_id}}
|
||||
|
||||
filt_code_session = {}
|
||||
if ("code_session" in diction.keys()):
|
||||
filt_code_session = {
|
||||
'code_session': {'$regex': mycommon.regex_replace_cartere(str(diction['code_session'])),
|
||||
"$options": "i"}}
|
||||
|
||||
filt_session_start_date = ""
|
||||
if ("session_start_date" in diction.keys()):
|
||||
filt_session_start_date = str(diction['session_start_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_start_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_session_end_date = ""
|
||||
if ("session_end_date" in diction.keys()):
|
||||
filt_session_end_date = str(diction['session_end_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_end_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_archive = {}
|
||||
if ("archive" in diction.keys() and str(diction['archive']) == "1"):
|
||||
filt_archive = {'archive': '1'}
|
||||
|
||||
elif ("archive" in diction.keys() and (str(diction['archive']) == "0" or str(diction['archive']) == "")):
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
||||
elif ("archive" not in diction.keys()):
|
||||
filt_archive = {'archive': {'$ne': '1'}}
|
||||
|
||||
filt_type_session = {}
|
||||
if ("type_session" in diction.keys()):
|
||||
filt_type_session = {'type_session': str(diction['type_session']).strip()}
|
||||
|
||||
filt_session_etape = {}
|
||||
if ("session_etape" in diction.keys() and diction['session_etape']):
|
||||
filt_session_etape = {'session_etape': str(diction['session_etape']).strip()}
|
||||
|
||||
"""
|
||||
Filter sur le client donner d'ordre
|
||||
"""
|
||||
filt_session_inscription_session_id = {}
|
||||
if ("inscrit_name" in diction.keys() and diction['inscrit_name']):
|
||||
tab_session_inscription_session_id = []
|
||||
|
||||
qry_gle = {"$or": [
|
||||
{'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
]}
|
||||
|
||||
tab_inscription_session_id_ObjectId = []
|
||||
for tmp in MYSY_GV.dbname['inscription'].find(qry_gle, {'session_id': 1}):
|
||||
tab_inscription_session_id_ObjectId.append(ObjectId(str(tmp['session_id'])))
|
||||
|
||||
if (len(tab_inscription_session_id_ObjectId) > 0):
|
||||
filt_session_inscription_session_id = {"_id": {'$in': tab_inscription_session_id_ObjectId}}
|
||||
|
||||
"""
|
||||
Filter sur le client donner d'ordre
|
||||
"""
|
||||
filt_session_inscription_client_rattachement_id = {}
|
||||
if ("client_name" in diction.keys() and diction['client_name']):
|
||||
tab_session_id_from_inscription = []
|
||||
|
||||
qry_gle = {"$or": [
|
||||
{'raison_sociale': {'$regex': mycommon.regex_replace_cartere(str(diction['client_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['client_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['client_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['client_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
]}
|
||||
|
||||
tab_client_id = []
|
||||
for tmp in MYSY_GV.dbname['partner_client'].find(qry_gle, {'_id': 1}):
|
||||
tab_client_id.append(str(tmp['_id']))
|
||||
|
||||
# print(" ### tab_client_id = ", tab_client_id)
|
||||
|
||||
for tmp in MYSY_GV.dbname['inscription'].find(
|
||||
{'client_rattachement_id': {'$in': tab_client_id}, 'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', },
|
||||
{'_id': 1, 'session_id': 1}):
|
||||
if ('session_id' in tmp.keys() and tmp['session_id']):
|
||||
tab_session_id_from_inscription.append(ObjectId(str(tmp['session_id'])))
|
||||
|
||||
if (len(tab_session_id_from_inscription) > 0):
|
||||
filt_session_inscription_client_rattachement_id = {'_id': {'$in': tab_session_id_from_inscription}}
|
||||
|
||||
"""
|
||||
Filtre sur les formation si mis sur l'utilisateur
|
||||
"""
|
||||
filt_scope_class_id = {}
|
||||
if ("scope" in my_partner.keys() and "class_id" in my_partner['scope'].keys() and len(
|
||||
my_partner['scope']['class_id']) > 0):
|
||||
filt_scope_class_id['class_id'] = {'$in': my_partner['scope']['class_id']}
|
||||
|
||||
filt_scope_session_id = {}
|
||||
tab_session_id_ObjectId = []
|
||||
if ("scope" in my_partner.keys() and "session_id" in my_partner['scope'].keys() and len(
|
||||
my_partner['scope']['session_id']) > 0):
|
||||
for tmp in my_partner['scope']['session_id']:
|
||||
if (tmp):
|
||||
tab_session_id_ObjectId.append((ObjectId(tmp)))
|
||||
|
||||
filt_scope_session_id['_id'] = {'$in': tab_session_id_ObjectId}
|
||||
|
||||
query2 = [{'$match': {
|
||||
'$and': [filt_code_session, {'partner_owner_recid': str(my_partner['recid'])}, filt_scope_class_id,
|
||||
filt_scope_session_id,
|
||||
filt_archive, filt_type_session, filt_class_title_v2, filt_session_etape,
|
||||
filt_session_inscription_client_rattachement_id,
|
||||
filt_session_inscription_session_id]}
|
||||
},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'let': {'class_id': "$class_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$class_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{'$project': {"_id": 1, "order_header_ref_interne": 1, "external_code": 1,
|
||||
"title": 1, "partner_owner_recid": 1, "valide": 1,
|
||||
'domaine': 1, 'lms_class_code': 1, 'duration': 1, 'duration_unit': 1, }
|
||||
},
|
||||
],
|
||||
'as': 'myclass_collection'
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
pipeline = [
|
||||
{
|
||||
"$match": {
|
||||
'$and': [filt_code_session, {'partner_owner_recid': str(my_partner['recid'])}, filt_scope_class_id,
|
||||
filt_scope_session_id,
|
||||
filt_archive, filt_type_session, filt_class_title_v2, filt_session_etape,
|
||||
filt_session_inscription_client_rattachement_id,
|
||||
filt_session_inscription_session_id]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"date_debut_inscription_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut_inscription",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
"date_fin_inscription_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_fin_inscription",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$and": [
|
||||
{"$ne": ["$date_debut_inscription_date", None]},
|
||||
{"$ne": ["$date_fin_inscription_date", None]},
|
||||
{"$lte": ["$date_debut_inscription_date", "$$NOW"]},
|
||||
{"$gte": ["$date_fin_inscription_date", "$$NOW"]}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$lookup": {
|
||||
"from": "myclass",
|
||||
"let": {
|
||||
"class_id": "$class_id"
|
||||
},
|
||||
"pipeline": [
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$eq": [
|
||||
"$_id",
|
||||
{
|
||||
"$convert": {
|
||||
"input": "$$class_id",
|
||||
"to": "objectId",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"as": "formation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"formation": {
|
||||
"$first": "$formation"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$project": {
|
||||
"_id": 1,
|
||||
|
||||
"code_session": 1,
|
||||
"titre_session": "$titre",
|
||||
"session_etape": 1,
|
||||
"session_status": 1,
|
||||
|
||||
"date_debut": 1,
|
||||
"date_fin": 1,
|
||||
"date_debut_inscription": 1,
|
||||
"date_fin_inscription": 1,
|
||||
|
||||
"nb_participant": 1,
|
||||
"prix_session": 1,
|
||||
"price_by": 1,
|
||||
"location_type": 1,
|
||||
"mode_animation": 1,
|
||||
|
||||
"adresse": 1,
|
||||
"code_postal": 1,
|
||||
"ville": 1,
|
||||
"pays": 1,
|
||||
|
||||
"class_id": 1,
|
||||
|
||||
"formation_code": "$formation.external_code",
|
||||
"formation_code_interne": "$formation.internal_code",
|
||||
"formation_titre": "$formation.title",
|
||||
"formation_description": "$formation.description",
|
||||
"formation_objectif": "$formation.objectif",
|
||||
"formation_duration": "$formation.duration",
|
||||
"formation_duration_unit": "$formation.duration_unit",
|
||||
"formation_price": "$formation.price",
|
||||
"formation_url": "$formation.internal_url",
|
||||
"formation_categorie_id": "$formation.categorie",
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"$sort": {
|
||||
"date_debut_inscription_date": 1,
|
||||
"date_debut": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
print("#### GetAllValideSessionPartner_List_filter_ - pipeline = ", pipeline)
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
for retVal in MYSY_GV.dbname['session_formation'].aggregate(pipeline):
|
||||
|
||||
val = retVal
|
||||
val['id'] = str(cpt)
|
||||
cpt = cpt + 1
|
||||
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
val['formateur_id'] = retVal['formateur_id']
|
||||
|
||||
# On va aller chercher le nom et prenom du formateur
|
||||
fomateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retVal['formateur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
if (fomateur_data is None):
|
||||
val['formateur'] = " Invalide"
|
||||
else:
|
||||
nom = ""
|
||||
prenom = ""
|
||||
if ("nom" in fomateur_data.keys()):
|
||||
nom = fomateur_data['nom']
|
||||
if ("prenom" in fomateur_data.keys()):
|
||||
prenom = fomateur_data['prenom']
|
||||
val['formateur'] = str(nom) + " " + str(prenom)
|
||||
|
||||
|
||||
else:
|
||||
val['formateur_id'] = ""
|
||||
|
||||
|
||||
|
||||
if ( "formation_duration" in val.keys() and "formation_duration_unit" in val.keys() and val['formation_duration_unit'] == "heure"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " h"
|
||||
|
||||
elif ("formation_duration" in val.keys() and "formation_duration" in val.keys() and val[
|
||||
'formation_duration_unit'] == "jour"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " j"
|
||||
|
||||
elif ("formation_duration" in val.keys() and "formation_duration" in val.keys() and val[
|
||||
'formation_duration_unit'] == "semaine"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " s"
|
||||
|
||||
elif ("formation_duration" in val.keys() and "formation_duration" in val.keys() and val[
|
||||
'formation_duration_unit'] == "mois"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " m"
|
||||
|
||||
elif ("formation_duration" in val.keys() and "formation_duration" in val.keys() and val[
|
||||
'formation_duration_unit'] == "annee"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " a"
|
||||
|
||||
elif ("formation_duration" in val.keys() and "formation_duration" in val.keys() and val[
|
||||
'formation_duration_unit'] == "user_rythme"):
|
||||
val['duration_concat'] = str(val['formation_duration']) + " u"
|
||||
|
||||
else :
|
||||
val['duration_concat'] = str(val['formation_duration']) + " ?"
|
||||
|
||||
|
||||
if ("formation_duration" in val.keys()):
|
||||
val['duration'] = str(val['formation_duration'])
|
||||
else:
|
||||
val['duration'] = "1"
|
||||
|
||||
if ("formation_duration_unit" in val.keys()):
|
||||
val['duration_unit'] = val['formation_duration_unit']
|
||||
else:
|
||||
val['duration_unit'] = "jour"
|
||||
|
||||
local_class_categorie_id = ""
|
||||
local_class_categorie_code = ""
|
||||
if ("formation_categorie_id" in val.keys() and val['formation_categorie_id']):
|
||||
categorie_data = MYSY_GV.dbname['class_categorie'].find_one({'_id':ObjectId(str(val['formation_categorie_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1'}, {'_id':1, 'code':1, 'nom':1})
|
||||
|
||||
if( categorie_data and '_id' in categorie_data.keys()):
|
||||
local_class_categorie_id = str(categorie_data['_id'])
|
||||
|
||||
if (categorie_data and 'code' in categorie_data.keys()):
|
||||
local_class_categorie_code = str(categorie_data['code'])
|
||||
|
||||
val['categorie'] = local_class_categorie_id
|
||||
val['code'] = local_class_categorie_code
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de récupérer la liste des sessions de formation valides et actives."
|
||||
|
|
|
|||
12
email_mgt.py
12
email_mgt.py
|
|
@ -2749,7 +2749,7 @@ def ManualSendInvoiceEmailRIB_ICOSS(diction):
|
|||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
body = {
|
||||
"params": {"order_id": "N/A",
|
||||
"date_order": ": 29/10/2025",
|
||||
"date_order": ": 02/02/2026",
|
||||
"periode":"",
|
||||
"total_ht": "1 500",
|
||||
"tva": "TVA non applicable",
|
||||
|
|
@ -2758,15 +2758,15 @@ def ManualSendInvoiceEmailRIB_ICOSS(diction):
|
|||
"client_address": "Place des magnolias",
|
||||
"client_zip_ville": "77680 Roissy en brie",
|
||||
"client_pays": "France",
|
||||
"packs": " Qualification base de données Client (2 000 contacts)",
|
||||
"packs": " Qualification base de données Client (1 200 contacts)",
|
||||
"detail_packs": "Qualification Contact, Poste, Email, Téléphone",
|
||||
"qty": "1",
|
||||
"unit_price": "1 500 €",
|
||||
"montant": "1 500 €",
|
||||
|
||||
"invoice_id": "202602-005",
|
||||
"invoice_date": "01/02/2026",
|
||||
"due_date": "01/02/2026",
|
||||
"invoice_id": "202607-020",
|
||||
"invoice_date": "01/07/2026",
|
||||
"due_date": "01/07/2026",
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -2788,7 +2788,7 @@ def ManualSendInvoiceEmailRIB_ICOSS(diction):
|
|||
#print(" ### body 22 = ", body)
|
||||
|
||||
sourceHtml = template.render(json_data=body["params"])
|
||||
orig_file_name = "ICOSS_FACTURE_202602-005.pdf"
|
||||
orig_file_name = "ICOSS_FACTURE_202607-020.pdf"
|
||||
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
|
|
|
|||
|
|
@ -157,9 +157,10 @@ def Add_Groupe_Inscrit(diction):
|
|||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
new_data['archive'] = "0"
|
||||
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
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['groupe_inscription'].insert_one(new_data).inserted_id
|
||||
|
|
@ -190,7 +191,7 @@ def Update_Groupe_Inscrit(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'code', 'nom', 'description', 'class_id', 'session_id',
|
||||
'color', 'groupe_inscription_type_id']
|
||||
'color', 'groupe_inscription_type_id', 'archive']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -306,12 +307,19 @@ def Update_Groupe_Inscrit(diction):
|
|||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
if('archive' in diction.keys() and diction['archive'] in ['0', '1']):
|
||||
new_data['archive'] = str(diction['archive'])
|
||||
else:
|
||||
new_data['archive'] = "0"
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
|
||||
result = MYSY_GV.dbname['groupe_inscription'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
|
|
@ -449,7 +457,7 @@ def Get_List_Groupe_Inscrit_With_Filter(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'nom', 'type_groupe_code', 'class_external_code',
|
||||
'code_session', 'session_id']
|
||||
'code_session', 'session_id', 'archive']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -545,13 +553,19 @@ def Get_List_Groupe_Inscrit_With_Filter(diction):
|
|||
# print(" ### liste des Id des sessions eligible list_session_id = ", list_session_id)
|
||||
filt_class_id = {'class_id': {'$in': list_class_id, }}
|
||||
|
||||
filt_archive = {}
|
||||
if ("archive" in diction.keys() and diction['archive'] in ['0', '1']):
|
||||
filt_archive = {'archive': str(diction['archive'])}
|
||||
|
||||
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
find_qry = {'$and': [{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}, filt_class_id,
|
||||
filt_session_id, filt_code, filt_nom, filt_type_groupe_code, filt_session_id_on_main_collection]}
|
||||
filt_session_id, filt_code, filt_nom, filt_type_groupe_code, filt_session_id_on_main_collection,
|
||||
filt_archive]}
|
||||
|
||||
print("### Get_List_Groupe_Inscrit_With_Filter find_qry = ", find_qry)
|
||||
|
||||
|
|
@ -723,6 +737,7 @@ def Get_Given_Groupe_Inscrit_Data(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
|
||||
type_groupe_code = ""
|
||||
type_groupe_id = ""
|
||||
if ("groupe_inscription_type_id" in retval.keys() and retval['groupe_inscription_type_id']):
|
||||
groupe_inscription_type_id_data = MYSY_GV.dbname['groupe_inscription_type'].find_one(
|
||||
{'_id': ObjectId(str(retval['groupe_inscription_type_id'])),
|
||||
|
|
@ -735,7 +750,11 @@ def Get_Given_Groupe_Inscrit_Data(diction):
|
|||
if (groupe_inscription_type_id_data and 'code' in groupe_inscription_type_id_data.keys()):
|
||||
type_groupe_code = groupe_inscription_type_id_data['code']
|
||||
|
||||
if (groupe_inscription_type_id_data and '_id' in groupe_inscription_type_id_data.keys()):
|
||||
type_groupe_id = str(groupe_inscription_type_id_data['_id'])
|
||||
|
||||
user['type_groupe_code'] = str(type_groupe_code)
|
||||
user['groupe_inscription_type_id'] = str(type_groupe_id)
|
||||
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
|
|||
54
main.py
54
main.py
|
|
@ -849,6 +849,30 @@ def get_all_class_Given_partner_owner_recid_No_Login():
|
|||
return response
|
||||
|
||||
|
||||
"""
|
||||
04/07/2026 - Cette API retoune les formation d'un partenaire pour permettre
|
||||
d'afficher son catalogue PUBLIC avec intégration des session dont la plage d'inscription
|
||||
est valide aujourd'hui
|
||||
"""
|
||||
@app.route('/myclass/api/get_all_class_Given_partner_owner_recid_No_Login_With_Valide_Session/', methods=['GET','POST'])
|
||||
@crossdomain(origin='*')
|
||||
def get_all_class_Given_partner_owner_recid_No_Login_With_Valide_Session():
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### get_all_class_Given_partner_owner_recid_No_Login_With_Valide_Session : payload = ", payload)
|
||||
if mycommon.check_source_ipv4(str(request.remote_addr)) is False :
|
||||
return jsonify(status="False", message="Security check : "+request.remote_addr+"' is not autorized")
|
||||
|
||||
|
||||
status, result = wp.get_all_class_Given_partner_owner_recid_No_Login_With_Valide_Session(payload)
|
||||
|
||||
response = jsonify(status=status, message=result)
|
||||
response.headers.add("Access-Control-Allow-Origin", "*")
|
||||
response.headers.add("Access-Control-Allow-Headers", "*")
|
||||
response.headers.add("Access-Control-Allow-Methods", "*")
|
||||
return response
|
||||
|
||||
|
||||
|
||||
@app.route('/myclass/api/update_class_by_attribut/<objId>,<attribut>,<value>', methods=['GET','POST'])
|
||||
def update_class_by_attribut(objId, attribut, value):
|
||||
print(" update_class_by_attribut ")
|
||||
|
|
@ -2627,6 +2651,20 @@ def Get_List_UE_Given_SessionFormation():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour Pour récuperer les session avec formation pouratelier et café creat pour France Active
|
||||
"""
|
||||
@app.route('/myclass/api/GetAllValideSessionPartner_List_filter_like_With_Class_Categorie/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GetAllValideSessionPartner_List_filter_like_With_Class_Categorie():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### GetAllValideSessionPartner_List_filter_like_With_Class_Categorie : payload = ",str(payload))
|
||||
localStatus, message = SF.GetAllValideSessionPartner_List_filter_like_With_Class_Categorie(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation de toutes les sessions de formation valides et actives
|
||||
|
|
@ -13008,6 +13046,22 @@ def Create_Inscrit_Absence_By_Plage_Of_Date_OR_Sequence_Id():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API permet d'identifier les conflits d'inscription
|
||||
Par exemple est une personne est inscrite à plusieurs sessions de formation qui se deroulent en meme temps
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Inscription_Conflit/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Inscription_Conflit():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Inscription_Conflit payload = ",payload)
|
||||
status, retval = inscription.Get_Inscription_Conflit(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API permet le pourcentage d'absence non justifié pour un inscrit par rapport à un domaine de compétence donnée
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -5261,11 +5261,17 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
Verifier que la facture est valide et s'assurer qu'il n'y pas un avoir (on est en mode avoir TOTAL).
|
||||
Colonne : 'credit_note_ref'
|
||||
"""
|
||||
|
||||
|
||||
is_valide_invoice_cout = MYSY_GV.dbname['partner_invoice_header'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
"$or": [
|
||||
{"credit_note_ref": {
|
||||
"$exists": False}},
|
||||
{"credit_note_ref": ""}
|
||||
]
|
||||
})
|
||||
|
||||
if( is_valide_invoice_cout <= 0 ):
|
||||
|
|
@ -5729,6 +5735,11 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
date_facture = datetime.today()
|
||||
if ("invoice_date" in diction.keys() and diction['invoice_date']):
|
||||
date_echance = datetime.strptime(diction['invoice_date'], "%d/%m/%Y")
|
||||
date_facture = datetime.strptime(diction['invoice_date'], "%d/%m/%Y")
|
||||
|
||||
|
||||
if( paiement_condition_data ):
|
||||
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
|
||||
|
|
@ -5736,11 +5747,11 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
|
||||
if (str(paiement_condition_data['depart']) == "mois"):
|
||||
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
|
||||
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
|
||||
first_day_next_month = date_facture.replace(day=1) + timedelta(days_in_month(date_facture))
|
||||
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "facture"):
|
||||
date_echance = today + timedelta(days=nb_jour_int)
|
||||
date_echance = date_facture + timedelta(days=nb_jour_int)
|
||||
|
||||
date_echance = date_echance.strftime("%d/%m/%Y")
|
||||
|
||||
|
|
@ -5828,17 +5839,23 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
date_facture = datetime.today()
|
||||
if( "invoice_date" in diction.keys() and diction['invoice_date']):
|
||||
date_echance = datetime.strptime(diction['invoice_date'], "%d/%m/%Y")
|
||||
date_facture = datetime.strptime(diction['invoice_date'], "%d/%m/%Y")
|
||||
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "mois"):
|
||||
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
|
||||
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
|
||||
first_day_next_month = date_facture.replace(day=1) + timedelta(days_in_month(date_facture))
|
||||
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "facture"):
|
||||
date_echance = today + timedelta(days=nb_jour_int)
|
||||
date_echance = date_facture + timedelta(days=nb_jour_int)
|
||||
|
||||
|
||||
date_echance = date_echance.strftime("%d/%m/%Y")
|
||||
|
||||
data['invoice_date_echeance'] = str(date_echance)
|
||||
|
||||
|
||||
|
|
@ -6031,6 +6048,7 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
return False, "La date de facturation n'est pas au format jj/mm/aaaa."
|
||||
|
||||
data['invoice_date'] = diction['invoice_date']
|
||||
invoice_date_str = str(invoice_date)
|
||||
else:
|
||||
invoice_date_time = str(datetime.now().strftime("%d/%m/%Y"))
|
||||
data['invoice_date'] = invoice_date_time
|
||||
|
|
|
|||
253
wrapper.py
253
wrapper.py
|
|
@ -387,7 +387,9 @@ on ne retourne que les formation dont published_catalog_prive != 0
|
|||
"""
|
||||
|
||||
|
||||
def get_all_class_Given_partner_owner_recid_No_Login(diction):
|
||||
|
||||
|
||||
def get_all_class_Given_partner_owner_recid_No_Login_With_Valide_Session(diction):
|
||||
try:
|
||||
|
||||
# Dictionnaire des champs utilisables
|
||||
|
|
@ -539,7 +541,8 @@ def get_all_class_Given_partner_owner_recid_No_Login(diction):
|
|||
{'external_code': {'$nin': alread_found}},
|
||||
{'display_rank': {'$nin': []}},
|
||||
{'partner_owner_recid':partner_owner_recid},
|
||||
{'published_catalog_prive': {'$ne': "0"}}
|
||||
{'published_catalog_prive': {'$ne': "0"}},
|
||||
|
||||
]}
|
||||
},
|
||||
{'$project': {'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0,
|
||||
|
|
@ -568,70 +571,218 @@ def get_all_class_Given_partner_owner_recid_No_Login(diction):
|
|||
},
|
||||
{'$sort': {"display_rank": pymongo.DESCENDING, "price": pymongo.ASCENDING,
|
||||
"date_update": pymongo.DESCENDING}},
|
||||
{'$limit': nb_formation_a_jouter},
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
mytoday = datetime.today()
|
||||
#print(" ### get_all_class_Given_partner_owner_recid_No_Login pipe = ", pipe)
|
||||
for x in coll_name.aggregate(pipe):
|
||||
|
||||
print(" ### get_all_class_Given_partner_owner_recid_No_Login pipe = ", pipe)
|
||||
for x in MYSY_GV.dbname['myclass'].aggregate(pipe):
|
||||
|
||||
"""
|
||||
24/10/2025 - Pour verifie si le prix est HT ou TTC du PRORITAIRE DE LA FORMATION
|
||||
on va aller chercher la valeur de TVA dans la collecion :'base_partner_setup'
|
||||
"""
|
||||
partnaire_tva = ""
|
||||
partner_tva_retval = mycommon.Get_Class_Owner_class(str(x['partner_owner_recid']))
|
||||
if (partner_tva_retval is False):
|
||||
04/07/26 - Recuperer les session dont la date d'inscripion est ouverte
|
||||
"""
|
||||
pipeline_session_valide = [
|
||||
{
|
||||
"$match": {
|
||||
"archive": {"$ne": "1"},
|
||||
"valide": "1",
|
||||
"partner_owner_recid": str(x['partner_owner_recid']),
|
||||
"class_id": str(x['_id'])
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
|
||||
"date_debut_sort": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
|
||||
"date_debut_inscription_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut_inscription",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
"date_fin_inscription_date": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_fin_inscription",
|
||||
"format": "%d/%m/%Y",
|
||||
"onError": None,
|
||||
"onNull": None
|
||||
}
|
||||
},
|
||||
"today_date": {
|
||||
"$dateTrunc": {
|
||||
"date": "$$NOW",
|
||||
"unit": "day",
|
||||
"timezone": "Europe/Paris"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$match": {
|
||||
"$expr": {
|
||||
"$and": [
|
||||
{"$ne": ["$date_debut_inscription_date", None]},
|
||||
{"$ne": ["$date_fin_inscription_date", None]},
|
||||
{"$lte": ["$date_debut_inscription_date", "$today_date"]},
|
||||
{"$gte": ["$date_fin_inscription_date", "$today_date"]}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$project": {
|
||||
"_id": 1,
|
||||
"code_session": 1,
|
||||
"date_debut": 1,
|
||||
"date_fin": 1,
|
||||
"ville": 1,
|
||||
"adresse": 1,
|
||||
"code_postal": 1,
|
||||
"nb_participant": 1,
|
||||
"mode_animation": 1,
|
||||
"date_debut_inscription": 1,
|
||||
"date_fin_inscription": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$sort": {
|
||||
"date_debut_sort": 1
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
#print(" ### pipeline_session_valide QRY = ", pipeline_session_valide)
|
||||
|
||||
tab_session = []
|
||||
for local_session in MYSY_GV.dbname['session_formation'].aggregate(pipeline_session_valide):
|
||||
|
||||
"""
|
||||
24/10/2025 - Pour verifie si le prix est HT ou TTC du PRORITAIRE DE LA FORMATION
|
||||
on va aller chercher la valeur de TVA dans la collecion :'base_partner_setup'
|
||||
"""
|
||||
partnaire_tva = ""
|
||||
else:
|
||||
partnaire_tva = partner_tva_retval
|
||||
|
||||
x['partnaire_tva'] = str(partnaire_tva)
|
||||
|
||||
# print("AVANT ==> "+str(x['description']))
|
||||
if ("description" in x.keys()):
|
||||
val = x['description']
|
||||
no_html = mycommon.cleanhtml(x['description'])
|
||||
if (len(no_html) > MYSY_GV.MAX_CARACT):
|
||||
x['description'] = no_html[:MYSY_GV.MAX_CARACT] + " ..."
|
||||
|
||||
partner_tva_retval = mycommon.Get_Class_Owner_class(str(x['partner_owner_recid']))
|
||||
if (partner_tva_retval is False):
|
||||
partnaire_tva = ""
|
||||
else:
|
||||
x['description'] = no_html
|
||||
partnaire_tva = partner_tva_retval
|
||||
|
||||
# mycommon.myprint("APRES ==> " + str(x['description']))
|
||||
x['partnaire_tva'] = str(partnaire_tva)
|
||||
local_session['partnaire_tva'] = str(partnaire_tva)
|
||||
|
||||
tab_selected_business_prices = []
|
||||
if ("business_prices" in x.keys()):
|
||||
# print("AVANT ==> "+str(x['description']))
|
||||
if ("description" in x.keys()):
|
||||
val = x['description']
|
||||
no_html = mycommon.cleanhtml(x['description'])
|
||||
if (len(no_html) > MYSY_GV.MAX_CARACT):
|
||||
x['description'] = no_html[:MYSY_GV.MAX_CARACT] + " ..."
|
||||
local_session['description'] = no_html[:MYSY_GV.MAX_CARACT] + " ..."
|
||||
|
||||
for local_business_prices in x['business_prices']:
|
||||
else:
|
||||
x['description'] = no_html
|
||||
local_session['description'] = no_html
|
||||
|
||||
if ("date_du" in local_business_prices.keys() and "date_au" in local_business_prices.keys()
|
||||
and mycommon.CheckisDate(local_business_prices['date_du']) and mycommon.CheckisDate(
|
||||
local_business_prices['date_au'])):
|
||||
# mycommon.myprint("APRES ==> " + str(x['description']))
|
||||
|
||||
local_date_du = datetime.strptime(str(local_business_prices['date_du']).strip(), '%d/%m/%Y')
|
||||
local_date_au = datetime.strptime(str(local_business_prices['date_au']).strip(), '%d/%m/%Y')
|
||||
tab_selected_business_prices = []
|
||||
if ("business_prices" in x.keys()):
|
||||
|
||||
if (local_date_du <= mytoday and mytoday <= local_date_au):
|
||||
local_discount = mycommon.tryFloat(str(local_business_prices['discount']))
|
||||
local_initial_price = mycommon.tryFloat(str(x['price']))
|
||||
local_discounted_price = round(
|
||||
local_initial_price - (local_initial_price * (local_discount / 100)), 2)
|
||||
x['business_prices'][0]['discounted_price'] = str(local_discounted_price)
|
||||
local_business_prices['discounted_price'] = str(local_discounted_price)
|
||||
tab_selected_business_prices.append(local_business_prices)
|
||||
for local_business_prices in x['business_prices']:
|
||||
|
||||
user = x
|
||||
user['id'] = str(val_tmp)
|
||||
user['business_prices'] = tab_selected_business_prices
|
||||
if ("date_du" in local_business_prices.keys() and "date_au" in local_business_prices.keys()
|
||||
and mycommon.CheckisDate(local_business_prices['date_du']) and mycommon.CheckisDate(
|
||||
local_business_prices['date_au'])):
|
||||
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
local_date_du = datetime.strptime(str(local_business_prices['date_du']).strip(), '%d/%m/%Y')
|
||||
local_date_au = datetime.strptime(str(local_business_prices['date_au']).strip(), '%d/%m/%Y')
|
||||
|
||||
# print(" 1111111 ")
|
||||
# print(str(x))
|
||||
mycommon.InsertStatistic(x, "summary", mydata)
|
||||
if (local_date_du <= mytoday and mytoday <= local_date_au):
|
||||
local_discount = mycommon.tryFloat(str(local_business_prices['discount']))
|
||||
local_initial_price = mycommon.tryFloat(str(x['price']))
|
||||
local_discounted_price = round(
|
||||
local_initial_price - (local_initial_price * (local_discount / 100)), 2)
|
||||
x['business_prices'][0]['discounted_price'] = str(local_discounted_price)
|
||||
local_business_prices['discounted_price'] = str(local_discounted_price)
|
||||
tab_selected_business_prices.append(local_business_prices)
|
||||
|
||||
tab_training_inzone.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
user = x
|
||||
user['id'] = str(val_tmp)
|
||||
user['business_prices'] = tab_selected_business_prices
|
||||
local_session['business_prices'] = tab_selected_business_prices
|
||||
|
||||
local_class_categorie_id = ""
|
||||
local_class_categorie_code = ""
|
||||
local_class_categorie_display_session_private_catalog = ""
|
||||
|
||||
if ("categorie" in user.keys() and user['categorie']):
|
||||
categorie_data = MYSY_GV.dbname['class_categorie'].find_one(
|
||||
{'_id': ObjectId(str(user['categorie'])),
|
||||
'partner_owner_recid': str(x['partner_owner_recid']),
|
||||
'valide': '1'}, {'_id': 1, 'code': 1, 'nom': 1, 'display_session_private_catalog':1})
|
||||
|
||||
if (categorie_data and '_id' in categorie_data.keys()):
|
||||
local_class_categorie_id = str(categorie_data['_id'])
|
||||
|
||||
if (categorie_data and 'code' in categorie_data.keys()):
|
||||
local_class_categorie_code = str(categorie_data['code'])
|
||||
|
||||
if (categorie_data and 'display_session_private_catalog' in categorie_data.keys()):
|
||||
local_class_categorie_display_session_private_catalog = str(categorie_data['display_session_private_catalog'])
|
||||
|
||||
user['categorie'] = local_class_categorie_id
|
||||
user['categorie_code'] = local_class_categorie_code
|
||||
user['categorie_display_session_private_catalog '] = local_class_categorie_display_session_private_catalog
|
||||
|
||||
local_session['cpf'] = user['cpf']
|
||||
if( "img_url" in user.keys()):
|
||||
local_session['img_url'] = user['img_url']
|
||||
|
||||
if ("metier" in user.keys()):
|
||||
local_session['metier'] = user['metier']
|
||||
|
||||
if ("note" in user.keys()):
|
||||
local_session['note'] = user['note']
|
||||
|
||||
if ("url" in user.keys()):
|
||||
local_session['url'] = user['url']
|
||||
|
||||
if ("price" in user.keys()):
|
||||
local_session['price'] = user['price']
|
||||
|
||||
if ("inscription_direct" in user.keys()):
|
||||
local_session['inscription_direct'] = user['inscription_direct']
|
||||
|
||||
|
||||
|
||||
|
||||
print(" SESSS ion local_session = ", local_session)
|
||||
tab_session.append(local_session)
|
||||
|
||||
user['tab_session'] = tab_session
|
||||
|
||||
|
||||
print(" V2222 user = ", user)
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
|
||||
# print(" 1111111 ")
|
||||
# print(str(x))
|
||||
mycommon.InsertStatistic(x, "summary", mydata)
|
||||
|
||||
tab_training_inzone.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# print(" ### insertObject = ", str(tab_training_inzone))
|
||||
# return True, insertObject
|
||||
|
|
@ -642,6 +793,8 @@ def get_all_class_Given_partner_owner_recid_No_Login(diction):
|
|||
return False, " Impossible de récupérer les formations"
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Cette Fonction récupérer les formations dans la zone de l'utilisateur.
|
||||
Par zone utilisateur j'entends : ville or pays
|
||||
|
|
|
|||
Loading…
Reference in New Issue