Lines 45-50
if ( $cgi->param('expirationdate') ) {
Link Here
|
45 |
} |
45 |
} |
46 |
my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); |
46 |
my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); |
47 |
my $number = $cgi->param('number'); |
47 |
my $number = $cgi->param('number'); |
|
|
48 |
my $helpkey = $cgi->param('helpkey'); |
48 |
my $lang = $cgi->param('lang'); |
49 |
my $lang = $cgi->param('lang'); |
49 |
my $branchcode = $cgi->param('branch'); |
50 |
my $branchcode = $cgi->param('branch'); |
50 |
my $error_message = $cgi->param('error_message'); |
51 |
my $error_message = $cgi->param('error_message'); |
Lines 55-71
$branchcode = undef if (defined($branchcode) && $branchcode eq '');
Link Here
|
55 |
|
56 |
|
56 |
my $new_detail = get_opac_new($id); |
57 |
my $new_detail = get_opac_new($id); |
57 |
|
58 |
|
|
|
59 |
# flagsrequired checks for all flags listed, we need an 'or' |
60 |
# to work with edit_news or edit_help. |
58 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
61 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
59 |
{ |
62 |
{ |
60 |
template_name => "tools/koha-news.tt", |
63 |
template_name => "tools/koha-news.tt", |
61 |
query => $cgi, |
64 |
query => $cgi, |
62 |
type => "intranet", |
65 |
type => "intranet", |
63 |
authnotrequired => 0, |
66 |
authnotrequired => 1, |
64 |
flagsrequired => { tools => 'edit_news' }, |
|
|
65 |
debug => 1, |
67 |
debug => 1, |
66 |
} |
68 |
} |
67 |
); |
69 |
); |
68 |
|
70 |
|
|
|
71 |
#Check now the flags, user must have news or help edit permissions |
72 |
if ( not (defined $template->{VARS}->{'CAN_user_tools_edit_news'} || |
73 |
defined $template->{VARS}->{'CAN_user_tools_edit_help'} ) ) { |
74 |
warn "EXIT FROM koha-news.pl "; |
75 |
print $cgi->redirect("/cgi-bin/koha/errors/403.pl"); |
76 |
} else { |
77 |
#TODO: Indent as followup to bug 18483 |
78 |
|
69 |
# Pass error message if there is one. |
79 |
# Pass error message if there is one. |
70 |
$template->param( error_message => $error_message ) if $error_message; |
80 |
$template->param( error_message => $error_message ) if $error_message; |
71 |
|
81 |
|
Lines 99-105
if ( $op eq 'add_form' ) {
Link Here
|
99 |
$template->{VARS}->{'new_detail'} = $new_detail; |
109 |
$template->{VARS}->{'new_detail'} = $new_detail; |
100 |
} |
110 |
} |
101 |
else { |
111 |
else { |
102 |
$template->param( op => 'add' ); |
112 |
$template->param( |
|
|
113 |
op => 'add', |
114 |
helpkey => $helpkey |
115 |
); |
116 |
|
103 |
} |
117 |
} |
104 |
} |
118 |
} |
105 |
elsif ( $op eq 'add' ) { |
119 |
elsif ( $op eq 'add' ) { |
Lines 112-117
elsif ( $op eq 'add' ) {
Link Here
|
112 |
expirationdate => $expirationdate, |
126 |
expirationdate => $expirationdate, |
113 |
timestamp => $timestamp, |
127 |
timestamp => $timestamp, |
114 |
number => $number, |
128 |
number => $number, |
|
|
129 |
helpkey => $helpkey, |
115 |
branchcode => $branchcode, |
130 |
branchcode => $branchcode, |
116 |
borrowernumber => $borrowernumber, |
131 |
borrowernumber => $borrowernumber, |
117 |
} |
132 |
} |
Lines 131-136
elsif ( $op eq 'edit' ) {
Link Here
|
131 |
lang => $lang, |
146 |
lang => $lang, |
132 |
expirationdate => $expirationdate, |
147 |
expirationdate => $expirationdate, |
133 |
timestamp => $timestamp, |
148 |
timestamp => $timestamp, |
|
|
149 |
helpkey => $helpkey, |
134 |
number => $number, |
150 |
number => $number, |
135 |
branchcode => $branchcode, |
151 |
branchcode => $branchcode, |
136 |
} |
152 |
} |
Lines 145-151
elsif ( $op eq 'del' ) {
Link Here
|
145 |
|
161 |
|
146 |
else { |
162 |
else { |
147 |
|
163 |
|
148 |
my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode ); |
164 |
my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, 'staffhelp', $branchcode ); |
149 |
|
165 |
|
150 |
foreach my $new ( @$opac_news ) { |
166 |
foreach my $new ( @$opac_news ) { |
151 |
next unless $new->{'expirationdate'}; |
167 |
next unless $new->{'expirationdate'}; |
Lines 161-164
else {
Link Here
|
161 |
); |
177 |
); |
162 |
} |
178 |
} |
163 |
$template->param( lang => $lang ); |
179 |
$template->param( lang => $lang ); |
|
|
180 |
} |
164 |
output_html_with_http_headers $cgi, $cookie, $template->output; |
181 |
output_html_with_http_headers $cgi, $cookie, $template->output; |
165 |
- |
|
|