From ffc73b0296f509c105763a79c97d7326b6fbdfba Mon Sep 17 00:00:00 2001 From: gdetrez Date: Wed, 25 Oct 2006 20:29:58 +0200 Subject: [PATCH] annulation d'une facture non paye darcs-hash:20061025182958-f46e9-c88fbf735adede3d119ff412ccd27aafe7131dae.gz --- intranet/conf/dev.cfg | 2 +- intranet/pages/factures.py | 45 +++++++++++++++++---------- intranet/static/css/cransFactures.css | 14 +++++++-- intranet/templates/factures.tmpl | 17 ++++++---- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/intranet/conf/dev.cfg b/intranet/conf/dev.cfg index bb822595..d77ff27a 100644 --- a/intranet/conf/dev.cfg +++ b/intranet/conf/dev.cfg @@ -21,4 +21,4 @@ paypal.businessAdress = "gdetrez-buisness@crans.org" paypal.useSandbox = True [/static] -staticFilter.dir = "/home/gdetrez/scripts/intranet/static/" +staticFilter.dir = "/usr/scripts/intranet/static/" diff --git a/intranet/pages/factures.py b/intranet/pages/factures.py index e62cee6c..fce02ef5 100755 --- a/intranet/pages/factures.py +++ b/intranet/pages/factures.py @@ -40,10 +40,10 @@ class root: } for art in f.articles()] facture['montant'] = f.total() facture['paypal'] = f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False), - businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"), - return_page = "https://intranet.crans.org/monCompte/paypalReturn", - cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel", - ) + businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"), + return_page = "https://intranet.crans.org/monCompte/paypalReturn", + cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel", + ) facture['payee'] = f.recuPaiement() listeFactures.append(facture) @@ -53,7 +53,7 @@ class root: 'template' :'factures', 'values' :t, 'stylesheets' :['cransFactures.css'], - 'scripts' :[], + 'scripts' :[], } index.exposed = True @@ -63,17 +63,16 @@ class root: lst = [ x for x in adh.historique() if x.split(u' : ',1)[1].startswith(u'credit') or x.split(u' : ',1)[1].startswith(u'debit') ] histLst = [] for anItem in lst: - #11/06/2006 01:40, gdetrez : credit 10.0 Euros [Facture n°1 : Impression] - aLine = {} - aLine["date"] = anItem.split(u",")[0] - aLine["type"] = anItem.split(u' : ',2)[1].split(u' ')[0] - aLine["montant"] = anItem.split(u' : ',2)[1].split(u' ')[1] - try: - aLine["intitule"] = anItem.split(u'[')[1].split(u']')[0] - except Exception: - aLine["intitule"] = "" - histLst.append(aLine) - + aLine = {} + aLine["date"] = anItem.split(u",")[0] + aLine["type"] = anItem.split(u' : ',2)[1].split(u' ')[0] + aLine["montant"] = anItem.split(u' : ',2)[1].split(u' ')[1] + try: + aLine["intitule"] = anItem.split(u'[')[1].split(u']')[0] + except Exception: + aLine["intitule"] = "" + histLst.append(aLine) + return { 'template' :'factures-historique', 'values' :{'liste':lst, 'historic_items':histLst}, @@ -81,3 +80,17 @@ class root: 'scripts' :[], } historique.exposed = True + + def delFacture(self, no): + try: + # trrouver la factures + fact = self.__ldap.search('fid=' + no, 'w')['facture'][0] + #verifier qu'elle appartient bien a l'adherent + if not fact.proprietaire().mail() == cherrypy.session['uid']: + raise Exception, "Impossible de supprimer cette facture" + # la supprimer + fact.delete() + except Exception, e: + cherrypy.log(str(e), "FACTURES", 1) + return self.index() + delFacture.exposed = True diff --git a/intranet/static/css/cransFactures.css b/intranet/static/css/cransFactures.css index eb9fbb78..ba5f27f3 100644 --- a/intranet/static/css/cransFactures.css +++ b/intranet/static/css/cransFactures.css @@ -70,6 +70,16 @@ td, tr { } +.actions { + display:block; + float:right; + font-size:0.9em; + font-weight:normal; +} +.actions a { + margin:2px 10px; +} + /******************************************** * ********************************************/ @@ -110,7 +120,7 @@ table.factureDetails td { margin:3px; font-weight:normal; } -span.note { +.note { color:#666 } @@ -142,4 +152,4 @@ table#historique_sous th { background:#fff7D7; padding:5px; text-decoration:underline; -} \ No newline at end of file +} diff --git a/intranet/templates/factures.tmpl b/intranet/templates/factures.tmpl index f19d16a6..43c2e803 100644 --- a/intranet/templates/factures.tmpl +++ b/intranet/templates/factures.tmpl @@ -47,16 +47,21 @@ function hideDetail(id){ #if not $f.payee (non payée) #end if - Crée le - + $f.montant € - #if not $f.payee - Payer avec PayPal - #else - Payée - #end if + Crée le - + #if not $f.payee + + Annuler + Payer avec PayPal + + #else + Payée + #end if + #if $f.details.__len__() > 1