From e12b080a4cc1131fd55810e1c18d0217e0ef765a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Jan 2017 13:39:47 +0100 Subject: [PATCH] Bug 17725: Do not copy subfield's content when cloning To replicate: - Open an existing record in your catalog - Create another field or subfield of a field/subfield already used using the icon to repeat it - Verify that the content is copied over - Verify this happens for input (one line) and textare (multiple lines) I can't make this happen for when creating a new record, but more consistently on editing existing records. This is rather annoying when cataloguing in Koha, as the cataloguer has to empty the field first and that adds an extra step for each repeated field. Test plan: Confirm than the content is not copied when you clone a field or a subfield. Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index ed43aec378..44cd9498ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -291,6 +291,9 @@ function CloneSubfield(index, advancedMARCEditor){ id_input = inputs[i].getAttribute('id')+new_key; inputs[i].setAttribute('id',id_input); inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); + if(inputs[i].getAttribute("id") && inputs[i].getAttribute("id").match(/^tag_/) ){ + inputs[i].value = ""; + } linkid = id_input; } @@ -312,6 +315,9 @@ function CloneSubfield(index, advancedMARCEditor){ id_input = textareas[i].getAttribute('id')+new_key; textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); + if(textareas[i].getAttribute("id") && textareas[i].getAttribute("id").match(/^tag_/) ){ + textareas[i].value = ""; + } linkid = id_input; } -- 2.20.1