Bug 12098: (follow-up) put can_show_subscription() into use
authorGalen Charlton <gmc@esilibrary.com>
Fri, 18 Apr 2014 20:47:48 +0000 (20:47 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 18 Apr 2014 20:47:48 +0000 (20:47 +0000)
This patch puts C4::Serials::can_show_subscription() into use.

Note that there is user-visible change: if a subscription has a
blank library, all users with serials permissions will be able
to view and/or edit it.  It remains to be determined whether
we *want* such subscriptions to exist, or if they should only
be tied to specific libraries.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Serials.pm

index 98d52f0..2540f16 100644 (file)
@@ -736,20 +736,9 @@ sub SearchSubscriptions {
     my $results = $sth->fetchall_arrayref( {} );
     $sth->finish;
 
-    my $cant_display_other_branches = 0;
-    if (my $env = C4::Context->userenv) {
-        my $userid = $env->{'id'};
-        $cant_display_other_branches =
-            C4::Context->preference('IndependentBranches') &&
-            !C4::Context->IsSuperLibrarian() &&
-            !C4::Auth::haspermission( $userid, {serials => 'superserials'});
-    }
-    my $user_branch = C4::Context->userenv ? C4::Context->userenv->{'branch'} : q{};
     for my $subscription ( @$results ) {
         $subscription->{cannotedit} = not can_edit_subscription( $subscription );
-        $subscription->{cannotdisplay} =
-            $cant_display_other_branches &&
-            $subscription->{branchcode} ne $user_branch;
+        $subscription->{cannotdisplay} = not can_show_subscription( $subscription );
     }
 
     return @$results;