From 52c4a60a57c344c194d4b89ca0322a8845707676 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 --- cataloguing/additem.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 8a2a112290d..6e51e824ad5 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -413,6 +413,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'); @@ -488,7 +489,7 @@ if ($op eq "additem") { } # If we have to add & duplicate - if ($prefillitem) { + if ($prefillitem || $add_duplicate_submit) { $current_item = $item->unblessed; @@ -500,6 +501,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.20.1