diff --git a/lib/RT/Action/CreateTickets.pm b/lib/RT/Action/CreateTickets.pm
index a88a6ee71f8..5fa64f9c030 100644
--- a/lib/RT/Action/CreateTickets.pm
+++ b/lib/RT/Action/CreateTickets.pm
@@ -691,7 +691,7 @@ sub ParseLines {
eval {
$dateobj->Set( Format => 'iso', Value => $args{$date} );
};
- if ($@ or $dateobj->Unix <= 0) {
+ if ($@ or not $dateobj->IsSet) {
$dateobj->Set( Format => 'unknown', Value => $args{$date} );
}
}
diff --git a/lib/RT/Action/EscalatePriority.pm b/lib/RT/Action/EscalatePriority.pm
index 046d6ddbbd6..344604c8c04 100644
--- a/lib/RT/Action/EscalatePriority.pm
+++ b/lib/RT/Action/EscalatePriority.pm
@@ -104,7 +104,7 @@ sub Prepare {
# If we don't have a due date, adjust the priority by one
# until we hit the final priority
- if ($due->Unix() < 1) {
+ if (not $due->IsSet) {
if ( $self->TicketObj->Priority > $self->TicketObj->FinalPriority ){
$self->{'prio'} = ($self->TicketObj->Priority - 1);
return 1;
diff --git a/lib/RT/Action/LinearEscalate.pm b/lib/RT/Action/LinearEscalate.pm
index e6260aa148e..fb2f6ea414b 100644
--- a/lib/RT/Action/LinearEscalate.pm
+++ b/lib/RT/Action/LinearEscalate.pm
@@ -155,8 +155,7 @@ sub Prepare {
my $ticket = $self->TicketObj;
- my $due = $ticket->DueObj->Unix;
- unless ( $due > 0 ) {
+ unless ( $ticket->DueObj->IsSet ) {
$RT::Logger->debug('Due is not set. Not escalating.');
return 1;
}
@@ -181,9 +180,8 @@ sub Prepare {
# now we know we have a due date. for every day that passes,
# increment priority according to the formula
- my $starts = $ticket->StartsObj->Unix;
- $starts = $ticket->CreatedObj->Unix unless $starts > 0;
- my $now = time;
+ my $starts = $ticket->StartsObj->IsSet ? $ticket->StartsObj->Unix : $ticket->CreatedObj->Unix;
+ my $now = time;
# do nothing if we didn't reach starts or created date
if ( $starts > $now ) {
@@ -191,6 +189,7 @@ sub Prepare {
return 1;
}
+ my $due = $ticket->DueObj->Unix;
$due = $starts + 1 if $due <= $starts; # +1 to avoid div by zero
my $percent_complete = ($now-$starts)/($due - $starts);
diff --git a/lib/RT/Condition/BeforeDue.pm b/lib/RT/Condition/BeforeDue.pm
index 7e5f1f75f31..fa7f364e5ee 100644
--- a/lib/RT/Condition/BeforeDue.pm
+++ b/lib/RT/Condition/BeforeDue.pm
@@ -86,7 +86,7 @@ sub IsApplicable {
my $cur = RT::Date->new( RT->SystemUser );
$cur->SetToNow();
my $due = $self->TicketObj->DueObj;
- return (undef) if $due->Unix <= 0;
+ return (undef) unless $due->IsSet;
my $diff = $due->Diff($cur);
if ( $diff >= 0 and $diff <= $elapse ) {
diff --git a/lib/RT/Condition/Overdue.pm b/lib/RT/Condition/Overdue.pm
index bf044f8c0db..444e373e1b4 100644
--- a/lib/RT/Condition/Overdue.pm
+++ b/lib/RT/Condition/Overdue.pm
@@ -70,7 +70,7 @@ If the due date is before "now" return true
sub IsApplicable {
my $self = shift;
- if ($self->TicketObj->DueObj->Unix > 0 and
+ if ($self->TicketObj->DueObj->IsSet and
$self->TicketObj->DueObj->Unix < time()) {
return(1);
}
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index 8a2dfa0c81c..ccd23aee87f 100644
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -463,7 +463,7 @@ sub AsString {
my $self = shift;
my %args = (@_);
- return $self->loc("Not set") unless $self->Unix > 0;
+ return $self->loc("Not set") unless $self->IsSet;
my $format = RT->Config->Get( 'DateTimeFormat', $self->CurrentUser ) || 'DefaultFormat';
$format = { Format => $format } unless ref $format;
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 439255c7d87..c1eb0e19f9b 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2968,7 +2968,7 @@ sub ProcessTicketReminders {
Format => 'unknown',
Value => $due,
);
- if ( defined $DateObj->Unix
+ if ( $DateObj->IsSet
&& $DateObj->Unix != $reminder->DueObj->Unix )
{
( $status, $msg ) = $reminder->SetDue( $DateObj->ISO );
@@ -3429,7 +3429,7 @@ sub ProcessTicketDates {
);
my $obj = $field . "Obj";
- if ( ( defined $DateObj->Unix )
+ if ( ( $DateObj->IsSet )
and ( $DateObj->Unix != $Ticket->$obj()->Unix() ) )
{
my $method = "Set$field";
diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index aaff9f14681..b8b2c2f203d 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -604,7 +604,7 @@ sub _LimitCustomField {
} elsif ( $type =~ /^Date(?:Time)?$/ ) {
my $date = RT::Date->new( $self->CurrentUser );
$date->Set( Format => 'unknown', Value => $value );
- if ( $date->Unix ) {
+ if ( $date->IsSet ) {
if (
$type eq 'Date'
# Heuristics to determine if a date, and not
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index c80427001f5..46577e4519d 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -2376,7 +2376,7 @@ sub _SetStatus {
if ( $args{SetStarted}
&& $args{Lifecycle}->IsInitial($old)
&& !$args{NewLifecycle}->IsInitial($args{Status})
- && !$raw_started->Unix) {
+ && !$raw_started->IsSet) {
# Set the Started time to "now"
$self->_Set(
Field => 'Started',
diff --git a/share/html/Approvals/Elements/PendingMyApproval b/share/html/Approvals/Elements/PendingMyApproval
index 96d3e860a91..c77a021d561 100644
--- a/share/html/Approvals/Elements/PendingMyApproval
+++ b/share/html/Approvals/Elements/PendingMyApproval
@@ -70,9 +70,9 @@
/>
-<&|/l_unsafe, qq{"&>Only show approvals for requests created before [_1]&>
+<&|/l_unsafe, qq{"&>Only show approvals for requests created before [_1]&>
-<&|/l_unsafe, qq{"&>Only show approvals for requests created after [_1]&>
+<&|/l_unsafe, qq{"&>Only show approvals for requests created after [_1]&>
&>
<%init>
diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index 359a79da96f..b95a9ba1100 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -207,7 +207,7 @@ $COLUMN_MAP = {
value => sub {
my $date = $_[0]->DueObj;
# Highlight the date if it was due in the past, and it's still active
- if ( $date && $date->Unix > 0 && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) {
+ if ( $date && $date->IsSet && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) {
return (\'' , $date->AgeAsString , \'');
} else {
return $date->AgeAsString;
diff --git a/share/html/Elements/ShowReminders b/share/html/Elements/ShowReminders
index 85b2b70e4cd..aa2346cd8ee 100644
--- a/share/html/Elements/ShowReminders
+++ b/share/html/Elements/ShowReminders
@@ -57,7 +57,7 @@ my $i =0;
while ( my $reminder = $reminders->Next ) {
$i++;
my $dueobj = $reminder->DueObj;
-my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0;
+my $overdue = $dueobj->IsSet && $dueobj->Diff < 0 ? 1 : 0;
my $targets = RT::Tickets->new($session{'CurrentUser'});
$targets->{'allow_deleted_search'} = 1;
diff --git a/share/html/Elements/ValidateCustomFields b/share/html/Elements/ValidateCustomFields
index 43f8ebd0b78..fc0049bb9a8 100644
--- a/share/html/Elements/ValidateCustomFields
+++ b/share/html/Elements/ValidateCustomFields
@@ -88,7 +88,7 @@ while ( my $CF = $CustomFields->Next ) {
Value => $_,
($CF->Type eq "Date" ? (Timezone => 'utc') : ())
);
- $DateObj->Unix > 0
+ $DateObj->IsSet
} @values;
}
push @values, '' unless @values;
diff --git a/share/html/NoAuth/iCal/dhandler b/share/html/NoAuth/iCal/dhandler
index f7e51d59e05..e319754e07c 100644
--- a/share/html/NoAuth/iCal/dhandler
+++ b/share/html/NoAuth/iCal/dhandler
@@ -86,9 +86,9 @@ $feed->add_properties('method' => ['publish']);
$feed->add_properties('prodid' => ["-//" . RT->Config->Get('rtname') ."//"]);
while (my $t = $tickets->Next) {
- next unless $t->DueObj->Unix > 0;
+ next unless $t->DueObj->IsSet;
- my $starttime = $t->StartsObj->Unix > 0 ? $t->StartsObj : $t->CreatedObj;
+ my $starttime = $t->StartsObj->IsSet ? $t->StartsObj : $t->CreatedObj;
my $url;
if ( RT->Config->Get('CanonicalizeURLsInFeeds') ) {
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 57e66df7290..e1a2ea36b3b 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -312,7 +312,7 @@
Status TimeLeft/;
$clone->{$_} = $CloneTicketObj->$_->AsString
- for grep { $CloneTicketObj->$_->Unix }
+ for grep { $CloneTicketObj->$_->IsSet }
map { $_ . "Obj" } qw/Starts Started Due Resolved/;
my $get_link_value = sub {
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index 0ce30abf377..5e61b1d8304 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -190,7 +190,7 @@ $Ticket
$Index
%args>
% my $dueobj = $Reminder->DueObj;
-% my $overdue = $dueobj->Unix > 0 && $dueobj->Diff < 0 ? 1 : 0;
+% my $overdue = $dueobj->IsSet && $dueobj->Diff < 0 ? 1 : 0;