Lines 94-100
if (defined C4::Context->preference('SCOAllowCheckin')) {
Link Here
|
94 |
} |
94 |
} |
95 |
|
95 |
|
96 |
my $issuerid = $loggedinuser; |
96 |
my $issuerid = $loggedinuser; |
97 |
my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = ( |
97 |
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts ) = ( |
98 |
$query->param("op") || '', |
98 |
$query->param("op") || '', |
99 |
$query->param("patronlogin") || '', |
99 |
$query->param("patronlogin") || '', |
100 |
$query->param("patronpw") || '', |
100 |
$query->param("patronpw") || '', |
Lines 112-118
if ($op eq "logout") {
Link Here
|
112 |
undef $jwt; |
112 |
undef $jwt; |
113 |
} |
113 |
} |
114 |
|
114 |
|
115 |
$barcode = barcodedecode( $barcode ) if $barcode; |
115 |
my $barcodes = []; |
|
|
116 |
if ( $barcodestr ) { |
117 |
push @$barcodes, split( /\s\n/, $barcodestr ); |
118 |
$barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ]; |
119 |
} |
116 |
|
120 |
|
117 |
my @newissueslist = split /,/, $newissues; |
121 |
my @newissueslist = split /,/, $newissues; |
118 |
my $issuenoconfirm = 1; #don't need to confirm on issue. |
122 |
my $issuenoconfirm = 1; #don't need to confirm on issue. |
Lines 142-151
my $branch = $issuer->{branchcode};
Link Here
|
142 |
my $confirm_required = 0; |
146 |
my $confirm_required = 0; |
143 |
my $return_only = 0; |
147 |
my $return_only = 0; |
144 |
|
148 |
|
|
|
149 |
if ( C4::Context->preference('BatchCheckouts') ) { |
150 |
my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories'); |
151 |
my $categorycode = $issuer->{categorycode}; |
152 |
if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) { |
153 |
# do nothing - logged in patron is allowed to do batch checkouts |
154 |
} else { |
155 |
# patron category not allowed to do batch checkouts, only allow first barcode |
156 |
while ( scalar @$barcodes > 1 ) { |
157 |
pop @$barcodes; |
158 |
} |
159 |
} |
160 |
} else { |
161 |
# batch checkouts not enabled, only allow first barcode |
162 |
while ( scalar @$barcodes > 1 ) { |
163 |
pop @$barcodes; |
164 |
} |
165 |
} |
166 |
|
145 |
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { |
167 |
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { |
146 |
my $success = 1; |
168 |
my $success = 1; |
147 |
|
169 |
|
148 |
|
170 |
foreach my $barcode ( @$barcodes ) { |
149 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
171 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
150 |
if ( $success && C4::Context->preference("CircConfirmItemParts") ) { |
172 |
if ( $success && C4::Context->preference("CircConfirmItemParts") ) { |
151 |
if ( defined($item) |
173 |
if ( defined($item) |
Lines 165-174
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
Link Here
|
165 |
($success) = AddReturn( $barcode, $branch ) |
187 |
($success) = AddReturn( $barcode, $branch ) |
166 |
} |
188 |
} |
167 |
|
189 |
|
168 |
$template->param( returned => $success ); |
190 |
$template->param( |
|
|
191 |
returned => $success, |
192 |
barcode => $barcode |
193 |
); |
194 |
} # foreach barcode in barcodes |
169 |
} |
195 |
} |
170 |
elsif ( $patron && ( $op eq 'cud-checkout' ) ) { |
|
|
171 |
|
196 |
|
|
|
197 |
elsif ( $patron && ( $op eq 'cud-checkout' ) ) { |
198 |
foreach my $barcode ( @$barcodes ) { |
172 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
199 |
my $item = Koha::Items->find( { barcode => $barcode } ); |
173 |
my $impossible = {}; |
200 |
my $impossible = {}; |
174 |
my $needconfirm = {}; |
201 |
my $needconfirm = {}; |
Lines 211-224
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
211 |
barcode => $barcode, |
238 |
barcode => $barcode, |
212 |
); |
239 |
); |
213 |
} |
240 |
} |
|
|
241 |
last; |
214 |
} elsif ( $needconfirm->{RENEW_ISSUE} ){ |
242 |
} elsif ( $needconfirm->{RENEW_ISSUE} ){ |
215 |
$template->param( |
243 |
$template->param( |
216 |
renew => 1, |
244 |
renew => 1, |
217 |
barcode => $barcode, |
245 |
barcode => $barcode, |
218 |
confirm => 1, |
246 |
confirm => $item->biblio->title, |
219 |
confirm_renew_issue => 1, |
247 |
confirm_renew_issue => 1, |
220 |
hide_main => 1, |
248 |
hide_main => 1, |
221 |
); |
249 |
); |
|
|
250 |
last; |
222 |
} elsif ( $confirm_required && !$confirmed ) { |
251 |
} elsif ( $confirm_required && !$confirmed ) { |
223 |
$template->param( |
252 |
$template->param( |
224 |
impossible => 1, |
253 |
impossible => 1, |
Lines 228-233
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
228 |
if ($issue_error eq 'DEBT') { |
257 |
if ($issue_error eq 'DEBT') { |
229 |
$template->param(DEBT => $needconfirm->{DEBT}); |
258 |
$template->param(DEBT => $needconfirm->{DEBT}); |
230 |
} |
259 |
} |
|
|
260 |
last; |
231 |
} else { |
261 |
} else { |
232 |
if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues. |
262 |
if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues. |
233 |
my ( $hold_existed, $item ); |
263 |
my ( $hold_existed, $item ); |
Lines 250-256
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
250 |
|
280 |
|
251 |
my $new_issue = AddIssue( $patron, $barcode ); |
281 |
my $new_issue = AddIssue( $patron, $barcode ); |
252 |
$template->param( issued => 1, new_issue => $new_issue ); |
282 |
$template->param( issued => 1, new_issue => $new_issue ); |
253 |
push @newissueslist, $barcode; |
283 |
push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist ); |
254 |
|
284 |
|
255 |
if ( $hold_existed ) { |
285 |
if ( $hold_existed ) { |
256 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
286 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
Lines 276-284
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
Link Here
|
276 |
); |
306 |
); |
277 |
} |
307 |
} |
278 |
} |
308 |
} |
|
|
309 |
} # foreach barcode in barcodes |
279 |
} # $op |
310 |
} # $op |
280 |
|
311 |
|
281 |
if ( $patron && ( $op eq 'cud-renew' ) ) { |
312 |
if ( $patron && ( $op eq 'cud-renew' ) ) { |
|
|
313 |
foreach my $barcode ( @$barcodes ) { |
282 |
my $item = Koha::Items->find({ barcode => $barcode }); |
314 |
my $item = Koha::Items->find({ barcode => $barcode }); |
283 |
|
315 |
|
284 |
if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { |
316 |
if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { |
Lines 292-302
if ( $patron && ( $op eq 'cud-renew' ) ) {
Link Here
|
292 |
} |
324 |
} |
293 |
); |
325 |
); |
294 |
push @newissueslist, $barcode; |
326 |
push @newissueslist, $barcode; |
295 |
$template->param( renewed => 1 ); |
327 |
$template->param( |
|
|
328 |
renewed => 1, |
329 |
barcode => $barcode |
330 |
); |
296 |
} |
331 |
} |
297 |
} else { |
332 |
} else { |
298 |
$template->param( renewed => 0 ); |
333 |
$template->param( renewed => 0 ); |
299 |
} |
334 |
} |
|
|
335 |
} # foreach barcode in barcodes |
300 |
} |
336 |
} |
301 |
|
337 |
|
302 |
if ( $patron) { |
338 |
if ( $patron) { |
303 |
- |
|
|