|
Lines 406-416
sub handle {
Link Here
|
| 406 |
# |
406 |
# |
| 407 |
sub build_patron_status { |
407 |
sub build_patron_status { |
| 408 |
my ( $patron, $lang, $fields, $server ) = @_; |
408 |
my ( $patron, $lang, $fields, $server ) = @_; |
| 409 |
|
409 |
my $overdrive_mode = $server->{account}->{'overdrive-mode'}; |
| 410 |
my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; |
410 |
my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; |
| 411 |
my $resp = (PATRON_STATUS_RESP); |
411 |
my $resp = (PATRON_STATUS_RESP); |
|
|
412 |
my $password_ok = 1; |
| 413 |
my $password_rc; |
| 412 |
|
414 |
|
| 413 |
if ($patron) { |
415 |
if ($patron) { |
|
|
416 |
if ($patron_pwd) { |
| 417 |
$password_rc = $patron->check_password($patron_pwd); |
| 418 |
$password_ok = 0 unless $password_rc; |
| 419 |
} |
| 420 |
elsif ( $overdrive_mode |
| 421 |
and not exists $fields->{'AL'} # not block_request |
| 422 |
and not $patron_pwd ) # no password supplied |
| 423 |
{ |
| 424 |
$password_ok = 0; |
| 425 |
} |
| 426 |
} |
| 427 |
|
| 428 |
if ( $patron and $password_ok ) { |
| 414 |
$resp .= patron_status_string($patron); |
429 |
$resp .= patron_status_string($patron); |
| 415 |
$resp .= $lang . timestamp(); |
430 |
$resp .= $lang . timestamp(); |
| 416 |
$resp .= add_field( FID_PERSONAL_NAME, $patron->name ); |
431 |
$resp .= add_field( FID_PERSONAL_NAME, $patron->name ); |
|
Lines 418-428
sub build_patron_status {
Link Here
|
| 418 |
# while the patron ID we got from the SC is valid, let's |
433 |
# while the patron ID we got from the SC is valid, let's |
| 419 |
# use the one returned from the ILS, just in case... |
434 |
# use the one returned from the ILS, just in case... |
| 420 |
$resp .= add_field( FID_PATRON_ID, $patron->id ); |
435 |
$resp .= add_field( FID_PATRON_ID, $patron->id ); |
|
|
436 |
|
| 421 |
if ( $protocol_version >= 2 ) { |
437 |
if ( $protocol_version >= 2 ) { |
| 422 |
$resp .= add_field( FID_VALID_PATRON, 'Y' ); |
438 |
$resp .= add_field( FID_VALID_PATRON, 'Y' ); |
| 423 |
|
439 |
|
| 424 |
# Patron password is a required field. |
440 |
# Patron password is a required field. |
| 425 |
$resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password($patron_pwd) ) ); |
441 |
$resp .= add_field( FID_VALID_PATRON_PWD, sipbool($password_rc) ); |
| 426 |
$resp .= maybe_add( FID_CURRENCY, $patron->currency ); |
442 |
$resp .= maybe_add( FID_CURRENCY, $patron->currency ); |
| 427 |
$resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); |
443 |
$resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); |
| 428 |
} |
444 |
} |
|
Lines 430-440
sub build_patron_status {
Link Here
|
| 430 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); |
446 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); |
| 431 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) |
447 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) |
| 432 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
448 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
| 433 |
|
|
|
| 434 |
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); |
449 |
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); |
| 435 |
} else { |
450 |
} else { |
| 436 |
|
451 |
|
| 437 |
# Invalid patron id. Report that the user has no privs., |
452 |
# Invalid patron id (and/or passwd for overdrive_mode) |
|
|
453 |
# Report that the user has no privs. |
| 454 |
|
| 438 |
# no personal name, and is invalid (if we're using 2.00) |
455 |
# no personal name, and is invalid (if we're using 2.00) |
| 439 |
$resp .= 'YYYY' . ( ' ' x 10 ) . $lang . timestamp(); |
456 |
$resp .= 'YYYY' . ( ' ' x 10 ) . $lang . timestamp(); |
| 440 |
$resp .= add_field( FID_PERSONAL_NAME, '' ); |
457 |
$resp .= add_field( FID_PERSONAL_NAME, '' ); |
|
Lines 445-450
sub build_patron_status {
Link Here
|
| 445 |
|
462 |
|
| 446 |
( $protocol_version >= 2 ) |
463 |
( $protocol_version >= 2 ) |
| 447 |
and $resp .= add_field( FID_VALID_PATRON, 'N' ); |
464 |
and $resp .= add_field( FID_VALID_PATRON, 'N' ); |
|
|
465 |
|
| 466 |
$resp .= |
| 467 |
maybe_add( FID_SCREEN_MSG, 'Invalid patron or patron password' ); |
| 448 |
} |
468 |
} |
| 449 |
|
469 |
|
| 450 |
$resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); |
470 |
$resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); |
| 451 |
- |
|
|