|
Lines 23-29
use CGI qw ( -utf8 );
Link Here
|
| 23 |
use Try::Tiny; |
23 |
use Try::Tiny; |
| 24 |
use Scalar::Util qw( blessed ); |
24 |
use Scalar::Util qw( blessed ); |
| 25 |
|
25 |
|
| 26 |
use C4::Auth qw( get_template_and_user ); |
26 |
use C4::Auth qw( get_template_and_user haspermission ); |
| 27 |
use C4::Output qw( output_html_with_http_headers ); |
27 |
use C4::Output qw( output_html_with_http_headers ); |
| 28 |
use C4::Context; |
28 |
use C4::Context; |
| 29 |
|
29 |
|
|
Lines 39-48
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
| 39 |
template_name => "tools/restore_deleted_borrowers.tt", |
39 |
template_name => "tools/restore_deleted_borrowers.tt", |
| 40 |
query => $input, |
40 |
query => $input, |
| 41 |
type => "intranet", |
41 |
type => "intranet", |
| 42 |
flagsrequired => { tools => 'restore_deleted_patrons' }, |
42 |
flagsrequired => { borrowers => 'restore_deleted_borrowers' }, |
| 43 |
} |
43 |
} |
| 44 |
); |
44 |
); |
| 45 |
|
45 |
|
|
|
46 |
#check if the user can view patrons from any branch, or just thier own |
| 47 |
my $logged_in_patron = Koha::Patrons->find($loggedinuser); |
| 48 |
my $can_view_all_libraries = |
| 49 |
haspermission( $logged_in_patron->userid, { borrowers => 'view_borrower_infos_from_any_libraries' } ); |
| 50 |
|
| 51 |
my @libraries; |
| 52 |
if ($can_view_all_libraries) { |
| 53 |
|
| 54 |
# User can view all branches, get them all |
| 55 |
@libraries = Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; |
| 56 |
} else { |
| 57 |
|
| 58 |
# User can only view their branch or branches in the group, get only those |
| 59 |
@libraries = Koha::Libraries->search_filtered( |
| 60 |
{ only_from_group => 1 }, |
| 61 |
{ order_by => ['branchname'] } |
| 62 |
)->as_list; |
| 63 |
} |
| 64 |
|
| 65 |
$template->param( |
| 66 |
allowed_libraries => \@libraries, |
| 67 |
can_view_all_libraries => $can_view_all_libraries, |
| 68 |
); |
| 69 |
|
| 46 |
if ( $op eq 'search' ) { |
70 |
if ( $op eq 'search' ) { |
| 47 |
|
71 |
|
| 48 |
# Get search parameters |
72 |
# Get search parameters |
| 49 |
- |
|
|