Number tickets returned by a search?

I’m trying to put a little text into Search/Listing.html to tell the user
how many tickets were returned in the search they just ran.

I have this:
Number of tickets returned in search:
<%$session{‘tickets’}->Count()%>

But that’s not really useful. If you ran a search that brings back
100 tickets and you have your $session{‘tickets_rows_per_page’} set at
25, $session{‘tickets’}->Count() will say 25. I want to get the total
number of tickets in a search, not just the ones displayed on the
page at the moment.

Thanks in advance,

-Grant Miller grant@pico.apple.com Apple Computer

Unix Systems Admin, Engineering Computer Services

I’m trying to put a little text into Search/Listing.html to tell the user
how many tickets were returned in the search they just ran.

I have this:
Number of tickets returned in search:
<%$session{‘tickets’}->Count()%>

But that’s not really useful. If you ran a search that brings back
100 tickets and you have your $session{‘tickets_rows_per_page’} set at
25, $session{‘tickets’}->Count() will say 25. I want to get the total
number of tickets in a search, not just the ones displayed on the
page at the moment.

I figured it out, had to get the count right after
$session{‘tickets’}->RedoSearch();

Then I put in

%if ($ticketcount > $session{‘tickets_rows_per_page’}) {
  
First page
  
<Previous page
  
Next page>
%}

To have it only show those links if there’s more than a page of tickets
returned.

-Grant Miller grant@pico.apple.com x42917

Unix Systems Admin, Engineering Computer Services
unix-support@pico.apple.com, http://www-ecs.apple.com
ECS Hotline: x44747

Grant Miller wrote:

I’m trying to put a little text into Search/Listing.html to tell the user
how many tickets were returned in the search they just ran.

I figured it out, had to get the count right after
$session{‘tickets’}->RedoSearch();

Then I put in

> > To have it only show those links if there's more than a page of tickets > returned.

Building on (and including) Grant’s work, the attached patch
should also prevent the “Previous page” link on the first page,
and the “Next page” link on the last. Whee.
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances

ticket-page-patch (1.44 KB)

Phil Homewood wrote:

Building on (and including) Grant’s work, the attached patch
should also prevent the “Previous page” link on the first page,
and the “Next page” link on the last. Whee.

And of course no sooner do I send it than I notice another bug.

Unless I’ve busted something in my local customisations (which
is quite possible), the “first page” link doesn’t work at all.

This patch (which is independent of the previous one) fixes
that, and should allow the commented out “Goto Page” box on
Search/Listing.html to work as well.

Jesse:- There seems to be a bit of confusion in DBIx::SB
(unless this has changed since 0.48) as to whether the first
foo is number 0 or number 1 (for values of foo like “row” and
“page”.)

I’m not sure whether making “-1” fudges in RT is ideal, or
whether DBIx::SB should be whacked around the head and told to
start counting from zero… the following feels wrong:

FirstRow(1); # set the first row to 1
$r = FirstRow(); # oh, look. The first row is zero.

Phil Homewood, Systems Janitor, www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances

Phil Homewood wrote:

This patch (which is independent of the previous one) fixes
that, and should allow the commented out “Goto Page” box on
Search/Listing.html to work as well.

It’s just not my day. Here’s the forgotten patch.

first-page-patch (581 Bytes)