Lines 23-28
use UNIVERSAL::can;
Link Here
|
23 |
|
23 |
|
24 |
use vars qw(@ISA $VERSION @EXPORT_OK); |
24 |
use vars qw(@ISA $VERSION @EXPORT_OK); |
25 |
|
25 |
|
|
|
26 |
use constant INVALID_CARD => 'Invalid cardnumber'; |
27 |
use constant INVALID_PW => 'Invalid password'; |
28 |
|
26 |
BEGIN { |
29 |
BEGIN { |
27 |
$VERSION = 3.07.00.049; |
30 |
$VERSION = 3.07.00.049; |
28 |
@ISA = qw(Exporter); |
31 |
@ISA = qw(Exporter); |
Lines 406-431
sub handle {
Link Here
|
406 |
# |
409 |
# |
407 |
sub build_patron_status { |
410 |
sub build_patron_status { |
408 |
my ( $patron, $lang, $fields, $server ) = @_; |
411 |
my ( $patron, $lang, $fields, $server ) = @_; |
409 |
my $overdrive_mode = $server->{account}->{'overdrive-mode'}; |
412 |
|
410 |
my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; |
413 |
my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; |
411 |
my $resp = (PATRON_STATUS_RESP); |
414 |
my $resp = (PATRON_STATUS_RESP); |
412 |
my $password_ok = 1; |
|
|
413 |
my $password_rc; |
415 |
my $password_rc; |
414 |
|
416 |
|
415 |
if ($patron) { |
417 |
if ( $patron ) { |
416 |
if ($patron_pwd) { |
418 |
if ($patron_pwd) { |
417 |
$password_rc = $patron->check_password($patron_pwd); |
419 |
$password_rc = $patron->check_password($patron_pwd); |
418 |
$password_ok = 0 unless $password_rc; |
|
|
419 |
} |
420 |
} |
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 |
|
421 |
|
428 |
if ( $patron and $password_ok ) { |
|
|
429 |
$resp .= patron_status_string($patron); |
422 |
$resp .= patron_status_string($patron); |
430 |
$resp .= $lang . timestamp(); |
423 |
$resp .= $lang . timestamp(); |
431 |
$resp .= add_field( FID_PERSONAL_NAME, $patron->name ); |
424 |
$resp .= add_field( FID_PERSONAL_NAME, $patron->name ); |
Lines 443-455
sub build_patron_status {
Link Here
|
443 |
$resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); |
436 |
$resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); |
444 |
} |
437 |
} |
445 |
|
438 |
|
446 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); |
439 |
my $msg = $patron->screen_msg; |
|
|
440 |
$msg .= ' -- '. INVALID_PW if $patron_pwd && !$password_rc; |
441 |
$resp .= maybe_add( FID_SCREEN_MSG, $msg, $server ); |
442 |
|
447 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) |
443 |
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server ) |
448 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
444 |
if ( $server->{account}->{send_patron_home_library_in_af} ); |
449 |
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); |
445 |
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); |
450 |
} else { |
|
|
451 |
|
446 |
|
452 |
# Invalid patron id (and/or passwd for overdrive_mode) |
447 |
} else { |
|
|
448 |
# Invalid patron (cardnumber) |
453 |
# Report that the user has no privs. |
449 |
# Report that the user has no privs. |
454 |
|
450 |
|
455 |
# no personal name, and is invalid (if we're using 2.00) |
451 |
# no personal name, and is invalid (if we're using 2.00) |
Lines 463-470
sub build_patron_status {
Link Here
|
463 |
( $protocol_version >= 2 ) |
459 |
( $protocol_version >= 2 ) |
464 |
and $resp .= add_field( FID_VALID_PATRON, 'N' ); |
460 |
and $resp .= add_field( FID_VALID_PATRON, 'N' ); |
465 |
|
461 |
|
466 |
$resp .= |
462 |
$resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD ); |
467 |
maybe_add( FID_SCREEN_MSG, 'Invalid patron or patron password' ); |
|
|
468 |
} |
463 |
} |
469 |
|
464 |
|
470 |
$resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); |
465 |
$resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); |
471 |
- |
|
|