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); $concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords; return $concatWords;
} else { } else {
$TNum = explode('.', $num); $TNum = explode('.', $num);
$num = (int) $TNum[0]; $num = (int) $TNum[0];
$words = array(); $words = array();

View File

@ -29,16 +29,15 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php <?php
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$productref = ''; $langs->load("productbatch");
if ($object->element == 'product') $productref = $object->ref;
$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() { jQuery(document).ready(function() {
function init_price() function init_price()
{ {
@ -53,21 +52,20 @@ if (empty($conf) || !is_object($conf)) {
</script>'; </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="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="correct_stock">'; print '<input type="hidden" name="action" value="correct_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Warehouse or product // Warehouse or product
print '<tr>'; print '<tr>';
if ($object->element == 'product') if ($object->element == 'product') {
{
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>'; print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<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 $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');
@ -76,9 +74,8 @@ if (empty($conf) || !is_object($conf)) {
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>'; print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>'; print '</select>';
print '</td>'; print '</td>';
} }
if ($object->element == 'stock') if ($object->element == 'stock') {
{
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>'; print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<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'); $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');
@ -87,17 +84,17 @@ if (empty($conf) || !is_object($conf)) {
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>'; print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
print '</select>'; print '</select>';
print '</td>'; print '</td>';
} }
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>'; print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" class="maxwidth75" value="'.GETPOST("nbpiece").'"></td>'; print '<td><input name="nbpiece" id="nbpiece" class="maxwidth75" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>'; print '</tr>';
// Serial / Eat-by date // Serial / Eat-by date
if (!empty($conf->productbatch->enabled) && if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch()) (($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock')) || ($object->element == 'stock'))
) )
{ {
print '<tr>'; print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">'; 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 '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
@ -113,41 +110,41 @@ if (empty($conf) || !is_object($conf)) {
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Purchase price and project // Purchase price and project
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>'; 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>'; 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)) if (!empty($conf->projet->enabled))
{ {
print '<td>'.$langs->trans('Project').'</td>'; print '<td>'.$langs->trans('Project').'</td>';
print '<td>'; print '<td>';
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>'; print '</td>';
} }
print '</tr>'; print '</tr>';
// Label of mouvement of id of inventory // Label of mouvement of id of inventory
$valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); $valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>'; print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">'; print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>'; 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 '<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 '</tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">'; print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
?> ?>
<!-- END PHP STOCKCORRECTION.TPL.PHP --> <!-- END PHP STOCKCORRECTION.TPL.PHP -->

View File

@ -29,16 +29,16 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php <?php
$productref = ''; $productref = '';
if ($object->element == 'product') $productref = $object->ref; 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) 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="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="transfert_stock">'; print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($pdluoid) if ($pdluoid)
{ {
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">'; print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
} }
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Source warehouse or product // Source warehouse or product
print '<tr>'; print '<tr>';
if ($object->element == 'product') if ($object->element == 'product') {
{
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>'; print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<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 $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>'; print '</td>';
} }
if ($object->element == 'stock') if ($object->element == 'stock') {
{
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>'; print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<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'); $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>';
} }
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>'; 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><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 '</tr>';
// Serial / Eat-by date // Serial / Eat-by date
if (!empty($conf->productbatch->enabled) && if (!empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch()) (($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock')) || ($object->element == 'stock'))
) )
{ {
print '<tr>'; print '<tr>';
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">'; 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>'; print '</tr>';
} }
// Label // Label
$valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref)); $valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>'; print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">'; print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>'; 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 '<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 '</tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">'; print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
?> ?>
<!-- END PHP STOCKCORRECTION.TPL.PHP --> <!-- END PHP STOCKCORRECTION.TPL.PHP -->