[Rt-commit] r6851 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.2: .
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jan 26 14:02:25 EST 2007
Author: ruz
Date: Fri Jan 26 14:02:24 2007
New Revision: 6851
Modified:
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/ (props changed)
rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm
Log:
r4420 at cubic-pc (orig r6729): jesse | 2007-01-10 09:53:50 +0300
r46883 at pinglin: jesse | 2007-01-10 01:53:34 -0500
* If the user submits two "add watcher" records with the same http arg name, treat them as separate.
Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm Fri Jan 26 14:02:24 2007
@@ -1366,27 +1366,30 @@
my $Ticket = $args{'TicketObj'};
my $ARGSRef = $args{'ARGSRef'};
- # {{{ Munge watchers
+ # Munge watchers
foreach my $key ( keys %$ARGSRef ) {
- # {{{ Delete deletable watchers
- if ( ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) ) {
- my ( $code, $msg ) =
- $Ticket->DeleteWatcher(PrincipalId => $2,
- Type => $1);
+ # Delete deletable watchers
+ if ( ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) )
+ {
+ my ( $code, $msg ) = $Ticket->DeleteWatcher(
+ PrincipalId => $2,
+ Type => $1
+ );
push @results, $msg;
}
# Delete watchers in the simple style demanded by the bulk manipulator
- elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
- my ( $code, $msg ) = $Ticket->DeleteWatcher( Email => $ARGSRef->{$key}, Type => $1 );
+ elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
+ my ( $code, $msg ) = $Ticket->DeleteWatcher(
+ Email => $ARGSRef->{$key},
+ Type => $1
+ );
push @results, $msg;
}
- # }}}
-
- # Add new wathchers by email address
+ # Add new wathchers by email address
elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
and ( $key =~ /^WatcherTypeEmail(\d*)$/ ) )
{
@@ -1409,18 +1412,23 @@
}
# Add new watchers by owner
- elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
- and ( $key =~ /^Ticket-AddWatcher-Principal-(\d*)$/ ) ) {
-
- #They're in this order because otherwise $1 gets clobbered :/
- my ( $code, $msg ) =
- $Ticket->AddWatcher( Type => $ARGSRef->{$key}, PrincipalId => $1 );
- push @results, $msg;
+ elsif ( $key =~ /^Ticket-AddWatcher-Principal-(\d*)$/ ) {
+ my $form = $ARGSRef->{$key};
+ foreach my $value ( ref($form) ? @{$form} : ($form) ) {
+
+ if ( $value =~ /^(AdminCc|Cc|Requestor)$/ ) {
+
+ #They're in this order because otherwise $1 gets clobbered :/
+ my ( $code, $msg ) = $Ticket->AddWatcher(
+ Type => $ARGSRef->{$key},
+ PrincipalId => $1
+ );
+ push @results, $msg;
+ }
+ }
}
- }
-
- # }}}
+ }
return (@results);
}
More information about the Rt-commit
mailing list