Lines 118-135
if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
Link Here
|
118 |
($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw); |
118 |
($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw); |
119 |
} |
119 |
} |
120 |
|
120 |
|
121 |
my ( $borrower, $patron ); |
121 |
my $patron; |
122 |
if ( $patronid ) { |
122 |
if ( $patronid ) { |
123 |
Koha::Plugins->call( 'patron_barcode_transform', \$patronid ); |
123 |
Koha::Plugins->call( 'patron_barcode_transform', \$patronid ); |
124 |
$patron = Koha::Patrons->find( { cardnumber => $patronid } ); |
124 |
$patron = Koha::Patrons->find( { cardnumber => $patronid } ); |
125 |
$borrower = $patron->unblessed if $patron; |
|
|
126 |
} |
125 |
} |
127 |
|
126 |
|
128 |
my $branch = $issuer->{branchcode}; |
127 |
my $branch = $issuer->{branchcode}; |
129 |
my $confirm_required = 0; |
128 |
my $confirm_required = 0; |
130 |
my $return_only = 0; |
129 |
my $return_only = 0; |
131 |
#warn "issuer cardnumber: " . $issuer->{cardnumber}; |
|
|
132 |
#warn "patron cardnumber: " . $borrower->{cardnumber}; |
133 |
if ($op eq "logout") { |
130 |
if ($op eq "logout") { |
134 |
$template->param( loggedout => 1 ); |
131 |
$template->param( loggedout => 1 ); |
135 |
$query->param( patronid => undef, patronlogin => undef, patronpw => undef ); |
132 |
$query->param( patronid => undef, patronlogin => undef, patronpw => undef ); |
Lines 222-228
elsif ( $patron && ( $op eq 'checkout' ) ) {
Link Here
|
222 |
$hold_existed = Koha::Holds->search( |
219 |
$hold_existed = Koha::Holds->search( |
223 |
{ |
220 |
{ |
224 |
-and => { |
221 |
-and => { |
225 |
borrowernumber => $borrower->{borrowernumber}, |
222 |
borrowernumber => $patron->borrowernumber, |
226 |
-or => { |
223 |
-or => { |
227 |
biblionumber => $item->biblionumber, |
224 |
biblionumber => $item->biblionumber, |
228 |
itemnumber => $item->itemnumber |
225 |
itemnumber => $item->itemnumber |
Lines 232-238
elsif ( $patron && ( $op eq 'checkout' ) ) {
Link Here
|
232 |
)->count; |
229 |
)->count; |
233 |
} |
230 |
} |
234 |
|
231 |
|
235 |
AddIssue( $borrower, $barcode ); |
232 |
AddIssue( $patron->unblessed, $barcode ); |
236 |
$template->param( issued => 1 ); |
233 |
$template->param( issued => 1 ); |
237 |
push @newissueslist, $barcode; |
234 |
push @newissueslist, $barcode; |
238 |
|
235 |
|
Lines 243-249
elsif ( $patron && ( $op eq 'checkout' ) ) {
Link Here
|
243 |
# Note that this should not be needed but since we do not have proper exception handling here we do it this way |
240 |
# Note that this should not be needed but since we do not have proper exception handling here we do it this way |
244 |
patron_has_hold_fee => Koha::Account::Lines->search( |
241 |
patron_has_hold_fee => Koha::Account::Lines->search( |
245 |
{ |
242 |
{ |
246 |
borrowernumber => $borrower->{borrowernumber}, |
243 |
borrowernumber => $patron->borrowernumber, |
247 |
debit_type_code => 'RESERVE', |
244 |
debit_type_code => 'RESERVE', |
248 |
description => $item->biblio->title, |
245 |
description => $item->biblio->title, |
249 |
date => $dtf->format_date(dt_from_string) |
246 |
date => $dtf->format_date(dt_from_string) |
Lines 265-289
elsif ( $patron && ( $op eq 'checkout' ) ) {
Link Here
|
265 |
} # $op |
262 |
} # $op |
266 |
|
263 |
|
267 |
if ( $patron && ( $op eq 'renew' ) ) { |
264 |
if ( $patron && ( $op eq 'renew' ) ) { |
268 |
my ($status,$renewerror) = CanBookBeRenewed( $borrower->{borrowernumber}, $item->itemnumber ); |
265 |
my ($status,$renewerror) = CanBookBeRenewed( $patron->borrowernumber, $item->itemnumber ); |
269 |
if ($status) { |
266 |
if ($status) { |
270 |
#warn "renewing"; |
267 |
#warn "renewing"; |
271 |
AddRenewal( $borrower->{borrowernumber}, $item->itemnumber, undef, undef, undef, undef, 1 ); |
268 |
AddRenewal( $patron->borrowernumber, $item->itemnumber, undef, undef, undef, undef, 1 ); |
272 |
push @newissueslist, $barcode; |
269 |
push @newissueslist, $barcode; |
273 |
$template->param( renewed => 1 ); |
270 |
$template->param( renewed => 1 ); |
274 |
} |
271 |
} |
275 |
} |
272 |
} |
276 |
|
273 |
|
277 |
if ($borrower) { |
274 |
if ($patron) { |
278 |
# warn "issuer's branchcode: " . $issuer->{branchcode}; |
275 |
my $borrowername = sprintf "%s %s", ($patron->firstname || ''), ($patron->surname || ''); |
279 |
# warn "user's branchcode: " . $borrower->{branchcode}; |
|
|
280 |
my $borrowername = sprintf "%s %s", ($borrower->{firstname} || ''), ($borrower->{surname} || ''); |
281 |
my $pending_checkouts = $patron->pending_checkouts; |
276 |
my $pending_checkouts = $patron->pending_checkouts; |
282 |
my @checkouts; |
277 |
my @checkouts; |
283 |
while ( my $c = $pending_checkouts->next ) { |
278 |
while ( my $c = $pending_checkouts->next ) { |
284 |
my $checkout = $c->unblessed_all_relateds; |
279 |
my $checkout = $c->unblessed_all_relateds; |
285 |
my ($can_be_renewed, $renew_error) = CanBookBeRenewed( |
280 |
my ($can_be_renewed, $renew_error) = CanBookBeRenewed( |
286 |
$borrower->{borrowernumber}, |
281 |
$patron->borrowernumber, |
287 |
$checkout->{itemnumber}, |
282 |
$checkout->{itemnumber}, |
288 |
); |
283 |
); |
289 |
$checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed |
284 |
$checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed |
Lines 320-326
if ($borrower) {
Link Here
|
320 |
patronpw => $patronpw, |
315 |
patronpw => $patronpw, |
321 |
waiting_holds_count => $waiting_holds_count, |
316 |
waiting_holds_count => $waiting_holds_count, |
322 |
noitemlinks => 1 , |
317 |
noitemlinks => 1 , |
323 |
borrowernumber => $borrower->{'borrowernumber'}, |
318 |
borrowernumber => $patron->borrowernumber, |
324 |
SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), |
319 |
SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), |
325 |
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), |
320 |
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), |
326 |
howpriority => $show_priority, |
321 |
howpriority => $show_priority, |
Lines 330-342
if ($borrower) {
Link Here
|
330 |
|
325 |
|
331 |
my $patron_messages = Koha::Patron::Messages->search( |
326 |
my $patron_messages = Koha::Patron::Messages->search( |
332 |
{ |
327 |
{ |
333 |
borrowernumber => $borrower->{'borrowernumber'}, |
328 |
borrowernumber => $patron->borrowernumber, |
334 |
message_type => 'B', |
329 |
message_type => 'B', |
335 |
} |
330 |
} |
336 |
); |
331 |
); |
337 |
$template->param( |
332 |
$template->param( |
338 |
patron_messages => $patron_messages, |
333 |
patron_messages => $patron_messages, |
339 |
opacnote => $borrower->{opacnote}, |
334 |
opacnote => $patron->opacnote, |
340 |
); |
335 |
); |
341 |
|
336 |
|
342 |
my $inputfocus = ($return_only == 1) ? 'returnbook' : |
337 |
my $inputfocus = ($return_only == 1) ? 'returnbook' : |
Lines 347-356
if ($borrower) {
Link Here
|
347 |
|
342 |
|
348 |
); |
343 |
); |
349 |
if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { |
344 |
if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { |
350 |
my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); |
345 |
my $patron_image = $patron->image; |
351 |
$template->param( |
346 |
$template->param( |
352 |
display_patron_image => 1, |
347 |
display_patron_image => 1, |
353 |
csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $query->cookie('CGISESSID') . $borrower->{cardnumber}, id => $borrower->{userid}} ), |
348 |
csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $query->cookie('CGISESSID') . $patron->cardnumber, id => $patron->userid } ), |
354 |
) if $patron_image; |
349 |
) if $patron_image; |
355 |
} |
350 |
} |
356 |
} else { |
351 |
} else { |
357 |
- |
|
|