[Bps-public-commit] rt-extension-assetsql branch, master, updated. d2d72091df114da0d8005b8384dcc2be8b911134

Shawn Moore shawn at bestpractical.com
Wed Jun 15 18:18:06 EDT 2016


The branch, master has been updated
       via  d2d72091df114da0d8005b8384dcc2be8b911134 (commit)
      from  6a3e4c77d402ffa71980aefb47e584be29c01ea6 (commit)

Summary of changes:
 patches/rt-4.4.2-later.patch | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit d2d72091df114da0d8005b8384dcc2be8b911134
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Jun 15 22:17:40 2016 +0000

    Implement $ShowSearchResultCount for AssetSQL on 4.4.2+

diff --git a/patches/rt-4.4.2-later.patch b/patches/rt-4.4.2-later.patch
index c62b4e3..6e9cf8d 100644
--- a/patches/rt-4.4.2-later.patch
+++ b/patches/rt-4.4.2-later.patch
@@ -1,5 +1,5 @@
 diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
-index 5325b2e..42a2591 100644
+index fd8c6e6..08ce079 100644
 --- a/share/html/Elements/CollectionList
 +++ b/share/html/Elements/CollectionList
 @@ -50,6 +50,10 @@ if (!$Collection && $Class eq 'RT::Tickets') {
@@ -14,7 +14,7 @@ index 5325b2e..42a2591 100644
  # flip HasResults from undef to 0 to indicate there was a search, so
  # dashboard mail can be suppressed if there are no results
 diff --git a/share/html/Elements/ShowSearch b/share/html/Elements/ShowSearch
-index 15b7b75..4234387 100644
+index 53ad702..5be90d6 100644
 --- a/share/html/Elements/ShowSearch
 +++ b/share/html/Elements/ShowSearch
 @@ -52,7 +52,7 @@
@@ -41,3 +41,33 @@ index 15b7b75..4234387 100644
  
          # XXX: dispatch to different handler here
          $query_display_component
+@@ -133,14 +139,24 @@ my $QueryString = '?' . $m->comp( '/Elements/QueryString', %$SearchArg );
+ 
+ my $title_raw;
+ if ($ShowCount) {
+-    my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+-    $tickets->FromSQL($ProcessedSearchArg->{Query});
+-    my $count = $tickets->CountAll();
++    my $collection;
++    my $count;
+ 
+-    $title_raw = '<span class="results-count">' . loc('(Found [quant,_1,ticket,tickets])', $count) . '</span>';
++    if ($SearchArg && ($SearchArg->{SearchType}||'') eq 'Asset') {
++        $collection = RT::Assets->new( $session{'CurrentUser'} );
++        $collection->FromSQL($ProcessedSearchArg->{Query});
++        $count = $collection->CountAll();
++        $title_raw = '<span class="results-count">' . loc('(Found [quant,_1,asset,assets])', $count) . '</span>';
++    }
++    else {
++        $collection = RT::Tickets->new( $session{'CurrentUser'} );
++        $collection->FromSQL($ProcessedSearchArg->{Query});
++        $count = $collection->CountAll();
++        $title_raw = '<span class="results-count">' . loc('(Found [quant,_1,ticket,tickets])', $count) . '</span>';
++    }
+ 
+     # don't repeat the search in CollectionList
+-    $ProcessedSearchArg->{Collection} = $tickets;
++    $ProcessedSearchArg->{Collection} = $collection;
+     $ProcessedSearchArg->{TotalFound} = $count;
+ }
+ </%init>

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


More information about the Bps-public-commit mailing list