Bug 29146: Same for item editor

Test plan:
Put some defaultvalue in an item subfield.
Test adding new item; is defaultvalue supplied already?
Test adding existing item. Clear the subfield. Save. Open again.
Is the subfield still empty now?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2021-10-27 12:07:03 +00:00 committed by Jonathan Druart
parent dc30d4c376
commit 35ad731102

View file

@ -119,7 +119,7 @@ sub generate_subfield_form {
$subfield->{kohafield} || 'items.more_subfields_xml';
if ( $prefill_with_default_values && ( !defined($value) || $value eq '' ) ) {
$value = $subfield->{defaultvalue};
$value = $subfield->{defaultvalue} if !$item->{itemnumber}; # apply defaultvalue only to new items
if ($value) {
# get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value