View | Details | Raw Unified | Return to bug 7350
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js (-2 / +14 lines)
Lines 6-12 function deleteItemBlock(index) { Link Here
6
}
6
}
7
function cloneItemBlock(index) {    
7
function cloneItemBlock(index) {    
8
    var original = document.getElementById(index); //original <div>
8
    var original = document.getElementById(index); //original <div>
9
    var clone = original.cloneNode(true);
9
    var clone = clone_with_selected(original)
10
    var random = Math.floor(Math.random()*100000); // get a random itemid.
10
    var random = Math.floor(Math.random()*100000); // get a random itemid.
11
    // set the attribute for the new 'div' subfields
11
    // set the attribute for the new 'div' subfields
12
    clone.setAttribute('id',index + random);//set another id.
12
    clone.setAttribute('id',index + random);//set another id.
Lines 55-60 function check_additem() { Link Here
55
	// duplicates within the form.  
55
	// duplicates within the form.  
56
	return success;
56
	return success;
57
}
57
}
58
59
function clone_with_selected (node) {
60
	   var origin = node.getElementsByTagName("select");
61
	   var tmp = node.cloneNode(true)
62
	   var selectelem = tmp.getElementsByTagName("select");
63
	   for (var i=0; i<origin.length; i++) {
64
	       selectelem[i].selectedIndex = origin[i].selectedIndex;
65
	   }
66
	   origin = null;
67
	   selectelem = null;
68
	   return tmp;
69
	}
70
58
$(document).ready(function(){
71
$(document).ready(function(){
59
	$(".cloneItemBlock").click(function(){
72
	$(".cloneItemBlock").click(function(){
60
		var clonedRow = $(this).parent().parent().clone(true);
73
		var clonedRow = $(this).parent().parent().clone(true);
61
- 

Return to bug 7350