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

(-)a/C4/Circulation.pm (-1 / +3 lines)
Lines 2908-2914 sub AddRenewal { Link Here
2908
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2908
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2909
    }
2909
    }
2910
2910
2911
    # Log the renewal
2911
    # Add the renewal to stats
2912
    UpdateStats(
2912
    UpdateStats(
2913
        {
2913
        {
2914
            branch => C4::Context->userenv ? C4::Context->userenv->{branch} : $branch,
2914
            branch => C4::Context->userenv ? C4::Context->userenv->{branch} : $branch,
Lines 2921-2926 sub AddRenewal { Link Here
2921
        }
2921
        }
2922
    );
2922
    );
2923
2923
2924
    #Log the renewal
2925
    logaction("CIRCULATION", "RENEW", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog");
2924
    return $datedue;
2926
    return $datedue;
2925
}
2927
}
2926
2928
(-)a/installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('RenewalLog','0','','If ON, log information about renewals','YesNo');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 428-433 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
428
('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'),
428
('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'),
429
('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'),
429
('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'),
430
('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'),
430
('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'),
431
('RenewalLog','0','','If ON, log information about renewals','YesNo'),
431
('RenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','Choice'),
432
('RenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','Choice'),
432
('RenewalSendNotice','0','',NULL,'YesNo'),
433
('RenewalSendNotice','0','',NULL,'YesNo'),
433
('RenewSerialAddsSuggestion','0',NULL,'If ON, adds a new suggestion at serial subscription renewal','YesNo'),
434
('RenewSerialAddsSuggestion','0',NULL,'If ON, adds a new suggestion at serial subscription renewal','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref (+6 lines)
Lines 49-54 Logging: Link Here
49
                  off: "Don't log"
49
                  off: "Don't log"
50
            - when items are returned.
50
            - when items are returned.
51
        -
51
        -
52
            - pref: RenewalLog
53
              choices:
54
                  on: Log
55
                  off: "Don't log"
56
            - when items are renewed.
57
        -
52
            - pref: SubscriptionLog
58
            - pref: SubscriptionLog
53
              choices:
59
              choices:
54
                  on: Log
60
                  on: Log
(-)a/t/db_dependent/Circulation.t (-3 / +16 lines)
Lines 17-26 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 92;
20
use Test::More tests => 94;
21
21
22
BEGIN {
22
BEGIN {
23
    require_ok('C4::Circulation');
23
    use_ok('C4::Log')
24
}
24
}
25
25
26
use DateTime;
26
use DateTime;
Lines 473-479 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
473
            due            => Koha::DateUtils::output_pref($five_weeks_ago)
473
            due            => Koha::DateUtils::output_pref($five_weeks_ago)
474
        }
474
        }
475
    );
475
    );
476
    t::lib::Mocks::mock_preference('RenewalLog', 0);
477
    my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } );
478
    my $old_log_size =  scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } );
476
    AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch );
479
    AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch );
480
    my $new_log_size =  scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } );
481
    is ($new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog');
482
483
    t::lib::Mocks::mock_preference('RenewalLog', 1);
484
    $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } );
485
    $old_log_size =  scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } );
486
    AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch );
487
    $new_log_size =  scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } );
488
    is ($new_log_size, $old_log_size + 1, 'renew log successfully added');
489
490
477
    $fine = $schema->resultset('Accountline')->single( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } );
491
    $fine = $schema->resultset('Accountline')->single( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } );
478
    is( $fine->accounttype, 'F', 'Fine on renewed item is closed out properly' );
492
    is( $fine->accounttype, 'F', 'Fine on renewed item is closed out properly' );
479
    $fine->delete();
493
    $fine->delete();
480
- 

Return to bug 17708