Lines 26-37
use Modern::Perl;
Link Here
|
26 |
use CGI qw ( -utf8 ); |
26 |
use CGI qw ( -utf8 ); |
27 |
use Try::Tiny; |
27 |
use Try::Tiny; |
28 |
use Array::Utils qw( array_minus ); |
28 |
use Array::Utils qw( array_minus ); |
29 |
use C4::Auth qw(get_template_and_user); |
29 |
use C4::Auth qw(get_template_and_user); |
30 |
use C4::Koha; |
30 |
use C4::Koha; |
31 |
use C4::Context; |
31 |
use C4::Context; |
32 |
use C4::Log qw( logaction ); |
32 |
use C4::Log qw( logaction ); |
33 |
use C4::Output qw(output_html_with_http_headers output_and_exit_if_error); |
33 |
use C4::Output qw(output_html_with_http_headers output_and_exit_if_error); |
34 |
use C4::Languages qw(getTranslatedLanguages); |
34 |
use C4::Languages qw(getTranslatedLanguages); |
35 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
35 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
36 |
|
36 |
|
37 |
use Koha::AdditionalContents; |
37 |
use Koha::AdditionalContents; |
Lines 63-68
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
63 |
); |
63 |
); |
64 |
|
64 |
|
65 |
my @messages; |
65 |
my @messages; |
|
|
66 |
my $my_branch = |
67 |
C4::Context->preference("IndependentBranches") |
68 |
&& !C4::Context->IsSuperLibrarian() |
69 |
? C4::Context->userenv()->{'branch'} |
70 |
: undef; |
66 |
if ( $op eq 'add_form' ) { |
71 |
if ( $op eq 'add_form' ) { |
67 |
|
72 |
|
68 |
my $additional_content = Koha::AdditionalContents->find($id); |
73 |
my $additional_content = Koha::AdditionalContents->find($id); |
Lines 72-77
if ( $op eq 'add_form' ) {
Link Here
|
72 |
$category = $additional_content->category; |
77 |
$category = $additional_content->category; |
73 |
} |
78 |
} |
74 |
$template->param( |
79 |
$template->param( |
|
|
80 |
my_branch => $my_branch, |
75 |
additional_content => $additional_content, |
81 |
additional_content => $additional_content, |
76 |
translated_contents => $translated_contents, |
82 |
translated_contents => $translated_contents, |
77 |
opac_available_options => Koha::AdditionalContents::get_html_customizations_options('opac'), |
83 |
opac_available_options => Koha::AdditionalContents::get_html_customizations_options('opac'), |
Lines 81-87
if ( $op eq 'add_form' ) {
Link Here
|
81 |
output_and_exit_if_error( $cgi, $cookie, $template, { check => 'csrf_token' } ); |
87 |
output_and_exit_if_error( $cgi, $cookie, $template, { check => 'csrf_token' } ); |
82 |
my $location = $cgi->param('location'); |
88 |
my $location = $cgi->param('location'); |
83 |
my $code = $cgi->param('code'); |
89 |
my $code = $cgi->param('code'); |
84 |
my $branchcode = $cgi->param('branchcode') || undef; |
90 |
my $branchcode = $my_branch ? $my_branch : $cgi->param('branchcode') || undef; |
85 |
|
91 |
|
86 |
my @lang = $cgi->multi_param('lang'); |
92 |
my @lang = $cgi->multi_param('lang'); |
87 |
|
93 |
|
Lines 229-235
if ( $op eq 'list' ) {
Link Here
|
229 |
{ category => $category, 'additional_contents_localizations.lang' => 'default' }, |
235 |
{ category => $category, 'additional_contents_localizations.lang' => 'default' }, |
230 |
{ order_by => { -desc => 'published_on' }, join => 'additional_contents_localizations' } |
236 |
{ order_by => { -desc => 'published_on' }, join => 'additional_contents_localizations' } |
231 |
); |
237 |
); |
232 |
$template->param( additional_contents => $additional_contents ); |
238 |
$template->param( additional_contents => $additional_contents, my_branch => $my_branch ); |
233 |
} |
239 |
} |
234 |
|
240 |
|
235 |
my $translated_languages = C4::Languages::getTranslatedLanguages(); |
241 |
my $translated_languages = C4::Languages::getTranslatedLanguages(); |
236 |
- |
|
|