[Rt-commit] rt branch, 4.0/silence-last-search-warning, created. rt-4.0.7-54-g8d02f08

Kevin Falcone falcone at bestpractical.com
Wed Aug 29 17:30:03 EDT 2012


The branch, 4.0/silence-last-search-warning has been created
        at  8d02f08217c011619d7bf8dc251e9b3d5a440f17 (commit)

- Log -----------------------------------------------------------------
commit 8d02f08217c011619d7bf8dc251e9b3d5a440f17
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Aug 29 17:25:56 2012 -0400

    Clean up a warning when iterating large search results.
    
    If you do a search that returns more results than your
    $TicketsItemMapSize then Tickets->ItemMap sets the last link to 'undef'
    because it doesn't know the last result in the set (it only knows the
    subset).  Unfortunately, this caused warnings in two places that were
    only checking for 'next' and assuming 'last' would be defined.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 184316e..0ea9dd8 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -642,8 +642,10 @@ my $build_main_nav = sub {
                 if ( $item_map->{$id}->{next} ) {
                     $search->child( next =>
                         title => loc('Next') . ' >',  class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
-                    $search->child( last =>
-                        title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+                    if ( $item_map->{last} ) {
+                        $search->child( last =>
+                            title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+                    }
                 }
             }
         }
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 5e84a50..413a5ff 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -226,6 +226,6 @@ if (defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHa
     $link_rel{first} = "Ticket/Display.html?id=" . $item_map->{first}                if $item_map->{$TicketObj->Id}{prev};
     $link_rel{prev}  = "Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{prev} if $item_map->{$TicketObj->Id}{prev};
     $link_rel{next}  = "Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{next} if $item_map->{$TicketObj->Id}{next};
-    $link_rel{last}  = "Ticket/Display.html?id=" . $item_map->{last}                 if $item_map->{$TicketObj->Id}{next};
+    $link_rel{last}  = "Ticket/Display.html?id=" . $item_map->{last}                 if $item_map->{$TicketObj->Id}{next} && $item_map->{last};
 }
 </%INIT>

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


More information about the Rt-commit mailing list