Lines 26-31
use C4::Output;
Link Here
|
26 |
|
26 |
|
27 |
use C4::Branch; # GetBranches |
27 |
use C4::Branch; # GetBranches |
28 |
use C4::Calendar; |
28 |
use C4::Calendar; |
|
|
29 |
use Koha::DateUtils; |
29 |
|
30 |
|
30 |
my $input = new CGI; |
31 |
my $input = new CGI; |
31 |
|
32 |
|
Lines 44-58
my ($template, $loggedinuser, $cookie)
Link Here
|
44 |
my $keydate; |
45 |
my $keydate; |
45 |
# calendardate - date passed in url for human readability (syspref) |
46 |
# calendardate - date passed in url for human readability (syspref) |
46 |
my $calendardate; |
47 |
my $calendardate; |
47 |
my $today = C4::Dates->new(); |
48 |
my $calendarinput_dt = eval { dt_from_string( $input->param('calendardate') ); } || dt_from_string; |
48 |
my $calendarinput = C4::Dates->new($input->param('calendardate')) || $today; |
|
|
49 |
# if the url has an invalid date default to 'now.' |
49 |
# if the url has an invalid date default to 'now.' |
50 |
unless($calendardate = $calendarinput->output('syspref')) { |
50 |
$calendardate = output_pref( { dt => $calendarinput_dt, dateonly => 1 } ); |
51 |
$calendardate = $today->output('syspref'); |
51 |
$keydate = output_pref( { dt => $calendarinput_dt, dateonly => 1, dateformat => 'iso' } ); |
52 |
} |
|
|
53 |
unless($keydate = $calendarinput->output('iso')) { |
54 |
$keydate = $today->output('iso'); |
55 |
} |
56 |
$keydate =~ s/-/\//g; |
52 |
$keydate =~ s/-/\//g; |
57 |
|
53 |
|
58 |
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'}; |
54 |
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'}; |
Lines 123-133
foreach my $monthDay (keys %$day_month_holidays) {
Link Here
|
123 |
my $exception_holidays = $calendar->get_exception_holidays(); |
119 |
my $exception_holidays = $calendar->get_exception_holidays(); |
124 |
my @exception_holidays; |
120 |
my @exception_holidays; |
125 |
foreach my $yearMonthDay (keys %$exception_holidays) { |
121 |
foreach my $yearMonthDay (keys %$exception_holidays) { |
126 |
my $exceptiondate = C4::Dates->new($exception_holidays->{$yearMonthDay}{date}, "iso"); |
122 |
my $exceptiondate = eval { dt_from_string( $exception_holidays->{$yearMonthDay}{date} ) }; |
127 |
my %exception_holiday; |
123 |
my %exception_holiday; |
128 |
%exception_holiday = (KEY => $yearMonthDay, |
124 |
%exception_holiday = (KEY => $yearMonthDay, |
129 |
DATE_SORT => $exception_holidays->{$yearMonthDay}{date}, |
125 |
DATE_SORT => $exception_holidays->{$yearMonthDay}{date}, |
130 |
DATE => $exceptiondate->output("syspref"), |
126 |
DATE => output_pref( { dt => $exceptiondate, dateonly => 1, dateformat => 'iso' } ), |
131 |
TITLE => $exception_holidays->{$yearMonthDay}{title}, |
127 |
TITLE => $exception_holidays->{$yearMonthDay}{title}, |
132 |
DESCRIPTION => $exception_holidays->{$yearMonthDay}{description}); |
128 |
DESCRIPTION => $exception_holidays->{$yearMonthDay}{description}); |
133 |
push @exception_holidays, \%exception_holiday; |
129 |
push @exception_holidays, \%exception_holiday; |
Lines 136-146
foreach my $yearMonthDay (keys %$exception_holidays) {
Link Here
|
136 |
my $single_holidays = $calendar->get_single_holidays(); |
132 |
my $single_holidays = $calendar->get_single_holidays(); |
137 |
my @holidays; |
133 |
my @holidays; |
138 |
foreach my $yearMonthDay (keys %$single_holidays) { |
134 |
foreach my $yearMonthDay (keys %$single_holidays) { |
139 |
my $holidaydate = C4::Dates->new($single_holidays->{$yearMonthDay}{date}, "iso"); |
135 |
my $holidaydate = eval { dt_from_string( $single_holidays->{$yearMonthDay}{date} ) }; |
140 |
my %holiday; |
136 |
my %holiday; |
141 |
%holiday = (KEY => $yearMonthDay, |
137 |
%holiday = (KEY => $yearMonthDay, |
142 |
DATE_SORT => $single_holidays->{$yearMonthDay}{date}, |
138 |
DATE_SORT => $single_holidays->{$yearMonthDay}{date}, |
143 |
DATE => $holidaydate->output("syspref"), |
139 |
DATE => output_pref( { dt => $holidaydate, dateonly => 1, dateformat => 'iso' } ), |
144 |
TITLE => $single_holidays->{$yearMonthDay}{title}, |
140 |
TITLE => $single_holidays->{$yearMonthDay}{title}, |
145 |
DESCRIPTION => $single_holidays->{$yearMonthDay}{description}); |
141 |
DESCRIPTION => $single_holidays->{$yearMonthDay}{description}); |
146 |
push @holidays, \%holiday; |
142 |
push @holidays, \%holiday; |