pagination des factures
darcs-hash:20070503213624-f46e9-e18b5311aebc0783e2eb535051a1ec3fba53c0f0.gz
This commit is contained in:
parent
48ccd00b8b
commit
5c5b8c138b
2 changed files with 35 additions and 2 deletions
|
@ -61,7 +61,7 @@ class main(ModuleBase):
|
|||
}
|
||||
index.exposed = True
|
||||
|
||||
def historique(self):
|
||||
def historique(self, page = 1, items_per_page = 20):
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
|
||||
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') ]
|
||||
|
@ -76,10 +76,30 @@ class main(ModuleBase):
|
|||
except Exception:
|
||||
aLine["intitule"] = ""
|
||||
histLst.append(aLine)
|
||||
|
||||
histLst.reverse()
|
||||
page = int(page)
|
||||
items_per_page = int(items_per_page)
|
||||
if page == 1:
|
||||
prevPage = None
|
||||
else:
|
||||
prevPage = page - 1
|
||||
|
||||
if page * items_per_page >= histLst.__len__():
|
||||
nextPage = None
|
||||
else:
|
||||
nextPage = page + 1
|
||||
offset = items_per_page * ( page - 1)
|
||||
|
||||
|
||||
return {
|
||||
'template' :'factures-historique',
|
||||
'values' :{'liste':lst, 'historic_items':histLst},
|
||||
'values' :{
|
||||
'liste':lst,
|
||||
'historic_items':histLst[offset:offset + items_per_page],
|
||||
'nextPage':nextPage,
|
||||
'prevPage':prevPage
|
||||
},
|
||||
'stylesheets' :['cransFactures.css'],
|
||||
'scripts' :[],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue