From 7f46a123536783ef5eceb8addd08d55c63a53539 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Tue, 14 Nov 2023 09:34:01 +0100 Subject: [PATCH] fix add button (did nothing when no doc selected at right) ; add clickable label on "copy meta" ckbox --- .../Controller/Prod/LazaretController.php | 2 +- templates/web/prod/upload/lazaret.html.twig | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php b/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php index e977facf8f..29cfe6d77e 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php @@ -136,7 +136,7 @@ public function addElement(Request $request, $file_id) $recordId = $request->request->get('record_id'); /** @var LazaretFile $lazaretFile */ $metadatasToSet = []; - if(!!$request->request->get('copy_meta', false)) { + if($recordId !== "" && !!$request->request->get('copy_meta', false)) { $substitutedRecord = null; diff --git a/templates/web/prod/upload/lazaret.html.twig b/templates/web/prod/upload/lazaret.html.twig index 08e1465f3b..8a32a2be9b 100644 --- a/templates/web/prod/upload/lazaret.html.twig +++ b/templates/web/prod/upload/lazaret.html.twig @@ -187,26 +187,25 @@ $("button.add-lazaret", scope).bind('click', function () { const that = $(this); const $elementRow = that.closest(".lazaretElement"); - if(!$elementRow.attr("hasSelected")) { - return false; - } - var lazaretId = getLazaretId(that); - + let $form = $("FORM", $elementRow); + const lazaretId = getLazaretId(that); let $selectedProposals = $(".record-proposal .selected"); - if($selectedProposals.length !== 1) { + if($selectedProposals.length > 1) { alert(language.onlyOneRecord); return false; } - let recordId = $selectedProposals.first().attr("data-record_id"); - let $form = $("FORM", $elementRow); - - $(".record_id", $form).val(recordId); + if($selectedProposals.length === 1) { + let recordId = $selectedProposals.first().attr("data-record_id"); + $(".record_id", $form).val(recordId); + } + else { + $(".record_id", $form).val(''); + } var destinationCollectionId = getDestinationId(that); var container = $(this).closest('.wrapper-item'); - /*fix POST on firefox*/ data = $form.serializeArray(); var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html(); @@ -582,7 +581,8 @@
-  {{ 'upload:: Copy meta' | trans }} +   +