[Rt-commit] rt branch, 4.0/add-date-datetime-to-bulk-update, created. rt-4.0.18-127-gdff134d
Jim Brandt
jbrandt at bestpractical.com
Fri Jan 3 13:57:51 EST 2014
The branch, 4.0/add-date-datetime-to-bulk-update has been created
at dff134d8c888e92173d83a8b85a63eba1aba6be2 (commit)
- Log -----------------------------------------------------------------
commit dff134d8c888e92173d83a8b85a63eba1aba6be2
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Aug 22 18:55:30 2013 -0400
Add Date and DateTime CFs to bulk update
Date conversion is needed only for delete because AddValueForObject
in RT::CustomField calls CanonicalizeValue methods to handle
conversion on add.
Don't pass a Default value for Date and DateTime because the
display in parens differs from the dates in the top section
which puts values in the text box like other fields. This
will ulimately be fixed for 4.4 via 4.2/date-input-keep-value.
diff --git a/share/html/Elements/EditCustomFieldDateTime b/share/html/Elements/EditCustomFieldDateTime
index 3d94855..761d8fc 100644
--- a/share/html/Elements/EditCustomFieldDateTime
+++ b/share/html/Elements/EditCustomFieldDateTime
@@ -50,7 +50,7 @@
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
-$DateObj->Set( Format => 'ISO', Value => $Default );
+$DateObj->Set( Format => $Format, Value => $Default );
</%INIT>
<%ARGS>
$Object => undef
@@ -59,4 +59,5 @@ $NamePrefix => undef
$Default => undef
$Values => undef
$MaxValues => 1
+$Format => 'ISO'
</%ARGS>
diff --git a/share/html/Search/Bulk.html b/share/html/Search/Bulk.html
index 5cc4000..1b54a69 100644
--- a/share/html/Search/Bulk.html
+++ b/share/html/Search/Bulk.html
@@ -184,6 +184,11 @@ $cfs->LimitToQueue($_) for keys %$seen_queues;
% my @del = (NamePrefix => 'Bulk-Delete-CustomField-', CustomField => $cf,
% Rows => $rows, Multiple => 1, Cols => 25,
% Default => $ARGS{"Bulk-Delete-CustomField-$cf_id-Values"} || $ARGS{"Bulk-Delete-CustomField-$cf_id-Value"}, );
+% # Remove Default for Date and DateTime CFs below.
+% my %add_params = @add;
+% delete $add_params{'Default'};
+% my %del_params = @del;
+% delete $del_params{'Default'};
% if ($cf->Type eq 'Select') {
<td><& /Elements/EditCustomFieldSelect, @add &></td>
<td><& /Elements/EditCustomFieldSelect, @del &></td>
@@ -196,6 +201,13 @@ $cfs->LimitToQueue($_) for keys %$seen_queues;
% } elsif ($cf->Type eq 'Text') {
<td><& /Elements/EditCustomFieldText, @add &></td>
<td> </td>
+% } elsif ($cf->Type eq 'Date') {
+<td><& /Elements/EditCustomFieldDate, %add_params &></td>
+<td><& /Elements/EditCustomFieldDate, %del_params &></td>
+% } elsif ($cf->Type eq 'DateTime') {
+% # Pass datemanip format to prevent another tz date conversion
+<td><& /Elements/EditCustomFieldDateTime, %add_params, Format => 'datemanip' &></td>
+<td><& /Elements/EditCustomFieldDateTime, %del_params, Format => 'datemanip' &></td>
% } else {
% $RT::Logger->crit("Unknown CustomField type: " . $cf->Type);
% }
@@ -360,6 +372,19 @@ unless ( $ARGS{'AddMoreAttach'} ) {
my $current_values = $Ticket->CustomFieldValues($cfid);
foreach my $value (@values) {
+
+ # Convert for timezone. Without converstion,
+ # HasEntry and DeleteCustomFieldValue fail because
+ # the value in the DB is converted.
+ if ( $op eq 'del'
+ && ($cf->Type eq 'DateTime' || $cf->Type eq 'Date') ){
+ my $DateObj = RT::Date->new( $session{'CurrentUser'} );
+ $DateObj->Set( Format => 'unknown',
+ Value => $value );
+ $value = $cf->Type eq 'DateTime' ? $DateObj->ISO
+ : $DateObj->ISO(Time => 0, Seconds => 0);
+ }
+
if ( $op eq 'del' && $current_values->HasEntry($value) ) {
my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue(
Field => $cfid,
-----------------------------------------------------------------------
More information about the rt-commit
mailing list