[Rt-commit] rt branch, 4.2/unset-dates, created. rt-4.2.5-65-g3477430
Alex Vandiver
alexmv at bestpractical.com
Mon Jun 30 14:54:28 EDT 2014
The branch, 4.2/unset-dates has been created
at 347743061583f002e92e3106316cfe4f1ed9765b (commit)
- Log -----------------------------------------------------------------
commit 347743061583f002e92e3106316cfe4f1ed9765b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Jun 30 14:04:41 2014 -0400
Fix unsetting of core date fields
b4c54faf switched to using ->IsSet instead of checking ->Unix to
determine if a date was set. However, two of the changed tests (in
RT::Interface::Web) actually check "defined $date->Unix" -- which is
always true. This led to it being impossible to unset core date fields.
Remove ->IsSet checks entirely, as the appropriate replacement for
"defined $date->Unix" is nothing, as it is always true.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index f18ff9d..717aee9 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2969,9 +2969,7 @@ sub ProcessTicketReminders {
Format => 'unknown',
Value => $due,
);
- if ( $DateObj->IsSet
- && $DateObj->Unix != $reminder->DueObj->Unix )
- {
+ if ( $DateObj->Unix != $reminder->DueObj->Unix ) {
( $status, $msg ) = $reminder->SetDue( $DateObj->ISO );
}
else {
@@ -3430,9 +3428,7 @@ sub ProcessTicketDates {
);
my $obj = $field . "Obj";
- if ( ( $DateObj->IsSet )
- and ( $DateObj->Unix != $Ticket->$obj()->Unix() ) )
- {
+ if ( $DateObj->Unix != $Ticket->$obj()->Unix() ) {
my $method = "Set$field";
my ( $code, $msg ) = $Ticket->$method( $DateObj->ISO );
push @results, "$msg";
diff --git a/t/web/ticket_modify_all.t b/t/web/ticket_modify_all.t
index cf398b2..5891846 100644
--- a/t/web/ticket_modify_all.t
+++ b/t/web/ticket_modify_all.t
@@ -1,13 +1,15 @@
use strict;
use warnings;
-use RT::Test tests => 22;
+use RT::Test tests => undef;
my $ticket = RT::Test->create_ticket(
Subject => 'test bulk update',
Queue => 1,
);
+RT->Config->Set(AutocompleteOwners => 1);
+
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login, 'logged in' );
@@ -25,12 +27,6 @@ $m->content_lacks("this is update content", 'textarea is clear');
$m->get_ok($url . '/Ticket/Display.html?id=' . $ticket->id );
$m->content_contains("this is update content", 'updated content in display page');
-# NOTE http://issues.bestpractical.com/Ticket/Display.html?id=18284
-RT::Test->stop_server;
-RT->Config->Set(AutocompleteOwners => 1);
-($url, $m) = RT::Test->started_ok;
-$m->login;
-
$m->get_ok($url . '/Ticket/ModifyAll.html?id=' . $ticket->id);
$m->form_name('TicketModifyAll');
@@ -57,10 +53,18 @@ $m->field('Told_Date' => "2015-01-01 00:00:00");
$m->click('SubmitTicket');
$m->text_contains("Last Contact: (Thu Jan 01 00:00:00 2015)", 'told date successfully updated');
-$m->form_name('TicketModifyAll');
-$m->field('Due_Date' => "2016-01-01 00:00:00");
-$m->click('SubmitTicket');
-$m->text_contains("Due: (Fri Jan 01 00:00:00 2016)", 'due date successfully updated');
+for my $unset ("0", "-", " ") {
+ $m->form_name('TicketModifyAll');
+ $m->field('Due_Date' => "2016-01-01 00:00:00");
+ $m->click('SubmitTicket');
+ $m->text_contains("Due: (Fri Jan 01 00:00:00 2016)", 'due date successfully updated');
+
+ $m->form_name('TicketModifyAll');
+ $m->field('Due_Date' => $unset);
+ $m->click('SubmitTicket');
+ $m->text_contains("Due: (Not set)", "due date successfully cleared with '$unset'");
+ $m->warning_like(qr/Couldn't parse date '-'/) if $unset eq "-";
+}
$m->get( $url . '/Ticket/ModifyAll.html?id=' . $ticket->id );
$m->form_name('TicketModifyAll');
@@ -80,4 +84,5 @@ $m->text_contains(
'no duplicate watchers',
);
-# XXX TODO test other parts, i.e. links
+undef $m;
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list