use strict;
-require Exporter;
+
use CGI;
use C4::Output;
use C4::Context;
function Clic$function_name(i) {
defaultvalue=document.getElementById(\"$field_number\").value;
- window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
+ window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=\" + i + \"&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
}
</script>
elsif ( $op eq "do_search" ) {
my $search = $query->param('search');
my $startfrom = $query->param('startfrom');
- my $resultsperpage = $query->param('resultsperpage');
+ my $resultsperpage = $query->param('resultsperpage') || 20;
my $orderby;
- my ( $errors, $results, $total_hits ) = SimpleSearch($search);
+ my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
my $total = scalar(@$results);
- $resultsperpage = 20 unless $resultsperpage;
# warn " biblio count : ".$total;
# multi page display gestion
my $displaynext = 0;
my $displayprev = $startfrom;
- if ( ( $total - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
+
+ if( ( $total_hits - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
$displaynext = 1;
}
my @arrayresults;
my @field_data = ($search);
for (
- my $i = $startfrom * $resultsperpage ;
- $i < (( $startfrom * $resultsperpage + $resultsperpage < scalar(@$results))
- ? $startfrom * $resultsperpage + $resultsperpage
- : scalar(@$results)
- ) ;
+ my $i = 0 ;
+ $i < $resultsperpage ;
$i++
)
{
my $from = $startfrom * $resultsperpage + 1;
my $to;
- if ( $total < ( ( $startfrom + 1 ) * $resultsperpage ) ) {
- $to = $total;
- }
- else {
- $to = ( ( $startfrom + 1 ) * $resultsperpage );
+ if ( $total_hits < $from + $resultsperpage ) {
+ $to = $total_hits;
+ }else{
+ $to = $from + $resultsperpage ;
}
my $defaultview =
'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView');
startfromnext => $startfrom + 1,
startfromprev => $startfrom - 1,
searchdata => \@field_data,
- total => $total,
+ total => $total_hits,
from => $from,
to => $to,
numbers => \@numbers,