Bugzilla – Attachment 35038 Details for
Bug 13540
Item's permanent_location is set to CART|PROC if an Item is edited when it's location is CART|PROC.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13540 - Item's permanent_location is set to CART|PROC if an Item is edited when it's location is CART|PROC.
Bug-13540---Items-permanentlocation-is-set-to-CART.patch (text/plain), 3.12 KB, created by
Olli-Antti Kivilahti
on 2015-01-08 18:32:09 UTC
(
hide
)
Description:
Bug 13540 - Item's permanent_location is set to CART|PROC if an Item is edited when it's location is CART|PROC.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-01-08 18:32:09 UTC
Size:
3.12 KB
patch
obsolete
>From f4f5e121e4ea76502103305c8f48a80ff76ba200 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Thu, 8 Jan 2015 20:26:40 +0200 >Subject: [PATCH] Bug 13540 - Item's permanent_location is set to CART|PROC if > an Item is edited when it's location is CART|PROC. > >This bug is rather nasty as it happens very discreetly when editing Items that are >in either locations 'CART' or 'PROC'. >For example when changing one of the Item's statuses or barcode, the permanent_location >gets overwritten without the user noticing it immediately. The damage becomes apparent >only weeks later when there are potentially thousands of Items missing the >permanent_location and location. > >:-:TEST SETUP:-: >0a. System preference "ReturnToShelvingCart" must be 'Move'. >0b. Find any Item (I69) >0c. Set I69's location to "Book Cart" (BC) or anything but empty. > >:-:REPLICATE ISSUE:-: >1. Check-in the I69 and the location should turn to 'CART' (returned today). >2. Go to the "Edit Item"-view for I69, don't change anything, simply click > "Save changes" >3. Observe that the permanent_location has changed to 'CART'. > This is not good since now the location data is forever lost again (Bugg 7817). > The "cart_to_shelf.pl --hours 24"-script cannot return the Item to the proper > place ;( > >:-:AFTER THIS PATCH:-: >Repeat steps 1-2. >3. Observe that the permanent_location is still the old one, instead of getting > overwritten by 'CART'. >--- > C4/Items.pm | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 33143a5..1dd7fe0 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -956,6 +956,22 @@ sub GetItemLocation { > return \%itemlocation; > } > >+=head GetRealItemLocations >+ >+ my $locations = C4::Items::GetRealItemLocations($itemnumber); >+ >+A convenience function of getting just the Item location and permanent_location >+@PARAM1, Long, the koha-items.itemnumber >+@RETURNS, Reference to Hash, with koha.items.location and permanent_location as hash keys. >+ >+=cut >+sub GetRealItemLocations { >+ my $itemnumber = shift; >+ my $sth = C4::Context->dbh()->prepare('SELECT location, permanent_location FROM items WHERE itemnumber = ?'); >+ $sth->execute($itemnumber); >+ return $sth->fetchrow_hashref(); >+} >+ > =head2 GetLostItems > > $items = GetLostItems( $where, $orderby ); >@@ -2030,7 +2046,15 @@ sub _do_column_fixes_for_mod { > $item->{'withdrawn'} = 0; > } > if (exists $item->{'location'} && !$item->{'permanent_location'}) { >- $item->{'permanent_location'} = $item->{'location'}; >+ if ($item->{'location'} ne 'CART' && $item->{'location'} ne 'PROC') { >+ $item->{'permanent_location'} = $item->{'location'}; >+ } >+ else { >+ #Preserve the old permanent_location in face of adversity! >+ #Don't let it fall to 'PROC' or 'CART'. Otherwise it will be forever lost! >+ my $locations = GetRealItemLocations( $item->{itemnumber} ); >+ $item->{'permanent_location'} = $locations->{'permanent_location'}; >+ } > } > if (exists $item->{'timestamp'}) { > delete $item->{'timestamp'}; >-- >1.7.9.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 13540
:
35038
|
35047
|
35055
|
35336
|
35337
|
35951
|
35952
|
35953
|
40183
|
40214
|
40878