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

(-)a/C4/Circulation.pm (-8 / +10 lines)
Lines 1421-1427 sub AddIssue { Link Here
1421
                    datelastborrowed => DateTime->now( time_zone => C4::Context->tz() )->ymd(),
1421
                    datelastborrowed => DateTime->now( time_zone => C4::Context->tz() )->ymd(),
1422
                },
1422
                },
1423
                $item->{'biblionumber'},
1423
                $item->{'biblionumber'},
1424
                $item->{'itemnumber'}
1424
                $item->{'itemnumber'},
1425
                0
1425
            );
1426
            );
1426
            ModDateLastSeen( $item->{'itemnumber'} );
1427
            ModDateLastSeen( $item->{'itemnumber'} );
1427
1428
Lines 1863-1869 sub AddReturn { Link Here
1863
            $item->{location} = $item->{permanent_location};
1864
            $item->{location} = $item->{permanent_location};
1864
        }
1865
        }
1865
1866
1866
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
1867
        ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'}, 0 );
1867
    }
1868
    }
1868
1869
1869
        # full item data, but no borrowernumber or checkout info (no issue)
1870
        # full item data, but no borrowernumber or checkout info (no issue)
Lines 1887-1893 sub AddReturn { Link Here
1887
            foreach my $key ( keys %$rules ) {
1888
            foreach my $key ( keys %$rules ) {
1888
                if ( $item->{notforloan} eq $key ) {
1889
                if ( $item->{notforloan} eq $key ) {
1889
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1890
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1890
                    ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber );
1891
                    ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber, 0 );
1891
                    last;
1892
                    last;
1892
                }
1893
                }
1893
            }
1894
            }
Lines 1959-1965 sub AddReturn { Link Here
1959
1960
1960
        }
1961
        }
1961
1962
1962
        ModItem({ onloan => undef }, $issue->{'biblionumber'}, $item->{'itemnumber'});
1963
        ModItem({ onloan => undef }, $issue->{'biblionumber'}, $item->{'itemnumber'}, 0 );
1963
    }
1964
    }
1964
1965
1965
    # the holdingbranch is updated if the document is returned to another location.
1966
    # the holdingbranch is updated if the document is returned to another location.
Lines 2200-2206 sub MarkIssueReturned { Link Here
2200
2201
2201
        $dbh->do(q|DELETE FROM issues WHERE issue_id = ?|, undef, $issue_id);
2202
        $dbh->do(q|DELETE FROM issues WHERE issue_id = ?|, undef, $issue_id);
2202
2203
2203
        ModItem( { 'onloan' => undef }, undef, $itemnumber );
2204
        ModItem( { 'onloan' => undef }, undef, $itemnumber, 0 );
2204
2205
2205
        if ( C4::Context->preference('StoreLastBorrower') ) {
2206
        if ( C4::Context->preference('StoreLastBorrower') ) {
2206
            my $item = Koha::Items->find( $itemnumber );
2207
            my $item = Koha::Items->find( $itemnumber );
Lines 2437-2443 sub _FixAccountForLostAndReturned { Link Here
2437
        }
2438
        }
2438
    );
2439
    );
2439
2440
2440
    ModItem( { paidfor => '' }, undef, $itemnumber );
2441
    ModItem( { paidfor => '' }, undef, $itemnumber, 0 );
2441
2442
2442
    return $credit_id;
2443
    return $credit_id;
2443
}
2444
}
Lines 2894-2900 sub AddRenewal { Link Here
2894
2895
2895
    # Update the renewal count on the item, and tell zebra to reindex
2896
    # Update the renewal count on the item, and tell zebra to reindex
2896
    $renews = $biblio->{'renewals'} + 1;
2897
    $renews = $biblio->{'renewals'} + 1;
2897
    ModItem({ renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $biblio->{'biblionumber'}, $itemnumber);
2898
    ModItem({ renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $biblio->{'biblionumber'}, $itemnumber, 0);
2898
2899
2899
    # Charge a new rental fee, if applicable?
2900
    # Charge a new rental fee, if applicable?
2900
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2901
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
Lines 3760-3766 sub ProcessOfflineReturn { Link Here
3760
            ModItem(
3761
            ModItem(
3761
                { renewals => 0, onloan => undef },
3762
                { renewals => 0, onloan => undef },
3762
                $issue->{'biblionumber'},
3763
                $issue->{'biblionumber'},
3763
                $itemnumber
3764
                $itemnumber,
3765
                0
3764
            );
3766
            );
3765
            return "Success.";
3767
            return "Success.";
3766
        } else {
3768
        } else {
(-)a/C4/Items.pm (-3 / +7 lines)
Lines 518-524 sub ModItemFromMarc { Link Here
518
518
519
=head2 ModItem
519
=head2 ModItem
520
520
521
  ModItem({ column => $newvalue }, $biblionumber, $itemnumber);
521
  ModItem({ column => $newvalue }, $biblionumber, $itemnumber, $log_action );
522
522
523
Change one or more columns in an item record and update
523
Change one or more columns in an item record and update
524
the MARC representation of the item.
524
the MARC representation of the item.
Lines 539-550 the derived value of a column such as C<items.cn_sort>, Link Here
539
this routine will perform the necessary calculation
539
this routine will perform the necessary calculation
540
and set the value.
540
and set the value.
541
541
542
If log_action is set to false, the action will not be logged.
543
If log_action is true or undefined, the action will be logged.
544
542
=cut
545
=cut
543
546
544
sub ModItem {
547
sub ModItem {
545
    my $item = shift;
548
    my $item = shift;
546
    my $biblionumber = shift;
549
    my $biblionumber = shift;
547
    my $itemnumber = shift;
550
    my $itemnumber = shift;
551
    my $log_action = shift // 1;
548
552
549
    # if $biblionumber is undefined, get it from the current item
553
    # if $biblionumber is undefined, get it from the current item
550
    unless (defined $biblionumber) {
554
    unless (defined $biblionumber) {
Lines 603-609 sub ModItem { Link Here
603
    # item status is possible
607
    # item status is possible
604
    ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
608
    ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
605
609
606
    logaction("CATALOGUING", "MODIFY", $itemnumber, "item ".Dumper($item)) if C4::Context->preference("CataloguingLog");
610
    logaction( "CATALOGUING", "MODIFY", $itemnumber, "item " . Dumper($item) )
611
      if $log_action && C4::Context->preference("CataloguingLog");
607
}
612
}
608
613
609
=head2 ModItemTransfer
614
=head2 ModItemTransfer
610
- 

Return to bug 18816