16/12/2022 - 22h00
parent
c010387c6e
commit
6d6c04f66e
|
@ -1,19 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="26/11/22 - 23h30">
|
||||
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="15/12/2022 - 22h00">
|
||||
<change afterPath="$PROJECT_DIR$/Attestation_Certificat.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Emargement/test_emargement.pdf" beforeDir="false" afterPath="$PROJECT_DIR$/Emargement/test_emargement.pdf" 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$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" 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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
|
@ -129,7 +137,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1669502557264</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="10" />
|
||||
<task id="LOCAL-00010" summary="15/12/2022 - 22h00">
|
||||
<created>1671139302487</created>
|
||||
<option name="number" value="00010" />
|
||||
<option name="presentableId" value="LOCAL-00010" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1671139302487</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="11" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -152,14 +167,15 @@
|
|||
<MESSAGE value="23/11/22 - 22h30" />
|
||||
<MESSAGE value="26/11/22 - 10h30" />
|
||||
<MESSAGE value="26/11/22 - 23h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="26/11/22 - 23h30" />
|
||||
<MESSAGE value="15/12/2022 - 22h00" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="15/12/2022 - 22h00" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/main.py</url>
|
||||
<line>251</line>
|
||||
<line>252</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
"""
|
||||
Cette Class permet de gerer la personnalisation des
|
||||
attestations et certificats
|
||||
"""
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
from datetime import timedelta
|
||||
from xhtml2pdf import pisa
|
||||
import jinja2
|
||||
import ftplib
|
||||
import pysftp
|
||||
from flask import send_file
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retour la liste des attestions et certificats pour un partenaire
|
||||
"""
|
||||
def GetPartnerAttestation_Certificat(diction):
|
||||
try:
|
||||
"""
|
||||
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 liste ")
|
||||
return False, "Impossible de recuperer la liste des attestations "
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de recuperer la liste des attestations ")
|
||||
return False, "Impossible de recuperer la liste des attestations "
|
||||
|
||||
RetObject = []
|
||||
for ret_val in MYSY_GV.dbname['attestation_certificat'].find( {"$or":[ {"partner_recid":str(partner_recid), "valide":"1"},
|
||||
{"partner_recid":'default', "valide":"1"}]}):
|
||||
RetObject.append(mycommon.JSONEncoder().encode(ret_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 d'importer les participants en masse "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction prend un nom d'attestation et retourne les informations asociées
|
||||
"""
|
||||
def GetSpecificPartnerAttestation_Certificat(diction):
|
||||
try:
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'nom']
|
||||
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 recuperer la liste des attestations "
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de recuperer la liste des attestations ")
|
||||
return False, "Impossible de recuperer la liste des attestations "
|
||||
|
||||
RetObject = []
|
||||
ret_val = MYSY_GV.dbname['attestation_certificat'].find_one({"nom":str(diction['nom']), "valide":"1" })
|
||||
|
||||
if( ret_val is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Impossible de recuperer les données de ce template ")
|
||||
return False, "Impossible de recuperer les données de ce template"
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(ret_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 recuperer la liste des attestations "
|
|
@ -40,7 +40,7 @@ endobj
|
|||
<<
|
||||
/Contents 11 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 10 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /XObject <<
|
||||
/FormXob.72b491439839fdac2ca0e33d4920d251 3 0 R
|
||||
/FormXob.7b1dcb7c9a100b9093e5e1bb749441ff 3 0 R
|
||||
>>
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
|
@ -55,7 +55,7 @@ endobj
|
|||
endobj
|
||||
9 0 obj
|
||||
<<
|
||||
/Author () /CreationDate (D:20221213173356-01'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20221213173356-01'00') /Producer (xhtml2pdf <https://github.com/xhtml2pdf/xhtml2pdf/>)
|
||||
/Author () /CreationDate (D:20221216204742-01'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20221216204742-01'00') /Producer (xhtml2pdf <https://github.com/xhtml2pdf/xhtml2pdf/>)
|
||||
/Subject () /Title () /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
|
@ -66,10 +66,10 @@ endobj
|
|||
endobj
|
||||
11 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 2127
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 1816
|
||||
>>
|
||||
stream
|
||||
Gb!;h9ofrJ&A@7.ppMa%Gl6B8DS'@\$*gO>aaq?9_Bb(l87j4e`8BIX1Mul!\gdiO0UdO?oj5>;qc,^t2j+LBOn&*f_q=F!G5Y#gWS%+nPD1#7J&D8QcQ6\:iE&33/'kVC`j*B2?>-A>)\7^rh;)ldj/ht0H;uXN\//JgTb[J"]YPlHPrsR=B%Cs5j86W!=R/;8ikiRE&9@a7I^aTPs+)!OK.3YEV:XhLjl0=s0#UBJV(%[3.P'2qHcX#2Td:hrcCcMPb1,2N^A3M_P"RAL#uk$'ShFUL"h13)1)scpkNo3l*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=Gc)HrSRuYa]#c^-H@ggtaX48'@&nB:SN_Q&MW^&CN$e_8TeYp@b.#d+TVbR@p+I]QhCsgdK$ipE5bH\#[5mg"92N]RPKMBjndAH:bp3:dhfLW$%f_Ms>P/;:U+@?BdZ?:X+.6IhD13>2rm_pMHi#IO6lTe+5Mp7a,3=a6aJX3e]Rl>n>*1!c1/TNBtDZ\PMY^C;$M-I61Z0'iZfBZ:%L_<ZNhr:+m$'?Ed3SG=WPn2B,&1M(UUQ$^F/imX^Va*(K)d;N5FR"NTJS<%][+)qUe-V`Kd>VpUZ&>ld'0ZYq)-bHc-_jV8:"s7GoBp":i4I<Rb8f:e-:\JcF?iB<+/gCbEl9Y%#?9hqFNt$8JS<%5[`leUe-V]Kd>T)^R?,ap'0HMo)*?J;+(J4sGV'KOfZ'6Q(nDR^g-(D.hF3+a:0O)fpE-d/6gcsI)78u6S10g7+`!4:%`K\b:kn&1!D;1(ad&M-a\r;+3Y.E)5oGi`"t4X4,$0@O/5HJ73XV&YA"EnNSsPH2^W[$\'#k9*au@%;Iaso&^Z8[MX]qN+lTXs%OX*lAgj&_0A.%Tgq;5Op4t7XR/.E=O`V>eJalGZ`Bc,%~>endstream
|
||||
endobj
|
||||
xref
|
||||
0 12
|
||||
|
@ -88,7 +88,7 @@ xref
|
|||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<9e280ecb619b1263d6a1ec2c297c4a4e><9e280ecb619b1263d6a1ec2c297c4a4e>]
|
||||
[<321ed4f2e1fbf8bd4260a37462acbf78><321ed4f2e1fbf8bd4260a37462acbf78>]
|
||||
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||
|
||||
/Info 9 0 R
|
||||
|
@ -96,5 +96,5 @@ trailer
|
|||
/Size 12
|
||||
>>
|
||||
startxref
|
||||
10515
|
||||
10204
|
||||
%%EOF
|
||||
|
|
|
@ -21,6 +21,11 @@ from datetime import timedelta
|
|||
import email_inscription_mgt as email_session
|
||||
from flask import send_file
|
||||
import re
|
||||
from xhtml2pdf import pisa
|
||||
import jinja2
|
||||
import ftplib
|
||||
import pysftp
|
||||
|
||||
"""
|
||||
Enregistrement d'un stagiaire
|
||||
|
||||
|
@ -318,10 +323,10 @@ def UpdateStagiairetoClass(diction):
|
|||
if( new_status != old_status ):
|
||||
# Il y a eu un changement de status
|
||||
if( new_status == "1"):
|
||||
mydata['inscription_validation_date'] = str(datetime.now())
|
||||
mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
if (new_status == "-1"):
|
||||
mydata['inscription_refuse_date'] = str(datetime.now())
|
||||
mydata['inscription_refuse_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
|
||||
|
||||
ret_val2 = coll_inscription.find_one_and_update(query_key,
|
||||
|
@ -943,3 +948,130 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible d'importer les participants en masse "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'imprimer/telecharger la fichier d'un inscrit à une session.
|
||||
Cette fonction va utiliser un template pour imprimer le modele
|
||||
"""
|
||||
def PrintAttendeeDetail_perSession(diction):
|
||||
try:
|
||||
field_list_obligatoire = ['session_id', 'token', 'attendee_email']
|
||||
|
||||
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 d'imprimer la fiche detaillée"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(str(my_token))
|
||||
if partner_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'imprimer la fiche detaillée")
|
||||
return False, " Les informations d'identification sont invalides"
|
||||
|
||||
RetObject = []
|
||||
# Recuperation des infos de la formation
|
||||
local_Insc_retval = MYSY_GV.dbname['inscription'].find_one({'session_id': str(diction['session_id']),
|
||||
'email': str(diction['attendee_email'])})
|
||||
my_retrun_dict = {}
|
||||
|
||||
my_retrun_dict['session_id'] = local_Insc_retval['session_id']
|
||||
my_retrun_dict['date_du'] = local_Insc_retval['date_du']
|
||||
my_retrun_dict['date_au'] = local_Insc_retval['date_au']
|
||||
my_retrun_dict['ville'] = local_Insc_retval['ville']
|
||||
my_retrun_dict['code_postal'] = local_Insc_retval['code_postal']
|
||||
|
||||
my_retrun_dict['adresse'] = local_Insc_retval['adresse']
|
||||
my_retrun_dict['nom'] = local_Insc_retval['nom']
|
||||
my_retrun_dict['prenom'] = local_Insc_retval['prenom']
|
||||
my_retrun_dict['employeur'] = local_Insc_retval['employeur']
|
||||
my_retrun_dict['telephone'] = local_Insc_retval['telephone']
|
||||
|
||||
my_retrun_dict['email'] = local_Insc_retval['email']
|
||||
my_retrun_dict['modefinancement'] = local_Insc_retval['modefinancement']
|
||||
my_retrun_dict['opco'] = local_Insc_retval['opco']
|
||||
my_retrun_dict['class_internal_url'] = local_Insc_retval['class_internal_url']
|
||||
my_retrun_dict['status'] = local_Insc_retval['status']
|
||||
|
||||
my_retrun_dict['price'] = local_Insc_retval['price']
|
||||
my_retrun_dict['inscription_validation_date'] = local_Insc_retval['inscription_validation_date']
|
||||
|
||||
v = local_Insc_retval['_id'].generation_time
|
||||
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))
|
||||
|
||||
my_retrun_dict['date_impression'] = str(datetime.today().strftime("%d/%m/%Y"))
|
||||
|
||||
# Recuperation des infotrmations de la formation
|
||||
local_formation = MYSY_GV.dbname['myclass'].find_one(
|
||||
{'internal_url': str(local_Insc_retval['class_internal_url'])})
|
||||
my_retrun_dict['class_title'] = local_formation['title']
|
||||
my_retrun_dict['formateur'] = local_formation['trainer']
|
||||
my_retrun_dict['partner'] = local_formation['institut_formation']
|
||||
my_retrun_dict['img_url'] = local_formation['img_url']
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# Recuperation des fiches de presence
|
||||
tab_presences = []
|
||||
for val_tmp in MYSY_GV.dbname['emargement'].find({'session_id':str(local_Insc_retval['session_id']),
|
||||
'email':str(local_Insc_retval['email'])}).sort([("date", pymongo.ASCENDING)]):
|
||||
local_tmp = {}
|
||||
local_tmp['email'] = val_tmp['email']
|
||||
local_tmp['matin'] = val_tmp['matin']
|
||||
local_tmp['apresmidi'] = val_tmp['apresmidi']
|
||||
local_tmp['date'] = val_tmp['date']
|
||||
|
||||
tab_presences.append(local_tmp)
|
||||
|
||||
|
||||
print(" ### tab_presences =",tab_presences)
|
||||
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
TEMPLATE_FILE = "Template/fiche_detail_stagiaire_tpl.html"
|
||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||
# This data can come from database query
|
||||
body = {
|
||||
"data": my_retrun_dict,
|
||||
"presences": tab_presences
|
||||
}
|
||||
|
||||
# print(" ### body = " + str(body))
|
||||
|
||||
sourceHtml = template.render(json_data=body["data"], presences=body["presences"])
|
||||
orig_file_name = "fichier_presence.pdf"
|
||||
outputFilename = str(MYSY_GV.EMARGEMENT_DIRECTORY) + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
resultFile = open(outputFilename, "w+b")
|
||||
|
||||
# convert HTML to PDF
|
||||
pisaStatus = pisa.CreatePDF(
|
||||
src=sourceHtml, # the HTML to convert
|
||||
dest=resultFile) # file handle to receive result
|
||||
|
||||
# close output file
|
||||
resultFile.close()
|
||||
|
||||
# print(" ### outputFilename = "+str(outputFilename))
|
||||
if os.path.exists(outputFilename):
|
||||
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
|
||||
return True, send_file(outputFilename, as_attachment=True)
|
||||
|
||||
# return True on success and False on errors
|
||||
print(pisaStatus.err, type(pisaStatus.err))
|
||||
|
||||
return True, " le fichier generé "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'imprimer la fiche detaillée"
|
||||
|
|
3227
Log/log_file.log
3227
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -40,7 +40,7 @@ def Add_Update_SessionFormation(diction):
|
|||
'''
|
||||
field_list = ['token', 'date_debut', 'date_fin', 'nb_participant', 'formation_session_id', 'adresse',
|
||||
'code_postal', 'ville',
|
||||
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription']
|
||||
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation_certif']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
|
@ -118,6 +118,11 @@ def Add_Update_SessionFormation(diction):
|
|||
if diction['ville']:
|
||||
mydata['ville'] = diction['ville']
|
||||
|
||||
if ("attestation_certif" in diction.keys()):
|
||||
if diction['attestation_certif']:
|
||||
mydata['attestation_certif'] = diction['attestation_certif']
|
||||
|
||||
|
||||
if ("session_status" in diction.keys()):
|
||||
if diction['session_status']:
|
||||
mydata['session_status'] = diction['session_status']
|
||||
|
@ -212,7 +217,7 @@ def GetSessionFormation(diction):
|
|||
myquery['class_internal_url'] = class_internal_url
|
||||
|
||||
|
||||
#print(" ##### myquery = "+str(myquery))
|
||||
print(" ##### myquery = "+str(myquery))
|
||||
RetObject = []
|
||||
|
||||
for retval in coll_session.find(myquery):
|
||||
|
@ -421,7 +426,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
# Verification que les noms des colonne sont bien corrects"
|
||||
'''
|
||||
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville',
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription']
|
||||
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation']
|
||||
|
||||
# Controle du nombre de lignes dans le fichier.
|
||||
total_rows = len(df)
|
||||
|
@ -477,6 +482,9 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
|
|||
mydata['adresse'] = str(df['adresse'].values[n]).strip()
|
||||
mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
|
||||
mydata['ville'] = str(df['ville'].values[n]).strip()
|
||||
mydata['attestation_certif'] = str(df['attestation'].values[n]).strip()
|
||||
|
||||
|
||||
|
||||
local_session = str(df['session_status'].values[n]).strip()
|
||||
|
||||
|
|
53
main.py
53
main.py
|
@ -35,6 +35,7 @@ import Session_Formation as SF
|
|||
import email_mgt as emails
|
||||
import email_inscription_mgt as emails_support
|
||||
import opco as opco
|
||||
import Attestation_Certificat as Att_Cert
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app, resources={r"/foo": {"origins": "*"}})
|
||||
|
@ -2133,6 +2134,58 @@ def GetAttendeeDetail_perSession():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API de recuperation, de liste des attestions et certificats
|
||||
"""
|
||||
@app.route('/myclass/api/GetPartnerAttestation_Certificat/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GetPartnerAttestation_Certificat():
|
||||
# On recupere le corps (payload) de la requet
|
||||
payload = request.form.to_dict()
|
||||
print(" ### GetPartnerAttestation_Certificat : payload = ",str(payload))
|
||||
localStatus, message= Att_Cert.GetPartnerAttestation_Certificat(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
"""
|
||||
API de recuperation des données d'une attestation
|
||||
"""
|
||||
@app.route('/myclass/api/GetSpecificPartnerAttestation_Certificat/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def GetSpecificPartnerAttestation_Certificat():
|
||||
# On recupere le corps (payload) de la requet
|
||||
payload = request.form.to_dict()
|
||||
print(" ### GetSpecificPartnerAttestation_Certificat : payload = ",str(payload))
|
||||
localStatus, message= Att_Cert.GetSpecificPartnerAttestation_Certificat(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
Cette API genere la fiche de presence d'un stagaire
|
||||
"""
|
||||
"""
|
||||
API de generation de liste PDF des liste d'emargement
|
||||
"""
|
||||
@app.route('/myclass/api/PrintAttendeeDetail_perSession/<token>/<session_id>/<attendee_email>', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def PrintAttendeeDetail_perSession(token, session_id, attendee_email):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
payload = {}
|
||||
payload['token'] = str(token)
|
||||
payload['session_id'] = str(session_id)
|
||||
payload['attendee_email'] = str(attendee_email)
|
||||
|
||||
print(" ### PrintAttendeeDetail_perSession : payload = ",str(payload))
|
||||
|
||||
|
||||
localStatus, response= inscription.PrintAttendeeDetail_perSession(payload)
|
||||
if(localStatus ):
|
||||
return response
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
Loading…
Reference in New Issue