Bug 27545: Use NewItemsDefaultLocation from places where an item is created
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 25 Jan 2021 13:04:31 +0000 (14:04 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Mar 2021 16:20:47 +0000 (17:20 +0100)
commitd776fa7b271644790219f56eb1f53e4be1ad5a12
treeb526fac1bfda61a5defb4dff2b54a490d86267bb
parent8efc21385a176c428151c7a2b5e0fee04e576041
Bug 27545: Use NewItemsDefaultLocation from places where an item is created

The syspref NewItemsDefaultLocation is used to set a default value for item's location.

But it seems that there are some weirdness in the behaviour:
1. It's only used from additem. It seems that it should be used from acq and serial modules as well. And maybe for the items import too.
2. It set the location even if another one has been picked from the UI
=> We UI must preselect the syspref's value, but the controller must pick what has been selected on the UI

This patch is adding the default to the UI and extend the use of the
pref to other areas.

Test plan:
Set a value to NewItemsDefaultLocation
Catalogue a new item and confirm that the syspref's value is picked to
selected the default value on the add item form
Same behaviour should apply to the acquisition and serial modules
When importing items, the default location must be used if the imported
items did not have a location defined.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Items.pm
Koha/Item.pm
cataloguing/additem.pl
t/db_dependent/Koha/Items.t