From bd07af498efce5c7647bda0ade23f68f3333a0a2 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 --- 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 ee03961..8930466 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -267,6 +267,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; } @@ -288,6 +291,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.1.4