| 
      
            Lines 17-23
          
      
      
        Link Here
      
     | 
  
        
          | 17 | 
           | 
          17 | 
           | 
        
        
          | 18 | 
          use Modern::Perl;  | 
          18 | 
          use Modern::Perl;  | 
        
        
          | 19 | 
           | 
          19 | 
           | 
        
          
            
              | 20 | 
              use Test::More tests => 2;  | 
              20 | 
              use Test::More tests => 3;  | 
            
        
          | 21 | 
          use Test::MockModule;  | 
          21 | 
          use Test::MockModule;  | 
        
        
          | 22 | 
          use Test::Warn;  | 
          22 | 
          use Test::Warn;  | 
        
        
          | 23 | 
           | 
          23 | 
           | 
        
  
    | 
      
            Lines 58-67
          Koha::CirculationRules->set_rule(
      
      
        Link Here
      
     | 
  
        
          | 58 | 
           | 
          58 | 
           | 
        
        
          | 59 | 
          $branch = $builder->build( { source => 'Branch' } )->{branchcode}; | 
          59 | 
          $branch = $builder->build( { source => 'Branch' } )->{branchcode}; | 
        
        
          | 60 | 
           | 
          60 | 
           | 
        
          
            
              | 61 | 
              subtest 'Test Koha::Checkout::claim_returned' => sub { | 
              61 | 
              subtest 'Test Koha::Checkout::claim_returned, do not mark as returned' => sub { | 
            
            
              | 62 | 
                  plan tests => 6;  | 
              62 | 
                  plan tests => 7;  | 
            
        
          | 63 | 
           | 
          63 | 
           | 
        
        
          | 64 | 
              t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );  | 
          64 | 
              t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );  | 
        
            
               | 
               | 
              65 | 
                  t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{} ); | 
            
        
          | 65 | 
              my $item   = $builder->build_sample_item;  | 
          66 | 
              my $item   = $builder->build_sample_item;  | 
        
        
          | 66 | 
              my $patron   = $builder->build_object( { class => 'Koha::Patrons' } ); | 
          67 | 
              my $patron   = $builder->build_object( { class => 'Koha::Patrons' } ); | 
        
        
          | 67 | 
              my $checkout = AddIssue( $patron->unblessed, $item->barcode );  | 
          68 | 
              my $checkout = AddIssue( $patron->unblessed, $item->barcode );  | 
        
  
    | 
      
            Lines 79-84
          subtest 'Test Koha::Checkout::claim_returned' => sub {
      
      
        Link Here
      
     | 
  
        
          | 79 | 
              is( $claim->notes, "Test note", "Claim notes match" );  | 
          80 | 
              is( $claim->notes, "Test note", "Claim notes match" );  | 
        
        
          | 80 | 
              is( $claim->created_by, $patron->id, "Claim created_by matches" );  | 
          81 | 
              is( $claim->created_by, $patron->id, "Claim created_by matches" );  | 
        
        
          | 81 | 
              ok( $claim->created_on, "Claim created_on is set" );  | 
          82 | 
              ok( $claim->created_on, "Claim created_on is set" );  | 
        
            
               | 
               | 
              83 | 
               | 
            
            
              | 84 | 
                  my $checkout2 = Koha::Checkouts->find( $checkout->id );  | 
            
            
              | 85 | 
                  is( $checkout2->id, $checkout->id, "Item is still checked out to patron")  | 
            
        
          | 82 | 
          };  | 
          86 | 
          };  | 
        
        
          | 83 | 
           | 
          87 | 
           | 
        
        
          | 84 | 
          subtest 'Test Koha::Patronn::return_claims' => sub { | 
          88 | 
          subtest 'Test Koha::Patronn::return_claims' => sub { | 
        
  
    | 
      
            Lines 110-113
          subtest 'Test Koha::Patronn::return_claims' => sub {
      
      
        Link Here
      
     | 
  
        
          | 110 | 
              ok( $claim->created_on, "Claim created_on is set" );  | 
          114 | 
              ok( $claim->created_on, "Claim created_on is set" );  | 
        
        
          | 111 | 
          };  | 
          115 | 
          };  | 
        
        
          | 112 | 
           | 
          116 | 
           | 
        
            
               | 
               | 
              117 | 
              subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { | 
            
            
              | 118 | 
                  plan tests => 8;  | 
            
            
              | 119 | 
               | 
            
            
              | 120 | 
                  t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );  | 
            
            
              | 121 | 
                  t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{claim_returned} ); | 
            
            
              | 122 | 
                  my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); | 
            
            
              | 123 | 
                  my $item   = $builder->build_object(  | 
            
            
              | 124 | 
                      { | 
            
            
              | 125 | 
                          class => 'Koha::Items',  | 
            
            
              | 126 | 
                          value => { | 
            
            
              | 127 | 
                              biblionumber => $biblio->biblionumber,  | 
            
            
              | 128 | 
                              notforloan   => 0,  | 
            
            
              | 129 | 
                              itemlost     => 0,  | 
            
            
              | 130 | 
                              withdrawn    => 0,  | 
            
            
              | 131 | 
                          }  | 
            
            
              | 132 | 
                      }  | 
            
            
              | 133 | 
                  );  | 
            
            
              | 134 | 
                  my $patron   = $builder->build_object( { class => 'Koha::Patrons' } ); | 
            
            
              | 135 | 
                  my $checkout = AddIssue( $patron->unblessed, $item->barcode );  | 
            
            
              | 136 | 
               | 
            
            
              | 137 | 
                  my $claim = $checkout->claim_returned(  | 
            
            
              | 138 | 
                      { | 
            
            
              | 139 | 
                          created_by => $patron->id,  | 
            
            
              | 140 | 
                          notes      => "Test note",  | 
            
            
              | 141 | 
                      }  | 
            
            
              | 142 | 
                  );  | 
            
            
              | 143 | 
               | 
            
            
              | 144 | 
                  is( $claim->issue_id, $checkout->id, "Claim issue id matches" );  | 
            
            
              | 145 | 
                  is( $claim->itemnumber, $item->id, "Claim itemnumber matches" );  | 
            
            
              | 146 | 
                  is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" );  | 
            
            
              | 147 | 
                  is( $claim->notes, "Test note", "Claim notes match" );  | 
            
            
              | 148 | 
                  is( $claim->created_by, $patron->id, "Claim created_by matches" );  | 
            
            
              | 149 | 
                  ok( $claim->created_on, "Claim created_on is set" );  | 
            
            
              | 150 | 
               | 
            
            
              | 151 | 
                  my $checkout2 = Koha::Checkouts->find( $checkout->id );  | 
            
            
              | 152 | 
                  is( $checkout2, undef, "Checkout is not longer in the issues table");  | 
            
            
              | 153 | 
                  $checkout2 = Koha::Old::Checkouts->find( $checkout->id );  | 
            
            
              | 154 | 
                  is( $checkout2->id, $checkout->id, "Checkout was foudn in the old_issues table");  | 
            
            
              | 155 | 
              };  | 
            
            
              | 156 | 
               | 
            
        
          | 113 | 
          $schema->storage->txn_rollback;  | 
          157 | 
          $schema->storage->txn_rollback;  | 
        
            
              | 114 | 
              -   | 
               | 
               |