View | Details | Raw Unified | Return to bug 18816
Collapse All | Expand All

(-)a/C4/Circulation.pm (-8 / +8 lines)
Lines 1398-1404 sub AddIssue { Link Here
1398
                },
1398
                },
1399
                $item->{'biblionumber'},
1399
                $item->{'biblionumber'},
1400
                $item->{'itemnumber'},
1400
                $item->{'itemnumber'},
1401
                0
1401
                { log_action => 0 }
1402
            );
1402
            );
1403
            ModDateLastSeen( $item->{'itemnumber'} );
1403
            ModDateLastSeen( $item->{'itemnumber'} );
1404
1404
Lines 1831-1837 sub AddReturn { Link Here
1831
            $item->{location} = $item->{permanent_location};
1831
            $item->{location} = $item->{permanent_location};
1832
        }
1832
        }
1833
1833
1834
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'}, 0 );
1834
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'}, { log_action => 0 } );
1835
    }
1835
    }
1836
1836
1837
        # full item data, but no borrowernumber or checkout info (no issue)
1837
        # full item data, but no borrowernumber or checkout info (no issue)
Lines 1855-1861 sub AddReturn { Link Here
1855
            foreach my $key ( keys %$rules ) {
1855
            foreach my $key ( keys %$rules ) {
1856
                if ( $item->{notforloan} eq $key ) {
1856
                if ( $item->{notforloan} eq $key ) {
1857
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1857
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1858
                    ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber, 0 );
1858
                    ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber, { log_action => 0 } );
1859
                    last;
1859
                    last;
1860
                }
1860
                }
1861
            }
1861
            }
Lines 1921-1927 sub AddReturn { Link Here
1921
1921
1922
        }
1922
        }
1923
1923
1924
        ModItem( { onloan => undef }, $item->{biblionumber}, $item->{itemnumber}, 0 );
1924
        ModItem( { onloan => undef }, $item->{biblionumber}, $item->{itemnumber}, { log_action => 0 } );
1925
    }
1925
    }
1926
1926
1927
    # the holdingbranch is updated if the document is returned to another location.
1927
    # the holdingbranch is updated if the document is returned to another location.
Lines 2157-2163 sub MarkIssueReturned { Link Here
2157
        # And finally delete the issue
2157
        # And finally delete the issue
2158
        $issue->delete;
2158
        $issue->delete;
2159
2159
2160
        ModItem( { 'onloan' => undef }, undef, $itemnumber, 0 );
2160
        ModItem( { 'onloan' => undef }, undef, $itemnumber, { log_action => 0 } );
2161
2161
2162
        if ( C4::Context->preference('StoreLastBorrower') ) {
2162
        if ( C4::Context->preference('StoreLastBorrower') ) {
2163
            my $item = Koha::Items->find( $itemnumber );
2163
            my $item = Koha::Items->find( $itemnumber );
Lines 2396-2402 sub _FixAccountForLostAndReturned { Link Here
2396
        }
2396
        }
2397
    );
2397
    );
2398
2398
2399
    ModItem( { paidfor => '' }, undef, $itemnumber, 0 );
2399
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
2400
2400
2401
    return $credit_id;
2401
    return $credit_id;
2402
}
2402
}
Lines 2821-2827 sub AddRenewal { Link Here
2821
2821
2822
    # Update the renewal count on the item, and tell zebra to reindex
2822
    # Update the renewal count on the item, and tell zebra to reindex
2823
    $renews = $item->{renewals} + 1;
2823
    $renews = $item->{renewals} + 1;
2824
    ModItem( { renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $item->{biblionumber}, $itemnumber, 0 );
2824
    ModItem( { renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $item->{biblionumber}, $itemnumber, { log_action => 0 } );
2825
2825
2826
    # Charge a new rental fee, if applicable?
2826
    # Charge a new rental fee, if applicable?
2827
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2827
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
Lines 3701-3707 sub ProcessOfflineReturn { Link Here
3701
                { renewals => 0, onloan => undef },
3701
                { renewals => 0, onloan => undef },
3702
                $issue->{'biblionumber'},
3702
                $issue->{'biblionumber'},
3703
                $itemnumber,
3703
                $itemnumber,
3704
                0
3704
                { log_action => 0 }
3705
            );
3705
            );
3706
            return "Success.";
3706
            return "Success.";
3707
        } else {
3707
        } else {
(-)a/C4/Items.pm (-2 / +4 lines)
Lines 547-553 sub ModItem { Link Here
547
    my $item = shift;
547
    my $item = shift;
548
    my $biblionumber = shift;
548
    my $biblionumber = shift;
549
    my $itemnumber = shift;
549
    my $itemnumber = shift;
550
    my $log_action = shift // 1;
550
    my $additional_params = shift;
551
552
    my $log_action = $additional_params->{log_action} // 1;
551
553
552
    # if $biblionumber is undefined, get it from the current item
554
    # if $biblionumber is undefined, get it from the current item
553
    unless (defined $biblionumber) {
555
    unless (defined $biblionumber) {
Lines 653-659 sub ModDateLastSeen { Link Here
653
    my ($itemnumber) = @_;
655
    my ($itemnumber) = @_;
654
656
655
    my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
657
    my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
656
    ModItem( { itemlost => 0, datelastseen => $today }, undef, $itemnumber, 0 );
658
    ModItem( { itemlost => 0, datelastseen => $today }, undef, $itemnumber, { log_action => 0 } );
657
}
659
}
658
660
659
=head2 DelItem
661
=head2 DelItem
(-)a/t/db_dependent/Items.t (-6 / +5 lines)
Lines 31-37 use Koha::Caches; Link Here
31
use t::lib::Mocks;
31
use t::lib::Mocks;
32
use t::lib::TestBuilder;
32
use t::lib::TestBuilder;
33
33
34
use Test::More tests => 13;
34
use Test::More tests => 14;
35
35
36
use Test::Warn;
36
use Test::Warn;
37
37
Lines 796-802 subtest 'get_hostitemnumbers_of' => sub { Link Here
796
    is( @itemnumbers, 0, );
796
    is( @itemnumbers, 0, );
797
};
797
};
798
798
799
subtest 'Test logging for AddItem' => sub {
799
subtest 'Test logging for ModItem' => sub {
800
800
801
    plan tests => 3;
801
    plan tests => 3;
802
802
Lines 821-833 subtest 'Test logging for AddItem' => sub { Link Here
821
821
822
    # False means no logging
822
    # False means no logging
823
    $schema->resultset('ActionLog')->search()->delete();
823
    $schema->resultset('ActionLog')->search()->delete();
824
    ModItem({ location => $location }, $bibnum, $itemnumber, 0);
824
    ModItem({ location => $location }, $bibnum, $itemnumber, { log_action => 0 });
825
    is( $schema->resultset('ActionLog')->count(), 0, 'False value does not trigger logging' );
825
    is( $schema->resultset('ActionLog')->count(), 0, 'False value does not trigger logging' );
826
826
827
    # True means logging
827
    # True means logging
828
    $schema->resultset('ActionLog')->search()->delete();
828
    $schema->resultset('ActionLog')->search()->delete();
829
    ModItem({ location => $location }, $bibnum, $itemnumber, 1, 'True value does trigger logging');
829
    ModItem({ location => $location }, $bibnum, $itemnumber, { log_action => 1 });
830
    is( $schema->resultset('ActionLog')->count(), 1 );
830
    is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' );
831
831
832
    # Undefined defaults to true
832
    # Undefined defaults to true
833
    $schema->resultset('ActionLog')->search()->delete();
833
    $schema->resultset('ActionLog')->search()->delete();
834
- 

Return to bug 18816