@@ -, +, @@ to send renew logs --- C4/Circulation.pm | 4 +++- installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql | 2 ++ installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences/logs.pref | 6 ++++++ t/db_dependent/Circulation.t | 9 +++++++-- 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -2911,7 +2911,7 @@ sub AddRenewal { DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); } - # Log the renewal + # Add the renewal to stats UpdateStats( { branch => C4::Context->userenv ? C4::Context->userenv->{branch} : $branch, @@ -2924,6 +2924,8 @@ sub AddRenewal { } ); + #Log the renewal + logaction("CIRCULATION", "RENEW", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog"); return $datedue; } --- a/installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql +++ a/installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql @@ -0,0 +1,2 @@ +INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('RenewalLog','0','','If ON, log information about reports','YesNo'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -423,6 +423,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), ('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'), +('RenewalLog','0','','If ON, log information about reports','YesNo'), ('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'), ('RenewalSendNotice','0','',NULL,'YesNo'), ('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 +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref @@ -49,6 +49,12 @@ Logging: off: "Don't log" - when items are returned. - + - pref: RenewalLog + choices: + on: Log + off: "Don't log" + - when items are renewed. + - - pref: SubscriptionLog choices: on: Log --- a/t/db_dependent/Circulation.t +++ a/t/db_dependent/Circulation.t @@ -17,10 +17,10 @@ use Modern::Perl; -use Test::More tests => 91; +use Test::More tests => 92; BEGIN { - require_ok('C4::Circulation'); + use_ok('C4::Log') } use DateTime; @@ -473,7 +473,12 @@ C4::Context->dbh->do("DELETE FROM accountlines"); due => Koha::DateUtils::output_pref($five_weeks_ago) } ); + my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); + my $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } ); AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch ); + my $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } ); + is ($new_log_size -1, $old_log_size, 'renew log successfuly added'); + $fine = $schema->resultset('Accountline')->single( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } ); is( $fine->accounttype, 'F', 'Fine on renewed item is closed out properly' ); $fine->delete(); --