From e6040977409ffe4dc6a23f6d76c3bd1f528837d0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 3 Feb 2015 13:25:47 +0100 Subject: [PATCH] Bug 13662: Fix the serials.receive_serials permissions There are some issues with serial permissions. For instance it's not possible to receive serials if the edit_subscription is not set. Also the toolbar is empty. Test plan: 1/ Set the serials => receive_serials permissions to a patron (and only this one for the serials module). 2/ Verify you cannot create a new subscription, you can search subscriptions but cannot edit them. 3/ On the serial result list, receive a serial (action > Serial receive). You can now change the status and receive it. 4/ On the serial collection, you can edit 1+ serials to reveice it. 5/ Set the serials => edit_subscription permission and confirm there is no regression. QA note: I think we should introduce a C4::Serials::can_receive_serials subroutine, to test the IndependentBranches pref, but I don't want to add to much processing to check permissions. Signed-off-by: Paola Rossi Signed-off-by: Brendan Gallagher Signed-off-by: Tomas Cohen Arazi --- .../prog/en/includes/serials-toolbar.inc | 95 ++++++++++--------- .../en/modules/serials/serials-collection.tt | 2 +- serials/serials-edit.pl | 1 + 3 files changed, 50 insertions(+), 48 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc index d02781a97f..f1d6547976 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc @@ -34,58 +34,59 @@ }); //]]> -
- [% IF ( CAN_user_serials_create_subscription ) %] - [% IF ( biblionumber_for_new_subscription ) %] - - [% ELSE %] - +[% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %] +
+ [% IF CAN_user_serials_create_subscription %] + [% IF biblionumber_for_new_subscription %] + + [% ELSE %] + + [% END %] [% END %] - [% END %] - [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %] - [% IF ( subscriptionid ) %] - - [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %] - [% UNLESS ( cannotedit ) %] -
- - -
- [% END %] + [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %] + [% UNLESS ( cannotedit ) %] +
+ + +
[% END %] + [% END %] - [% UNLESS ( cannotedit ) %] - [% UNLESS closed %] - [% IF ( CAN_user_serials_renew_subscription ) %] - - [% END %] - [% END %] - [% IF ( CAN_user_serials_receive_serials ) %] - [% UNLESS closed %] - - [% END %] - [% END %] - [% IF CAN_user_serials_edit_subscription %] - [% IF closed %] - - [% ELSE %] - - [% END %] + [% IF not cannotedit or CAN_user_serials_receive_serials %] + [% IF CAN_user_serials_renew_subscription and not closed %] + + [% END %] + [% IF CAN_user_serials_receive_serials and not closed %] + + [% END %] + [% UNLESS cannotedit %] + [% IF closed %] + + [% ELSE %] + [% END %] [% END %] [% END %] - [% END %] -
+
+[% ELSIF CAN_user_serials_create_subscription %] +
+ [% IF ( biblionumber_for_new_subscription ) %] + + [% ELSE %] + + [% END %] +
+[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 723f31eea6..4418baf835 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -223,7 +223,7 @@ $(document).ready(function() { [% UNLESS ( loop.odd ) %][% ELSE %][% END %] [% IF ( CAN_user_serials_receive_serials ) %] - [% IF ( serial.cannotedit ) %] + [% UNLESS CAN_user_serials_receive_serials %] disabled [% ELSE %] [% IF ( serial.subscriptionexpired ) %] diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index 1b7d2ed125..8df489dde9 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -154,6 +154,7 @@ foreach my $serialid (@serialids) { ) || $serinfo->{'cannotedit'} ); + $serinfo->{editdisable} = 0 if C4::Auth::haspermission( C4::Context->userenv->{id}, { serials => 'receive_serials' } ); $serinfo->{editdisable} ||= ($serinfo->{status8} and $serinfo->{closed}); push @serialdatalist, $serinfo; $processedserialid{$serialid} = 1; -- 2.39.5