Bugzilla – Attachment 87037 Details for
Bug 21159
Update item shelving location (952$c) on checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21159 - Implementing 2 sysprefs to enable blanking location
Bug-21159---Implementing-2-sysprefs-to-enable-blan.patch (text/plain), 6.96 KB, created by
Hayley Pelham
on 2019-03-26 21:58:14 UTC
(
hide
)
Description:
Bug 21159 - Implementing 2 sysprefs to enable blanking location
Filename:
MIME Type:
Creator:
Hayley Pelham
Created:
2019-03-26 21:58:14 UTC
Size:
6.96 KB
patch
obsolete
>From 3a69aad2c48ce5c6a260ad2385351a5b260bb365 Mon Sep 17 00:00:00 2001 >From: Hayley Mapley <hayleymapley@catalyst.net.nz> >Date: Wed, 27 Mar 2019 10:37:38 +1300 >Subject: [PATCH] Bug 21159 - Implementing 2 sysprefs to enable blanking > location > >This patch introduces two new system preferences: >BlankingShelvingLocationOnIssue and BlankingShelvingLocationOnReturn. By >default both are off. > >If BlankingShelvingLocationOnIssue is enabled then when an item is >issued it's shelving location 952$c field will be set to '' in >C4::Items->BlankShelvingLocation() > >If BlankingShelvingLocationOnReturn is enabled then when an item is >returned it's shelving location field will be set to '' in >C4::Items->BlankShelvingLocation(). > >t/db_dependent/Circulation/issue.t contains tests for >BlankShelvingLocationOnIssue > >t/db_dependen/Circulation/Returns.t contains tests for >BlankShelvingLocationOnReturn > >Test plan: >1. Create a new biblio and associated item and set the value of the >shelving location for the item to 'CART' >2. Checkout the item to a user and notice that the status does not >change >3. Apply patch, and run ./updatedatabase.pl inside the koha shell >4. Now return the checked out item (when you updated the database >you added two new sysprefs: BlankShelvingLocationOnIssue and >BlankShelvingLocationOnReturn both of which are off by >default) >5. Notice the shelving location has not changed, showing with the >BlankShelvingLocationOnReturn syspref not enabled the shelving >location is not changed upon return >6. Check the item out again and notice the shelving location is not >changed, showing that when the BlankShelvingLocationOnIssue is not >enabled the shelving location is not changed upon issue. >7. Enable both aforementioned sysprefs in the Administration->Global >system preferences->Circulation interface >8. Return the item and notice the Shelving location has changed from >'Cart' to no value, showing when the BlankShelvingLocationOnReturn >syspref is enabled it blanks the shelving location value on the >return of the item >9. Edit the item changing the shelving location back to 'Shelving >Trolley'(CART) >10. Check out the item and notice the shelving location is changed >to no value, showing when the BlankShelvingLocationOnIssue syspref >is enabled it blanks the shelving location on the issue of an item. >11. Run t/db_dependent/Circulation/Returns.t >12. Run t/db_dependent/Circulation/issue.t > >Sponsored-By: Toi Ohomai Institute of Technology, New Zealand >--- > C4/Circulation.pm | 5 ++++ > C4/Items.pm | 24 ++++++++++++++++++ > .../en/modules/admin/preferences/circulation.pref | 6 +++++ > t/db_dependent/Circulation/issue.t | 29 +++++++++++++++++++++- > 4 files changed, 63 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index da689c1f30..f2d25d782e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1450,6 +1450,11 @@ sub AddIssue { > } > } > >+ if (C4::Context->preference('UpdateItemLocationOnCheckout')) { >+ # UpdateItemLocationOnCheckout is on, set the value of the shelving location (items.location) to blank upon checkout >+ BlankShelvingLocation( $item_object->itemnumber ); >+ } >+ > ModItem( > { > issues => $item_object->issues + 1, >diff --git a/C4/Items.pm b/C4/Items.pm >index a06fdfabde..60ef0d3c08 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -47,6 +47,7 @@ BEGIN { > DelItemCheck > MoveItemFromBiblio > CartToShelf >+ BlankShelvingLocation > GetAnalyticsCount > SearchItemsByField > SearchItems >@@ -140,6 +141,29 @@ sub CartToShelf { > } > } > >+=head2 BlankShelvingLocation >+ >+ BlankShelvingLocation($itemnumber); >+ >+Set the value of the shelving location to blank when an >+item is issued or returned. >+ >+This is called by >+C4:Circulation->AddIssue if the BlankItemLocationOnCheckout >+syspref is enabled >+ >+=cut >+ >+sub BlankShelvingLocation { >+ my ($itemnumber) = @_; >+ unless ($itemnumber) { >+ croak "Failed BlankShelvingLocation() - no itemnumber supplied"; >+ } >+ my $item = GetItem($itemnumber); >+ $item->location = ''; >+ ModItem($item, undef, $itemnumber); >+} >+ > =head2 AddItemFromMarc > > my ($biblionumber, $biblioitemnumber, $itemnumber) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index e79ba532f1..e212ddad3c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -533,6 +533,12 @@ Circulation: > - <br><b>Use of an _ALL_ rule will override/ignore any other values.</b> > - <br>Each pair of values should be on a separate line. > - >+ -pref: UpdateItemLocationOnCheckout >+ choices: >+ yes: Blank >+ no: "Don't Blank" >+ - Blank the 952$c (shelving location) field of the item when is is issued. >+ - > - pref: UpdateNotForLoanStatusOnCheckin > type: textarea > class: code >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index e945876378..af9de03757 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 45; >+use Test::More tests => 47; > use DateTime::Duration; > > use t::lib::Mocks; >@@ -423,7 +423,34 @@ ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location valu > ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); > > >+my $itemnumber3; >+($biblionumber, $biblioitemnumber, $itemnumber3) = C4::Items::AddItem( >+ { >+ barcode => 'barcode_5', >+ itemcallnumber => 'callnumber5', >+ homebranch => $branchcode_1, >+ holdingbranch => $branchcode_1, >+ location => 'CART', >+ itype => $itemtype >+ }, >+ $biblionumber >+); > >+#BlankItemLocationOnCheckout >+t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 0); >+AddIssue($borrower_1, 'barcode_5', $daysago10, 0, $today, 0); >+my $item3 = GetItem($itemnumber3); >+ok($item3->location eq 'CART'), >+q{UpdateItemLocationOnCheckout does not update item shelving location value from 'CART' to '' when not enabled} ); >+ >+t::lib::Mocks::mock_preference('UpdateItemLocationOnCheckout', 1); >+if (C4::Context->preference('UpdateItemLocationOnCheckout') ) >+{ >+ BlankShelvingLocation($itemnumber3); >+} >+$item3 = GetItem($itemnumber3); >+ok($item3->location eq '', q{UpdateItemLocationOnCheckout updates item shelving location value from 'CART' >+ to '' when enabled} ); > > # Bug 14640 - Cancel the hold on checking out if asked > my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber, >-- >2.11.0
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 21159
:
77487
|
77549
|
77594
|
77775
|
77859
|
77869
|
77870
|
77871
|
80892
|
80893
|
80894
|
80895
|
87037
|
87038
|
87041
|
87693
|
87694
|
87695
|
139097
|
139098
|
139099
|
139103
|
139104
|
139105
|
139106
|
139107
|
139108
|
139109
|
139220
|
146602
|
146603
|
146604
|
146605
|
146606
|
146607
|
146608
|
154147
|
154148
|
154149
|
154150
|
154151
|
154152
|
155284
|
155285
|
155771
|
155772
|
155773
|
155774
|
158146
|
158147
|
158149
|
158150
|
158169
|
158170
|
158171
|
158172
|
158173
|
158521
|
158522