Bug 7634

Summary: Permanent Location (shelving location) is NULL when Import MARC records tool is used
Product: Koha Reporter: Joy Nelson <1joynelson>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P5 - low CC: chris, jonathan.druart, katrin.fischer, liz, nengard, tmisilo, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7817
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6034
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13026
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14811
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 7634: Make the tests pass
Bug 7634: Add tests
Bug 7634: Prevent permanent_location to be set to NULL if not defined
Bug 7634: Make the tests pass
\# Attachment to Bug 7634 - Permanent Location (shelving location) is NULL when Import MARC records tool is used
Bug 7634: Prevent permanent_location to be set to NULL if not defined
[PASSED QA] Bug 7634: Make the tests pass
[PASSED QA] Bug 7634: Add tests
[PASSED QA] Bug 7634: Prevent permanent_location to be set to NULL if not defined

Description Joy Nelson 2012-03-01 16:29:45 UTC
When MARC records and items are ingested into Koha through the MARC record import tool, the items.permanent_location field is left NULL.  Items that are created through original cataloging have the items.permanent_location set to the items.location value.  

This causes serious issues when items are circulated and the library is using the CART/PROC system preferences.  NULL values in the permanent_location are then copied to the location field.
Comment 1 Owen Leonard 2014-07-11 12:18:36 UTC
Confirmed in master. I assume libraries are working around this by adding the correct value to items.permanent_location before/during import?
Comment 2 Joy Nelson 2015-07-21 14:28:58 UTC
Not sure.  I can say that if they are not (or do not know to add it or edit the item to force a permanent location value) then using the CART feature in Koha will cause data loss.  I continue to see this happen.


(In reply to Owen Leonard from comment #1)
> Confirmed in master. I assume libraries are working around this by adding
> the correct value to items.permanent_location before/during import?
Comment 3 Jonathan Druart 2015-09-02 13:47:54 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-09-02 13:47:57 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2015-09-02 13:48:07 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2015-09-03 03:28:06 UTC Comment hidden (obsolete)
Comment 7 Chris Cormack 2015-09-03 03:28:22 UTC Comment hidden (obsolete)
Comment 8 Chris Cormack 2015-09-03 03:28:41 UTC Comment hidden (obsolete)
Comment 9 Katrin Fischer 2015-09-13 15:17:43 UTC
Question: should we provide an update database to fix the proble on existing databases? Something like:

If the location is not empty or CART or PROC, copy to permanent_location.
Comment 10 Katrin Fischer 2015-09-13 15:34:08 UTC
Created attachment 42495 [details] [review]
[PASSED QA] Bug 7634: Make the tests pass

This patch just fixed a master bug, if your database already has some
items.homebranch set to CPL

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2015-09-13 15:34:11 UTC
Created attachment 42496 [details] [review]
[PASSED QA] Bug 7634: Add tests

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2015-09-13 15:34:14 UTC
Created attachment 42497 [details] [review]
[PASSED QA] Bug 7634: Prevent permanent_location to be set to NULL if not defined

The permanent_location is correctly filled when an item is added from
the cataloguing module (routine set_item_default_location from
cataloguing/additem.pl).
But when records are imported, this filled is not managed. It's only on
editing (_do_column_fixes_for_mod called from ModItem).

This patch set the permanent_location item fields to the location value for all
items created, even the imported ones.

Test plan:
0/ Do not apply this patch
1/ Import a record with items using the "Stage MARC for import" tool
2/ Check the values for the permanent_location in the items table.
They are set to NULL
3/ Apply this patch
4/ Repeat 2 and confirm that now the permanent_location values are set
to the location values.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2015-09-13 15:37:09 UTC
I filed bug 14811 to deal with a related problem.
Comment 14 Tomás Cohen Arazi 2015-09-16 14:07:44 UTC
Patches pushed to master.

Thanks Jonathan!
Comment 15 Chris Cormack 2015-09-22 17:51:56 UTC
Pushed to 3.20.x will be in 3.20.4
Comment 16 Liz Rea 2015-09-23 00:42:07 UTC
pushed to 3.18.x will be in 3.18.11