Bug 3886

Summary: Can't print receipt w/out allowing "Add or modify borrowers" permission
Product: Koha Reporter: Richard <rpritsky>
Component: PatronsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: charles.farmer, fridolin.somers, magnus, martin.renvoize, mtompset, nick, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Proposed fix
Bug 3886: Fix mismatch of required permissions for printing slips
Bug 3886: Fix mismatch of required permissions for printing slips
Bug 3886: Fix mismatch of required permissions for printing slips

Description Chris Cormack 2010-05-21 01:16:16 UTC


---- Reported by rpritsky@gmail.com 2009-12-09 20:06:14 ----

We have vokal libraries who must restrict some staff from being able to modify borrower records, yet be able to print receipts for borrowers when they checkout items.  Currently, if this staff id does not have "(borrowers) Add or modify borrowers" set in "Set Permissions", receipt printing is not available.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:16 UTC  ---

This bug was previously known as _bug_ 3886 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3886

Actual time not defined. Setting to 0.0

Comment 1 Owen Leonard 2011-05-18 15:33:33 UTC
Created attachment 4167 [details] [review]
Proposed fix

    For some reason the template wrapped the "print page" menu
    item in a check for CAN_user_borrowers. The slip and quick
    slip print options were excluded from this check.
Comment 2 Magnus Enger 2011-05-28 22:24:50 UTC
I created a new staff user with just the "circulate" and "catalogue" permissions, then logged in as this user. 

Before the patch was applied: When I go to the circulation screen and select a patron for checking out to, I can only see the Print Slip and Quick Slip options on the Print menu. Both of them works as expected. 

After applying the patch: I now have a third option, Print Page. Clicking on this opens a new tab, but instead of displaying information about the patron, it says "Error: You do not have permission to access this page. Click to log out" and displays the staff login screen. 

I think the problem here is that Print Page takes me to this URL: http://localhost:8080/cgi-bin/koha/members/moremember.pl?borrowernumber=51&amp;print=page which is not really a part of the circulation "module", but rather falls within the "jurisdiction" of the "borrowers" permission. Giving my circulation-only staff user the "borrowers" permission makes it possible for that user to have the Print Page action display properly, as described by the bug submitter. 

In light of this, limiting Print Page with CAN_user_borrowers actually seems to make sense. I think there are two options for making Print Page work for users without the "borrowers" permission: 

1. Make is possible for them to access members/moremember.pl?borrowernumber=51&amp;print=page (but not other functions of the members/moremember.pl script)

2. Recreate the Print Page functionality within the "jurisdiction" of the "circulate" permission. 

Marking as "Failed QA".
Comment 3 Mark Tompsett 2015-10-19 16:15:11 UTC
Prog theme no longer exists.
Comment 4 Marc VĂ©ron 2016-02-10 17:11:20 UTC
Testing on current master:

Staff member with circulate_remaining_permissions is able to print slip and quick slip only.

To print summary, borrowers permission has to be set.
(members-toolbar.inc line 160)

Question: Should a staff member with circulate_remaining_permissions be able to print the summary?
Comment 5 Katrin Fischer 2018-05-16 00:29:53 UTC
We have a mismatch here between the templates and the perl script. The script asks for circulate_remaining_permissions and the template for edit_borrowers:

http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc;h=9b5524d4c16c15b81cc7ba9c8eaaad240cf51cf5;hb=9b31bc2d27c6e045a6e7ea079778c47674c135db#l27

I tend to follow the script here.
Comment 6 Katrin Fischer 2018-05-16 00:50:48 UTC
Created attachment 75350 [details] [review]
Bug 3886: Fix mismatch of required permissions for printing slips

- Print summary (summary-print.pl)
- Print quick slip (printslip.pl)
- Print slip (printslip.pl)
- Print overdues (print_overdues.pl)

Perl scripts all require circulate_remaining_permissions, while
in the template we were checking for edit_borrowers.

Now the print pull down will only be visible if the patron has
circulate or circulate_remaining_permissions.

To test:
- Verify that printing the listed slips works for staff users
  with either circulate or circulate_remaining_permissions
  and without edit_borrowers.
Comment 7 Charles Farmer 2018-05-25 19:08:45 UTC
Works as advertised, though I had to manually enter the print-summary URL in order to test, since my borrower only had the 'catalogue' and either 'circulate' or 'circulate_remaining_permissions' and couldn't directly visit moremember.pl.

Are there any other pages available to a patron with such narrow permissions where the printslip button appears?

Signed Off
Comment 8 Charles Farmer 2018-05-25 19:10:34 UTC
Created attachment 75568 [details] [review]
Bug 3886: Fix mismatch of required permissions for printing slips

- Print summary (summary-print.pl)
- Print quick slip (printslip.pl)
- Print slip (printslip.pl)
- Print overdues (print_overdues.pl)

Perl scripts all require circulate_remaining_permissions, while
in the template we were checking for edit_borrowers.

Now the print pull down will only be visible if the patron has
circulate or circulate_remaining_permissions.

To test:
- Verify that printing the listed slips works for staff users
  with either circulate or circulate_remaining_permissions
  and without edit_borrowers.

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 9 Jonathan Druart 2018-05-28 19:51:51 UTC
Created attachment 75604 [details] [review]
Bug 3886: Fix mismatch of required permissions for printing slips

- Print summary (summary-print.pl)
- Print quick slip (printslip.pl)
- Print slip (printslip.pl)
- Print overdues (print_overdues.pl)

Perl scripts all require circulate_remaining_permissions, while
in the template we were checking for edit_borrowers.

Now the print pull down will only be visible if the patron has
circulate or circulate_remaining_permissions.

To test:
- Verify that printing the listed slips works for staff users
  with either circulate or circulate_remaining_permissions
  and without edit_borrowers.

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Nick Clemens (kidclamp) 2018-05-29 14:38:22 UTC
Pushed to master for 18.11.

Awesome work all, thank you.
Comment 11 Martin Renvoize (ashimema) 2018-06-05 10:18:14 UTC
This patch has been pushed to 18.05.x and will be in 18.05.01

Nice one killing off this old bug team :)
Comment 12 Fridolin Somers 2018-06-06 11:54:28 UTC
Pushed to 17.11.x for 17.11.07
Comment 13 Fridolin Somers 2018-06-06 11:56:37 UTC
I choose not to backport to 17.05.x, i focus on major and blocker bugs.

Resoooooolved ;)