X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FBulk.html;h=03e6bf02721131ad47f87d4851b091165533a953;hb=34e42c0d926bf569ceaf8da784c2569bc7f83cec;hp=9fbbc47902edf633ed388b4c8695004c439a455f;hpb=679854b8bbc65d112071111bbd7f34a6a481fb30;p=freeside.git diff --git a/rt/share/html/Search/Bulk.html b/rt/share/html/Search/Bulk.html index 9fbbc4790..03e6bf027 100755 --- a/rt/share/html/Search/Bulk.html +++ b/rt/share/html/Search/Bulk.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -202,6 +202,13 @@ $cfs->LimitToQueue($_) for keys %$seen_queues; % } elsif ($cf->Type eq 'Text') { <& /Elements/EditCustomFieldText, @add &>   +% } elsif ($cf->Type eq 'Date') { +<& /Elements/EditCustomFieldDate, @add, Default => undef &> +<& /Elements/EditCustomFieldDate, @del, Default => undef &> +% } elsif ($cf->Type eq 'DateTime') { +% # Pass datemanip format to prevent another tz date conversion +<& /Elements/EditCustomFieldDateTime, @add, Default => undef, Format => 'datemanip' &> +<& /Elements/EditCustomFieldDateTime, @del, Default => undef, Format => 'datemanip' &> % } else { % $RT::Logger->crit("Unknown CustomField type: " . $cf->Type); % } @@ -229,6 +236,13 @@ unless ( defined $Rows ) { } my $title = loc("Update multiple tickets"); +#freeside +unless ( $session{'CurrentUser'} + ->HasRight( Right => 'BulkUpdateTickets', Object => RT->System) ) +{ + Abort('You are not allowed to bulk-update tickets.'); +} + # Iterate through the ARGS hash and remove anything with a null value. map ( $ARGS{$_} =~ /^$/ && ( delete $ARGS{$_} ), keys %ARGS ); @@ -279,7 +293,6 @@ while ( my $ticket = $Tickets->Next ) { #Iterate through each ticket we've been handed my @linkresults; -my %queues; $Tickets->RedoSearch(); @@ -306,7 +319,6 @@ unless ( $ARGS{'AddMoreAttach'} ) { #Update the links $ARGS{'id'} = $Ticket->id; - $queues{ $Ticket->QueueObj->Id }++; my @updateresults = ProcessUpdateMessage( TicketObj => $Ticket, @@ -374,13 +386,23 @@ unless ( $ARGS{'AddMoreAttach'} ) { 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) ) { @@ -413,11 +435,13 @@ unless ( $ARGS{'AddMoreAttach'} ) { # 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 ); <%args>