Fix phpcs

This commit is contained in:
Laurent Destailleur 2020-08-06 02:18:34 +02:00
parent 4785e84c43
commit 12b9a73ca5
3 changed files with 131 additions and 137 deletions

View File

@ -56,7 +56,6 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
$concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords;
} else {
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();

View File

@ -29,16 +29,15 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
$langs->load("productbatch");
if (empty($id)) $id = $object->id;
if (empty($id)) $id = $object->id;
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_price()
{
@ -53,101 +52,99 @@ if (empty($conf) || !is_object($conf)) {
</script>';
print load_fiche_titre($langs->trans("StockCorrection"), '', 'generic');
print load_fiche_titre($langs->trans("StockCorrection"), '', 'generic');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
dol_fiche_head();
dol_fiche_head();
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border centpercent">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border centpercent">';
// Warehouse or product
print '<tr>';
if ($object->element == 'product')
{
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
if ($object->element == 'stock')
{
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
$form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" class="maxwidth75" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';
// Warehouse or product
print '<tr>';
if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
if ($object->element == 'stock') {
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
$form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print ' &nbsp; <select class="button buttongen" name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" class="maxwidth75" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("EatByDate").'</td><td>';
$eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
print $form->selectDate($eatbyselected, 'eatby', '', '', 1, "");
print '</td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
$sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
print '</td>';
print '</tr>';
}
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("EatByDate").'</td><td>';
$eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
print $form->selectDate($eatbyselected, 'eatby', '', '', 1, "");
print '</td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
$sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
print '</td>';
print '</tr>';
}
// Purchase price and project
print '<tr>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (!empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
print '<td>';
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
print '</tr>';
// Purchase price and project
print '<tr>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (!empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
print '<td>';
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
print '</tr>';
// Label of mouvement of id of inventory
$valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
// Label of mouvement of id of inventory
$valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
print '</table>';
print '</table>';
dol_fiche_end();
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '</form>';
print '</form>';
?>
<!-- END PHP STOCKCORRECTION.TPL.PHP -->

View File

@ -29,16 +29,16 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
$langs->load("productbatch");
if (empty($id)) $id = $object->id;
if (empty($id)) $id = $object->id;
$pdluoid = GETPOST('pdluoid', 'int');
$pdluoid = GETPOST('pdluoid', 'int');
$pdluo = new Productbatch($db);
$pdluo = new Productbatch($db);
if ($pdluoid > 0)
{
@ -53,49 +53,47 @@ if ($pdluoid > 0)
}
}
print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
dol_fiche_head();
dol_fiche_head();
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($pdluoid)
{
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
}
print '<table class="border centpercent">';
print '<table class="border centpercent">';
// Source warehouse or product
print '<tr>';
if ($object->element == 'product')
{
// Source warehouse or product
print '<tr>';
if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
print '</td>';
}
if ($object->element == 'stock')
{
if ($object->element == 'stock') {
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
$form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print '</td>';
}
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';
// Serial / Eat-by date
// Serial / Eat-by date
if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
@ -122,26 +120,26 @@ if (!empty($conf->productbatch->enabled) &&
print '</tr>';
}
// Label
$valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
// Label
$valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"]) ?GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
print '</tr>';
print '</table>';
print '</table>';
dol_fiche_end();
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>';
print '</form>';
print '</form>';
?>
<!-- END PHP STOCKCORRECTION.TPL.PHP -->