zzz
parent
c09aa9fc40
commit
68172adc11
|
@ -5,6 +5,9 @@
|
|||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
4777
Log/log_file.log
4777
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -595,6 +595,109 @@ def GetActiveSessionFormation_List(diction):
|
|||
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."
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recupere UNIQUEMENT LES VILLES ET SI A DISTANCEsessions de formation actives et valides
|
||||
d'une formation données ET les sessions "on demande"
|
||||
|
||||
on doit renvoyer les villes de manière unique et eviter les doublon de villes
|
||||
|
||||
"""
|
||||
def GetActiveSession_Cities_And_Distance_Formation_List(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'class_internal_url']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
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 = [ 'class_internal_url', ]
|
||||
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, "Impossible de récupérer la liste des session de formation"
|
||||
|
||||
# Le controle de token n'est effectué que une valeur est fournie dans le token
|
||||
if( 'token' in diction.keys() and len(str(diction['token'])) > 0) :
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
|
||||
liste_session_cities = []
|
||||
|
||||
class_internal_url = ""
|
||||
if ("class_internal_url" in diction.keys()):
|
||||
if diction['class_internal_url']:
|
||||
class_internal_url = diction['class_internal_url']
|
||||
|
||||
coll_session = MYSY_GV.dbname['session_formation']
|
||||
myquery = {}
|
||||
myquery['class_internal_url'] = class_internal_url
|
||||
|
||||
|
||||
myquery['valide'] = "1"
|
||||
myquery['session_status'] = "1"
|
||||
|
||||
|
||||
RetObject = []
|
||||
|
||||
print(" ### GetActiveSessionFormation_List myquery = ", myquery)
|
||||
for retval in coll_session.find(myquery):
|
||||
|
||||
local_tmp = retval
|
||||
## Verification des conditions supplementaires :
|
||||
# en realité c'est parce que c'est chaud de le faire avec pymongo
|
||||
tmp_debut_inscritp = str(local_tmp['date_debut_inscription']).strip().split(" ")
|
||||
tmp_fin_inscritp = str(local_tmp['date_fin_inscription']).strip().split(" ")
|
||||
|
||||
debut_inscr = datetime.strptime(str(tmp_debut_inscritp[0]).strip(), '%d/%m/%Y')
|
||||
fin_inscr = datetime.strptime(str(tmp_fin_inscritp[0]).strip(), '%d/%m/%Y')
|
||||
|
||||
#print(" #### date_debut_inscription = ", debut_inscr, " date_fin_inscription = ", fin_inscr, " NOW = ",datetime.now())
|
||||
if(debut_inscr <= datetime.now() and fin_inscr >= datetime.now()):
|
||||
|
||||
if( "ville" in retval.keys() and retval['ville']):
|
||||
if( str(retval['ville']) not in liste_session_cities):
|
||||
liste_session_cities.append(str(retval['ville']))
|
||||
RetObject.append(mycommon.JSONEncoder().encode(str(retval['ville'])))
|
||||
|
||||
elif( "distantiel" in retval.keys() and str(retval['distantiel']) == "1"):
|
||||
if ( "A Distance" not in liste_session_cities):
|
||||
liste_session_cities.append("A Distance")
|
||||
RetObject.append(mycommon.JSONEncoder().encode("A Distance"))
|
||||
|
||||
else:
|
||||
if ("session_ondemande" in local_tmp.keys()):
|
||||
if( str(local_tmp['session_ondemande']).strip() == "1"):
|
||||
if ("A la demande" not in liste_session_cities):
|
||||
liste_session_cities.append("A la demande")
|
||||
RetObject.append(mycommon.JSONEncoder().encode("A la demande"))
|
||||
|
||||
|
||||
print("#### GetActiveSessionFormation_List RetObject = "+str(RetObject))
|
||||
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 villes des sessions de formation valides et actives."
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction récupérer la liste des toutes les sessions
|
||||
de formation valides pour une formation données.
|
||||
|
@ -2668,6 +2771,13 @@ def Controle_Add_Update_SessionFormation_mass_for_many_class(saved_file=None, Fo
|
|||
{'external_code': str(external_code), 'valide': '1',
|
||||
'locked': '0', 'partner_owner_recid': str(partner_recid)})
|
||||
|
||||
else:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Erreur : Ligne " + str(
|
||||
n + 2) + " : Le code_externe de la formation n'est pas invalide.")
|
||||
return False, " Erreur : Ligne " + str(
|
||||
n + 2) + " : Le code_externe de la formation n'est pas invalide."
|
||||
|
||||
|
||||
mydata['date_debut'] = str(df['date_debut'].values[n]).strip().split(" ")[0]
|
||||
local_status = mycommon.CheckisDate(mydata['date_debut'])
|
||||
|
@ -3118,7 +3228,7 @@ def Delete_List_SessionFormation(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + str(deleted_data.deleted_count)+" Document supprimé. La session_id " + str(
|
||||
session_id) + " a été correctement supprimée ")
|
||||
|
||||
return True, "Les sessions ont correctement supprimées"
|
||||
return True, "Les sessions ont été correctement supprimées"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
16
main.py
16
main.py
|
@ -1950,6 +1950,22 @@ def GetActiveSessionFormation_List():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation des villes les sessions de formation valides et actives
|
||||
"""
|
||||
@app.route('/myclass/api/GetActiveSession_Cities_And_Distance_Formation_List/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GetActiveSession_Cities_And_Distance_Formation_List():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### GetActiveSession_Cities_And_Distance_Formation_List : payload = ",str(payload))
|
||||
localStatus, message= SF.GetActiveSession_Cities_And_Distance_Formation_List(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de toutes sessions de formation valide, (peu importe qu'elles soient terminées ou pas
|
||||
"""
|
||||
|
|
|
@ -316,7 +316,7 @@ def Get_Given_Partner_Basic_Setup(diction):
|
|||
qry_tva = {'partner_owner_recid':str(my_partner['recid']), 'valide':'1',
|
||||
'locked':'0', 'config_name':str(diction['config_name'])}
|
||||
|
||||
print(" ### qry_tva = ", qry_tva)
|
||||
#print(" ### qry_tva = ", qry_tva)
|
||||
for New_retVal in MYSY_GV.dbname['base_partner_setup'].find({'partner_owner_recid':str(my_partner['recid']), 'valide':'1',
|
||||
'locked':'0', 'config_name':str(diction['config_name'])}):
|
||||
user = New_retVal
|
||||
|
@ -339,7 +339,7 @@ def Get_Given_Partner_Basic_Setup(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(retval_json))
|
||||
|
||||
print(" ### retval_json =", retval_json)
|
||||
#print(" ### retval_json =", retval_json)
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -4134,6 +4134,7 @@ def Compute_Order_Header(diction):
|
|||
Impression PDF d'une commande / devis
|
||||
"""
|
||||
|
||||
|
||||
def GerneratePDF_Partner_Order(diction):
|
||||
try:
|
||||
field_list = ['order_id', 'token', ]
|
||||
|
|
Loading…
Reference in New Issue