[Rt-commit] r2733 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: .
lib/RT lib/t/regression
jesse at bestpractical.com
jesse at bestpractical.com
Sat Apr 16 04:20:46 EDT 2005
Author: jesse
Date: Sat Apr 16 04:20:45 2005
New Revision: 2733
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/SavedSearch.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/20savedsearch.t
Log:
r13122 at hualien: jesse | 2005-04-16 03:13:07 -0400
r13021 at hualien: jesse | 2005-04-16 02:28:10 -0400
r12963 at hualien: jesse | 2005-04-15 17:46:02 -0400
r12958 at hualien: jesse | 2005-04-15 17:30:30 -0400
r12957 at hualien (orig r2634): tla | 2005-04-15 17:21:25 -0400
Added ability to update name as well as search parameters.
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/SavedSearch.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/SavedSearch.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/SavedSearch.pm Sat Apr 16 04:20:45 2005
@@ -170,23 +170,27 @@
=head2 Update
-Updates the parameters of an existing search. Takes a hashref with
-the new parameters.
+Updates the parameters of an existing search. Takes the arguments
+"Name" and "SearchParams"; SearchParams should be a hashref containing
+the new parameters of the search. If Name is not specified, the name
+will not be changed.
=cut
sub Update {
my $self = shift;
- my $params = shift;
+ my %args = ('Name' => '',
+ 'SearchParams' => {},
+ @_);
return(0, $self->loc("No search loaded")) unless $self->Id;
return(0, $self->loc("Could not load search attribute"))
unless $self->{'Attribute'}->Id;
- my ($status, $msg) = $self->{'Attribute'}->SetSubValues(%{$params});
- if ($status) {
- # Update all the accessor variables.
- return ($status, $self->loc("Search update: [_1]", $msg));
+ my ($status, $msg) = $self->{'Attribute'}->SetSubValues(%{$args{'SearchParams'}});
+ if ($status && $args{'Name'}) {
+ ($status, $msg) = $self->{'Attribute'}->SetDescription($args{'Name'});
}
+ return ($status, $self->loc("Search update: [_1]", $msg));
}
=head2 Delete
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/20savedsearch.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/20savedsearch.t (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/20savedsearch.t Sat Apr 16 04:20:45 2005
@@ -147,8 +147,8 @@
isnt($loadedsearch4->Id, $othersearch->Id, "Did not load othersearch");
# Try to update an existing search.
-$loadedsearch1->Update({'Format' => $format,
- 'Query' => "Queue = '" . $queue->Name . "'" });
+$loadedsearch1->Update( SearchParams => {'Format' => $format,
+ 'Query' => "Queue = '" . $queue->Name . "'" } );
like($loadedsearch1->GetParameter('Query'), qr/Queue/,
"Updated mysearch parameter");
is($loadedsearch1->Type, 'Ticket', "mysearch is still for tickets");
More information about the Rt-commit
mailing list