[Rt-commit] r13275 - in rt/branches/3.8-TESTING: share/html/Search/Elements
elacour at bestpractical.com
elacour at bestpractical.com
Fri Jun 13 06:16:38 EDT 2008
Author: elacour
Date: Fri Jun 13 06:16:37 2008
New Revision: 13275
Modified:
rt/branches/3.8-TESTING/ (props changed)
rt/branches/3.8-TESTING/share/html/Search/Elements/EditSearches
Log:
r9514 at datura: manu | 2008-06-13 12:16:31 +0200
Skip oj_id/obj_type update if there is no change to avoid error messages to
user.
Modified: rt/branches/3.8-TESTING/share/html/Search/Elements/EditSearches
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Search/Elements/EditSearches (original)
+++ rt/branches/3.8-TESTING/share/html/Search/Elements/EditSearches Fri Jun 13 06:16:37 2008
@@ -222,7 +222,7 @@
my $privacy = $SavedSearch->{'Privacy'};
my %params = map { $_ => $Query->{$_} } @SearchFields;
-my ($obj_type, $obj_id) = split(/\-/, ($privacy || ''));
+my ($new_obj_type, $new_obj_id) = split(/\-/, ($privacy || ''));
if ( $obj && $obj->id ) {
# permission check
@@ -235,11 +235,22 @@
$obj->SetSubValues( %params );
$obj->SetDescription( $desc );
- if ( $obj_type && $obj_id ) {
- my ($val, $msg ) = $obj->SetObjectType($obj_type);
- push @results, loc ('Unable to set privacy object: [_1]', $msg) unless ( $val );
- ($val, $msg) = $obj->SetObjectId($obj_id);
- push @results, loc ('Unable to set privacy id: [_1]', $msg) unless ( $val );
+
+ my $obj_type = ref($obj->Object);
+ # We need to get current obj_id now, because when we change obj_type to
+ # RT::System, $obj->Object->Id returns 1, not the old one :(
+ my $obj_id = $obj->Object->Id;
+
+ if ( $new_obj_type && $new_obj_id ) {
+ my ($val, $msg);
+ if ( $new_obj_type ne $obj_type ) {
+ ($val, $msg ) = $obj->SetObjectType($new_obj_type);
+ push @results, loc ('Unable to set privacy object: [_1]', $msg) unless ( $val );
+ }
+ if ( $new_obj_id != $obj_id ) {
+ ($val, $msg) = $obj->SetObjectId($new_obj_id);
+ push @results, loc ('Unable to set privacy id: [_1]', $msg) unless ( $val );
+ }
} else {
push @results, loc('Unable to determine object type or id');
}
More information about the Rt-commit
mailing list