Lines 85-91
my $CGIbranch = CGI::scrolling_list(
Link Here
|
85 |
my $findborrower = $input->param('findborrower'); |
85 |
my $findborrower = $input->param('findborrower'); |
86 |
$findborrower = '' unless defined $findborrower; |
86 |
$findborrower = '' unless defined $findborrower; |
87 |
$findborrower =~ s|,| |g; |
87 |
$findborrower =~ s|,| |g; |
88 |
my $cardnumber = $input->param('cardnumber') || ''; |
88 |
my $borrowernumber_hold = $input->param('borrowernumber') || ''; |
89 |
my $borrowerslist; |
89 |
my $borrowerslist; |
90 |
my $messageborrower; |
90 |
my $messageborrower; |
91 |
my $warnings; |
91 |
my $warnings; |
Lines 117-137
if ($findborrower) {
Link Here
|
117 |
|
117 |
|
118 |
my @borrowers = @$borrowers; |
118 |
my @borrowers = @$borrowers; |
119 |
|
119 |
|
120 |
if ( $#borrowers == -1 ) { |
120 |
if ( !@borrowers ) { |
121 |
$input->param( 'findborrower', '' ); |
|
|
122 |
$messageborrower = "'$findborrower'"; |
121 |
$messageborrower = "'$findborrower'"; |
123 |
} |
122 |
} |
124 |
elsif ( $#borrowers == 0 ) { |
123 |
elsif ( @borrowers == 1 ) { |
125 |
$input->param( 'cardnumber', $borrowers[0]->{'cardnumber'} ); |
124 |
$borrowernumber_hold = $borrowers[0]->{'borrowernumber'}; |
126 |
$cardnumber = $borrowers[0]->{'cardnumber'}; |
|
|
127 |
} |
125 |
} |
128 |
else { |
126 |
else { |
129 |
$borrowerslist = \@borrowers; |
127 |
$borrowerslist = \@borrowers; |
130 |
} |
128 |
} |
131 |
} |
129 |
} |
132 |
|
130 |
|
133 |
if ($cardnumber) { |
131 |
if ($borrowernumber_hold) { |
134 |
my $borrowerinfo = GetMemberDetails( 0, $cardnumber ); |
132 |
my $borrowerinfo = GetMemberDetails( $borrowernumber_hold ); |
135 |
my $diffbranch; |
133 |
my $diffbranch; |
136 |
my @getreservloop; |
134 |
my @getreservloop; |
137 |
my $count_reserv = 0; |
135 |
my $count_reserv = 0; |
Lines 143-149
if ($cardnumber) {
Link Here
|
143 |
my $number_reserves = |
141 |
my $number_reserves = |
144 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
142 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
145 |
|
143 |
|
146 |
if ( C4::Context->preference('maxreserves') && $number_reserves >= C4::Context->preference('maxreserves') ) { |
144 |
if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { |
147 |
$warnings = 1; |
145 |
$warnings = 1; |
148 |
$maxreserves = 1; |
146 |
$maxreserves = 1; |
149 |
} |
147 |
} |
Lines 164-187
if ($cardnumber) {
Link Here
|
164 |
} |
162 |
} |
165 |
|
163 |
|
166 |
$template->param( |
164 |
$template->param( |
167 |
borrowernumber => $borrowerinfo->{'borrowernumber'}, |
165 |
borrowernumber => $borrowerinfo->{'borrowernumber'}, |
168 |
borrowersurname => $borrowerinfo->{'surname'}, |
166 |
borrowersurname => $borrowerinfo->{'surname'}, |
169 |
borrowerfirstname => $borrowerinfo->{'firstname'}, |
167 |
borrowerfirstname => $borrowerinfo->{'firstname'}, |
170 |
borrowerstreetaddress => $borrowerinfo->{'address'}, |
168 |
borrowerstreetaddress => $borrowerinfo->{'address'}, |
171 |
borrowercity => $borrowerinfo->{'city'}, |
169 |
borrowercity => $borrowerinfo->{'city'}, |
172 |
borrowerphone => $borrowerinfo->{'phone'}, |
170 |
borrowerphone => $borrowerinfo->{'phone'}, |
173 |
borrowermobile => $borrowerinfo->{'mobile'}, |
171 |
borrowermobile => $borrowerinfo->{'mobile'}, |
174 |
borrowerfax => $borrowerinfo->{'fax'}, |
172 |
borrowerfax => $borrowerinfo->{'fax'}, |
175 |
borrowerphonepro => $borrowerinfo->{'phonepro'}, |
173 |
borrowerphonepro => $borrowerinfo->{'phonepro'}, |
176 |
borroweremail => $borrowerinfo->{'email'}, |
174 |
borroweremail => $borrowerinfo->{'email'}, |
177 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
175 |
borroweremailpro => $borrowerinfo->{'emailpro'}, |
178 |
borrowercategory => $borrowerinfo->{'category'}, |
176 |
borrowercategory => $borrowerinfo->{'category'}, |
179 |
borrowerreservs => $count_reserv, |
177 |
borrowerreservs => $count_reserv, |
180 |
maxreserves => $maxreserves, |
178 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
181 |
expiry => $expiry, |
179 |
maxreserves => $maxreserves, |
182 |
diffbranch => $diffbranch, |
180 |
expiry => $expiry, |
183 |
messages => $messages, |
181 |
diffbranch => $diffbranch, |
184 |
warnings => $warnings |
182 |
messages => $messages, |
|
|
183 |
warnings => $warnings |
185 |
); |
184 |
); |
186 |
} |
185 |
} |
187 |
|
186 |
|
Lines 200-217
if ($borrowerslist) {
Link Here
|
200 |
} @{$borrowerslist} |
199 |
} @{$borrowerslist} |
201 |
) |
200 |
) |
202 |
{ |
201 |
{ |
203 |
push @values, $borrower->{cardnumber}; |
202 |
push @values, $borrower->{borrowernumber}; |
204 |
|
203 |
|
205 |
$labels{ $borrower->{cardnumber} } = sprintf( |
204 |
$labels{ $borrower->{borrowernumber} } = sprintf( |
206 |
'%s, %s ... (%s - %s) ... %s', |
205 |
'%s, %s ... (%s - %s) ... %s', |
207 |
$borrower->{surname}, $borrower->{firstname}, |
206 |
$borrower->{surname} ||'', $borrower->{firstname} || '', |
208 |
$borrower->{cardnumber}, $borrower->{categorycode}, |
207 |
$borrower->{cardnumber} || '', $borrower->{categorycode} || '', |
209 |
$borrower->{address}, |
208 |
$borrower->{address} || '', |
210 |
); |
209 |
); |
211 |
} |
210 |
} |
212 |
|
211 |
|
213 |
$CGIselectborrower = CGI::scrolling_list( |
212 |
$CGIselectborrower = CGI::scrolling_list( |
214 |
-name => 'cardnumber', |
213 |
-name => 'borrowernumber', |
215 |
-values => \@values, |
214 |
-values => \@values, |
216 |
-labels => \%labels, |
215 |
-labels => \%labels, |
217 |
-size => 7, |
216 |
-size => 7, |
Lines 220-226
if ($borrowerslist) {
Link Here
|
220 |
} |
219 |
} |
221 |
|
220 |
|
222 |
# FIXME launch another time GetMemberDetails perhaps until |
221 |
# FIXME launch another time GetMemberDetails perhaps until |
223 |
my $borrowerinfo = GetMemberDetails( 0, $cardnumber ); |
222 |
my $borrowerinfo = GetMemberDetails( $borrowernumber_hold ); |
224 |
|
223 |
|
225 |
my @biblionumbers = (); |
224 |
my @biblionumbers = (); |
226 |
my $biblionumbers = $input->param('biblionumbers'); |
225 |
my $biblionumbers = $input->param('biblionumbers'); |
Lines 238-244
foreach my $biblionumber (@biblionumbers) {
Link Here
|
238 |
|
237 |
|
239 |
my $dat = GetBiblioData($biblionumber); |
238 |
my $dat = GetBiblioData($biblionumber); |
240 |
|
239 |
|
241 |
if ( not CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
240 |
unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
242 |
$warnings = 1; |
241 |
$warnings = 1; |
243 |
$maxreserves = 1; |
242 |
$maxreserves = 1; |
244 |
} |
243 |
} |
Lines 429-439
foreach my $biblionumber (@biblionumbers) {
Link Here
|
429 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
428 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
430 |
|
429 |
|
431 |
if ( $branchitemrule->{'holdallowed'} == 0 || |
430 |
if ( $branchitemrule->{'holdallowed'} == 0 || |
432 |
( $branchitemrule->{'holdallowed'} == 1 && $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) { |
431 |
( $branchitemrule->{'holdallowed'} == 1 && |
|
|
432 |
$borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) { |
433 |
$policy_holdallowed = 0; |
433 |
$policy_holdallowed = 0; |
434 |
} |
434 |
} |
435 |
|
435 |
|
436 |
if (IsAvailableForItemLevelRequest($itemnumber) and not $item->{cantreserve} and CanItemBeReserved($borrowerinfo->{borrowernumber}, $itemnumber) ) { |
436 |
if (IsAvailableForItemLevelRequest($itemnumber) and |
|
|
437 |
not $item->{cantreserve} and |
438 |
CanItemBeReserved($borrowerinfo->{borrowernumber}, $itemnumber) ) { |
437 |
if ( $policy_holdallowed ) { |
439 |
if ( $policy_holdallowed ) { |
438 |
$item->{available} = 1; |
440 |
$item->{available} = 1; |
439 |
$num_available++; |
441 |
$num_available++; |
Lines 564-570
foreach my $biblionumber (@biblionumbers) {
Link Here
|
564 |
date => $date, |
566 |
date => $date, |
565 |
biblionumber => $biblionumber, |
567 |
biblionumber => $biblionumber, |
566 |
findborrower => $findborrower, |
568 |
findborrower => $findborrower, |
567 |
cardnumber => $cardnumber, |
|
|
568 |
title => $dat->{title}, |
569 |
title => $dat->{title}, |
569 |
author => $dat->{author}, |
570 |
author => $dat->{author}, |
570 |
holdsview => 1, |
571 |
holdsview => 1, |
571 |
- |
|
|