From b69ad9de3e41f0ef280c10b50b1ea62f228f3f2a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 24 Jan 2011 14:38:48 -0500 Subject: [PATCH] Fix for Bug 5650, item type page key wrong - Fixes for authorised_values.pl and itemtypes.pl - Hiding table when there are no values to prevent js error - Hiding table pager when there are no values - Removing paging code from the script Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- admin/authorised_values.pl | 17 +------- admin/itemtypes.pl | 13 +----- .../en/modules/admin/authorised_values.tmpl | 12 +++--- .../prog/en/modules/admin/itemtypes.tmpl | 40 ++++++++++--------- 4 files changed, 30 insertions(+), 52 deletions(-) diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index de05512195..77ab6f1b45 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -60,7 +60,6 @@ my ($template, $borrowernumber, $cookie)= get_template_and_user({ type => "intranet", debug => 1, }); -my $pagesize = 20; $template->param( script_name => $script_name, ($op||'else') => 1 ); @@ -220,7 +219,7 @@ sub default_form { my $count = scalar(@$results); my @loop_data = (); # builds value list - for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ + for (my $i=0; $i < $count; $i++){ my %row_data; # get a fresh hash for the row data $row_data{category} = $results->[$i]{'category'}; $row_data{authorised_value} = $results->[$i]{'authorised_value'}; @@ -235,19 +234,5 @@ sub default_form { $template->param( loop => \@loop_data, tab_list => $tab_list, category => $searchfield ); - - if ($offset>0) { - my $prevpage = $offset-$pagesize; - $template->param(isprevpage => $offset, - prevpage=> $prevpage, - searchfield => $searchfield, - ); - } - if ($offset+$pagesize<$count) { - my $nextpage =$offset+$pagesize; - $template->param(nextpage =>$nextpage, - searchfield => $searchfield, - ); - } } diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 9876852bc4..1a33a219c5 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -69,7 +69,6 @@ my $input = new CGI; my $searchfield = $input->param('description'); my $script_name = "/cgi-bin/koha/admin/itemtypes.pl"; my $itemtype = $input->param('itemtype'); -my $pagesize = 10; my $op = $input->param('op'); $searchfield =~ s/\,//g; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -230,14 +229,8 @@ elsif ( $op eq 'delete_confirmed' ) { } else { # DEFAULT my ($results) = StringSearch( $searchfield, 'web' ); - my $page = $input->param('page') || 1; - my $first = ( $page - 1 ) * $pagesize; - - # if we are on the last page, the number of the last word to display - # must not exceed the length of the results array - my $last = min( $first + $pagesize - 1, scalar @{$results} - 1, ); my @loop; - foreach my $itemtype ( @{$results}[ $first .. $last ] ) { + foreach my $itemtype ( @{$results} ) { $itemtype->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtype->{imageurl} ); $itemtype->{rentalcharge} = sprintf( '%.2f', $itemtype->{rentalcharge} ); push( @loop, $itemtype ); @@ -245,10 +238,6 @@ else { # DEFAULT $template->param( loop => \@loop, - pagination_bar => pagination_bar( - $script_name, getnbpages( scalar @{$results}, $pagesize ), - $page, 'page' - ) ); } #---- END $OP eq DEFAULT diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl index 1aeab0d2ee..b4f69541a3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl @@ -221,9 +221,9 @@

Statuses to describe why an item is not for loan

-

Authorized values for category :

+

Authorized values for category :

- +
 page(s) : /prog/img/first.png" class="first"/> /prog/img/prev.png" class="prev"/> @@ -241,9 +241,9 @@
-
+
- +
@@ -267,7 +267,9 @@ -
Authorized value Description">Delete
+ +
There are no authorized values defined for
+
" method="post"> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl index e24a545296..2d9aafca96 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl @@ -173,7 +173,7 @@ Item Types Administration
  • " />
  • -
  • Image: Item type images are disabled. To enable them, turn off the noItemTypeImages system preference
  • +
  • Image: Item type images are disabled. To enable them, turn off the noItemTypeImages system preference
  • Choose an Icon:
    @@ -285,23 +285,23 @@ Item Types Administration

    Item Types Administration

    - -  page(s) : - /prog/img/first.png" class="first"/> - /prog/img/prev.png" class="prev"/> - - /prog/img/next.png" class="next"/> - /prog/img/last.png" class="last"/> - , entries/page : - - + +
     page(s):  + /prog/img/first.png" class="first"/> + /prog/img/prev.png" class="prev"/> + + /prog/img/next.png" class="next"/> + /prog/img/last.png" class="last"/> + , entries/page: + +
    @@ -337,7 +337,9 @@ Item Types Administration -
    + +
    There are no itemtypes defined
    +
    -- 2.39.5