Skip to content

Commit

Permalink
Show eat by and sell by date on update select batch by warehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
lvessiller-opendsi committed Nov 22, 2024
1 parent fe1ca54 commit 6b353a5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions htdocs/expedition/dispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,16 +1259,24 @@
$out_js_line .= ' jQuery.each(data, function(key, objBatch) {';
$out_js_line .= ' var dataEatByDate = objBatch.eatbydate;';
$out_js_line .= ' var dataSellByDate = objBatch.sellbydate;';
$out_js_line .= ' var optionLabel = key+" (";';
$out_js_line .= ' if (selectwarehouse.val() == -1) {';
$out_js_line .= ' var label = key+" ('.dol_escape_js($langs->trans('StockTotal')).' : "+objBatch.qty+")";';
$out_js_line .= ' optionLabel += "'.dol_escape_js($langs->trans('StockTotal')).': "+objBatch.qty;';
$out_js_line .= ' } else {';
$out_js_line .= ' var label = key+" ('.dol_escape_js($langs->trans('Stock')).' : "+objBatch.qty+")";';
$out_js_line .= ' optionLabel += "'.dol_escape_js($langs->trans('Stock')).': "+objBatch.qty;';
$out_js_line .= ' }';
$out_js_line .= ' if (dataEatByDate != "") {';
$out_js_line .= ' optionLabel += " - '.dol_escape_js($langs->trans('EatByDate')).': "+dataEatByDate;';
$out_js_line .= ' }';
$out_js_line .= ' if (dataSellByDate != "") {';
$out_js_line .= ' optionLabel += " - '.dol_escape_js($langs->trans('SellByDate')).': "+dataSellByDate;';
$out_js_line .= ' }';
$out_js_line .= ' optionLabel += ")";';
$out_js_line .= ' var option = "<option data-eatbydate=\""+dataEatByDate+"\" data-sellbydate=\""+dataSellByDate+"\" value=\""+key+"\"";';
$out_js_line .= ' if (key === selectedbatch) {';
$out_js_line .= ' var option = "<option data-eatbydate=\""+dataEatByDate+"\" data-sellbydate=\""+dataSellByDate+"\" value=\""+key+"\" selected>"+label+"</option>";';
$out_js_line .= ' } else {';
$out_js_line .= ' var option = "<option data-eatbydate=\""+dataEatByDate+"\" data-sellbydate=\""+dataSellByDate+"\" value=\""+key+"\">"+label+"</option>";';
$out_js_line .= ' option += " selected";';
$out_js_line .= ' }';
$out_js_line .= ' option += ">"+optionLabel+"</option>";';
$out_js_line .= ' selectbatch.append(option);';
$out_js_line .= ' });';
$out_js_line .= ' });';
Expand Down

0 comments on commit 6b353a5

Please sign in to comment.