Lines 21-26
use Modern::Perl;
Link Here
|
21 |
|
21 |
|
22 |
use CGI qw ( -utf8 ); |
22 |
use CGI qw ( -utf8 ); |
23 |
use C4::Auth qw( get_template_and_user ); |
23 |
use C4::Auth qw( get_template_and_user ); |
|
|
24 |
use C4::Context; |
24 |
use C4::Output qw( output_html_with_http_headers ); |
25 |
use C4::Output qw( output_html_with_http_headers ); |
25 |
use Koha::Libraries; |
26 |
use Koha::Libraries; |
26 |
|
27 |
|
Lines 37-57
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
37 |
} |
38 |
} |
38 |
); |
39 |
); |
39 |
|
40 |
|
40 |
my $found; |
41 |
my $library; |
41 |
if ($branchcode) { |
42 |
if( $template->{VARS}->{singleBranchMode} ) { |
42 |
my $library = Koha::Libraries->find($branchcode); |
43 |
$library = Koha::Libraries->search({ public => 1 })->next; |
43 |
if ( $library && $library->public ) { |
44 |
} elsif( $branchcode ) { |
44 |
$found++; |
45 |
$library = Koha::Libraries->search({ branchcode => $branchcode, public => 1 })->next; |
45 |
$template->param( library => $library ); |
|
|
46 |
} |
47 |
} |
46 |
} |
48 |
|
47 |
|
49 |
unless ($found) { |
48 |
if( $library ) { |
|
|
49 |
$template->param( library => $library ); |
50 |
} else { |
50 |
my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } ); |
51 |
my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } ); |
51 |
|
|
|
52 |
$template->param( |
52 |
$template->param( |
53 |
libraries => $libraries, |
53 |
libraries => $libraries, |
54 |
branchcode => $branchcode, |
54 |
branchcode => C4::Context->userenv ? C4::Context->userenv->{branch} : q{}, |
55 |
); |
55 |
); |
56 |
} |
56 |
} |
57 |
|
57 |
|
58 |
- |
|
|