Lines 61-72
while ( my $c = $pending_checkouts->next ) {
Link Here
|
61 |
# Catch the result of the template and split on newline |
61 |
# Catch the result of the template and split on newline |
62 |
my ($summary,$description) = split /\n/, $template->output; |
62 |
my ($summary,$description) = split /\n/, $template->output; |
63 |
my $datestart; |
63 |
my $datestart; |
|
|
64 |
my $datestart_local; |
64 |
if ($issue->{'overdue'} && $issue->{'overdue'} == 1) { |
65 |
if ($issue->{'overdue'} && $issue->{'overdue'} == 1) { |
65 |
# Not much use adding an event in the past for a book that is overdue |
66 |
# Not much use adding an event in the past for a book that is overdue |
66 |
# so we set datestart = now |
67 |
# so we set datestart = now |
67 |
$datestart = $timestamp; |
68 |
$datestart = $timestamp; |
|
|
69 |
$datestart_local = $datestart->clone(); |
68 |
} else { |
70 |
} else { |
69 |
$datestart = dt_from_string($issue->{'date_due'}); |
71 |
$datestart = dt_from_string($issue->{'date_due'}); |
|
|
72 |
$datestart_local = $datestart->clone(); |
70 |
$datestart->set_time_zone('UTC'); |
73 |
$datestart->set_time_zone('UTC'); |
71 |
} |
74 |
} |
72 |
# Create a UID that includes the issue number and the domain |
75 |
# Create a UID that includes the issue number and the domain |
Lines 80-90
while ( my $c = $pending_checkouts->next ) {
Link Here
|
80 |
} |
83 |
} |
81 |
my $uid = 'issue-' . $issue->{'issue_id'} . '@' . $domain; |
84 |
my $uid = 'issue-' . $issue->{'issue_id'} . '@' . $domain; |
82 |
# Create the event |
85 |
# Create the event |
|
|
86 |
|
87 |
my ( $dtstart, $dtend ); |
88 |
# Checkouts due at 23:59 are "all day events" |
89 |
if ( $datestart_local->hour eq '23' && $datestart_local->minute eq '59' ) { |
90 |
$dtstart = $datestart->ymd(q{}); |
91 |
$dtend = $datestart->clone()->add(days => 1)->ymd(q{}), |
92 |
} |
93 |
else { # Checkouts due any other time start at 00:00 and end at the due time |
94 |
$dtstart = DateTime::Format::ICal->format_datetime($datestart->clone()->truncate( to => "day")); |
95 |
$dtend = DateTime::Format::ICal->format_datetime($datestart); |
96 |
} |
97 |
|
83 |
$vevent->add_properties( |
98 |
$vevent->add_properties( |
84 |
summary => $summary, |
99 |
summary => $summary, |
85 |
description => $description, |
100 |
description => $description, |
86 |
dtstamp => DateTime::Format::ICal->format_datetime($timestamp), |
101 |
dtstart => $dtstart, |
87 |
dtstart => DateTime::Format::ICal->format_datetime($datestart), |
102 |
dtend => $datestart->clone()->add(days => 1)->ymd(q{}), |
88 |
uid => $uid, |
103 |
uid => $uid, |
89 |
); |
104 |
); |
90 |
# Add it to the calendar |
105 |
# Add it to the calendar |
91 |
- |
|
|