Browse Source

Bug 29146: Apply framework defaultvalue only to new records

This applies only to the 'regular' cataloguing editor.
Another report could be opened for the advanced one,
if needed.

Test plan:
[1] Add a default value to some field X in framework Y.
[2] Open an existing biblio record in that fw. Clear field X. Save.
[3] Reopen the record. The default should not be in field X.
[4] Add a new record in that fw. You should see default value in X.

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>
21.11/bug30761
Marcel de Rooy 2 years ago
committed by Jonathan Druart
parent
commit
dc30d4c376
  1. 7
      cataloguing/addbiblio.pl

7
cataloguing/addbiblio.pl

@ -288,8 +288,9 @@ sub create_input {
my $index_subfield = CreateKey(); # create a specifique key for each subfield
# if there is no value provided but a default value in parameters, get it
if ( $value eq '' ) {
# Apply optional framework default value when it is a new record
# Substitute date parts, user name
if ( $value eq '' && !$cgi->param('biblionumber') ) {
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{};
# get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value
@ -305,8 +306,8 @@ sub create_input {
# And <<USER>> with surname (?)
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian");
$value=~s/<<USER>>/$username/g;
}
my $dbh = C4::Context->dbh;
# map '@' as "subfield" label for fixed fields

Loading…
Cancel
Save