Lines 64-73
my ($input) = @_;
Link Here
|
64 |
my $resultstring = $query->param('result'); |
64 |
my $resultstring = $query->param('result'); |
65 |
my $dbh = C4::Context->dbh; |
65 |
my $dbh = C4::Context->dbh; |
66 |
|
66 |
|
67 |
my $startfrom=$query->param('startfrom'); |
67 |
my $startfrom = $query->param('startfrom') // 1; # Page number starting at 1 |
68 |
$startfrom=0 if(!defined $startfrom); |
|
|
69 |
my ($template, $loggedinuser, $cookie); |
68 |
my ($template, $loggedinuser, $cookie); |
70 |
my $resultsperpage; |
69 |
my $resultsperpage = $query->param('resultsperpage') // 20; # TODO hardcoded |
|
|
70 |
my $offset = ( $startfrom - 1 ) * $resultsperpage; |
71 |
|
71 |
|
72 |
if ($op eq "do_search") { |
72 |
if ($op eq "do_search") { |
73 |
my @marclist = $query->multi_param('marclist'); |
73 |
my @marclist = $query->multi_param('marclist'); |
Lines 77-91
my ($input) = @_;
Link Here
|
77 |
my @value = $query->multi_param('value'); |
77 |
my @value = $query->multi_param('value'); |
78 |
my $orderby = $query->param('orderby'); |
78 |
my $orderby = $query->param('orderby'); |
79 |
|
79 |
|
80 |
$resultsperpage= $query->param('resultsperpage'); |
|
|
81 |
$resultsperpage = 19 if(!defined $resultsperpage); |
82 |
|
83 |
# builds tag and subfield arrays |
80 |
# builds tag and subfield arrays |
84 |
my @tags; |
81 |
my @tags; |
85 |
|
82 |
|
86 |
my ($results,$total) = SearchAuthorities( \@tags,\@and_or, |
83 |
my ($results,$total) = SearchAuthorities( \@tags,\@and_or, |
87 |
\@excluding, \@operator, \@value, |
84 |
\@excluding, \@operator, \@value, |
88 |
$startfrom*$resultsperpage, $resultsperpage,$authtypecode, $orderby); |
85 |
$offset, $resultsperpage,$authtypecode, $orderby); |
89 |
|
86 |
|
90 |
# Getting the $b if it exists |
87 |
# Getting the $b if it exists |
91 |
for (@$results) { |
88 |
for (@$results) { |
Lines 104-152
my ($input) = @_;
Link Here
|
104 |
debug => 1, |
101 |
debug => 1, |
105 |
}); |
102 |
}); |
106 |
|
103 |
|
107 |
# multi page display gestion |
104 |
# Results displayed in current page |
108 |
my $displaynext=0; |
105 |
my $from = $offset + 1; |
109 |
my $displayprev=$startfrom; |
106 |
my $to = ( $offset + $resultsperpage > $total ) ? $total : $offset + $resultsperpage; |
110 |
if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) { |
107 |
|
111 |
$displaynext = 1; |
|
|
112 |
} |
113 |
|
114 |
my @numbers = (); |
115 |
|
116 |
if ($total>$resultsperpage) { |
117 |
for (my $i=1; $i<$total/$resultsperpage+1; $i++) { |
118 |
if ($i<16) { |
119 |
my $highlight=0; |
120 |
($startfrom==($i-1)) && ($highlight=1); |
121 |
push @numbers, { number => $i, |
122 |
highlight => $highlight , |
123 |
startfrom => ($i-1)}; |
124 |
} |
125 |
} |
126 |
} |
127 |
|
128 |
my $from = $startfrom*$resultsperpage+1; |
129 |
my $to; |
130 |
|
131 |
if($total < (($startfrom+1)*$resultsperpage)) { |
132 |
$to = $total; |
133 |
} else { |
134 |
$to = (($startfrom+1)*$resultsperpage); |
135 |
} |
136 |
my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&authtypecode=EDITORS&".join("&",map {"value=".$_} @value)."&op=do_search&type=intranet&index=$index"; |
108 |
my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&authtypecode=EDITORS&".join("&",map {"value=".$_} @value)."&op=do_search&type=intranet&index=$index"; |
137 |
|
109 |
|
138 |
$template->param(result => $results) if $results; |
110 |
$template->param(result => $results) if $results; |
139 |
$template->param('index' => scalar $query->param('index')); |
111 |
$template->param('index' => scalar $query->param('index')); |
140 |
$template->param(startfrom=> $startfrom, |
112 |
$template->param( |
141 |
displaynext=> $displaynext, |
|
|
142 |
displayprev=> $displayprev, |
143 |
resultsperpage => $resultsperpage, |
144 |
startfromnext => $startfrom+1, |
145 |
startfromprev => $startfrom-1, |
146 |
total=>$total, |
113 |
total=>$total, |
147 |
from=>$from, |
114 |
from=>$from, |
148 |
to=>$to, |
115 |
to=>$to, |
149 |
numbers=>\@numbers, |
|
|
150 |
authtypecode =>$authtypecode, |
116 |
authtypecode =>$authtypecode, |
151 |
resultstring =>$value[0], |
117 |
resultstring =>$value[0], |
152 |
pagination_bar => pagination_bar( |
118 |
pagination_bar => pagination_bar( |
153 |
- |
|
|