|
Lines 86-92
if (defined C4::Context->preference('SCOAllowCheckin')) {
Link Here
|
| 86 |
} |
86 |
} |
| 87 |
|
87 |
|
| 88 |
my $issuerid = $loggedinuser; |
88 |
my $issuerid = $loggedinuser; |
| 89 |
my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = ( |
89 |
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts ) = ( |
| 90 |
$query->param("op") || '', |
90 |
$query->param("op") || '', |
| 91 |
$query->param("patronlogin") || '', |
91 |
$query->param("patronlogin") || '', |
| 92 |
$query->param("patronpw") || '', |
92 |
$query->param("patronpw") || '', |
|
Lines 104-110
if ($op eq "logout") {
Link Here
|
| 104 |
undef $jwt; |
104 |
undef $jwt; |
| 105 |
} |
105 |
} |
| 106 |
|
106 |
|
| 107 |
$barcode = barcodedecode( $barcode ) if $barcode; |
107 |
my $barcodes = []; |
|
|
108 |
if ( $barcodestr ) { |
| 109 |
push @$barcodes, split( /\s\n/, $barcodestr ); |
| 110 |
$barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ]; |
| 111 |
} |
| 108 |
|
112 |
|
| 109 |
my @newissueslist = split /,/, $newissues; |
113 |
my @newissueslist = split /,/, $newissues; |
| 110 |
my $issuenoconfirm = 1; #don't need to confirm on issue. |
114 |
my $issuenoconfirm = 1; #don't need to confirm on issue. |
|
Lines 134-143
my $branch = $issuer->{branchcode};
Link Here
|
| 134 |
my $confirm_required = 0; |
138 |
my $confirm_required = 0; |
| 135 |
my $return_only = 0; |
139 |
my $return_only = 0; |
| 136 |
|
140 |
|
|
|
141 |
if ( C4::Context->preference('BatchCheckouts') ) { |
| 142 |
my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories'); |
| 143 |
my $categorycode = $issuer->{categorycode}; |
| 144 |
if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) { |
| 145 |
# do nothing - logged in patron is allowed to do batch checkouts |
| 146 |
} else { |
| 147 |
# patron category not allowed to do batch checkouts, only allow first barcode |
| 148 |
while ( scalar @$barcodes > 1 ) { |
| 149 |
pop @$barcodes; |
| 150 |
} |
| 151 |
} |
| 152 |
} else { |
| 153 |
# batch checkouts not enabled, only allow first barcode |
| 154 |
while ( scalar @$barcodes > 1 ) { |
| 155 |
pop @$barcodes; |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 137 |
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { |
159 |
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { |
| 138 |
my $success = 1; |
160 |
my $success = 1; |
| 139 |
|
161 |
|
| 140 |
|
162 |
foreach my $barcode ( @$barcodes ) { |
| 141 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
163 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
| 142 |
if ( $success && C4::Context->preference("CircConfirmItemParts") ) { |
164 |
if ( $success && C4::Context->preference("CircConfirmItemParts") ) { |
| 143 |
if ( defined($item) |
165 |
if ( defined($item) |
|
Lines 157-166
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
Link Here
|
| 157 |
($success) = AddReturn( $barcode, $branch ) |
179 |
($success) = AddReturn( $barcode, $branch ) |
| 158 |
} |
180 |
} |
| 159 |
|
181 |
|
| 160 |
$template->param( returned => $success ); |
182 |
$template->param( |
|
|
183 |
returned => $success, |
| 184 |
barcode => $barcode |
| 185 |
); |
| 186 |
} # foreach barcode in barcodes |
| 161 |
} |
187 |
} |
| 162 |
elsif ( $patron && ( $op eq 'cud-checkout' ) ) { |
|
|
| 163 |
|
188 |
|
|
|
189 |
elsif ( $patron && ( $op eq 'cud-checkout' ) ) { |
| 190 |
foreach my $barcode ( @$barcodes ) { |
| 164 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
191 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
| 165 |
my $impossible = {}; |
192 |
my $impossible = {}; |
| 166 |
my $needconfirm = {}; |
193 |
my $needconfirm = {}; |
|
Lines 203-216
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
| 203 |
barcode => $barcode, |
230 |
barcode => $barcode, |
| 204 |
); |
231 |
); |
| 205 |
} |
232 |
} |
|
|
233 |
last; |
| 206 |
} elsif ( $needconfirm->{RENEW_ISSUE} ){ |
234 |
} elsif ( $needconfirm->{RENEW_ISSUE} ){ |
| 207 |
$template->param( |
235 |
$template->param( |
| 208 |
renew => 1, |
236 |
renew => 1, |
| 209 |
barcode => $barcode, |
237 |
barcode => $barcode, |
| 210 |
confirm => 1, |
238 |
confirm => $item->biblio->title, |
| 211 |
confirm_renew_issue => 1, |
239 |
confirm_renew_issue => 1, |
| 212 |
hide_main => 1, |
240 |
hide_main => 1, |
| 213 |
); |
241 |
); |
|
|
242 |
last; |
| 214 |
} elsif ( $confirm_required && !$confirmed ) { |
243 |
} elsif ( $confirm_required && !$confirmed ) { |
| 215 |
$template->param( |
244 |
$template->param( |
| 216 |
impossible => 1, |
245 |
impossible => 1, |
|
Lines 220-225
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
| 220 |
if ($issue_error eq 'DEBT') { |
249 |
if ($issue_error eq 'DEBT') { |
| 221 |
$template->param(DEBT => $needconfirm->{DEBT}); |
250 |
$template->param(DEBT => $needconfirm->{DEBT}); |
| 222 |
} |
251 |
} |
|
|
252 |
last; |
| 223 |
} else { |
253 |
} else { |
| 224 |
if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues. |
254 |
if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues. |
| 225 |
my ( $hold_existed, $item ); |
255 |
my ( $hold_existed, $item ); |
|
Lines 242-248
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
| 242 |
|
272 |
|
| 243 |
my $new_issue = AddIssue( $patron, $barcode ); |
273 |
my $new_issue = AddIssue( $patron, $barcode ); |
| 244 |
$template->param( issued => 1, new_issue => $new_issue ); |
274 |
$template->param( issued => 1, new_issue => $new_issue ); |
| 245 |
push @newissueslist, $barcode; |
275 |
push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist ); |
| 246 |
|
276 |
|
| 247 |
if ( $hold_existed ) { |
277 |
if ( $hold_existed ) { |
| 248 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
278 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
|
Lines 268-276
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
| 268 |
); |
298 |
); |
| 269 |
} |
299 |
} |
| 270 |
} |
300 |
} |
|
|
301 |
} # foreach barcode in barcodes |
| 271 |
} # $op |
302 |
} # $op |
| 272 |
|
303 |
|
| 273 |
if ( $patron && ( $op eq 'cud-renew' ) ) { |
304 |
if ( $patron && ( $op eq 'cud-renew' ) ) { |
|
|
305 |
foreach my $barcode ( @$barcodes ) { |
| 274 |
my $item = Koha::Items->find({ barcode => $barcode }); |
306 |
my $item = Koha::Items->find({ barcode => $barcode }); |
| 275 |
|
307 |
|
| 276 |
if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { |
308 |
if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { |
|
Lines 284-294
if ( $patron && ( $op eq 'cud-renew' ) ) {
Link Here
|
| 284 |
} |
316 |
} |
| 285 |
); |
317 |
); |
| 286 |
push @newissueslist, $barcode; |
318 |
push @newissueslist, $barcode; |
| 287 |
$template->param( renewed => 1 ); |
319 |
$template->param( |
|
|
320 |
renewed => 1, |
| 321 |
barcode => $barcode |
| 322 |
); |
| 288 |
} |
323 |
} |
| 289 |
} else { |
324 |
} else { |
| 290 |
$template->param( renewed => 0 ); |
325 |
$template->param( renewed => 0 ); |
| 291 |
} |
326 |
} |
|
|
327 |
} # foreach barcode in barcodes |
| 292 |
} |
328 |
} |
| 293 |
|
329 |
|
| 294 |
if ( $patron) { |
330 |
if ( $patron) { |
| 295 |
- |
|
|