Bugzilla – Attachment 60641 Details for
Bug 17708
Renewal log seems empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG 17708: Added a logaction function in Addrenewal in order to send renew logs
BUG-17708-Added-a-logaction-function-in-Addrenewal.patch (text/plain), 5.98 KB, created by
Baptiste Wojtkowski (bwoj)
on 2017-02-24 08:43:43 UTC
(
hide
)
Description:
BUG 17708: Added a logaction function in Addrenewal in order to send renew logs
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2017-02-24 08:43:43 UTC
Size:
5.98 KB
patch
obsolete
>From 9a6577922479c5393a942b61f6bfafef6ee190eb Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Wed, 8 Feb 2017 08:54:42 +0000 >Subject: [PATCH] BUG 17708: Added a logaction function in Addrenewal in order > to send renew logs > >20/02/17 : added the syspref RenewalLog >24/20/17 : added a test for the syspref Renewal Log > >test plan >1 - Chose a Borrower and have him renewing an item >2 - Check the renew logs : they should be empty >3 - Apply patch and set the syspref RenewalLog to 1 >4 - Have the Borrower renewing a new item >5 - Check the renew logs : there should be your renew > >I called the function logaction, which is in charge of modifying the >logs, within the function which adds a new renewal at the list. > >https://bugs.koha-community.org/show_bug.cgi?id=17708 >--- > C4/Circulation.pm | 4 +++- > .../mysql/atomicupdate/bug_17708_add-RenewalLog.sql | 2 ++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/logs.pref | 6 ++++++ > t/db_dependent/Circulation.t | 18 ++++++++++++++++-- > 5 files changed, 28 insertions(+), 3 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index e2cd626..b6cfb83 100644 >--- a/C4/Circulation.pm >+++ b/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; > } > >diff --git a/installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql b/installer/data/mysql/atomicupdate/bug_17708_add-RenewalLog.sql >new file mode 100644 >index 0000000..1ab946e >--- /dev/null >+++ b/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 renewals','YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 3d7a8a5..6b0f601 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/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 renewals','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'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index 4aa5790..cb896c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/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 >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e3d4c8d..4626103 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,10 +17,10 @@ > > use Modern::Perl; > >-use Test::More tests => 91; >+use Test::More tests => 93; > > BEGIN { >- require_ok('C4::Circulation'); >+ use_ok('C4::Log') > } > > use DateTime; >@@ -473,7 +473,21 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > due => Koha::DateUtils::output_pref($five_weeks_ago) > } > ); >+ t::lib::Mocks::mock_preference('RenewalLog', 0); >+ 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, $old_log_size, 'renew log not added because of the syspref RenewalLog'); >+ >+ t::lib::Mocks::mock_preference('RenewalLog', 1); >+ $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); >+ $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } ); >+ AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch ); >+ $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEW"]) } ); >+ is ($new_log_size, $old_log_size + 1, 'renew log successfully 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(); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17708
:
57861
|
60007
|
60383
|
60454
|
60455
|
60458
|
60459
|
60460
|
60541
|
60641
|
61353
|
61368
|
61369
|
61417
|
61418
|
61419
|
61420