| 
      
            Lines 429-442
          sub handle {
      
      
        Link Here
      
     | 
  
        
          | 429 | 
          # ASSUMPTION: If the patron password field is present in the  | 
          429 | 
          # ASSUMPTION: If the patron password field is present in the  | 
        
        
          | 430 | 
          # message, then it must match, otherwise incomplete patron status  | 
          430 | 
          # message, then it must match, otherwise incomplete patron status  | 
        
        
          | 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 | 
                  my $overdrive_mode = $server->{account}->{'overdrive-mode'}; | 
            
        
          | 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 | 
                  my $password_ok = 1;  | 
            
            
              | 439 | 
                  my $password_rc;  | 
            
        
          | 438 | 
           | 
          440 | 
           | 
        
        
          | 439 | 
              if ($patron) { | 
          441 | 
              if ($patron) { | 
        
            
               | 
               | 
              442 | 
                      if ($patron_pwd) { | 
            
            
              | 443 | 
                          $password_rc = $patron->check_password($patron_pwd);  | 
            
            
              | 444 | 
                          $password_ok = 0 unless $password_rc;  | 
            
            
              | 445 | 
                      }  | 
            
            
              | 446 | 
                      elsif ( $overdrive_mode  | 
            
            
              | 447 | 
                          and not exists $fields->{'AL'} # not block_request | 
            
            
              | 448 | 
                          and not $patron_pwd ) # no password supplied  | 
            
            
              | 449 | 
                      { | 
            
            
              | 450 | 
                          $password_ok = 0;  | 
            
            
              | 451 | 
                      }  | 
            
            
              | 452 | 
                  }  | 
            
            
              | 453 | 
               | 
            
            
              | 454 | 
                  if ( $patron and $password_ok ) { | 
            
        
          | 440 | 
                  $resp .= patron_status_string($patron);  | 
          455 | 
                  $resp .= patron_status_string($patron);  | 
        
        
          | 441 | 
                  $resp .= $lang . Sip::timestamp();  | 
          456 | 
                  $resp .= $lang . Sip::timestamp();  | 
        
        
          | 442 | 
                  $resp .= add_field( FID_PERSONAL_NAME, $patron->name );  | 
          457 | 
                  $resp .= add_field( FID_PERSONAL_NAME, $patron->name );  | 
        
  
    | 
      
            Lines 444-456
          sub build_patron_status {
      
      
        Link Here
      
     | 
  
        
          | 444 | 
                  # while the patron ID we got from the SC is valid, let's  | 
          459 | 
                  # while the patron ID we got from the SC is valid, let's  | 
        
        
          | 445 | 
                  # use the one returned from the ILS, just in case...  | 
          460 | 
                  # use the one returned from the ILS, just in case...  | 
        
        
          | 446 | 
                  $resp .= add_field( FID_PATRON_ID, $patron->id );  | 
          461 | 
                  $resp .= add_field( FID_PATRON_ID, $patron->id );  | 
        
            
               | 
               | 
              462 | 
               | 
            
        
          | 447 | 
                  if ( $protocol_version >= 2 ) { | 
          463 | 
                  if ( $protocol_version >= 2 ) { | 
        
        
          | 448 | 
                      $resp .= add_field( FID_VALID_PATRON, 'Y' );  | 
          464 | 
                      $resp .= add_field( FID_VALID_PATRON, 'Y' );  | 
        
        
          | 449 | 
           | 
          465 | 
           | 
        
        
          | 450 | 
                      # Patron password is a required field.  | 
          466 | 
                      # Patron password is a required field.  | 
        
          
            
              | 451 | 
                          $resp .=  | 
              467 | 
                          $resp .= add_field( FID_VALID_PATRON_PWD, sipbool($password_rc) );  | 
            
            
              | 452 | 
                            add_field( FID_VALID_PATRON_PWD,  | 
               | 
               | 
            
            
              | 453 | 
                              sipbool( $patron->check_password($patron_pwd) ) );  | 
            
        
          | 454 | 
                      $resp .= maybe_add( FID_CURRENCY, $patron->currency );  | 
          468 | 
                      $resp .= maybe_add( FID_CURRENCY, $patron->currency );  | 
        
        
          | 455 | 
                      $resp .= maybe_add( FID_FEE_AMT,  $patron->fee_amount );  | 
          469 | 
                      $resp .= maybe_add( FID_FEE_AMT,  $patron->fee_amount );  | 
        
        
          | 456 | 
                  }  | 
          470 | 
                  }  | 
        
  
    | 
      
            Lines 458-468
          sub build_patron_status {
      
      
        Link Here
      
     | 
  
        
          | 458 | 
                  $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg );  | 
          472 | 
                  $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg );  | 
        
        
          | 459 | 
                  $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) | 
          473 | 
                  $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) | 
        
        
          | 460 | 
                    if ( $server->{account}->{send_patron_home_library_in_af} ); | 
          474 | 
                    if ( $server->{account}->{send_patron_home_library_in_af} ); | 
        
            
              | 461 | 
               | 
               | 
               | 
            
        
          | 462 | 
                  $resp .= maybe_add( FID_PRINT_LINE, $patron->print_line );  | 
          475 | 
                  $resp .= maybe_add( FID_PRINT_LINE, $patron->print_line );  | 
        
            
               | 
               | 
              476 | 
               | 
            
        
          | 463 | 
              }  | 
          477 | 
              }  | 
        
        
          | 464 | 
              else { | 
          478 | 
              else { | 
        
          
            
              | 465 | 
                      # Invalid patron id.  Report that the user has no privs.,  | 
              479 | 
               | 
            
            
               | 
               | 
              480 | 
                      # Invalid patron id (and/or passwd for overdrive_mode)  | 
            
            
              | 481 | 
                      # Report that the user has no privs.  | 
            
            
              | 482 | 
               | 
            
        
          | 466 | 
                  # no personal name, and is invalid (if we're using 2.00)  | 
          483 | 
                  # no personal name, and is invalid (if we're using 2.00)  | 
        
        
          | 467 | 
                  $resp .= 'YYYY' . ( ' ' x 10 ) . $lang . Sip::timestamp();  | 
          484 | 
                  $resp .= 'YYYY' . ( ' ' x 10 ) . $lang . Sip::timestamp();  | 
        
        
          | 468 | 
                  $resp .= add_field( FID_PERSONAL_NAME, '' );  | 
          485 | 
                  $resp .= add_field( FID_PERSONAL_NAME, '' );  | 
        
  
    | 
      
            Lines 473-478
          sub build_patron_status {
      
      
        Link Here
      
     | 
  
        
          | 473 | 
           | 
          490 | 
           | 
        
        
          | 474 | 
                  ( $protocol_version >= 2 )  | 
          491 | 
                  ( $protocol_version >= 2 )  | 
        
        
          | 475 | 
                    and $resp .= add_field( FID_VALID_PATRON, 'N' );  | 
          492 | 
                    and $resp .= add_field( FID_VALID_PATRON, 'N' );  | 
        
            
               | 
               | 
              493 | 
               | 
            
            
              | 494 | 
                      $resp .=  | 
            
            
              | 495 | 
                        maybe_add( FID_SCREEN_MSG, 'Invalid patron or patron password' );  | 
            
        
          | 476 | 
              }  | 
          496 | 
              }  | 
        
        
          | 477 | 
           | 
          497 | 
           | 
        
        
          | 478 | 
              $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); | 
          498 | 
              $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); | 
        
            
              | 479 | 
              -   | 
               | 
               |