added societes.pt and societe_edit.pt
This commit is contained in:
@@ -212,3 +212,15 @@ def get_stats_delais(request, societe, datedeb, datefin, groupe, id_chart):
|
|||||||
'datefin': datefin.strftime("%Y%m"), 'groupe': groupe})
|
'datefin': datefin.strftime("%Y%m"), 'groupe': groupe})
|
||||||
return results.fetchall()
|
return results.fetchall()
|
||||||
|
|
||||||
|
def update_societe(request, code, new_values):
|
||||||
|
# formater les champs
|
||||||
|
s = ''
|
||||||
|
for param in new_values.keys():
|
||||||
|
if s:
|
||||||
|
s += ",%s=:%s" % (param, param)
|
||||||
|
else:
|
||||||
|
s = "%s=:%s" % (param, param)
|
||||||
|
|
||||||
|
new_values['societe'] = code
|
||||||
|
query = "UPDATE p_societe SET %s WHERE societe = :societe;" % s
|
||||||
|
execute_query(request, query, new_values)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def get_societes(request, societe):
|
|||||||
|
|
||||||
if societe == '0':
|
if societe == '0':
|
||||||
query = "SELECT * FROM p_societe;"
|
query = "SELECT * FROM p_societe;"
|
||||||
results = request.dbsession.execute(query, {'societe': societe, 'no_id': no_id}).fetchall()
|
results = request.dbsession.execute(query,).fetchall()
|
||||||
else:
|
else:
|
||||||
query = "SELECT * FROM p_societe WHERE societe = :societe;"
|
query = "SELECT * FROM p_societe WHERE societe = :societe;"
|
||||||
results = request.dbsession.execute(query, {'societe': societe}).first()
|
results = request.dbsession.execute(query, {'societe': societe}).first()
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ def includeme(config):
|
|||||||
config.add_route('rappels_rdv', '/rappels_rdv')
|
config.add_route('rappels_rdv', '/rappels_rdv')
|
||||||
config.add_route('rdf_cause_edit', '/rdf_cause_edit/{code}')
|
config.add_route('rdf_cause_edit', '/rdf_cause_edit/{code}')
|
||||||
config.add_route('rdf_causes', '/rdf_causes')
|
config.add_route('rdf_causes', '/rdf_causes')
|
||||||
|
config.add_route('societe_edit', '/societe_edit/{societe}')
|
||||||
|
config.add_route('societes', '/societes')
|
||||||
config.add_route('text_edit', '/text_edit/{text_id}')
|
config.add_route('text_edit', '/text_edit/{text_id}')
|
||||||
config.add_route('text_list', '/text_list')
|
config.add_route('text_list', '/text_list')
|
||||||
config.add_route('text_view', '/text_view/{text_id}')
|
config.add_route('text_view', '/text_view/{text_id}')
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<h4>ARTICLES</h4>
|
<h4>ARTICLES</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<a href="${request.application_url}/rdf_causes"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
<a href="${request.application_url}/cabinets"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
||||||
<h4>RDF : CAUSES</h4>
|
<h4>CABINETS EXP.</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<a href="${request.application_url}/text_list"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
<a href="${request.application_url}/text_list"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
||||||
@@ -23,8 +23,12 @@
|
|||||||
<br />
|
<br />
|
||||||
<div class="row text-center">
|
<div class="row text-center">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<a href="${request.application_url}/cabinets"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
<a href="${request.application_url}/societes"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
||||||
<h4>CABINETS EXP.</h4>
|
<h4>SOCIETES</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<a href="${request.application_url}/rdf_causes"><span class="glyphicon glyphicon-list logo-primary"></span></a>
|
||||||
|
<h4>RDF : CAUSES</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
221
mondumas/templates/parametres/societe_edit.pt
Normal file
221
mondumas/templates/parametres/societe_edit.pt
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
<metal:block use-macro="main_template">
|
||||||
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
|
<br />
|
||||||
|
<form id="cabinet_edit-form" class="form-horizontal" action="${url}" method="post"
|
||||||
|
data-fv-framework="bootstrap"
|
||||||
|
data-fv-icon-valid="glyphicon glyphicon-ok"
|
||||||
|
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
||||||
|
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-3" for="societe">Societe</label>
|
||||||
|
<div class="col-xs-9">
|
||||||
|
<p class="form-control-static">${code}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-3" for="NOM">Nom</label>
|
||||||
|
<div class="col-xs-9">
|
||||||
|
<input class="form-control" type="text" id="NOM" name="NOM" value="${societe.NOM}"
|
||||||
|
placeholder="50 caractères maximum"
|
||||||
|
data-fv-notempty="true"
|
||||||
|
data-fv-notempty-message="Le nom est obligatoire"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="50"
|
||||||
|
data-fv-stringlength-message="50 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="ADRESSE">Adresse</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" id="ADRESSE" name="ADRESSE" value="${societe.ADRESSE}"
|
||||||
|
placeholder="50 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="50"
|
||||||
|
data-fv-stringlength-message="50 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="code_postal">Code postal - Ville</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" id="code_postal" name="code_postal" value="${code_postal}"
|
||||||
|
placeholder="5 caractères maximum"
|
||||||
|
data-fv-notempty="true"
|
||||||
|
data-fv-notempty-message="Le code postal est obligatoire" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="TEL1">Télphone</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="TEL" value="${societe.TEL}"
|
||||||
|
placeholder="14 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="14"
|
||||||
|
data-fv-stringlength-message="14 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="email_from">Email</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="email_from" value="${societe.email_from}"
|
||||||
|
placeholder="45 caractères maximum"
|
||||||
|
data-fv-emailaddress="true"
|
||||||
|
data-fv-emailaddress-message="L'adresse email n'est pas valide" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="Corresp1">Horiares</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="Corresp1" value="${societe.Corresp1}"
|
||||||
|
placeholder="65 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="65"
|
||||||
|
data-fv-stringlength-message="65 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-xs-offset-3 col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="Corresp2" value="${societe.Corresp2}"
|
||||||
|
placeholder="65 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="65"
|
||||||
|
data-fv-stringlength-message="65 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-xs-offset-3 col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="Corresp3" value="${societe.Corresp3}"
|
||||||
|
placeholder="65 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="65"
|
||||||
|
data-fv-stringlength-message="65 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-xs-offset-3 col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="Corresp4" value="${societe.Corresp4}"
|
||||||
|
placeholder="65 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="65"
|
||||||
|
data-fv-stringlength-message="65 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="bic">BIC</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="bic" value="${societe.bic}"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="11"
|
||||||
|
data-fv-stringlength-message="11 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="iban">IBAN</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input class="form-control" type="text" name="iban" value="${societe.iban}"
|
||||||
|
placeholder="45 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="45"
|
||||||
|
data-fv-stringlength-message="45 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="V_Code">Journal de vente</label>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="V_Code" value="${societe.V_Code}"
|
||||||
|
placeholder="2 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="2"
|
||||||
|
data-fv-stringlength-message="2 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="V_Lib" value="${societe.V_Lib}"
|
||||||
|
placeholder="20 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="20"
|
||||||
|
data-fv-stringlength-message="20 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="V_Compte" value="${societe.V_Compte}"
|
||||||
|
placeholder="10 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="10"
|
||||||
|
data-fv-stringlength-message="10 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-3 control-label" for="B_Code">Journal de banque</label>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="B_Code" value="${societe.B_Code}"
|
||||||
|
placeholder="2 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="2"
|
||||||
|
data-fv-stringlength-message="2 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="B_Lib" value="${societe.B_Lib}"
|
||||||
|
placeholder="20 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="20"
|
||||||
|
data-fv-stringlength-message="20 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3">
|
||||||
|
<input class="form-control" type="text" name="B_Compte" value="${societe.B_Compte}"
|
||||||
|
placeholder="10 caractères maximum"
|
||||||
|
data-fv-stringlength="true"
|
||||||
|
data-fv-stringlength-max="10"
|
||||||
|
data-fv-stringlength-message="10 caractères maximum" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-3">Dern. modif le</label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<p class="form-control-static">${societe.modif_le.strftime('%d-%m-%Y %H:%M')}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-xs-offset-3 col-xs-9">
|
||||||
|
<a class="btn btn-default" href="/societes">
|
||||||
|
<span class="glyphicon glyphicon-arrow-left"></span> Annuler</a>
|
||||||
|
<button class="btn btn-primary" type="submit" name="form.submitted">
|
||||||
|
<span class="glyphicon glyphicon-ok"></span> Enregistrer</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet">
|
||||||
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#cabinet_edit-form').formValidation();
|
||||||
|
$('form input').on('keypress', function(e) {
|
||||||
|
return e.which !== 13;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#code_postal').autocomplete({
|
||||||
|
source: function (request, response) {
|
||||||
|
$.ajax({
|
||||||
|
url:'/ajax_codepostal',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
recherche: request.term,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
response( data );
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
minLength: 3,
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</metal:block>
|
||||||
55
mondumas/templates/parametres/societes.pt
Normal file
55
mondumas/templates/parametres/societes.pt
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<metal:block use-macro="main_template">
|
||||||
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="${request.application_url}/parametres" class="btn btn-default" role="button">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table id="cabinets" class="table table-striped table-bordered table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Code</th>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Télépone</th>
|
||||||
|
<th>BIC</th>
|
||||||
|
<th>IBAN</th>
|
||||||
|
<th>Modif le</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var dataSet = ${dt_data};
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
|
||||||
|
$('#cabinets').DataTable({
|
||||||
|
data: dataSet,
|
||||||
|
pageLength: 50,
|
||||||
|
bLengthChange: false,
|
||||||
|
language: {
|
||||||
|
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||||
|
},
|
||||||
|
order: [[ 0, "asc" ]],
|
||||||
|
columnDefs: [
|
||||||
|
{ targets: 1,
|
||||||
|
"render": function (data, type, row, meta) {
|
||||||
|
// ajouter un link vers la fiche élève
|
||||||
|
return '<a href="/societe_edit/' + row[0] + '">' + data + '</a>';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div><!-- content -->
|
||||||
|
</metal:block>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ import json
|
|||||||
|
|
||||||
from ..models.parametres import *
|
from ..models.parametres import *
|
||||||
from ..models.default import *
|
from ..models.default import *
|
||||||
|
from ..models.utils import *
|
||||||
from ..views.default import *
|
from ..views.default import *
|
||||||
|
|
||||||
@view_config(route_name='parametres', renderer='../templates/parametres/parametres.pt', permission='manage')
|
@view_config(route_name='parametres', renderer='../templates/parametres/parametres.pt', permission='manage')
|
||||||
@@ -735,3 +736,68 @@ def stats_delais(request):
|
|||||||
'societe': societe,
|
'societe': societe,
|
||||||
'groupes': groupes,
|
'groupes': groupes,
|
||||||
'groupe': groupe,
|
'groupe': groupe,
|
||||||
|
}
|
||||||
|
|
||||||
|
@view_config(route_name='societes', renderer='../templates/parametres/societes.pt', permission='manage')
|
||||||
|
def societes(request):
|
||||||
|
|
||||||
|
# lire les societes
|
||||||
|
items = get_societes(request, '0')
|
||||||
|
|
||||||
|
# construire la liste
|
||||||
|
liste=[]
|
||||||
|
for item in items:
|
||||||
|
modif_le = item.modif_le.strftime('%d/%m/%Y')
|
||||||
|
d = (item.societe, item.NOM, item.email_from, item.TEL, item.bic, item.iban, modif_le)
|
||||||
|
liste.append(d)
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
'page_title': 'Liste des societes',
|
||||||
|
'dt_data': json.dumps(liste),
|
||||||
|
}
|
||||||
|
|
||||||
|
@view_config(route_name='societe_edit', renderer='../templates/parametres/societe_edit.pt', permission='manage')
|
||||||
|
def societe_edit(request):
|
||||||
|
|
||||||
|
logged_in = request.authenticated_userid
|
||||||
|
code = request.matchdict['societe']
|
||||||
|
url = request.route_url("societe_edit", societe=code)
|
||||||
|
|
||||||
|
message = ''
|
||||||
|
|
||||||
|
# lire societe
|
||||||
|
societe = get_societes(request, code)
|
||||||
|
if not societe:
|
||||||
|
request.session.flash(u"Societe non trouvé : %s" % code, 'warning')
|
||||||
|
return HTTPFound(location=request.route_url('societes'))
|
||||||
|
|
||||||
|
code_postal = '%s - %s' % (societe.CP, societe.VILLE)
|
||||||
|
|
||||||
|
if 'form.submitted' in request.params:
|
||||||
|
new_values = {}
|
||||||
|
for param, db_value in societe.items():
|
||||||
|
if param in request.params and request.params[param] != db_value:
|
||||||
|
new_values[param] = request.params[param]
|
||||||
|
|
||||||
|
# controle saisie code postal
|
||||||
|
code_postal = request.params['code_postal']
|
||||||
|
cp = code_postal.split(' - ')
|
||||||
|
if len(cp) < 2:
|
||||||
|
message = 'Code postal invalide. Veuillez sélectionner un parmi la liste.'
|
||||||
|
else:
|
||||||
|
new_values['CP'] = cp[0]
|
||||||
|
new_values['VILLE'] = cp[1]
|
||||||
|
|
||||||
|
if new_values:
|
||||||
|
update_societe(request, code, new_values)
|
||||||
|
request.session.flash(u"La societe a été mise à jour avec succès.", 'success')
|
||||||
|
return HTTPFound(location=request.route_url('societes'))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'page_title': "Modification de %s" % (societe.NOM),
|
||||||
|
'url': url,
|
||||||
|
'societe': societe,
|
||||||
|
'code': code,
|
||||||
|
'code_postal': code_postal,
|
||||||
|
'message': message,
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ def batch_nuit(request):
|
|||||||
if TODAY.day == 1 :
|
if TODAY.day == 1 :
|
||||||
# données de + 10 ans
|
# données de + 10 ans
|
||||||
until_date = date(TODAY.year - 10, TODAY.month, 1)
|
until_date = date(TODAY.year - 10, TODAY.month, 1)
|
||||||
purge_mensuelle(request, until_date)
|
# purge_mensuelle(request, until_date)
|
||||||
purge_clients(request)
|
# purge_clients(request)
|
||||||
delete_orphan_attached_files(request)
|
# delete_orphan_attached_files(request)
|
||||||
|
|
||||||
# ----- MAJ STATS DELAIS de traitements des dossiers sur 1 an
|
# ----- MAJ STATS DELAIS de traitements des dossiers sur 1 an
|
||||||
insert_log(request, 'STATS', '- Début MAJ STATS DES PERFORMANCES')
|
insert_log(request, 'STATS', '- Début MAJ STATS DES PERFORMANCES')
|
||||||
|
|||||||
Reference in New Issue
Block a user