qsh
parent
d50be3292f
commit
695c0b465c
|
@ -1,14 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/09/2024 - 20:00">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="04/09/2024 - 23h">
|
||||
<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$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/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$/model_planning_sequence_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/model_planning_sequence_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$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.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" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -78,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00341" summary="ww">
|
||||
<created>1719519702779</created>
|
||||
<option name="number" value="00341" />
|
||||
<option name="presentableId" value="LOCAL-00341" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719519702780</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00342" summary="ww">
|
||||
<created>1719675793617</created>
|
||||
<option name="number" value="00342" />
|
||||
|
@ -421,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1725389636275</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="390" />
|
||||
<task id="LOCAL-00390" summary="04/09/2024 - 23h">
|
||||
<created>1725482228553</created>
|
||||
<option name="number" value="00390" />
|
||||
<option name="presentableId" value="LOCAL-00390" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1725482228555</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="391" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -463,7 +464,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/08/2024 - 20h30" />
|
||||
<MESSAGE value="08/08/2024 - 20h32" />
|
||||
<MESSAGE value="08/08/2024 - 20h32s" />
|
||||
<MESSAGE value="10/08/2024 - 20h32s" />
|
||||
|
@ -488,6 +488,7 @@
|
|||
<MESSAGE value="01/09/2024 - 14:00" />
|
||||
<MESSAGE value="01/09/2024 - 20:00" />
|
||||
<MESSAGE value="03/09/2024 - 20:00" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/09/2024 - 20:00" />
|
||||
<MESSAGE value="04/09/2024 - 23h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="04/09/2024 - 23h" />
|
||||
</component>
|
||||
</project>
|
548
Activite.py
548
Activite.py
|
@ -437,6 +437,144 @@ def Update_activite(diction):
|
|||
return False, " Impossible de mettre à jour l'activité "
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour du status de l'activité
|
||||
"""
|
||||
def Update_activite_status(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "status",'_id' ]
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id', 'status' ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(token)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire. "
|
||||
|
||||
"""
|
||||
Verification s'il n'existe pas un cient du partenaire qui perte le meme
|
||||
nom, ou la meme adresse email
|
||||
"""
|
||||
|
||||
qry_update = {'valide': '1', 'locked':'0', 'partner_recid': str(my_partner['recid']),
|
||||
'_id':ObjectId(str(diction['_id'])),}
|
||||
|
||||
|
||||
|
||||
print(" ### qry_update = ", qry_update)
|
||||
|
||||
tmp_count = MYSY_GV.dbname['activite'].count_documents(qry_update)
|
||||
if (tmp_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité est invalide ")
|
||||
|
||||
return False, " L'identifiant de l'activité est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
|
||||
data_update = {}
|
||||
"""
|
||||
Recuperation des données fournies en entrée
|
||||
"""
|
||||
|
||||
|
||||
|
||||
status = ""
|
||||
if ("status" in diction.keys()):
|
||||
status = diction['status']
|
||||
data_update['status'] = diction['status']
|
||||
if (status not in MYSY_GV.ACTIVITE_STATUS):
|
||||
mycommon.myprint(
|
||||
"- Le statut " + str(status) + " n'est pas autorisé ")
|
||||
return False, "- Le statut " + str(status) + " n'est pas autorisé "
|
||||
|
||||
|
||||
|
||||
|
||||
data_update['valide'] = '1'
|
||||
data_update['locked'] = '0'
|
||||
data_update['date_update'] = str(datetime.now())
|
||||
data_update['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {'valide': '1', 'locked':'0', 'partner_recid': str(my_partner['recid']),
|
||||
'_id':ObjectId(str(diction['_id'])),}
|
||||
|
||||
|
||||
inserted_id = ""
|
||||
result = MYSY_GV.dbname['activite'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": data_update},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour l'activité : related_collection_recid = " + str(diction['related_collection_recid']))
|
||||
return False, " Impossible de mettre à jour l'activité "
|
||||
|
||||
return True, " L'activité a été correctement mise à 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 l'activité "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de la liste des activité d'une entité en se basant sur
|
||||
- related_collection
|
||||
|
@ -463,12 +601,222 @@ def Get_List_Entity_Activite(diction):
|
|||
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",
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'related_collection']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. ", False
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['related_collection'] = str(diction['related_collection'])
|
||||
|
||||
if ("related_collection_owner_email" in diction.keys()):
|
||||
related_collection_owner_email = str(diction['related_collection_owner_email'])
|
||||
"""
|
||||
Recuperation du recid associé au related_collection_owner_email dans la collection : related_collection
|
||||
"""
|
||||
|
||||
local_tmp_val = MYSY_GV.dbname[str(diction['related_collection'])].find_one(
|
||||
{'email': related_collection_owner_email})
|
||||
|
||||
if (local_tmp_val is None or "recid" not in local_tmp_val.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - impossible de récupérer les données de " + str(
|
||||
related_collection_owner_email) + " dans la collection " + str(diction['related_collection']))
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de " + str(
|
||||
related_collection_owner_email) + " dans la collection " + str(
|
||||
diction['related_collection']) + " . ", False
|
||||
|
||||
data_cle['related_collection_recid'] = str(local_tmp_val['recid'])
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
nb_activite_en_retard = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
retard = 0
|
||||
# On analyse le retard que sur les activité en cours , pas celles annulées ou faite
|
||||
if( "deadline" in retval.keys() and retval['status'] == "0"):
|
||||
local_status = mycommon.CheckisDate(retval['deadline'])
|
||||
if( local_status is not False ):
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
retard = (datetime.strptime(str(retval['deadline']), '%d/%m/%Y') - datetime.strptime(str(mytoday), '%d/%m/%Y')).days
|
||||
|
||||
if (retard < 0):
|
||||
nb_activite_en_retard = nb_activite_en_retard + 1
|
||||
|
||||
user['retard'] = str(retard)
|
||||
|
||||
if("employee_assigned_view_statut" not in user.keys() ):
|
||||
user['employee_assigned_view_statut'] = ""
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject, str(nb_activite_en_retard)
|
||||
|
||||
|
||||
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 activités ", False
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des Activité qui sont assigné à : employee_assigned_to_id
|
||||
"""
|
||||
def Get_List_Activite_Assign_To(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'employee_assigned_to_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'employee_assigned_to_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. ", False
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(diction['employee_assigned_to_id'])
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
nb_activite_en_retard = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
retard = 0
|
||||
# On analyse le retard que sur les activité en cours , pas celles annulées ou faite
|
||||
if( "deadline" in retval.keys() and retval['status'] == "0"):
|
||||
local_status = mycommon.CheckisDate(retval['deadline'])
|
||||
if( local_status is not False ):
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
retard = (datetime.strptime(str(retval['deadline']), '%d/%m/%Y') - datetime.strptime(str(mytoday), '%d/%m/%Y')).days
|
||||
|
||||
if (retard < 0):
|
||||
nb_activite_en_retard = nb_activite_en_retard + 1
|
||||
|
||||
user['retard'] = str(retard)
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject, str(nb_activite_en_retard)
|
||||
|
||||
|
||||
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 activités ", False
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de recuperer le nombre de tache en retard pour une personne données
|
||||
(les taches qui sont assignées)
|
||||
"""
|
||||
def Get_Nb_Entity_Activite_Assign_To_Me_En_Retard(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'employee_assigned_to_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'employee_assigned_to_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
|
@ -501,55 +849,117 @@ def Get_List_Entity_Activite(diction):
|
|||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['related_collection'] = str(diction['related_collection'])
|
||||
|
||||
if ("related_collection_owner_email" in diction.keys()):
|
||||
related_collection_owner_email = str(diction['related_collection_owner_email'])
|
||||
"""
|
||||
Recuperation du recid associé au related_collection_owner_email dans la collection : related_collection
|
||||
"""
|
||||
|
||||
local_tmp_val = MYSY_GV.dbname[str(diction['related_collection'])].find_one(
|
||||
{'email': related_collection_owner_email})
|
||||
|
||||
if (local_tmp_val is None or "recid" not in local_tmp_val.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - impossible de récupérer les données de " + str(
|
||||
related_collection_owner_email) + " dans la collection " + str(diction['related_collection']))
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de " + str(
|
||||
related_collection_owner_email) + " dans la collection " + str(
|
||||
diction['related_collection']) + " . "
|
||||
|
||||
data_cle['related_collection_recid'] = str(local_tmp_val['recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(diction['employee_assigned_to_id'])
|
||||
data_cle['status'] = "0"
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
val_tmp = 0
|
||||
|
||||
nb_activite_en_retard = 0
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
retard = "0"
|
||||
if( "deadline" in retval.keys() ):
|
||||
retard = 0
|
||||
if( "deadline" in retval.keys() and retval['status'] == "0" ):
|
||||
local_status = mycommon.CheckisDate(retval['deadline'])
|
||||
if( local_status is not False ):
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
retard = (datetime.strptime(str(retval['deadline']), '%d/%m/%Y') - datetime.strptime(str(mytoday), '%d/%m/%Y')).days
|
||||
|
||||
|
||||
if( retard < 0 ):
|
||||
nb_activite_en_retard = nb_activite_en_retard + 1
|
||||
|
||||
user['retard'] = str(retard)
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
print(" ### il y a "+str(nb_activite_en_retard)+" taches en retard ")
|
||||
|
||||
return True, str(nb_activite_en_retard)
|
||||
|
||||
|
||||
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 activités "
|
||||
return False, " Impossible de récupérer la liste des activités en retard"
|
||||
|
||||
|
||||
"""
|
||||
On traite les retard sur les taches qui me sont assignées
|
||||
"""
|
||||
def Get_Nb_Entity_Activite_Assigne_To_Me_En_Retard_No_token(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'employee_assigned_to_id',]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_owner_recid', 'employee_assigned_to_id',]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(diction['partner_owner_recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(diction['employee_assigned_to_id'])
|
||||
data_cle['status'] = "0"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
nb_activite_en_retard = 0
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
retard = 0
|
||||
if( "deadline" in retval.keys() and retval['status'] == "0"):
|
||||
local_status = mycommon.CheckisDate(retval['deadline'])
|
||||
if( local_status is not False ):
|
||||
mytoday = datetime.today().strftime("%d/%m/%Y")
|
||||
retard = (datetime.strptime(str(retval['deadline']), '%d/%m/%Y') - datetime.strptime(str(mytoday), '%d/%m/%Y')).days
|
||||
|
||||
if( retard < 0 ):
|
||||
nb_activite_en_retard = nb_activite_en_retard + 1
|
||||
|
||||
user['retard'] = str(retard)
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### il y a "+str(nb_activite_en_retard)+" taches en retard ")
|
||||
|
||||
return True, str(nb_activite_en_retard)
|
||||
|
||||
|
||||
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 activités en retard"
|
||||
|
||||
|
||||
"""
|
||||
|
@ -613,7 +1023,7 @@ def Get_Given_Activite(diction):
|
|||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
val_tmp = 0
|
||||
|
||||
#print(" ### data_cle = ", data_cle)
|
||||
for retval in MYSY_GV.dbname['activite'].find(data_cle):
|
||||
|
@ -642,6 +1052,21 @@ def Get_Given_Activite(diction):
|
|||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
|
||||
"""
|
||||
05/08/2024 -
|
||||
Pour gerer les badget : nouvelle tache qui me sont assigné ...
|
||||
en gros, quand un utilisateur se connectect on lui affiche le nombre
|
||||
de nouvelles activité.
|
||||
Une fois qu'il a ouvert l'activité, elle n'est plus 'nouvelle'
|
||||
"""
|
||||
if( val_tmp > 0 ):
|
||||
MYSY_GV.dbname['activite'].find_one_and_update(data_cle,
|
||||
{"$set": {"employee_assigned_view_statut":"1"}},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
@ -650,3 +1075,72 @@ def Get_Given_Activite(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer l'activité "
|
||||
|
||||
|
||||
"""
|
||||
Supprimer une activité
|
||||
"""
|
||||
def Delete_Given_Activite(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
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']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
del_activite = MYSY_GV.dbname['activite'].delete_one(data_cle)
|
||||
|
||||
return True, " L'activité a été correctement supprimée "
|
||||
|
||||
|
||||
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 l'activité "
|
||||
|
||||
|
|
|
@ -496,9 +496,10 @@ Variable qui defini les status qui sont acceptés pour une activité
|
|||
encours : 0
|
||||
fait : 1
|
||||
annulé : -1
|
||||
archivé : 2
|
||||
"""
|
||||
|
||||
ACTIVITE_STATUS = ['0', '-1', '1']
|
||||
ACTIVITE_STATUS = ['0', '-1', '1', '2']
|
||||
|
||||
"""
|
||||
Les types d'image authorisé a etre stockés en base de données
|
||||
|
|
8129
Log/log_file.log
8129
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -2104,7 +2104,7 @@ def LMS_Get_Partner_Data(diction):
|
|||
lms_part_recid = ""
|
||||
lms_virtualhost_url = ""
|
||||
lms_url = ""
|
||||
if( lms_account == "1"):
|
||||
if( lms_account == "1" and 'mysy_lms_user_id' in connected_user_data.keys() ):
|
||||
lms_user_id = connected_user_data['mysy_lms_user_id']
|
||||
lms_user_name = my_partner['email']
|
||||
#lms_pwd_mask = my_partner['pwd']
|
||||
|
|
61
main.py
61
main.py
|
@ -4529,6 +4529,22 @@ def Update_activite():
|
|||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui met à jour une activité (juste statut)
|
||||
"""
|
||||
@app.route('/myclass/api/Update_activite_status/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_activite_status():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_activite_status : payload = ",payload)
|
||||
localStatus, message = Activite.Update_activite_status(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere la liste des activités d'une entité
|
||||
"""
|
||||
|
@ -4538,10 +4554,39 @@ def Get_List_Entity_Activite():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Entity_Activite : payload = ",payload)
|
||||
localStatus, message = Activite.Get_List_Entity_Activite(payload)
|
||||
localStatus, message, nb_activite_en_retard = Activite.Get_List_Entity_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message, nb_activite_en_retard = nb_activite_en_retard)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de Recuperation des Activité qui sont assigné à : employee_assigned_to_id
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Activite_Assign_To/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Activite_Assign_To():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Activite_Assign_To : payload = ",payload)
|
||||
localStatus, message, nb_activite_en_retard = Activite.Get_List_Activite_Assign_To(payload)
|
||||
return jsonify(status=localStatus, message=message, nb_activite_en_retard = nb_activite_en_retard)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere le nombre d'activité en retard
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Nb_Entity_Activite_Assign_To_Me_En_Retard/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Nb_Entity_Activite_Assign_To_Me_En_Retard():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Nb_Entity_Activite_En_Retard : payload = ",payload)
|
||||
localStatus, message = Activite.Get_Nb_Entity_Activite_Assign_To_Me_En_Retard(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui recupere activité donnée
|
||||
"""
|
||||
|
@ -4555,6 +4600,20 @@ def Get_Given_Activite():
|
|||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui supprime une activité donnée
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Given_Activite/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Given_Activite():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Given_Activite : payload = ",payload)
|
||||
localStatus, message = Activite.Delete_Given_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet de publier/mettre à jour une formation
|
||||
du LMS Search vers MySy LMS
|
||||
|
|
20
partners.py
20
partners.py
|
@ -18,6 +18,8 @@ import json
|
|||
from bson import ObjectId
|
||||
import re
|
||||
import numpy as np
|
||||
|
||||
import Activite
|
||||
import ela_index_bdd_classes as ela_index
|
||||
import email_mgt as mail
|
||||
from datetime import datetime
|
||||
|
@ -1162,6 +1164,20 @@ def get_partner_account(diction):
|
|||
user['mysy_lms_user_id'] = mysy_lms_user_id
|
||||
|
||||
|
||||
"""
|
||||
05/09/2024 : Recuperer le nombre d'activité en retard pour la personne connectée
|
||||
"""
|
||||
local_diction = {}
|
||||
local_diction['partner_owner_recid'] = str(partnere_recid)
|
||||
local_diction['employee_assigned_to_id'] = str(retVal['ressource_humaine_id'])
|
||||
|
||||
local_activite_status, local_activite_retval = Activite.Get_Nb_Entity_Activite_Assigne_To_Me_En_Retard_No_token(local_diction)
|
||||
if( local_activite_status is True):
|
||||
user['nb_activite_retard'] = local_activite_retval
|
||||
else:
|
||||
user['nb_activite_retard'] = "0"
|
||||
|
||||
|
||||
"""
|
||||
update du 01/05/2024
|
||||
Pour distinguer si le partenaire est a lié à une formation initiale ou continue
|
||||
|
@ -1170,8 +1186,6 @@ def get_partner_account(diction):
|
|||
Volontairement, on ne descend pas ce paramettre sur les utilisateurs associée au partenaire
|
||||
"""
|
||||
|
||||
|
||||
|
||||
admin_partnair_account = MYSY_GV.dbname['partnair_account'].find_one({'recid':retVal['recid'],
|
||||
'active':'1',
|
||||
'locked':'0',
|
||||
|
@ -1216,8 +1230,10 @@ def get_partner_account(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) +
|
||||
" WARNING : Impossible de mettre à jour du firstconnexion et/ou lastconnexion du partner recid = "+str(partnere_recid)+". ")
|
||||
|
||||
|
||||
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))
|
||||
|
|
|
@ -1783,9 +1783,12 @@ def Get_List_Ressource_Humaine_no_filter(diction):
|
|||
user['user_login'] = ""
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
"""06/09 /2024 - peut etre ne pas exclure les comptes admin
|
||||
is_admin_account_count = MYSY_GV.dbname['partnair_account'].count_documents({'ressource_humaine_id':str(retval['_id']), 'is_partner_admin_account':'1'}) # exclure les comptes admin
|
||||
if( is_admin_account_count <= 0 ):
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
"""
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
|
Loading…
Reference in New Issue