浏览代码

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

Laurent Destailleur 1 年之前
父节点
当前提交
ed81003169
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      htdocs/fourn/js/lib_dispatch.js.php

+ 4 - 1
htdocs/fourn/js/lib_dispatch.js.php

@@ -125,7 +125,10 @@ function addDispatchLine(index, type, mode) {
 
 		//create new select2 to avoid duplicate id of cloned one
 		$row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").select2();
-		// TODO find solution to copy selected option to new select
+		// Copy selected option to new select
+		let $prevRow = $("tr[name^='" + type + "_'][name$='_" + index + "']:last")
+		let $prevEntr = Number($prevRow.find("select[name='" + 'entrepot_' + (nbrTrs-1) + '_' + index + "']").val())
+		$row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").val($prevEntr)
 		// TODO find solution to keep new tr's after page refresh
 		//clear value
 		$row.find("input[name^='qty']").val('');