Lines 32-48
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
32 |
} |
32 |
} |
33 |
); |
33 |
); |
34 |
|
34 |
|
|
|
35 |
my $branch = C4::Context->userenv->{'branch'}; |
35 |
my $page_id = $query->param('page_id'); |
36 |
my $page_id = $query->param('page_id'); |
|
|
37 |
my $code = $query->param('code'); |
36 |
my $page; |
38 |
my $page; |
37 |
|
39 |
|
38 |
if (defined $page_id){ |
40 |
if( $page_id ) { |
39 |
my $branch = C4::Context->userenv->{'branch'}; |
|
|
40 |
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'], branchcode => [ $branch, undef ] }); |
41 |
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'], branchcode => [ $branch, undef ] }); |
41 |
if ( $page->count > 0){ |
42 |
} elsif( $code ) { |
42 |
$template->param( page => $page->next ); |
43 |
my $lang = $query->param('language') || $query->cookie('KohaOpacLanguage'); |
43 |
} else { |
44 |
# In the next query we make sure that the 'default' records come after the regular languages |
44 |
$template->param( page_error => 1 ); |
45 |
$page = Koha::AdditionalContents->search({ code => $code, lang => ['default', $lang], location => ['staff_only', 'staff_and_opac'], branchcode => [ $branch, undef ] }, { order_by => { -desc => \[ 'CASE WHEN lang="default" THEN "" ELSE lang END' ]}} ); |
45 |
} |
|
|
46 |
} |
46 |
} |
|
|
47 |
$template->param( $page && $page->count ? ( page => $page->next ) : ( page_error => 1 ) ); |
47 |
|
48 |
|
48 |
output_html_with_http_headers $query, $cookie, $template->output; |
49 |
output_html_with_http_headers $query, $cookie, $template->output; |
49 |
- |
|
|