Bugzilla – Attachment 32447 Details for
Bug 6473
Test bug for Git-bz ✔ ❤ ★
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), 6.24 KB, created by
Kyle M Hall (khall)
on 2014-10-16 16:42:41 UTC
(
hide
)
Description:
Bug 9011 - Add the ability to store the last patron to return an item
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-10-16 16:42:41 UTC
Size:
6.24 KB
patch
obsolete
>From d5041737f92c014d7e6aa8dd69bfb1b460449448 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> > >http://bugs.koha-community.org/show_bug.cgi?id=6473 >--- > C4/Circulation.pm | 16 ++++++++++++++-- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++++++ > .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > t/db_dependent/Circulation_anonymization.t | 19 +++++++++++++++++-- > 5 files changed, 46 insertions(+), 4 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 47f7ca1..9207731 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3791,8 +3791,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/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index b845d53..32c57fa 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -378,6 +378,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'), > ('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'), > ('StatisticsFields','location|itype|ccode', NULL, 'Define Fields (from the items table) used for statistics members','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/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index eb12838..98b1f48 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8800,6 +8800,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.17.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT 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')"); >+ >+ print "Upgrade to $DBversion done (Bug 9011 - Add the ability to store the last patron to return an item)\n"; >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 2770e53..3cc67f0 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 >@@ -592,6 +592,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 6473
:
4386
|
6837
|
6838
|
6839
|
6840
|
6841
|
6842
|
6843
|
7154
|
7155
|
7567
|
7994
|
7995
|
7996
|
7997
|
8018
|
9807
|
9808
|
9813
|
9831
|
9832
|
9836
|
9854
|
10842
|
10843
|
10844
|
10845
|
10846
|
10847
|
10848
|
10849
|
10850
|
10851
|
10852
|
10853
|
10854
|
10855
|
10856
|
10857
|
10858
|
11540
|
11543
|
11544
|
12502
|
12513
|
12514
|
12515
|
12516
|
12517
|
12518
|
12519
|
13473
|
13673
|
14955
|
14969
|
14970
|
14972
|
15201
|
18949
|
18950
|
18951
|
18952
|
18953
|
18954
|
18955
|
18956
|
18957
|
18958
|
18959
|
18960
|
18961
|
18962
|
18963
|
18971
|
18972
|
19518
|
19519
|
19591
|
19592
|
19871
|
19879
|
19880
|
19881
|
19882
|
20011
|
20012
|
20013
|
20014
|
22477
|
22481
|
22482
|
22496
|
22502
|
22503
|
31958
|
32444
|
32445
|
32446
|
32447
|
32448
|
32449
|
32450
|
32451
|
32452
|
34200
|
34201
|
34625
|
34999
|
35130
|
35269
|
35273
|
35274
|
35275
|
35276
|
35277
|
35279
|
35280
|
35303
|
40954
|
40957
|
45345
|
45349
|
45731
|
45732
|
45733
|
45734
|
47283
|
47284
|
47298
|
47299
|
47300
|
47334
|
47336
|
49083
|
56974
|
61059
|
61069
|
62038
|
65313
|
77301
|
78016
|
79959
|
80178
|
80179
|
80180
|
80181
|
80182
|
84400
|
86644
|
86645
|
87152
|
88128
|
95586
|
95716
|
97394
|
99026
|
99027
|
114217
|
114218
|
114219
|
114220
|
114221
|
114222
|
114223
|
114224
|
114225
|
114226
|
119255
|
121181
|
131891
|
131893
|
131894
|
134862
|
144109
|
144144
|
144671
|
144672
|
144673
|
147183
|
149030
|
149031
|
149032
|
149033
|
160566
|
160567
|
160568