[Rt-commit] rt branch, 4.0/add-date-datetime-to-bulk-update, created. rt-4.0.17-76-geebb99d
Jim Brandt
jbrandt at bestpractical.com
Thu Aug 22 19:02:28 EDT 2013
The branch, 4.0/add-date-datetime-to-bulk-update has been created
at eebb99df444576d7afca4b83d15b1dfcabfff493 (commit)
- Log -----------------------------------------------------------------
commit eebb99df444576d7afca4b83d15b1dfcabfff493
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.
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..a16dea9 100644
--- a/share/html/Search/Bulk.html
+++ b/share/html/Search/Bulk.html
@@ -196,6 +196,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 &></td>
+<td><& /Elements/EditCustomFieldDate, @del &></td>
+% } elsif ($cf->Type eq 'DateTime') {
+% # Pass datemanip format to prevent another tz date conversion
+<td><& /Elements/EditCustomFieldDateTime, @add, Format => 'datemanip' &></td>
+<td><& /Elements/EditCustomFieldDateTime, @del, Format => 'datemanip' &></td>
% } else {
% $RT::Logger->crit("Unknown CustomField type: " . $cf->Type);
% }
@@ -360,6 +367,17 @@ 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' ){
+ my $DateObj = RT::Date->new( $session{'CurrentUser'} );
+ $DateObj->Set( Format => 'unknown',
+ Value => $value );
+ $value = $DateObj->ISO;
+ }
+
if ( $op eq 'del' && $current_values->HasEntry($value) ) {
my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue(
Field => $cfid,
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list