| Lines 157-163
          my $patron_category = $builder->build(
      
      
        Link Here | 
        
          | 157 |         value  => { | 157 |         value  => { | 
        
          | 158 |             category_type                 => 'P', | 158 |             category_type                 => 'P', | 
        
          | 159 |             enrolmentfee                  => 0, | 159 |             enrolmentfee                  => 0, | 
          
            
              | 160 |             BlockExpiredPatronOpacActions => -1, # Pick the pref value | 160 |             BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', | 
        
          | 161 |         } | 161 |         } | 
        
          | 162 |     } | 162 |     } | 
        
          | 163 | ); | 163 | ); | 
  
    | Lines 1321-1340
          subtest "CanBookBeRenewed tests" => sub {
      
      
        Link Here | 
        
          | 1321 |         my $ten_days_before = dt_from_string->add( days => -10 ); | 1321 |         my $ten_days_before = dt_from_string->add( days => -10 ); | 
        
          | 1322 |         my $ten_days_ahead = dt_from_string->add( days => 10 ); | 1322 |         my $ten_days_ahead = dt_from_string->add( days => 10 ); | 
        
          | 1323 |  | 1323 |  | 
          
            
              | 1324 |         # Patron is expired and BlockExpiredPatronOpacActions=0 | 1324 |         # Patron is expired and BlockExpiredPatronOpacActions='' | 
        
          | 1325 |         # => auto renew is allowed | 1325 |         # => auto renew is allowed | 
          
            
              | 1326 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 0); | 1326 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', ''); | 
        
          | 1327 |         my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1327 |         my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1328 |         ( $renewokay, $error ) = | 1328 |         ( $renewokay, $error ) = | 
        
          | 1329 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 1329 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 
        
          | 1330 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 1330 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 
          
            
              | 1331 |         is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=0' ); | 1331 |         is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=\'\'' ); | 
        
          | 1332 |         Koha::Checkouts->find( $issue->issue_id )->delete; | 1332 |         Koha::Checkouts->find( $issue->issue_id )->delete; | 
        
          | 1333 |  | 1333 |  | 
        
          | 1334 |  | 1334 |  | 
          
            
              | 1335 |         # Patron is expired and BlockExpiredPatronOpacActions=1 | 1335 |         # Patron is expired and BlockExpiredPatronOpacActions='renew' | 
        
          | 1336 |         # => auto renew is not allowed | 1336 |         # => auto renew is not allowed | 
          
            
              | 1337 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); | 1337 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); | 
        
          | 1338 |         $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1338 |         $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1339 |         ( $renewokay, $error ) = | 1339 |         ( $renewokay, $error ) = | 
        
          | 1340 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 1340 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 
  
    | Lines 1344-1355
          subtest "CanBookBeRenewed tests" => sub {
      
      
        Link Here | 
        
          | 1344 |  | 1344 |  | 
        
          | 1345 |         # Patron is not expired and BlockExpiredPatronOpacActions=1 | 1345 |         # Patron is not expired and BlockExpiredPatronOpacActions=1 | 
        
          | 1346 |         # => auto renew is allowed | 1346 |         # => auto renew is allowed | 
          
            
              | 1347 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); | 1347 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); | 
        
          | 1348 |         $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1348 |         $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1349 |         ( $renewokay, $error ) = | 1349 |         ( $renewokay, $error ) = | 
        
          | 1350 |           CanBookBeRenewed( $renewing_borrower_obj, $issue ); | 1350 |           CanBookBeRenewed( $renewing_borrower_obj, $issue ); | 
        
          | 1351 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 1351 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 
          
            
              | 1352 |         is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=1 but patron is not expired' ); | 1352 |         is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=\'renew\' but patron is not expired' ); | 
        
          | 1353 |         $issue->delete; | 1353 |         $issue->delete; | 
        
          | 1354 |     }; | 1354 |     }; | 
        
          | 1355 |  | 1355 |  | 
  
    | Lines 1950-1956
          subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
      
      
        Link Here | 
        
          | 1950 |             value  => { | 1950 |             value  => { | 
        
          | 1951 |                 category_type                 => 'P', | 1951 |                 category_type                 => 'P', | 
        
          | 1952 |                 enrolmentfee                  => 0, | 1952 |                 enrolmentfee                  => 0, | 
          
            
              | 1953 |                 BlockExpiredPatronOpacActions => -1, # Pick the pref value | 1953 |                 BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', | 
        
          | 1954 |             } | 1954 |             } | 
        
          | 1955 |         } | 1955 |         } | 
        
          | 1956 |     ); | 1956 |     ); |