Commit ae80f068 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

controllers/patient.py, patient/info.html: 'prev' and 'next' buttons work for everyone

parent a43ee848
......@@ -22,9 +22,9 @@ def next_patient():
current_id = request.vars["id"]
go_next = int(request.vars['next'])
if go_next > 0:
res = db(db.patient.id > current_id).select(db.patient.id, orderby=db.patient.id, limitby=(0,1))
res = db((db.patient.id > current_id) & (auth.accessible_query('read', db.patient))).select(db.patient.id, orderby=db.patient.id, limitby=(0,1))
else:
res = db(db.patient.id < current_id).select(db.patient.id, orderby=~db.patient.id, limitby=(0,1))
res = db((db.patient.id < current_id) & (auth.accessible_query('read', db.patient))).select(db.patient.id, orderby=~db.patient.id, limitby=(0,1))
if (len(res) > 0):
request.vars["id"] = str(res[0].id)
except:
......
......@@ -5,10 +5,10 @@
<div>
{{if auth.is_admin():}}
<span class="button" onclick="db.call('patient/info', {'next': '1', 'id' :'{{=request.vars['id']}}', 'config_id' : '{{=request.vars['config_id']}}'})">prev</span>
<span class="button" onclick="db.call('patient/info', {'next': '-1', 'id' :'{{=request.vars['id']}}', 'config_id' : '{{=request.vars['config_id']}}'})">next</span>
{{ pass }}
<h3>{{=vidjil_utils.anon_names(request.vars['id'], patient.first_name, patient.last_name)}}</h3>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment