Bug 12874: A DB field without a default mapping is set to a default value on editing
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 19 Jun 2014 13:18:23 +0000 (15:18 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sat, 11 Oct 2014 15:57:11 +0000 (12:57 -0300)
commitd85f29661b6455a4920c64a684de4eb3f0c06bcd
treebc13ecad2fc508fbff76bc7653b3bcd14b37c9ce
parentfe478d76e527ff45c77c6c4912e41f5c4f4504f5
Bug 12874: A DB field without a default mapping is set to a default value on editing

If an item is edited and a field is not mapped to Koha, it is to 0 or
NULL (depending on the default value defined).

This patch adds a check on the mapping before editing the item. It there
is no mapping, the DB value is not erased.

Test plan:
1/ Edit an item and fill a value for a field
2/ Unmap this field
3/ Edit the item
4/ Verify that the value is not erased (using the MySQL CLI)

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Items.pm
C4/Koha.pm
t/db_dependent/Koha/IsKohaFieldLinked.t [new file with mode: 0644]