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 197-203
foreach my $biblionumber (@biblionumbers) {
Link Here
|
197 |
#All is OK and we can continue |
211 |
#All is OK and we can continue |
198 |
} |
212 |
} |
199 |
elsif ( $canReserve eq 'tooManyReserves' ) { |
213 |
elsif ( $canReserve eq 'tooManyReserves' ) { |
200 |
$maxreserves = 1; |
214 |
$exceeded_maxreserves = 1; |
201 |
} |
215 |
} |
202 |
elsif ( $canReserve eq 'ageRestricted' ) { |
216 |
elsif ( $canReserve eq 'ageRestricted' ) { |
203 |
$template->param( $canReserve => 1 ); |
217 |
$template->param( $canReserve => 1 ); |
Lines 301-315
foreach my $biblionumber (@biblionumbers) {
Link Here
|
301 |
my $num_override = 0; |
315 |
my $num_override = 0; |
302 |
my $hiddencount = 0; |
316 |
my $hiddencount = 0; |
303 |
|
317 |
|
304 |
$biblioitem->{description} = |
318 |
if ( $biblioitem->{biblioitemnumber} ne $biblionumber ) { |
305 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
319 |
$biblioitem->{hostitemsflag} = 1; |
306 |
if($biblioitem->{biblioitemnumber} ne $biblionumber){ |
320 |
} |
307 |
$biblioitem->{hostitemsflag}=1; |
321 |
|
308 |
} |
|
|
309 |
$biblioloopiter{description} = $biblioitem->{description}; |
322 |
$biblioloopiter{description} = $biblioitem->{description}; |
310 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
323 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
311 |
$biblioloopiter{imageurl} = |
324 |
if ( $biblioitem->{itemtype} ) { |
312 |
getitemtypeimagelocation('intranet', $itemtypes->{$biblioitem->{itemtype}}{imageurl}); |
325 |
|
|
|
326 |
$biblioitem->{description} = |
327 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
328 |
|
329 |
$biblioloopiter{imageurl} = |
330 |
getitemtypeimagelocation( 'intranet', |
331 |
$itemtypes->{ $biblioitem->{itemtype} }{imageurl} ); |
332 |
} |
313 |
|
333 |
|
314 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
334 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
315 |
my $item = $iteminfos_of->{$itemnumber}; |
335 |
my $item = $iteminfos_of->{$itemnumber}; |
Lines 423-428
foreach my $biblionumber (@biblionumbers) {
Link Here
|
423 |
|
443 |
|
424 |
if ( |
444 |
if ( |
425 |
$policy_holdallowed |
445 |
$policy_holdallowed |
|
|
446 |
&& !$exceeded_maxreserves |
426 |
&& !$item->{cantreserve} |
447 |
&& !$item->{cantreserve} |
427 |
&& IsAvailableForItemLevelRequest($itemnumber) |
448 |
&& IsAvailableForItemLevelRequest($itemnumber) |
428 |
&& CanItemBeReserved( |
449 |
&& CanItemBeReserved( |
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 |
- |
|
|