<div class="yui-b">
[% UNLESS ( add_form ) %]
+ [% IF (error_message) %]<p>[% error_message %]</p>[% END %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&lang=[% lang %]"><i class="icon-plus"></i> New entry</a>
</div>
my $number = $cgi->param('number');
my $lang = $cgi->param('lang');
my $branchcode = $cgi->param('branch');
+my $error_message = $cgi->param('error_message');
+
# Foreign Key constraints work with NULL, not ''
# NULL = All branches.
$branchcode = undef if (defined($branchcode) && $branchcode eq '');
}
);
+# Pass error message if there is one.
+$template->param( error_message => $error_message ) if $error_message;
+
# get lang list
my @lang_list;
my $tlangs = getTranslatedLanguages() ;
}
}
elsif ( $op eq 'add' ) {
- add_opac_new(
- {
- title => $title,
- new => $new,
- lang => $lang,
- expirationdate => $expirationdate,
- timestamp => $timestamp,
- number => $number,
- branchcode => $branchcode,
- }
- );
- print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
+ if ($title) {
+ add_opac_new(
+ {
+ title => $title,
+ new => $new,
+ lang => $lang,
+ expirationdate => $expirationdate,
+ timestamp => $timestamp,
+ number => $number,
+ branchcode => $branchcode,
+ }
+ );
+ print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
+ }
+ else {
+ print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl?error_message=ERROR:+Required+news+title+missing!");
+ }
}
elsif ( $op eq 'edit' ) {
upd_opac_new(