annulation d'une facture non paye

darcs-hash:20061025182958-f46e9-c88fbf735adede3d119ff412ccd27aafe7131dae.gz
This commit is contained in:
gdetrez 2006-10-25 20:29:58 +02:00
parent 1fea392dae
commit ffc73b0296
4 changed files with 53 additions and 25 deletions

View file

@ -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/"

View file

@ -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

View file

@ -70,6 +70,16 @@ td, tr {
}
.actions {
display:block;
float:right;
font-size:0.9em;
font-weight:normal;
}
.actions a {
margin:2px 10px;
}
/********************************************
* <!-- factures - details -->
********************************************/
@ -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;
}
}

View file

@ -47,16 +47,21 @@ function hideDetail(id){
#if not $f.payee
(non pay&eacute;e)
#end if
<span class="note">Cr&eacute;e le -</span>
</span>
<span class="montant">
$f.montant&nbsp;&euro;
#if not $f.payee
<a class="note" href="$f.paypal">Payer avec PayPal</a>
#else
<span class="note">Pay&eacute;e</span>
#end if
</span>
<span class="note" style="float:left;clear: left;">Cr&eacute;e le -</span>
#if not $f.payee
<span class="actions">
<a href="delFacture?no=$f.no">Annuler</a>
<a href="$f.paypal">Payer avec PayPal</a>
</span>
#else
<span class="note" style="float:right;clear:right;">Pay&eacute;e</span>
#end if
</div>
#if $f.details.__len__() > 1
<div id="facture$f.no" style="display:none;">