|
Lines 45-60
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
| 45 |
); |
45 |
); |
| 46 |
|
46 |
|
| 47 |
my $library; |
47 |
my $library; |
| 48 |
if ( $template->{VARS}->{singleBranchMode} ) { |
48 |
my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } ); |
| 49 |
$library = Koha::Libraries->search( { public => 1 } )->next; |
49 |
$template->param( public_count => $libraries->count ); |
|
|
50 |
if ( $template->{VARS}->{singleBranchMode} || $libraries->count == 1 ) { |
| 51 |
$library = $libraries->next; |
| 50 |
} elsif ($branchcode) { |
52 |
} elsif ($branchcode) { |
| 51 |
$library = Koha::Libraries->search( { branchcode => $branchcode, public => 1 } )->next; |
53 |
$library = $libraries->search( { branchcode => $branchcode } )->next; |
| 52 |
} |
54 |
} |
| 53 |
|
55 |
|
| 54 |
if ($library) { |
56 |
if ($library) { |
| 55 |
$template->param( library => $library ); |
57 |
$template->param( library => $library ); |
| 56 |
} else { |
58 |
} else { |
| 57 |
my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } ); |
|
|
| 58 |
$template->param( |
59 |
$template->param( |
| 59 |
libraries => $libraries, |
60 |
libraries => $libraries, |
| 60 |
branchcode => C4::Context->userenv ? C4::Context->userenv->{branch} : q{}, |
61 |
branchcode => C4::Context->userenv ? C4::Context->userenv->{branch} : q{}, |
| 61 |
- |
|
|