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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
Jonathan Druart 2015-09-02 14:28:52 +01:00 committed by Tomas Cohen Arazi
parent ae5ee62d59
commit a2ca59efb8

View file

@ -2144,6 +2144,7 @@ sub _koha_new_item {
my ( $item, $barcode ) = @_;
my $dbh=C4::Context->dbh;
my $error;
$item->{permanent_location} //= $item->{location};
my $query =
"INSERT INTO items SET
biblionumber = ?,