Lines 77-85
$findborrower = '' unless defined $findborrower;
Link Here
|
77 |
$findborrower =~ s|,| |g; |
77 |
$findborrower =~ s|,| |g; |
78 |
my $borrowernumber_hold = $input->param('borrowernumber') || ''; |
78 |
my $borrowernumber_hold = $input->param('borrowernumber') || ''; |
79 |
my $messageborrower; |
79 |
my $messageborrower; |
80 |
my $maxreserves; |
|
|
81 |
my $warnings; |
80 |
my $warnings; |
82 |
my $messages; |
81 |
my $messages; |
|
|
82 |
my $exceeded_maxreserves; |
83 |
|
83 |
|
84 |
my $date = C4::Dates->today('iso'); |
84 |
my $date = C4::Dates->today('iso'); |
85 |
my $action = $input->param('action'); |
85 |
my $action = $input->param('action'); |
Lines 116-138
if ($findborrower) {
Link Here
|
116 |
} |
116 |
} |
117 |
} |
117 |
} |
118 |
|
118 |
|
|
|
119 |
my @biblionumbers = (); |
120 |
my $biblionumbers = $input->param('biblionumbers'); |
121 |
if ($multihold) { |
122 |
@biblionumbers = split '/', $biblionumbers; |
123 |
} else { |
124 |
push @biblionumbers, $input->param('biblionumber'); |
125 |
} |
126 |
|
127 |
|
119 |
# If we have the borrowernumber because we've performed an action, then we |
128 |
# If we have the borrowernumber because we've performed an action, then we |
120 |
# don't want to try to place another reserve. |
129 |
# don't want to try to place another reserve. |
121 |
if ($borrowernumber_hold && !$action) { |
130 |
if ($borrowernumber_hold && !$action) { |
122 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
131 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
123 |
my $diffbranch; |
132 |
my $diffbranch; |
124 |
my @getreservloop; |
133 |
my @getreservloop; |
125 |
my $count_reserv = 0; |
|
|
126 |
|
134 |
|
127 |
# we check the reserves of the borrower, and if he can reserv a document |
135 |
# we check the reserves of the borrower, and if he can reserv a document |
128 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
136 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
129 |
|
137 |
|
130 |
my $number_reserves = |
138 |
my $reserves_count = |
131 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
139 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
132 |
|
140 |
|
133 |
if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { |
141 |
my $new_reserves_count = scalar( @biblionumbers ); |
134 |
$warnings = 1; |
142 |
|
135 |
$maxreserves = 1; |
143 |
my $maxreserves = C4::Context->preference('maxreserves'); |
|
|
144 |
if ( $maxreserves |
145 |
&& ( $reserves_count + $new_reserves_count > $maxreserves ) ) |
146 |
{ |
147 |
my $new_reserves_allowed = |
148 |
$maxreserves - $reserves_count > 0 |
149 |
? $maxreserves - $reserves_count |
150 |
: 0; |
151 |
$warnings = 1; |
152 |
$exceeded_maxreserves = 1; |
153 |
$template->param( |
154 |
new_reserves_allowed => $new_reserves_allowed, |
155 |
new_reserves_count => $new_reserves_count, |
156 |
reserves_count => $reserves_count, |
157 |
maxreserves => $maxreserves, |
158 |
); |
136 |
} |
159 |
} |
137 |
|
160 |
|
138 |
# we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn) |
161 |
# we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn) |
Lines 161-167
if ($borrowernumber_hold && !$action) {
Link Here
|
161 |
borroweremail => $borrowerinfo->{'email'}, |
184 |
borroweremail => $borrowerinfo->{'email'}, |
162 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
185 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
163 |
borrowercategory => $borrowerinfo->{'category'}, |
186 |
borrowercategory => $borrowerinfo->{'category'}, |
164 |
borrowerreservs => $count_reserv, |
|
|
165 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
187 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
166 |
expiry => $expiry, |
188 |
expiry => $expiry, |
167 |
diffbranch => $diffbranch, |
189 |
diffbranch => $diffbranch, |
Lines 175-188
$template->param( messageborrower => $messageborrower );
Link Here
|
175 |
# FIXME launch another time GetMember perhaps until |
197 |
# FIXME launch another time GetMember perhaps until |
176 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
198 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
177 |
|
199 |
|
178 |
my @biblionumbers = (); |
|
|
179 |
my $biblionumbers = $input->param('biblionumbers'); |
180 |
if ($multihold) { |
181 |
@biblionumbers = split '/', $biblionumbers; |
182 |
} else { |
183 |
push @biblionumbers, $input->param('biblionumber'); |
184 |
} |
185 |
|
186 |
my $itemdata_enumchron = 0; |
200 |
my $itemdata_enumchron = 0; |
187 |
my @biblioloop = (); |
201 |
my @biblioloop = (); |
188 |
foreach my $biblionumber (@biblionumbers) { |
202 |
foreach my $biblionumber (@biblionumbers) { |
Lines 192-198
foreach my $biblionumber (@biblionumbers) {
Link Here
|
192 |
my $dat = GetBiblioData($biblionumber); |
206 |
my $dat = GetBiblioData($biblionumber); |
193 |
|
207 |
|
194 |
unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
208 |
unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
195 |
$maxreserves = 1; |
209 |
$exceeded_maxreserves = 1; # note that exceeding the circ policy's hold |
|
|
210 |
# limit is not the only reason CanBookBeReserved() |
211 |
# can return false |
196 |
} |
212 |
} |
197 |
|
213 |
|
198 |
my $alreadypossession; |
214 |
my $alreadypossession; |
Lines 289-303
foreach my $biblionumber (@biblionumbers) {
Link Here
|
289 |
my $num_override = 0; |
305 |
my $num_override = 0; |
290 |
my $hiddencount = 0; |
306 |
my $hiddencount = 0; |
291 |
|
307 |
|
292 |
$biblioitem->{description} = |
308 |
if ( $biblioitem->{biblioitemnumber} ne $biblionumber ) { |
293 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
309 |
$biblioitem->{hostitemsflag} = 1; |
294 |
if($biblioitem->{biblioitemnumber} ne $biblionumber){ |
310 |
} |
295 |
$biblioitem->{hostitemsflag}=1; |
311 |
|
296 |
} |
|
|
297 |
$biblioloopiter{description} = $biblioitem->{description}; |
312 |
$biblioloopiter{description} = $biblioitem->{description}; |
298 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
313 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
299 |
$biblioloopiter{imageurl} = |
314 |
if ( $biblioitem->{itemtype} ) { |
300 |
getitemtypeimagelocation('intranet', $itemtypes->{$biblioitem->{itemtype}}{imageurl}); |
315 |
|
|
|
316 |
$biblioitem->{description} = |
317 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
318 |
|
319 |
$biblioloopiter{imageurl} = |
320 |
getitemtypeimagelocation( 'intranet', |
321 |
$itemtypes->{ $biblioitem->{itemtype} }{imageurl} ); |
322 |
} |
301 |
|
323 |
|
302 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
324 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
303 |
my $item = $iteminfos_of->{$itemnumber}; |
325 |
my $item = $iteminfos_of->{$itemnumber}; |
Lines 411-416
foreach my $biblionumber (@biblionumbers) {
Link Here
|
411 |
|
433 |
|
412 |
if ( |
434 |
if ( |
413 |
$policy_holdallowed |
435 |
$policy_holdallowed |
|
|
436 |
&& !$exceeded_maxreserves |
414 |
&& !$item->{cantreserve} |
437 |
&& !$item->{cantreserve} |
415 |
&& IsAvailableForItemLevelRequest($itemnumber) |
438 |
&& IsAvailableForItemLevelRequest($itemnumber) |
416 |
&& CanItemBeReserved( |
439 |
&& CanItemBeReserved( |
Lines 575-581
foreach my $biblionumber (@biblionumbers) {
Link Here
|
575 |
|
598 |
|
576 |
$template->param( biblioloop => \@biblioloop ); |
599 |
$template->param( biblioloop => \@biblioloop ); |
577 |
$template->param( biblionumbers => $biblionumbers ); |
600 |
$template->param( biblionumbers => $biblionumbers ); |
578 |
$template->param( maxreserves => $maxreserves ); |
601 |
$template->param( exceeded_maxreserves => $exceeded_maxreserves ); |
579 |
|
602 |
|
580 |
if ($multihold) { |
603 |
if ($multihold) { |
581 |
$template->param( multi_hold => 1 ); |
604 |
$template->param( multi_hold => 1 ); |
582 |
- |
|
|