| Lines 480-485
          my $itemnumber2 = Koha::Item->new(
      
      
        Link Here | 
        
          | 480 |     } | 480 |     } | 
        
          | 481 | )->store->itemnumber; | 481 | )->store->itemnumber; | 
        
          | 482 |  | 482 |  | 
            
              |  |  | 483 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); | 
            
              | 484 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin',  q{} ); | 
            
              | 485 |  | 
        
          | 483 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); | 486 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); | 
        
          | 484 | AddReturn( 'barcode_4', $branchcode_1 ); | 487 | AddReturn( 'barcode_4', $branchcode_1 ); | 
        
          | 485 | my $item2 = Koha::Items->find( $itemnumber2 ); | 488 | my $item2 = Koha::Items->find( $itemnumber2 ); | 
  
    | Lines 655-703
          my $itemnumber5 = Koha::Item->new(
      
      
        Link Here | 
        
          | 655 | )->store->itemnumber; | 658 | )->store->itemnumber; | 
        
          | 656 |  | 659 |  | 
        
          | 657 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); | 660 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); | 
          
            
              | 658 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); | 661 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin',  q{} ); | 
            
              | 659 | AddIssue( $patron_1, 'barcode_7'); | 662 | AddIssue( $patron_1, 'barcode_7' ); | 
            
              | 660 | my $item5 = Koha::Items->find( $itemnumber5 ); | 663 | my $item5 = Koha::Items->find($itemnumber5); | 
        
          | 661 | ok( $item5->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' ); | 664 | ok( $item5->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' ); | 
        
          | 662 |  | 665 |  | 
        
          | 663 | #--- | 666 | #--- | 
        
          | 664 | AddReturn( 'barcode_7', $branchcode_1 ); | 667 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 665 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' ); | 668 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' ); | 
          
            
              | 666 | $log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); | 669 | $log_count_before = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count(); | 
        
          | 667 | AddIssue( $patron_1, 'barcode_7' ); | 670 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 668 | $item5 = Koha::Items->find( $itemnumber5 ); | 671 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 669 | is( $item5->location, 'GEN', q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); | 672 | is( | 
            
              | 670 | is( $item5->permanent_location, 'GEN', q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); | 673 |     $item5->location, 'GEN', | 
            
              | 671 | $log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); | 674 |     q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} | 
            
              | 672 | is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged"); | 675 | ); | 
            
              |  |  | 676 | is( | 
            
              | 677 |     $item5->permanent_location, 'GEN', | 
            
              | 678 |     q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} | 
            
              | 679 | ); | 
            
              | 680 | $log_count_after = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count(); | 
            
              | 681 | is( $log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged" ); | 
        
          | 673 | AddReturn( 'barcode_7', $branchcode_1 ); | 682 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 674 | AddIssue( $patron_1, 'barcode_7' ); | 683 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 675 | $item5 = Koha::Items->find( $itemnumber5 ); | 684 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 676 | ok( $item5->location eq 'GEN', q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"} ); | 685 | ok( | 
            
              |  |  | 686 |     $item5->location eq 'GEN', | 
            
              | 687 |     q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"} | 
            
              | 688 | ); | 
        
          | 677 |  | 689 |  | 
        
          | 678 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); | 690 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); | 
        
          | 679 | AddReturn( 'barcode_7', $branchcode_1 ); | 691 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 680 | AddIssue( $patron_1, 'barcode_7' ); | 692 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 681 | $item5 = Koha::Items->find( $itemnumber5 ); | 693 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 682 | ok( $item5->location eq 'CART', q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"} ); | 694 | ok( | 
            
              | 683 | ok( $item5->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); | 695 |     $item5->location eq 'CART', | 
            
              |  |  | 696 |     q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"} | 
            
              | 697 | ); | 
            
              | 698 | ok( | 
            
              | 699 |     $item5->permanent_location eq 'GEN', | 
            
              | 700 |     q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} | 
            
              | 701 | ); | 
        
          | 684 |  | 702 |  | 
        
          | 685 | $item5->location('GEN')->store; | 703 | $item5->location('GEN')->store; | 
        
          | 686 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); | 704 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); | 
        
          | 687 | AddReturn( 'barcode_7', $branchcode_1 ); | 705 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 688 | AddIssue( $patron_1, 'barcode_7' ); | 706 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 689 | $item5 = Koha::Items->find( $itemnumber5 ); | 707 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 690 | ok( $item5->location eq '', q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); | 708 | ok( | 
            
              |  |  | 709 |     $item5->location eq '', | 
            
              | 710 |     q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} | 
            
              | 711 | ); | 
        
          | 691 | AddReturn( 'barcode_7', $branchcode_1 ); | 712 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 692 | AddIssue( $patron_1, 'barcode_7' ); | 713 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 693 | $item5 = Koha::Items->find( $itemnumber5 ); | 714 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 694 | ok( $item5->location eq 'PROC' , q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); | 715 | ok( | 
            
              | 695 | ok( $item5->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); | 716 |     $item5->location eq 'PROC', | 
            
              |  |  | 717 |     q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} | 
            
              | 718 | ); | 
            
              | 719 | ok( | 
            
              | 720 |     $item5->permanent_location eq '', | 
            
              | 721 |     q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} | 
            
              | 722 | ); | 
        
          | 696 | AddReturn( 'barcode_7', $branchcode_1 ); | 723 | AddReturn( 'barcode_7', $branchcode_1 ); | 
        
          | 697 | AddIssue( $patron_1, 'barcode_7' ); | 724 | AddIssue( $patron_1, 'barcode_7' ); | 
          
            
              | 698 | $item5 = Koha::Items->find( $itemnumber5 ); | 725 | $item5 = Koha::Items->find($itemnumber5); | 
            
              | 699 | ok( $item5->location eq '' , q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); | 726 | ok( | 
            
              | 700 | ok( $item5->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" } ); | 727 |     $item5->location eq '', | 
            
              |  |  | 728 |     q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" } | 
            
              | 729 | ); | 
            
              | 730 | ok( | 
            
              | 731 |     $item5->permanent_location eq '', | 
            
              | 732 |     q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" } | 
            
              | 733 | ); | 
        
          | 701 |  | 734 |  | 
        
          | 702 | # Bug 28472 | 735 | # Bug 28472 | 
        
          | 703 | my $itemnumber6 = Koha::Item->new( | 736 | my $itemnumber6 = Koha::Item->new( | 
  
    | Lines 714-722
          my $itemnumber6 = Koha::Item->new(
      
      
        Link Here | 
        
          | 714 |  | 747 |  | 
        
          | 715 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); | 748 | t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); | 
        
          | 716 | AddIssue( $patron_1, 'barcode_8' ); | 749 | AddIssue( $patron_1, 'barcode_8' ); | 
          
            
              | 717 | my $item6 = Koha::Items->find( $itemnumber6 ); | 750 | my $item6 = Koha::Items->find($itemnumber6); | 
            
              | 718 | is( $item6->location, 'CART', q{UpdateItemLocationOnCheckout updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} ); | 751 | is( | 
            
              | 719 |  | 752 |     $item6->location, 'CART', | 
            
              |  |  | 753 |     q{UpdateItemLocationOnCheckout updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} | 
            
              | 754 | ); | 
        
          | 720 |  | 755 |  | 
        
          | 721 | #End transaction | 756 | #End transaction | 
        
          | 722 | $schema->storage->txn_rollback; | 757 | $schema->storage->txn_rollback; | 
            
              | 723 | -  |  |  |