diff --git a/jm2l/__init__.py b/jm2l/__init__.py
index 75dd230..a294324 100644
--- a/jm2l/__init__.py
+++ b/jm2l/__init__.py
@@ -109,6 +109,7 @@ def main(global_config, **settings):
# HTML Routes - Staff
config.add_route('Live', '/Live')
+ config.add_route('list_expenses', '/Staff/compta')
config.add_route('list_task', '/Staff')
config.add_route('handle_pole', '/Staff/poles{sep:/*}{pole_id:(\d+)?}')
config.add_route('handle_task', '/Staff/tasks{sep:/*}{task_id:(\d+)?}')
diff --git a/jm2l/templates/Staff/compta.mako b/jm2l/templates/Staff/compta.mako
new file mode 100644
index 0000000..e996274
--- /dev/null
+++ b/jm2l/templates/Staff/compta.mako
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+<%inherit file="jm2l:templates/layout.mako"/>
+<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
+<%namespace name="h" file="jm2l:templates/helpers.mako"/>
+<%def name="jsAddOn()">
+
+
+
+%def>
+<%def name="cssAddOn()">
+
+
+
+
+
+
+
+%def>
+
+
+
+
+
Liste des justificatifs
+
+
+
+
+
+ Liste des Frais
+ |
+
+
+
+ Nom
+ |
+
+ Justificatif
+ |
+
+ RIB
+ |
+
+
+
+ % if len(found)==0:
+
+
+ Aucun justificatif trouvé
+ |
+
+ % endif
+ % for item, one_dic in found.iteritems():
+
+
+
+ ${one_dic["User"]["prenom"]} ${one_dic["User"]["nom"]}
+
+ |
+ % if one_dic.has_key("Justif"):
+
+ ${h.uploader("Justif", one_dic["User"]["uid"], "Justif")}
+ |
+ % else:
+ Rien |
+ % endif
+
+
+ % if one_dic.has_key("RIB"):
+
+ ${h.uploader("RIB", one_dic["User"]["uid"], "RIB")}
+ |
+ % else:
+ Rien |
+ % endif
+
+ % endfor
+
+
+
+
+
diff --git a/jm2l/templates/layout.mako b/jm2l/templates/layout.mako
index 05f63d7..efa5b52 100644
--- a/jm2l/templates/layout.mako
+++ b/jm2l/templates/layout.mako
@@ -134,6 +134,7 @@ ${helpers.uploader_js()}
Gérer les salles
Gérer les entités
Participations à l'orga
+ Comptabilité
% endif
Mon profil
diff --git a/jm2l/views.py b/jm2l/views.py
index 4d478b8..89da654 100644
--- a/jm2l/views.py
+++ b/jm2l/views.py
@@ -25,7 +25,8 @@ import unicodedata
import datetime
import re
import shutil
-
+import glob
+
CurrentYear = 2015
## =-=- Here, We keep some usefull function -=-=
@@ -459,6 +460,57 @@ def list_view(request):
DicTask[grp] = tasks
return {'tasks': DicTask }
+
+@view_config(route_name='list_expenses', renderer='jm2l:templates/Staff/compta.mako')
+def expenses(request):
+ if request.user is None:
+ # Don't answer to users that aren't logged
+ raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
+ if not request.user.Staff:
+ # Don't answer to users that aren't logged
+ raise HTTPForbidden(u'Vous n\'avez pas l\'autorité suffisante pour effectuer cette action.')
+
+ output = []
+ dic_out = {}
+ for name in glob.glob('jm2l/upload/images/users/*/RIB/*'):
+ tab_path = name.split('/')
+ if tab_path[6]=='thumbnails' or tab_path[6].endswith('.type'):
+ continue
+ if dic_out.get(tab_path[4]) is None:
+ dic_out[tab_path[4]] = {}
+ if dic_out[tab_path[4]].get('RIB') is None:
+ dic_out[tab_path[4]]['RIB'] = {'files':[], 'thumb':[]}
+ u = User.by_slug(tab_path[4])
+ dic_out[tab_path[4]]['User'] = {
+ 'uid':u.uid,
+ 'nom':u.nom,
+ 'prenom':u.prenom,
+ 'slug':u.slug
+ }
+ dic_out[tab_path[4]]['RIB']['files'].append( name )
+ dic_out[tab_path[4]]['RIB']['thumb'].append( name + ".jpg" )
+
+ for name in glob.glob('jm2l/upload/images/users/*/Justif/*'):
+ tab_path = name.split('/')
+ if tab_path[6]=='thumbnails' or tab_path[6].endswith('.type'):
+ continue
+ if dic_out.get(tab_path[4]) is None:
+ dic_out[tab_path[4]] = {}
+ if dic_out[tab_path[4]].get('Justif') is None:
+ dic_out[tab_path[4]]['Justif'] = {'files':[], 'thumb':[]}
+ u = User.by_slug(tab_path[4])
+ dic_out[tab_path[4]]['User'] = {
+ 'uid':u.uid,
+ 'nom':u.nom,
+ 'prenom':u.prenom,
+ 'slug':u.slug
+ }
+ dic_out[tab_path[4]]['Justif']['files'].append( name )
+ dic_out[tab_path[4]]['Justif']['thumb'].append( name + ".jpg" )
+
+ return dict(found=dic_out)
+
+
@view_config(route_name='handle_task', renderer='jm2l:templates/Staff/tasks.mako')
def tasks(request):
if request.user is None: