diff --git a/printing/templates.py b/printing/templates.py index 7524b4d..6d37b99 100644 --- a/printing/templates.py +++ b/printing/templates.py @@ -27,6 +27,16 @@ def blacklist(l): def split(str, *arg): return str.split(*arg) +def telephone(l): + tel=[] + for t in l: + if len(str(t)) == 10: + tel.append("%c%c.%c%c.%c%c.%c%c.%c%c" % tuple(map(ord, str(t)))) + else: + if t.startswith("00"): + t="+%s" % t[2:] + tel.append(t) + return tel templateEnv=None def template(): @@ -42,6 +52,7 @@ def template(): templateEnv.filters['prise_etat'] = prise_etat templateEnv.filters['timeformat'] = timeformat templateEnv.filters['split'] = split + templateEnv.filters['telephone'] = telephone return templateEnv def machine(machine, params): diff --git a/printing/templates/adherent b/printing/templates/adherent index 599445a..6a8ebe5 100644 --- a/printing/templates/adherent +++ b/printing/templates/adherent @@ -3,7 +3,7 @@ {{["aid=",o.aid.0]|join|coul('bleu')}} {{"Nom : "|coul('gras')}}{{o.prenom|join(' ')}} {{o.nom|join(' ')}} {% endblock%} {% block proprio %} -{{"Numéro de téléphone : "|coul('gras')}}{{o.tel|join(', ')}} +{{"Numéro de téléphone : "|coul('gras')}}{{o.tel|telephone|join(', ')}} {{"Chambre : "|coul('gras')}}{{o.chbre.0}} ({{o.chbre.0|string|prise_etat}}) {{"Études : "|coul('gras')}}{{o.etudes|join(' ')}} {{"Cotisation payée pour les années : "|coul('gras')}}{{o.paiement|join(' ')}} {% if o.get('controle', []) and 'p' in o.controle.0.value %}{{"(OK)"|coul('vert')}}{% endif %}