[Bps-public-commit] rt-extension-assets branch, 1.0-trunk, updated. f0ae812bb55b04398c218d406ebde8e0212a6672

Alex Vandiver alexmv at bestpractical.com
Tue Jan 28 18:16:00 EST 2014


The branch, 1.0-trunk has been updated
       via  f0ae812bb55b04398c218d406ebde8e0212a6672 (commit)
       via  931a782daab713f8854093c23a2b09373fbc65cd (commit)
       via  d87cd134b7897164d95626220b507530ba8b3ce7 (commit)
      from  5943d56b58f55a09e8d947e1c40c0a65f09f0a16 (commit)

Summary of changes:
 lib/RT/Assets.pm           | 12 +++++++++---
 lib/RT/Extension/Assets.pm |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit d87cd134b7897164d95626220b507530ba8b3ce7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 28 18:14:28 2014 -0500

    Ensure that we do not try to id = 'string'

diff --git a/lib/RT/Assets.pm b/lib/RT/Assets.pm
index b7ad98e..cdfd4a1 100644
--- a/lib/RT/Assets.pm
+++ b/lib/RT/Assets.pm
@@ -195,7 +195,7 @@ sub SimpleSearch {
                 VALUE           => $args{Term},
                 ENTRYAGGREGATOR => 'OR',
                 SUBCLAUSE       => 'autocomplete',
-            );
+            ) unless $args{Term} =~ /\D/ and $name eq 'id';
         }
     }
     return $self;

commit 931a782daab713f8854093c23a2b09373fbc65cd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 28 18:15:34 2014 -0500

    Pass the Catalog (which is the fetched DefaultCatalog) down into SimpleSearch
    
    Previously, we limited to Catalog IS NULL

diff --git a/lib/RT/Extension/Assets.pm b/lib/RT/Extension/Assets.pm
index 34485db..69dae4c 100644
--- a/lib/RT/Extension/Assets.pm
+++ b/lib/RT/Extension/Assets.pm
@@ -204,7 +204,7 @@ RT->AddJavaScript("RTx-Assets.js");
         my @PassArguments;
 
         if ($ARGSRef->{q}) {
-            $args{'Assets'}->SimpleSearch( Term => $ARGSRef->{q} );
+            $args{'Assets'}->SimpleSearch( Term => $ARGSRef->{q}, Catalog => $args{Catalog} );
             push @PassArguments, "q";
         } elsif ( $ARGSRef->{'SearchAssets'} ){
             for my $key (keys %$ARGSRef) {

commit f0ae812bb55b04398c218d406ebde8e0212a6672
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 28 18:15:54 2014 -0500

    Accept Catalog as either an object or an id/name to load

diff --git a/lib/RT/Assets.pm b/lib/RT/Assets.pm
index cdfd4a1..0315043 100644
--- a/lib/RT/Assets.pm
+++ b/lib/RT/Assets.pm
@@ -156,9 +156,15 @@ sub SimpleSearch {
     # and currently fails in odd ways.  Such a mapping obviously assumes
     # that names are unique within the catalog, but ids are also
     # allowable as well.
+    my $catalog;
+    if (ref $args{Catalog}) {
+        $catalog = $args{Catalog};
+    } else {
+        $catalog = RT::Catalog->new( $self->CurrentUser );
+        $catalog->Load( $args{Catalog} );
+    }
+
     my %cfs;
-    my $catalog = RT::Catalog->new( $self->CurrentUser );
-    $catalog->Load( $args{Catalog} );
     my $cfs = $catalog->AssetCustomFields;
     while (my $customfield = $cfs->Next) {
         $cfs{$customfield->id} = $cfs{$customfield->Name}

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list