Bug 17152: Do not copy value when duplicating a subfield

When cataloguing, if you want to duplicate a subfield that is not
empty, the new subfield is created with a copy of data in it.
This is not the case when you duplicate an whole field. The new one is
created with subfields but without data in it.

Test plan:
Add or edit a bibliographic record
Fill a subfield
Duplicate the subfield
=> Without this patch the value of the input will be copied
=> With this patch the new input will be emptied

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 451fd67dd1)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
(cherry picked from commit 71b81ae6d6)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Hector Castro 2016-08-31 13:33:53 -06:00 committed by Julian Maurice
parent 2a4dfb1ed7
commit ffe7aeaeda
1 changed files with 3 additions and 1 deletions

View File

@ -255,7 +255,6 @@ function CloneSubfield(index, advancedMARCEditor){
var original = document.getElementById(index); //original <div>
var clone = original.cloneNode(true);
var new_key = CreateKey();
// set the attribute for the new 'div' subfields
var inputs = clone.getElementsByTagName('input');
var selects = clone.getElementsByTagName('select');
@ -270,6 +269,7 @@ function CloneSubfield(index, advancedMARCEditor){
inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
linkid = id_input;
}
// Plugin input
if( $(inputs[1]).hasClass('framework_plugin') ) {
var oldcontrol= original.getElementsByTagName('input')[1];
@ -326,6 +326,8 @@ function CloneSubfield(index, advancedMARCEditor){
}
// insert this line on the page
original.parentNode.insertBefore(clone,original.nextSibling);
// delete data of cloned subfield
document.getElementById(linkid).value = "";
}
function AddEventHandlers (oldcontrol, newcontrol, newinputid ) {