Bugzilla – Attachment 39813 Details for
Bug 9011
Add the ability to store the last patron to return an item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9011 - Add the ability to store the last patron to return an item
Bug-9011---Add-the-ability-to-store-the-last-patro.patch (text/plain), 5.91 KB, created by
Kyle M Hall
on 2015-06-03 18:20:36 UTC
(
hide
)
Description:
Bug 9011 - Add the ability to store the last patron to return an item
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2015-06-03 18:20:36 UTC
Size:
5.91 KB
patch
obsolete
>From f5a1c3c407688a4844bd39b4841b8dc2c6e086d4 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 5 Mar 2014 11:24:58 -0500 >Subject: [PATCH] Bug 9011 - Add the ability to store the last patron to return an item > >Signed-off-by: Nick Clemens <nick@quecheelibrary.org> >--- > C4/Circulation.pm | 16 ++++++++++++++-- > installer/data/mysql/atomicupdate/bug_9011.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > t/db_dependent/Circulation_anonymization.t | 19 +++++++++++++++++-- > 5 files changed, 40 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_9011.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 3712798..6dd476e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3936,8 +3936,20 @@ sub AnonymizeItemIssueHistory { > { prefetch => 'borrower', order_by => { -desc => 'issue_id' } } > ); > >- my $oi = $old_issues_rs->next(); >- if ( $oi->borrower()->privacy() == 2 ) { >+ my $oi; >+ if ( C4::Context->preference('StoreLastBorrower') ) { >+ >+ # If storing last borrower, skip the latest old_issue for this item >+ $old_issues_rs->next(); >+ $oi = $old_issues_rs->next(); >+ } >+ else { >+ >+ # If *not* storing last borrower, use the latest old_issue for this item >+ $oi = $old_issues_rs->next(); >+ } >+ >+ if ( $oi && $oi->borrower()->privacy() == 2 ) { > $oi->set_column( 'borrowernumber', $a ); > $oi->update(); > } >diff --git a/installer/data/mysql/atomicupdate/bug_9011.sql b/installer/data/mysql/atomicupdate/bug_9011.sql >new file mode 100644 >index 0000000..260f1e6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_9011.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by', 'YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 9620d67..415685e 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -404,6 +404,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('StatisticsFields','location|itype|ccode', NULL, 'Define Fields (from the items table) used for statistics members','Free'), > ('SubfieldsToAllowForRestrictedBatchmod','','Define a list of subfields for which edition is authorized when items_batchmod_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j',NULL,'Free'), > ('SubfieldsToAllowForRestrictedEditing','','Define a list of subfields for which edition is authorized when edit_items_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j',NULL,'Free'), >+('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by','YesNo'), > ('SubfieldsToUseWhenPrefill','','','Define a list of subfields to use when prefilling items (separated by space)','Free'), > ('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'), > ('SubscriptionHistory','simplified','simplified|full','Define the display preference for serials issue history in OPAC','Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 9a4309c..2ab64eb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -594,6 +594,13 @@ OPAC: > track: "Track" > no: "Don't track" > - links that patrons click on >+ - >+ - pref: StoreLastBorrower >+ default: 0 >+ choices: >+ yes: Store >+ no: "Don't store" >+ - the last patron to return an item. This setting is independent of opacreadinghistory/AnonymousPatron. > > Shelf Browser: > - >diff --git a/t/db_dependent/Circulation_anonymization.t b/t/db_dependent/Circulation_anonymization.t >index caec6b5..d886bf1 100644 >--- a/t/db_dependent/Circulation_anonymization.t >+++ b/t/db_dependent/Circulation_anonymization.t >@@ -6,7 +6,7 @@ use C4::Context; > use C4::Circulation; > use Koha::Database; > >-use Test::More tests => 4; >+use Test::More tests => 6; > > BEGIN { > use_ok('C4::Circulation'); >@@ -132,6 +132,8 @@ my $userenv = C4::Context->userenv > > #Begin Tests > >+C4::Context->set_preference( 'StoreLastBorrower', 0 ); >+ > AddIssue( $borrower_1, 'barcode_1' ); > AddReturn('barcode_1'); > my $old_issue = >@@ -141,13 +143,26 @@ ok( $old_issue->borrower()->borrowernumber() == $anonymous_patron->borrowernumbe > > my $next_issue_id = $old_issue->issue_id() + 1; > >- > AddIssue( $borrower_2, 'barcode_1' ); > AddReturn('barcode_1'); > $old_issue = > $schema->resultset('OldIssue')->find( $next_issue_id ); > ok( $old_issue->borrower()->borrowernumber() == $borrower2->borrowernumber(), "Patron with privacy of 1 not anonymized" ); > >+C4::Context->set_preference( 'StoreLastBorrower', 1 ); >+ >+$next_issue_id = $old_issue->issue_id() + 1; >+ >+AddIssue( $borrower_1, 'barcode_1' ); >+AddReturn('barcode_1'); >+$old_issue = >+ $schema->resultset('OldIssue')->find( $next_issue_id ); >+ok( $old_issue->borrower()->borrowernumber() == $borrower1->borrowernumber(), "Patron with privacy of 2 not anonymized with StoreLastBorrower enabled" ); >+AddIssue( $borrower_2, 'barcode_1' ); >+AddReturn('barcode_1'); >+$old_issue = >+ $schema->resultset('OldIssue')->find( $next_issue_id ); >+ok( $old_issue->borrower()->borrowernumber() == $anonymous_patron->borrowernumber(), "Patron with privacy of 2 anonymized after next return with StoreLastBorrower enabled" ); > > #End transaction > $dbh->rollback; >-- >1.7.2.5
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 9011
:
13258
|
15117
|
15200
|
16666
|
16763
|
16773
|
18676
|
20180
|
20181
|
20329
|
20342
|
20343
|
20344
|
22577
|
22578
|
22579
|
25866
|
25867
|
25868
|
25869
|
25870
|
25871
|
25872
|
25873
|
28923
|
28924
|
28925
|
29301
|
29745
|
29749
|
29750
|
29930
|
29931
|
30979
|
30993
|
30994
|
30995
|
30996
|
30997
|
30998
|
30999
|
32430
|
32431
|
32432
|
32433
|
32434
|
32435
|
32436
|
32437
|
32438
|
32439
|
32440
|
32441
|
32442
|
32443
|
32977
|
37113
|
37114
|
37115
|
37116
|
37117
|
38441
|
38442
|
38443
|
38444
|
38445
|
39812
| 39813 |
39814
|
39815
|
39816