|
Lines 77-84
$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 $warnings; |
80 |
my $maxreserves; |
| 81 |
my $messages; |
|
|
| 82 |
|
81 |
|
| 83 |
my $date = C4::Dates->today('iso'); |
82 |
my $date = C4::Dates->today('iso'); |
| 84 |
my $action = $input->param('action'); |
83 |
my $action = $input->param('action'); |
|
Lines 126-132
if ($borrowernumber_hold && !$action) {
Link Here
|
| 126 |
my $diffbranch; |
125 |
my $diffbranch; |
| 127 |
my @getreservloop; |
126 |
my @getreservloop; |
| 128 |
my $count_reserv = 0; |
127 |
my $count_reserv = 0; |
| 129 |
my $maxreserves; |
|
|
| 130 |
|
128 |
|
| 131 |
# we check the reserves of the borrower, and if he can reserv a document |
129 |
# we check the reserves of the borrower, and if he can reserv a document |
| 132 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
130 |
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... |
|
Lines 135-141
if ($borrowernumber_hold && !$action) {
Link Here
|
| 135 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
133 |
GetReserveCount( $borrowerinfo->{'borrowernumber'} ); |
| 136 |
|
134 |
|
| 137 |
if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { |
135 |
if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { |
| 138 |
$warnings = 1; |
|
|
| 139 |
$maxreserves = 1; |
136 |
$maxreserves = 1; |
| 140 |
} |
137 |
} |
| 141 |
|
138 |
|
|
Lines 144-155
if ($borrowernumber_hold && !$action) {
Link Here
|
| 144 |
my $expiry = 0; # flag set if patron account has expired |
141 |
my $expiry = 0; # flag set if patron account has expired |
| 145 |
if ($expiry_date and $expiry_date ne '0000-00-00' and |
142 |
if ($expiry_date and $expiry_date ne '0000-00-00' and |
| 146 |
Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) { |
143 |
Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) { |
| 147 |
$messages = $expiry = 1; |
144 |
$expiry = 1; |
| 148 |
} |
145 |
} |
| 149 |
|
146 |
|
| 150 |
# check if the borrower make the reserv in a different branch |
147 |
# check if the borrower make the reserv in a different branch |
| 151 |
if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) { |
148 |
if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) { |
| 152 |
$messages = 1; |
|
|
| 153 |
$diffbranch = 1; |
149 |
$diffbranch = 1; |
| 154 |
} |
150 |
} |
| 155 |
|
151 |
|
|
Lines 168-178
if ($borrowernumber_hold && !$action) {
Link Here
|
| 168 |
borrowercategory => $borrowerinfo->{'category'}, |
164 |
borrowercategory => $borrowerinfo->{'category'}, |
| 169 |
borrowerreservs => $count_reserv, |
165 |
borrowerreservs => $count_reserv, |
| 170 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
166 |
cardnumber => $borrowerinfo->{'cardnumber'}, |
| 171 |
maxreserves => $maxreserves, |
|
|
| 172 |
expiry => $expiry, |
167 |
expiry => $expiry, |
| 173 |
diffbranch => $diffbranch, |
168 |
diffbranch => $diffbranch, |
| 174 |
messages => $messages, |
|
|
| 175 |
warnings => $warnings |
| 176 |
); |
169 |
); |
| 177 |
} |
170 |
} |
| 178 |
|
171 |
|
|
Lines 194-211
my @biblioloop = ();
Link Here
|
| 194 |
foreach my $biblionumber (@biblionumbers) { |
187 |
foreach my $biblionumber (@biblionumbers) { |
| 195 |
|
188 |
|
| 196 |
my %biblioloopiter = (); |
189 |
my %biblioloopiter = (); |
| 197 |
my $maxreserves; |
|
|
| 198 |
|
190 |
|
| 199 |
my $dat = GetBiblioData($biblionumber); |
191 |
my $dat = GetBiblioData($biblionumber); |
| 200 |
|
192 |
|
| 201 |
unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
193 |
unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { |
| 202 |
$warnings = 1; |
|
|
| 203 |
$maxreserves = 1; |
194 |
$maxreserves = 1; |
| 204 |
} |
195 |
} |
| 205 |
|
196 |
|
| 206 |
my $alreadypossession; |
197 |
my $alreadypossession; |
| 207 |
if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { |
198 |
if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { |
| 208 |
$warnings = 1; |
|
|
| 209 |
$alreadypossession = 1; |
199 |
$alreadypossession = 1; |
| 210 |
} |
200 |
} |
| 211 |
|
201 |
|
|
Lines 220-238
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 220 |
} |
210 |
} |
| 221 |
|
211 |
|
| 222 |
if ( defined $borrowerinfo && ($borrowerinfo->{borrowernumber} eq $res->{borrowernumber}) ) { |
212 |
if ( defined $borrowerinfo && ($borrowerinfo->{borrowernumber} eq $res->{borrowernumber}) ) { |
| 223 |
$warnings = 1; |
|
|
| 224 |
$alreadyreserved = 1; |
213 |
$alreadyreserved = 1; |
| 225 |
$biblioloopiter{warn} = 1; |
214 |
$biblioloopiter{warn} = 1; |
| 226 |
$biblioloopiter{alreadyres} = 1; |
215 |
$biblioloopiter{alreadyres} = 1; |
| 227 |
} |
216 |
} |
| 228 |
} |
217 |
} |
| 229 |
|
218 |
|
| 230 |
$template->param( alreadyreserved => $alreadyreserved, |
219 |
$template->param( |
| 231 |
messages => $messages, |
220 |
alreadyreserved => $alreadyreserved, |
| 232 |
warnings => $warnings, |
221 |
alreadypossession => $alreadypossession, |
| 233 |
maxreserves=>$maxreserves, |
222 |
); |
| 234 |
alreadypossession => $alreadypossession, |
|
|
| 235 |
); |
| 236 |
|
223 |
|
| 237 |
|
224 |
|
| 238 |
# FIXME think @optionloop, is maybe obsolete, or must be switchable by a systeme preference fixed rank or not |
225 |
# FIXME think @optionloop, is maybe obsolete, or must be switchable by a systeme preference fixed rank or not |
|
Lines 456-462
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 456 |
$template->param( override_required => 1 ); |
443 |
$template->param( override_required => 1 ); |
| 457 |
} elsif ( $num_available == 0 ) { |
444 |
} elsif ( $num_available == 0 ) { |
| 458 |
$template->param( none_available => 1 ); |
445 |
$template->param( none_available => 1 ); |
| 459 |
$template->param( warnings => 1 ); |
|
|
| 460 |
$biblioloopiter{warn} = 1; |
446 |
$biblioloopiter{warn} = 1; |
| 461 |
$biblioloopiter{none_avail} = 1; |
447 |
$biblioloopiter{none_avail} = 1; |
| 462 |
} |
448 |
} |
|
Lines 590-595
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 590 |
|
576 |
|
| 591 |
$template->param( biblioloop => \@biblioloop ); |
577 |
$template->param( biblioloop => \@biblioloop ); |
| 592 |
$template->param( biblionumbers => $biblionumbers ); |
578 |
$template->param( biblionumbers => $biblionumbers ); |
|
|
579 |
$template->param( maxreserves => $maxreserves ); |
| 593 |
|
580 |
|
| 594 |
if ($multihold) { |
581 |
if ($multihold) { |
| 595 |
$template->param( multi_hold => 1 ); |
582 |
$template->param( multi_hold => 1 ); |
| 596 |
- |
|
|