Bug 34478: Changes for tools/holidays
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
159b9bbcf2
commit
6a366faf3f
|
|
@ -48,6 +48,7 @@
|
|||
<div class="panel" id="showHoliday">
|
||||
<form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-edit" />
|
||||
<input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
|
||||
<fieldset class="brief">
|
||||
<h3>Edit this holiday</h3>
|
||||
|
|
@ -145,6 +146,7 @@
|
|||
<div class="panel" id="newHoliday">
|
||||
<form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-add" />
|
||||
<fieldset class="brief">
|
||||
<h3>Add new holiday</h3>
|
||||
<ol>
|
||||
|
|
@ -237,6 +239,7 @@
|
|||
<div style="margin-top: 2em;">
|
||||
<form action="copy-holidays.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-copy" />
|
||||
<input type="hidden" name="from_branchcode" value="[% branch | html %]" />
|
||||
<label for="branchcode">Copy holidays to:</label>
|
||||
<select id="branchcode" name="branchcode">
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use C4::Output;
|
|||
use C4::Calendar;
|
||||
|
||||
my $input = CGI->new;
|
||||
my $op = $input->param('op') // q{};
|
||||
my $dbh = C4::Context->dbh();
|
||||
|
||||
checkauth($input, 0, {tools=> 'edit_calendar'}, 'intranet');
|
||||
|
|
@ -35,6 +36,8 @@ checkauth($input, 0, {tools=> 'edit_calendar'}, 'intranet');
|
|||
my $branchcode = $input->param('branchcode');
|
||||
my $from_branchcode = $input->param('from_branchcode');
|
||||
|
||||
C4::Calendar->new(branchcode => $from_branchcode)->copy_to_branch($branchcode) if $from_branchcode && $branchcode;
|
||||
if ( $op eq 'cud-copy' ) {
|
||||
C4::Calendar->new( branchcode => $from_branchcode )->copy_to_branch($branchcode) if $from_branchcode && $branchcode;
|
||||
}
|
||||
|
||||
print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=".($branchcode || $from_branchcode));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ use C4::Calendar;
|
|||
use Koha::DateUtils qw( dt_from_string );
|
||||
|
||||
my $input = CGI->new;
|
||||
my $dbh = C4::Context->dbh();
|
||||
my $op = $input->param('op') // q{};
|
||||
my $dbh = C4::Context->dbh();
|
||||
|
||||
checkauth($input, 0, {tools=> 'edit_calendar'}, 'intranet');
|
||||
|
||||
|
|
@ -52,12 +53,12 @@ if ($datecancelrange_dt){
|
|||
}
|
||||
}
|
||||
|
||||
if($allbranches) {
|
||||
if ( $op eq 'cud-edit' && $allbranches ) {
|
||||
my $libraries = Koha::Libraries->search;
|
||||
while ( my $library = $libraries->next ) {
|
||||
edit_holiday($showoperation, $library->branchcode, $weekday, $day, $month, $year, $title, $description, $holidaytype, @holiday_list);
|
||||
}
|
||||
} else {
|
||||
} elsif( $op eq 'cud-edit' ) {
|
||||
edit_holiday($showoperation, $branchcode, $weekday, $day, $month, $year, $title, $description, $holidaytype, @holiday_list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use DateTime;
|
|||
use Koha::DateUtils qw( dt_from_string output_pref );
|
||||
|
||||
my $input = CGI->new;
|
||||
my $op = $input->param('op') // q{};
|
||||
my $dbh = C4::Context->dbh();
|
||||
|
||||
checkauth($input, 0, {tools=> 'edit_calendar'}, 'intranet');
|
||||
|
|
@ -70,12 +71,12 @@ if ($end_dt){
|
|||
}
|
||||
}
|
||||
|
||||
if($allbranches) {
|
||||
if ( $op eq 'cud-add' && $allbranches ) {
|
||||
my $libraries = Koha::Libraries->search;
|
||||
while ( my $library = $libraries->next ) {
|
||||
add_holiday($newoperation, $library->branchcode, $weekday, $day, $month, $year, $title, $description);
|
||||
}
|
||||
} else {
|
||||
} elsif ( $op eq 'cud-add' ) {
|
||||
add_holiday($newoperation, $branchcode, $weekday, $day, $month, $year, $title, $description);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue