Bug 12098: (follow-up) put can_show_subscription() into use
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>
(cherry picked from commit dc6d8a2199)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
15716da33e
commit
20c1fac16b
|
|
@ -734,20 +734,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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue