Merge pull request #7503 from fappels/develop

Dispatch clean code and remove deprecated code
This commit is contained in:
Laurent Destailleur 2017-09-26 20:06:44 +02:00 committed by GitHub
commit 4dd737fe44
2 changed files with 4 additions and 57 deletions

View File

@ -1,50 +0,0 @@
// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// or see http://www.gnu.org/
//
// \file htdocs/core/js/lib_batch.js
// \brief File that include javascript functions used when dispatching batch-enabled product
//
/**
* addLineBatch
* @deprecated replaced by addDispatchLine and moved to module folder and file fourn/js/lib_dispatch.js
*
* @param index int number of produt. 0 = first product line
*/
function addLineBatch(index)
{
var nme = 'dluo_0_'+index;
$row=$("tr[name='"+nme+"']").clone(true);
$row.find("input[name^='qty']").val('');
var trs = $("tr[name^='dluo_'][name$='_"+index+"']"); /* trs.length = position of line for batch */
var newrow=$row.html().replace(/_0_/g,"_"+(trs.length)+"_");
$row.html(newrow);
//clear value
$row.find("input[name^='qty']").val('');
//change name of row
$row.attr('name','dluo_'+trs.length+'_'+index);
$("tr[name^='dluo_'][name$='_"+index+"']:last").after($row);
/* Suffix of lines are: _ trs.length _ index */
jQuery("#lot_number_"+trs.length+"_"+index).focus();
nb = jQuery("#qty_"+(trs.length - 1)+"_"+index).val();
if (nb > 0)
{
jQuery("#qty_"+(trs.length - 1)+"_"+index).val(1);
jQuery("#qty_"+trs.length+"_"+index).val(nb - 1);
}
}

View File

@ -547,6 +547,9 @@ if ($id > 0 || ! empty($ref)) {
print "\n";
print '<!-- Line to dispatch ' . $suffix . ' -->' . "\n";
// hidden fields for js function
print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . ( float ) $products_dispatched[$objp->rowid] . '">';
print '<tr class="oddeven">';
$linktoprod = '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>';
@ -607,9 +610,6 @@ if ($id > 0 || ! empty($ref)) {
print '<input class="maxwidth75" name="pu' . $suffix . '" type="hidden" value="' . price2num($up_ht_disc, 'MU') . '">';
}
// hidden fields for js function
print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . ( float ) $products_dispatched[$objp->rowid] . '">';
print '</td>';
print '<td>';
@ -649,16 +649,13 @@ if ($id > 0 || ! empty($ref)) {
print '<input class="maxwidth75" name="pu' . $suffix . '" type="hidden" value="' . price2num($up_ht_disc, 'MU') . '">';
}
// hidden fields for js function
print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . ( float ) $products_dispatched[$objp->rowid] . '">';
print '</td>';
}
// Qty to dispatch
print '<td align="right">';
print '<input id="qty' . $suffix . '" name="qty' . $suffix . '" type="text" size="8" value="' . (GETPOST('qty' . $suffix) != '' ? GETPOST('qty' . $suffix) : $remaintodispatch) . '">';
print '</td>';
print '</td>';
print '<td>';
if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) {