@@ -, +, @@ --- authorities/authorities.pl | 13 ++++++++++--- cataloguing/addbiblio.pl | 12 ++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) --- a/authorities/authorities.pl +++ a/authorities/authorities.pl @@ -112,9 +112,16 @@ sub create_input { $max_length = 40; } - # if there is no value provided but a default value in parameters, get it - if ($value eq '') { - $value = $tagslib->{$tag}->{$subfield}->{defaultvalue} if !$cgi->param('authid'); # only for new records + # Apply optional framework default value when it is a new record, + # or when editing as new (duplicating a record), + # based on the ApplyFrameworkDefaults setting. + # Substitute date parts, user name + my $applydefaults = C4::Context->preference('ApplyFrameworkDefaults'); + if ( $value eq '' && ( + ( $applydefaults =~ /new/ && !$cgi->param('authid') ) || + ( $applydefaults =~ /duplicate/ && $cgi->param('op') eq 'duplicate' ) + ) ) { + $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; if (!defined $value) { $value = q{}; } --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -292,9 +292,17 @@ sub create_input { my $index_subfield = CreateKey(); # create a specifique key for each subfield - # Apply optional framework default value when it is a new record + # Apply optional framework default value when it is a new record, + # or when editing as new (duplicating a record), + # or when changing a record's framework, + # based on the ApplyFrameworkDefaults setting. # Substitute date parts, user name - if ( $value eq '' && !$cgi->param('biblionumber') ) { + my $applydefaults = C4::Context->preference('ApplyFrameworkDefaults'); + if ( $value eq '' && ( + ( $applydefaults =~ /new/ && !$cgi->param('biblionumber') ) || + ( $applydefaults =~ /duplicate/ && $cgi->param('op') eq 'duplicate' ) || + ( $applydefaults =~ /changed/ && $cgi->param('changed_framework') ) + ) ) { $value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; # get today date & replace <>, <>, <>, <
> if provided in the default value --