Bugzilla – Attachment 77859 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 syspref to enable blanking of item shelving location on issue.
Bug-21159---Implementing-syspref-to-enable-blankin.patch (text/plain), 6.88 KB, created by
Alex Buckley
on 2018-08-15 21:00:19 UTC
(
hide
)
Description:
Bug 21159 - Implementing syspref to enable blanking of item shelving location on issue.
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-08-15 21:00:19 UTC
Size:
6.88 KB
patch
obsolete
>From e8b626cf2160ba5198148592eb8436e3b6b981f5 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 13 Aug 2018 09:41:57 +1200 >Subject: [PATCH] Bug 21159 - Implementing syspref to enable blanking of item > shelving location on issue. > >This patch builds upon the functionality implemented in bug 14576, >by allowing library staff to automatically change the item shelving >location of items which are circulated. > >In the case of this patch it automatically blanks the item shelving locations of items >when they are issued if the >BlankItemLocationOnCheckout syspref is enabled. > >t/db_dependent/Circulation/issue.t contains tests for >BlankItemLocationOnCheckout. > >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 patches on bug report 14576, and this patch, and run ./updatedatabase.pl inside the koha shell >4. Now return the checked out item (when you updated the database you >added one new syspref: UpdateItemLocationOnCheckout which is off by default) >5. Check the item out again and notice the shelving location is not >changed, showing that when the UpdateItemLocationOnCheckout is not >enabled and the shelving location is not changed upon issue. >6. Enable the aforementioned syspref in the Administration->Global >system preferences->Circulation interface >7. Check out the item and notice the shelving location is changed to no >value, showing when the UpdateItemLocationOnCheckout syspref is enabled >it blanks the shelving location on the issue of an item. >8. Run t/db_dependent/Circulation/issue.t > >Sponsored-By: Toi Ohomai Institute of Technology, New Zealand >--- > C4/Circulation.pm | 6 ++++++ > C4/Items.pm | 23 +++++++++++++++++++++- > .../bug_21159-add_UpdateItemLocationOnCheckout.sql | 1 + > .../en/modules/admin/preferences/circulation.pref | 6 ++++++ > t/db_dependent/Circulation/issue.t | 23 +++++++++++++++++++++- > 5 files changed, 57 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_21159-add_UpdateItemLocationOnCheckout.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 66687e2..5ad4cea 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1393,6 +1393,12 @@ sub AddIssue { > } > } > >+ if ( C4->Context->preference('UpdateItemLocationOnCheckout')) { >+ # UpdateItemLocationOnCheckout is on, set the value of the shelving location (items.location) to blank >+ BlankShelvingLocation( $item->{itemnumber}); >+ } >+ >+ > ModItem( > { > issues => $item->{'issues'}, >diff --git a/C4/Items.pm b/C4/Items.pm >index c2a5a9e..1bfa45c 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -84,7 +84,7 @@ BEGIN { > GetLatestAcquisitions > > CartToShelf >- >+ BlankShelvingLocation > GetAnalyticsCount > > SearchItemsByField >@@ -198,6 +198,27 @@ sub CartToShelf { > } > } > >+ >+=head2 BlankShelvingLocation >+ >+ BalnkShelvingLocation($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/installer/data/mysql/atomicupdate/bug_21159-add_UpdateItemLocationOnCheckout.sql b/installer/data/mysql/atomicupdate/bug_21159-add_UpdateItemLocationOnCheckout.sql >new file mode 100644 >index 0000000..c10c680 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_21159-add_UpdateItemLocationOnCheckout.sql >@@ -0,0 +1 @@ >+INSERT INTO systempreferences (variable, value, explanation, type) VALUES ('UpdateItemLocationOnCheckout', 0, 'Blank the 952$c (Shelving Location) field of item when it is issued', 'YesNo'); >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 5eb6492..9d46271 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 >@@ -500,6 +500,12 @@ Circulation: > - <br>**Use of an _ALL_ rule will override/ignore any other values** > - <br>Each pair of values should be on a separate line. > - >+ - pref: BlankShelvingLocationOnIssue >+ - choices: >+ yes: Blank >+ no: "Don't blank" >+ - Blank the 952$c (shelving location) field of item when it 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 4f3ec3c..f6e8d98 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 => 44; >+use Test::More tests => 46; > use DateTime::Duration; > > use t::lib::Mocks; >@@ -419,8 +419,29 @@ $item2 = GetItem( $itemnumber2 ); > ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); > 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); >+AddIssue($borrower_1, 'barcode_5', $daysago10, 0, $today, ''); >+$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.1.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 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