Bug 8436: QA Follow-up: Activate branch filter, if IndependentBranches is off
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Tue, 20 Oct 2015 14:36:06 +0000 (16:36 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 4 Nov 2015 14:11:47 +0000 (11:11 -0300)
The superserials permission is only in use in combination with
IndependentBranches - so it makes sense to also show the branch
filter when IndependentBranches is off.

Permission description:
 superserials Manage subscriptions from any branch
 (only applies when IndependentBranches is used)

Also adds a missing check for superlibraian.

Note: the duplicated permission check in the code is not really nice
- would be good to rewrite this to be more clean.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

serials/checkexpiration.pl

index bb0715a..c926814 100755 (executable)
@@ -81,7 +81,9 @@ if ($date) {
         $subscription->{expirationdate} = $expirationdate;
         next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format.
         next if $subscription->{closed};
-        if (   ( ref $flags->{serials} and $flags->{serials}->{superserials} )
+        if (   !C4::Context->preference("IndependentBranches")
+            or C4::Context->IsSuperLibrarian()
+            or ( ref $flags->{serials} and $flags->{serials}->{superserials} )
             or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
         {
             $subscription->{cannotedit} = 0;
@@ -107,7 +109,8 @@ if ($date) {
 
 my $branchname;
 my $branches_loop;
-if (   C4::Context->IsSuperLibrarian()
+if (  !C4::Context->preference("IndependentBranches")
+    or C4::Context->IsSuperLibrarian()
     or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
     or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
 {