%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
% } elsif ($cf->Type eq 'Text') {
<td><& /Elements/EditCustomFieldText, @add &></td>
<td> </td>
+% } elsif ($cf->Type eq 'Date') {
+<td><& /Elements/EditCustomFieldDate, @add, Default => undef &></td>
+<td><& /Elements/EditCustomFieldDate, @del, Default => undef &></td>
+% } elsif ($cf->Type eq 'DateTime') {
+% # Pass datemanip format to prevent another tz date conversion
+<td><& /Elements/EditCustomFieldDateTime, @add, Default => undef, Format => 'datemanip' &></td>
+<td><& /Elements/EditCustomFieldDateTime, @del, Default => undef, Format => 'datemanip' &></td>
% } else {
% $RT::Logger->crit("Unknown CustomField type: " . $cf->Type);
% }
#Iterate through each ticket we've been handed
my @linkresults;
-my %queues;
$Tickets->RedoSearch();
#Update the links
$ARGS{'id'} = $Ticket->id;
- $queues{ $Ticket->QueueObj->Id }++;
my @updateresults = ProcessUpdateMessage(
TicketObj => $Ticket,
unless ( $cf->SingleValue );
my $current_values = $Ticket->CustomFieldValues($cfid);
+
+ if ( $cf->Type eq 'DateTime' || $cf->Type eq 'Date' ){
+ # Clear out empty string submissions to avoid
+ # Not set changed to Not set
+ @values = grep length, @values;
+ }
+
foreach my $value (@values) {
- if ( $op eq 'del' && $current_values->HasEntry($value) ) {
- my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue(
- Field => $cfid,
- Value => $value
- );
- push @cfresults, $msg;
+
+ if ( $op eq 'del' ) {
+ if ( my $entry = $current_values->HasEntry($value) ) {
+ my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue(
+ Field => $cfid,
+ ValueId => $entry->id,
+ );
+ push @cfresults, $msg;
+ }
}
elsif ( $op eq 'add' && !$current_values->HasEntry($value) ) {
# Cleanup WebUI
delete $session{'Attachments'};
+
+ $Tickets->RedoSearch();
}
my $TxnCFs = RT::CustomFields->new( $session{CurrentUser} );
$TxnCFs->LimitToLookupType( RT::Transaction->CustomFieldLookupType );
-$TxnCFs->LimitToGlobalOrObjectId( sort keys %queues );
+$TxnCFs->LimitToGlobalOrObjectId( keys %$seen_queues );
</%INIT>
<%args>