X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FElements%2FEditSearches;fp=rt%2Fshare%2Fhtml%2FSearch%2FElements%2FEditSearches;h=0a55e0dff8cfd14b9eae694c6f7b829ed255a1eb;hb=1c538bfabc2cd31f27067505f0c3d1a46cba6ef0;hp=f5be486b8fd48ea73d571cfd76e5ff6cd72397fc;hpb=4f5619288413a185e9933088d9dd8c5afbc55dfa;p=freeside.git diff --git a/rt/share/html/Search/Elements/EditSearches b/rt/share/html/Search/Elements/EditSearches index f5be486b8..0a55e0dff 100644 --- a/rt/share/html/Search/Elements/EditSearches +++ b/rt/share/html/Search/Elements/EditSearches @@ -146,7 +146,7 @@ $SavedSearch => {} $SavedSearch->{'Id'} = ( $ARGS{Type} && $ARGS{Type} eq 'Chart' ? $ARGS{'SavedChartSearchId'} : $ARGS{'SavedSearchId'} ) || 'new'; -$SavedSearch->{'Description'} = $ARGS{'SavedSearchDescription'} || undef; +$SavedSearch->{'Description'} = $ARGS{'SavedSearchDescription'} || ''; $SavedSearch->{'Privacy'} = $ARGS{'SavedSearchOwner'} || undef; my @results; @@ -158,7 +158,8 @@ if ( $ARGS{'SavedSearchRevert'} ) { if ( $ARGS{'SavedSearchLoad'} ) { my ($container, $id ) = _parse_saved_search ($ARGS{'SavedSearchLoad'}); if ( $container ) { - my $search = $container->Attributes->WithId( $id ); + my $search = RT::Attribute->new( $session{'CurrentUser'} ); + $search->Load( $id ); $SavedSearch->{'Id'} = $ARGS{'SavedSearchLoad'}; $SavedSearch->{'Object'} = $search; $SavedSearch->{'Description'} = $search->Description; @@ -194,7 +195,8 @@ elsif ( $ARGS{'SavedSearchDelete'} ) { } elsif ( $ARGS{'SavedSearchCopy'} ) { my ($container, $id ) = _parse_saved_search( $ARGS{'SavedSearchId'} ); - $SavedSearch->{'Object'} = $container->Attributes->WithId( $id ); + $SavedSearch->{'Object'} = RT::Attribute->new( $session{'CurrentUser'} ); + $SavedSearch->{'Object'}->Load( $id ); if ( $ARGS{'SavedSearchDescription'} && $ARGS{'SavedSearchDescription'} ne $SavedSearch->{'Object'}->Description ) { $SavedSearch->{'Description'} = $ARGS{'SavedSearchDescription'}; } else { @@ -208,7 +210,8 @@ if ( $SavedSearch->{'Id'} && $SavedSearch->{'Id'} ne 'new' && !$SavedSearch->{'Object'} ) { my ($container, $id ) = _parse_saved_search( $ARGS{'SavedSearchId'} ); - $SavedSearch->{'Object'} = $container->Attributes->WithId( $id ); + $SavedSearch->{'Object'} = RT::Attribute->new( $session{'CurrentUser'} ); + $SavedSearch->{'Object'}->Load( $id ); $SavedSearch->{'Description'} ||= $SavedSearch->{'Object'}->Description; } @@ -290,7 +293,7 @@ if ( $obj && $obj->id ) { } push @results, loc('Updated saved search "[_1]"', $desc); } -elsif ( $id eq 'new' ) { +elsif ( $id eq 'new' and defined $desc and length $desc ) { my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} ); my ($status, $msg) = $saved_search->Save( Privacy => $privacy, @@ -300,8 +303,8 @@ elsif ( $id eq 'new' ) { ); if ( $status ) { - $SavedSearch->{'Object'} = - $session{'CurrentUser'}->UserObj->Attributes->WithId( $saved_search->Id ); + $SavedSearch->{'Object'} = RT::Attribute->new( $session{'CurrentUser'} ); + $SavedSearch->{'Object'}->Load( $saved_search->Id ); # Build new SearchId $SavedSearch->{'Id'} = ref( $session{'CurrentUser'}->UserObj ) . '-' @@ -313,6 +316,9 @@ elsif ( $id eq 'new' ) { push @results, loc("Can't find a saved search to work with").': '.loc($msg); } } +elsif ( $id eq 'new' ) { + push @results, loc("Can't save a search without a Description"); +} else { push @results, loc("Can't save this search"); }