Lines 78-86
$findborrower = '' unless defined $findborrower;
Link Here
|
78 |
$findborrower =~ s|,| |g; |
78 |
$findborrower =~ s|,| |g; |
79 |
my $borrowernumber_hold = $input->param('borrowernumber') || ''; |
79 |
my $borrowernumber_hold = $input->param('borrowernumber') || ''; |
80 |
my $messageborrower; |
80 |
my $messageborrower; |
81 |
my $maxreserves; |
|
|
82 |
my $warnings; |
81 |
my $warnings; |
83 |
my $messages; |
82 |
my $messages; |
|
|
83 |
my $exceeded_maxreserves; |
84 |
|
84 |
|
85 |
my $date = C4::Dates->today('iso'); |
85 |
my $date = C4::Dates->today('iso'); |
86 |
my $action = $input->param('action'); |
86 |
my $action = $input->param('action'); |
Lines 125-147
if ($findborrower) {
Link Here
|
125 |
} |
125 |
} |
126 |
} |
126 |
} |
127 |
|
127 |
|
|
|
128 |
my @biblionumbers = (); |
129 |
my $biblionumbers = $input->param('biblionumbers'); |
130 |
if ($multihold) { |
131 |
@biblionumbers = split '/', $biblionumbers; |
132 |
} else { |
133 |
push @biblionumbers, $input->param('biblionumber'); |
134 |
} |
135 |
|
136 |
|
128 |
# If we have the borrowernumber because we've performed an action, then we |
137 |
# If we have the borrowernumber because we've performed an action, then we |
129 |
# don't want to try to place another reserve. |
138 |
# don't want to try to place another reserve. |
130 |
if ($borrowernumber_hold && !$action) { |
139 |
if ($borrowernumber_hold && !$action) { |
131 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
140 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
132 |
my $diffbranch; |
141 |
my $diffbranch; |
133 |
my @getreservloop; |
142 |
my @getreservloop; |
134 |
my $count_reserv = 0; |
|
|
135 |
|
143 |
|
136 |
# we check the reserves of the borrower, and if he can reserv a document |
144 |
# we check the reserves of the borrower, and if he can reserv a document |
137 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
145 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
138 |
|
146 |
|
139 |
my $number_reserves = |
147 |
my $reserves_count = |
140 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
148 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
141 |
|
149 |
|
142 |
if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { |
150 |
my $new_reserves_count = scalar( @biblionumbers ); |
143 |
$warnings = 1; |
151 |
|
144 |
$maxreserves = 1; |
152 |
my $maxreserves = C4::Context->preference('maxreserves'); |
|
|
153 |
if ( $maxreserves |
154 |
&& ( $reserves_count + $new_reserves_count > $maxreserves ) ) |
155 |
{ |
156 |
my $new_reserves_allowed = |
157 |
$maxreserves - $reserves_count > 0 |
158 |
? $maxreserves - $reserves_count |
159 |
: 0; |
160 |
$warnings = 1; |
161 |
$exceeded_maxreserves = 1; |
162 |
$template->param( |
163 |
new_reserves_allowed => $new_reserves_allowed, |
164 |
new_reserves_count => $new_reserves_count, |
165 |
reserves_count => $reserves_count, |
166 |
maxreserves => $maxreserves, |
167 |
); |
145 |
} |
168 |
} |
146 |
|
169 |
|
147 |
# we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn) |
170 |
# we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn) |
Lines 170-176
if ($borrowernumber_hold && !$action) {
Link Here
|
170 |
borroweremail => $borrowerinfo->{'email'}, |
193 |
borroweremail => $borrowerinfo->{'email'}, |
171 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
194 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
172 |
borrowercategory => $borrowerinfo->{'category'}, |
195 |
borrowercategory => $borrowerinfo->{'category'}, |
173 |
borrowerreservs => $count_reserv, |
|
|
174 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
196 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
175 |
expiry => $expiry, |
197 |
expiry => $expiry, |
176 |
diffbranch => $diffbranch, |
198 |
diffbranch => $diffbranch, |
Lines 184-197
$template->param( messageborrower => $messageborrower );
Link Here
|
184 |
# FIXME launch another time GetMember perhaps until |
206 |
# FIXME launch another time GetMember perhaps until |
185 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
207 |
my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold ); |
186 |
|
208 |
|
187 |
my @biblionumbers = (); |
|
|
188 |
my $biblionumbers = $input->param('biblionumbers'); |
189 |
if ($multihold) { |
190 |
@biblionumbers = split '/', $biblionumbers; |
191 |
} else { |
192 |
push @biblionumbers, $input->param('biblionumber'); |
193 |
} |
194 |
|
195 |
my $itemdata_enumchron = 0; |
209 |
my $itemdata_enumchron = 0; |
196 |
my @biblioloop = (); |
210 |
my @biblioloop = (); |
197 |
foreach my $biblionumber (@biblionumbers) { |
211 |
foreach my $biblionumber (@biblionumbers) { |
Lines 207-213
foreach my $biblionumber (@biblionumbers) {
Link Here
|
207 |
#All is OK and we can continue |
221 |
#All is OK and we can continue |
208 |
} |
222 |
} |
209 |
elsif ( $canReserve eq 'tooManyReserves' ) { |
223 |
elsif ( $canReserve eq 'tooManyReserves' ) { |
210 |
$maxreserves = 1; |
224 |
$exceeded_maxreserves = 1; |
211 |
} |
225 |
} |
212 |
elsif ( $canReserve eq 'ageRestricted' ) { |
226 |
elsif ( $canReserve eq 'ageRestricted' ) { |
213 |
$template->param( $canReserve => 1 ); |
227 |
$template->param( $canReserve => 1 ); |
Lines 311-325
foreach my $biblionumber (@biblionumbers) {
Link Here
|
311 |
my $num_override = 0; |
325 |
my $num_override = 0; |
312 |
my $hiddencount = 0; |
326 |
my $hiddencount = 0; |
313 |
|
327 |
|
314 |
$biblioitem->{description} = |
328 |
if ( $biblioitem->{biblioitemnumber} ne $biblionumber ) { |
315 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
329 |
$biblioitem->{hostitemsflag} = 1; |
316 |
if($biblioitem->{biblioitemnumber} ne $biblionumber){ |
330 |
} |
317 |
$biblioitem->{hostitemsflag}=1; |
331 |
|
318 |
} |
|
|
319 |
$biblioloopiter{description} = $biblioitem->{description}; |
332 |
$biblioloopiter{description} = $biblioitem->{description}; |
320 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
333 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
321 |
$biblioloopiter{imageurl} = |
334 |
if ( $biblioitem->{itemtype} ) { |
322 |
getitemtypeimagelocation('intranet', $itemtypes->{$biblioitem->{itemtype}}{imageurl}); |
335 |
|
|
|
336 |
$biblioitem->{description} = |
337 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
338 |
|
339 |
$biblioloopiter{imageurl} = |
340 |
getitemtypeimagelocation( 'intranet', |
341 |
$itemtypes->{ $biblioitem->{itemtype} }{imageurl} ); |
342 |
} |
323 |
|
343 |
|
324 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
344 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
325 |
my $item = $iteminfos_of->{$itemnumber}; |
345 |
my $item = $iteminfos_of->{$itemnumber}; |
Lines 423-428
foreach my $biblionumber (@biblionumbers) {
Link Here
|
423 |
|
443 |
|
424 |
if ( |
444 |
if ( |
425 |
!$item->{cantreserve} |
445 |
!$item->{cantreserve} |
|
|
446 |
&& !$exceeded_maxreserves |
426 |
&& IsAvailableForItemLevelRequest($item, $borrowerinfo) |
447 |
&& IsAvailableForItemLevelRequest($item, $borrowerinfo) |
427 |
&& CanItemBeReserved( |
448 |
&& CanItemBeReserved( |
428 |
$borrowerinfo->{borrowernumber}, $itemnumber |
449 |
$borrowerinfo->{borrowernumber}, $itemnumber |
Lines 589-595
foreach my $biblionumber (@biblionumbers) {
Link Here
|
589 |
|
610 |
|
590 |
$template->param( biblioloop => \@biblioloop ); |
611 |
$template->param( biblioloop => \@biblioloop ); |
591 |
$template->param( biblionumbers => $biblionumbers ); |
612 |
$template->param( biblionumbers => $biblionumbers ); |
592 |
$template->param( maxreserves => $maxreserves ); |
613 |
$template->param( exceeded_maxreserves => $exceeded_maxreserves ); |
593 |
|
614 |
|
594 |
if ($multihold) { |
615 |
if ($multihold) { |
595 |
$template->param( multi_hold => 1 ); |
616 |
$template->param( multi_hold => 1 ); |
596 |
- |
|
|