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