From 1439243ac4f3d5962f40054379e50b5a31a4a048 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 9 Jul 2021 10:00:05 +0200 Subject: [PATCH] Bug 27526: Fix Add & duplicate Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- cataloguing/additem.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 3869bb1c1f..a69ddd1c8d 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -424,6 +424,7 @@ my $prefillitem = C4::Context->preference('PrefillItem'); if ($op eq "additem") { my $add_submit = $input->param('add_submit'); + my $add_duplicate_submit = $input->param('add_duplicate_submit'); my $add_multiple_copies_submit = $input->param('add_multiple_copies_submit'); my $number_of_copies = $input->param('number_of_copies'); @@ -499,7 +500,7 @@ if ($op eq "additem") { } # If we have to add & duplicate - if ($prefillitem) { + if ($prefillitem || $add_duplicate_submit) { $current_item = $item->unblessed; @@ -511,6 +512,10 @@ if ($op eq "additem") { # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin $current_item->{barcode} = undef; # FIXME or delete? } + + # Don't use the "prefill" feature if we want to generate the form with all the info from this item + # It will remove subfields that are not in SubfieldsToUseWhenPrefill. + $prefillitem = 0 if $add_duplicate_submit; } # If we have to add multiple copies -- 2.39.5