[Rt-commit] r14838 - rt/branches/3.6-EXPERIMENTAL-PAGING/html/Search
ruz at bestpractical.com
ruz at bestpractical.com
Tue Aug 5 21:12:49 EDT 2008
Author: ruz
Date: Tue Aug 5 21:12:44 2008
New Revision: 14838
Modified:
rt/branches/3.6-EXPERIMENTAL-PAGING/html/Search/Results.html
Log:
* report tickets counter according to estimations
Modified: rt/branches/3.6-EXPERIMENTAL-PAGING/html/Search/Results.html
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-PAGING/html/Search/Results.html (original)
+++ rt/branches/3.6-EXPERIMENTAL-PAGING/html/Search/Results.html Tue Aug 5 21:12:44 2008
@@ -116,7 +116,7 @@
}
}
-my ($title, $ticketcount);
+my ($title);
$session{'i'}++;
$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ;
$session{'tickets'}->FromSQL($Query) if ($Query);
@@ -143,8 +143,27 @@
if ( $session{'tickets'}->Query()) {
- $ticketcount = $session{tickets}->CountAll();
- $title = loc('Found [quant,_1,ticket]', $ticketcount);
+ my $ticketcount = $session{tickets}->CountAll;
+ unless ( defined $ticketcount ) {
+ $title = loc('Unknown number of tickets');
+ }
+ elsif ( $ticketcount >= 0 ) {
+ $title = loc('Found [quant,_1,ticket]', $ticketcount);
+ } else {
+ $ticketcount = -($ticketcount+1);
+ if ( $ticketcount/1000 > 1.0 ) {
+ $title = loc('Found thousands of tickets', $ticketcount);
+ }
+ elsif ( $ticketcount/100 > 1.0 ) {
+ $title = loc('Found hundreds of tickets', $ticketcount);
+ }
+ elsif ( $ticketcount/10 > 1.0 ) {
+ $title = loc('Found tens of tickets', $ticketcount);
+ }
+ else {
+ $title = loc('Found several tickets', $ticketcount);
+ }
+ }
} else {
$title = loc("Find tickets");
}
More information about the Rt-commit
mailing list