From e0b8256d6f5b39f748b043b536d565406df7385e Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 23 Aug 2016 18:15:41 +0100
Subject: [PATCH] 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
---
 koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
index c23637f..46e5693 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
@@ -268,6 +268,7 @@ 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);
+        inputs[i].value = "";
         linkid = id_input;
     }
     // Plugin input
-- 
2.8.1