| 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 1340-1359
          subtest "CanBookBeRenewed tests" => sub {
      
      
        Link Here | 
        
          | 1340 |         my $ten_days_before = dt_from_string->add( days => -10 ); | 1340 |         my $ten_days_before = dt_from_string->add( days => -10 ); | 
        
          | 1341 |         my $ten_days_ahead = dt_from_string->add( days => 10 ); | 1341 |         my $ten_days_ahead = dt_from_string->add( days => 10 ); | 
        
          | 1342 |  | 1342 |  | 
          
            
              | 1343 |         # Patron is expired and BlockExpiredPatronOpacActions=0 | 1343 |         # Patron is expired and BlockExpiredPatronOpacActions='' | 
        
          | 1344 |         # => auto renew is allowed | 1344 |         # => auto renew is allowed | 
          
            
              | 1345 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 0); | 1345 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', ''); | 
        
          | 1346 |         my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1346 |         my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1347 |         ( $renewokay, $error ) = | 1347 |         ( $renewokay, $error ) = | 
        
          | 1348 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 1348 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 
        
          | 1349 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 1349 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 
          
            
              | 1350 |         is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=0' ); | 1350 |         is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=\'\'' ); | 
        
          | 1351 |         Koha::Checkouts->find( $issue->issue_id )->delete; | 1351 |         Koha::Checkouts->find( $issue->issue_id )->delete; | 
        
          | 1352 |  | 1352 |  | 
        
          | 1353 |  | 1353 |  | 
          
            
              | 1354 |         # Patron is expired and BlockExpiredPatronOpacActions=1 | 1354 |         # Patron is expired and BlockExpiredPatronOpacActions='renew' | 
        
          | 1355 |         # => auto renew is not allowed | 1355 |         # => auto renew is not allowed | 
          
            
              | 1356 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); | 1356 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); | 
        
          | 1357 |         $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1357 |         $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1358 |         ( $renewokay, $error ) = | 1358 |         ( $renewokay, $error ) = | 
        
          | 1359 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 1359 |           CanBookBeRenewed( $expired_borrower_obj, $issue ); | 
  
    | Lines 1363-1374
          subtest "CanBookBeRenewed tests" => sub {
      
      
        Link Here | 
        
          | 1363 |  | 1363 |  | 
        
          | 1364 |         # Patron is not expired and BlockExpiredPatronOpacActions=1 | 1364 |         # Patron is not expired and BlockExpiredPatronOpacActions=1 | 
        
          | 1365 |         # => auto renew is allowed | 1365 |         # => auto renew is allowed | 
          
            
              | 1366 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); | 1366 |         t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); | 
        
          | 1367 |         $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 1367 |         $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); | 
        
          | 1368 |         ( $renewokay, $error ) = | 1368 |         ( $renewokay, $error ) = | 
        
          | 1369 |           CanBookBeRenewed( $renewing_borrower_obj, $issue ); | 1369 |           CanBookBeRenewed( $renewing_borrower_obj, $issue ); | 
        
          | 1370 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 1370 |         is( $renewokay, 1, 'Renew, even if renewal is automatic' ); | 
          
            
              | 1371 |         is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=1 but patron is not expired' ); | 1371 |         is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=\'renew\' but patron is not expired' ); | 
        
          | 1372 |         $issue->delete; | 1372 |         $issue->delete; | 
        
          | 1373 |     }; | 1373 |     }; | 
        
          | 1374 |  | 1374 |  | 
  
    | Lines 1983-1989
          subtest "AllowRenewalIfOtherItemsAvailable tests" => sub {
      
      
        Link Here | 
        
          | 1983 |             value  => { | 1983 |             value  => { | 
        
          | 1984 |                 category_type                 => 'P', | 1984 |                 category_type                 => 'P', | 
        
          | 1985 |                 enrolmentfee                  => 0, | 1985 |                 enrolmentfee                  => 0, | 
          
            
              | 1986 |                 BlockExpiredPatronOpacActions => -1, # Pick the pref value | 1986 |                 BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', | 
        
          | 1987 |             } | 1987 |             } | 
        
          | 1988 |         } | 1988 |         } | 
        
          | 1989 |     ); | 1989 |     ); |