Lines 431-477
sub handle {
Link Here
|
431 |
# information will be returned to the terminal. |
431 |
# information will be returned to the terminal. |
432 |
# |
432 |
# |
433 |
sub build_patron_status { |
433 |
sub build_patron_status { |
434 |
my ($patron, $lang, $fields, $server)= @_; |
434 |
my ( $patron, $lang, $fields, $server ) = @_; |
435 |
|
435 |
|
436 |
my $patron_pwd = $fields->{(FID_PATRON_PWD)}; |
436 |
my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; |
437 |
my $resp = (PATRON_STATUS_RESP); |
437 |
my $resp = (PATRON_STATUS_RESP); |
438 |
|
438 |
|
439 |
if ($patron) { |
439 |
if ($patron) { |
440 |
$resp .= patron_status_string($patron); |
440 |
$resp .= patron_status_string($patron); |
441 |
$resp .= $lang . timestamp(); |
441 |
$resp .= $lang . Sip::timestamp(); |
442 |
$resp .= add_field(FID_PERSONAL_NAME, $patron->name); |
442 |
$resp .= add_field( FID_PERSONAL_NAME, $patron->name ); |
443 |
|
443 |
|
444 |
# while the patron ID we got from the SC is valid, let's |
444 |
# while the patron ID we got from the SC is valid, let's |
445 |
# use the one returned from the ILS, just in case... |
445 |
# use the one returned from the ILS, just in case... |
446 |
$resp .= add_field(FID_PATRON_ID, $patron->id); |
446 |
$resp .= add_field( FID_PATRON_ID, $patron->id ); |
447 |
if ($protocol_version >= 2) { |
447 |
if ( $protocol_version >= 2 ) { |
448 |
$resp .= add_field(FID_VALID_PATRON, 'Y'); |
448 |
$resp .= add_field( FID_VALID_PATRON, 'Y' ); |
449 |
# Patron password is a required field. |
449 |
|
450 |
$resp .= add_field(FID_VALID_PATRON_PWD, sipbool($patron->check_password($patron_pwd))); |
450 |
# Patron password is a required field. |
451 |
$resp .= maybe_add(FID_CURRENCY, $patron->currency); |
451 |
$resp .= |
452 |
$resp .= maybe_add(FID_FEE_AMT, $patron->fee_amount); |
452 |
add_field( FID_VALID_PATRON_PWD, |
453 |
} |
453 |
sipbool( $patron->check_password($patron_pwd) ) ); |
|
|
454 |
$resp .= maybe_add( FID_CURRENCY, $patron->currency ); |
455 |
$resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); |
456 |
} |
454 |
|
457 |
|
455 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); |
458 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg ); |
456 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) |
459 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) |
457 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
460 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
458 |
|
461 |
|
459 |
$resp .= maybe_add(FID_PRINT_LINE, $patron->print_line); |
462 |
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); |
460 |
} else { |
463 |
} |
461 |
# Invalid patron id. Report that the user has no privs., |
464 |
else { |
462 |
# no personal name, and is invalid (if we're using 2.00) |
465 |
# Invalid patron id. Report that the user has no privs., |
463 |
$resp .= 'YYYY' . (' ' x 10) . $lang . timestamp(); |
466 |
# no personal name, and is invalid (if we're using 2.00) |
464 |
$resp .= add_field(FID_PERSONAL_NAME, ''); |
467 |
$resp .= 'YYYY' . ( ' ' x 10 ) . $lang . Sip::timestamp(); |
|
|
468 |
$resp .= add_field( FID_PERSONAL_NAME, '' ); |
465 |
|
469 |
|
466 |
# the patron ID is invalid, but it's a required field, so |
470 |
# the patron ID is invalid, but it's a required field, so |
467 |
# just echo it back |
471 |
# just echo it back |
468 |
$resp .= add_field(FID_PATRON_ID, $fields->{(FID_PATRON_ID)}); |
472 |
$resp .= add_field( FID_PATRON_ID, $fields->{ (FID_PATRON_ID) } ); |
469 |
|
473 |
|
470 |
($protocol_version >= 2) and |
474 |
( $protocol_version >= 2 ) |
471 |
$resp .= add_field(FID_VALID_PATRON, 'N'); |
475 |
and $resp .= add_field( FID_VALID_PATRON, 'N' ); |
472 |
} |
476 |
} |
473 |
|
477 |
|
474 |
$resp .= add_field(FID_INST_ID, $fields->{(FID_INST_ID)}); |
478 |
$resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); |
475 |
return $resp; |
479 |
return $resp; |
476 |
} |
480 |
} |
477 |
|
481 |
|
478 |
- |
|
|