%args>
$Date => undef
$Object => undef
$DateTypes => undef
%args>
<%init>
use RTx::Calendar;
my $today = $Date->strftime("%F");
my $TicketId;
my $ticket;
my $subject;
my $IsReminder;
if ($Object->Type eq 'reminder') {
$IsReminder = 1;
if ($Object->RefersTo->First) {
$ticket = $Object->RefersTo->First->TargetObj;
$TicketId = $ticket->Id;
$subject = $Object->Subject . " (" . $ticket->Subject . ")";
}
} else {
$TicketId = $Object->Id;
$subject = $Object->Subject;
}
my $display_owner = $RT::CalendarDisplayOwner;
$display_owner ||= RT->Config->Get('CalendarDisplayOwner')
if RT->can('Config');
# 3.6 config
my @display_fields = @RT::CalendarPopupFields;
# 3.8 config
# the if condition is weird but it doesn't work with 3.8.0 without the last part
@display_fields = RT->Config->Get('CalendarPopupFields')
if 0 == @display_fields and RT->can('Config') and RT->Config->Get('CalendarPopupFields');
# default
if (0 == @display_fields) {
@display_fields = qw(OwnerObj->Name CreatedObj->ISO StartsObj->ISO
StartedObj->ISO LastUpdatedObj->ISO DueObj->ISO
ResolvedObj->ISO Status Priority
Requestors->MemberEmailAddressesAsString);
}
my %label_of;
for my $field (@display_fields) {
my $label = $field;
$label =~ s'Obj-.(?:AsString|Name|ISO)''g;
$label =~ s'-\>MemberEmailAddressesAsString''g;
$label_of{$field} = $label;
}
%init>