X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=labels%2Flabel-item-search.pl;h=386c97dba1ef50fe56672b169a9338972ce9a15d;hb=20cfc347e1150011ab1358b183e362b2b49a9043;hp=3da74f56ba41c5515cb302e3ca2b9964758a08a6;hpb=cd4c9aac43bd6246bab69ddc907294b86d0b4bea;p=koha_fer diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl index 3da74f56ba..386c97dba1 100755 --- a/labels/label-item-search.pl +++ b/labels/label-item-search.pl @@ -58,6 +58,7 @@ my $dbh = C4::Context->dbh; my $startfrom = $query->param('startfrom') || 0; my ( $template, $loggedinuser, $cookie ); +my $total_hits; my (@marclist,@and_or,@excluding,@operator,@value,$orderby,@tags,$results,$total,$error,$marcresults); # XXX should this be maxItemsInSearchResults or numSearchResults preference instead of 19? my $resultsperpage = $query->param('resultsperpage') || 19; @@ -74,7 +75,7 @@ if ( $op eq "do_search" ) { #catalogsearch( $dbh, \@tags, \@and_or, \@excluding, \@operator, \@value, # $startfrom * $resultsperpage, # $resultsperpage, $orderby ); - ( $error, $marcresults ) = SimpleSearch( $marclist[0], $startfrom, $resultsperpage ); + ( $error, $marcresults, $total_hits ) = SimpleSearch( $marclist[0], $startfrom, $resultsperpage ); if ($marcresults) { $show_results = scalar @$marcresults; } else { @@ -112,10 +113,11 @@ if ( $show_results ) { if ($item_results->{$item}->{'biblionumber'} eq $results[$i]->{'biblionumber'}) { # NOTE: The order of the elements in this array must be preserved or the table dependent on it will be incorrectly rendered. # This is a real hack, but I can't think of a better way right now. -fbcit + # It is conceivable that itemcallnumber and/or barcode fields might be empty so the trinaries cover this possibility. push @{$results[$i]->{'item'}}, { i_itemnumber1 => $item_results->{$item}->{'itemnumber'} }; - push @{$results[$i]->{'item'}}, { i_itemcallnumber => $item_results->{$item}->{'itemcallnumber'} }; + push @{$results[$i]->{'item'}}, { i_itemcallnumber => ($item_results->{$item}->{'itemcallnumber'} ? $item_results->{$item}->{'itemcallnumber'} : 'NA') }; push @{$results[$i]->{'item'}}, { i_dateaccessioned => $item_results->{$item}->{'dateaccessioned'} }; - push @{$results[$i]->{'item'}}, { i_barcode => $item_results->{$item}->{'barcode'} }; + push @{$results[$i]->{'item'}}, { i_barcode => ($item_results->{$item}->{'barcode'} ? $item_results->{$item}->{'barcode'} : 'NA')}; push @{$results[$i]->{'item'}}, { i_itemnumber2 => $item_results->{$item}->{'itemnumber'} }; } } @@ -149,6 +151,7 @@ if ( $show_results ) { } my @numbers = (); + $total = $total_hits; if ( $total > $resultsperpage ) { for ( my $i = 1 ; $i < $total / $resultsperpage + 1 ; $i++ ) { if ( $i < 16 ) { @@ -182,7 +185,7 @@ if ( $show_results ) { startfromnext => $startfrom + min( $resultsperpage, scalar @results ), startfromprev => max( $startfrom - $resultsperpage, 0 ), searchdata => \@field_data, - total => $total, + total => $total_hits, from => $startfrom + 1, to => $startfrom + min( $resultsperpage, scalar @results ), numbers => \@numbers,