From de87321c15ebc3771abfe214946d54a71ec44757 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 13 Feb 2019 10:28:08 +0100 Subject: [PATCH] fix travcis --- htdocs/compta/compta-files.php | 2 +- htdocs/core/class/cmeasuringunits.class.php | 3 +- htdocs/core/lib/product.lib.php | 6 +- .../product/class/html.formproduct.class.php | 42 ++++---- htdocs/product/stock/movement_card.php | 95 +++++++++++-------- 5 files changed, 86 insertions(+), 62 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index f67160c698e..7a18c642741 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -81,7 +81,7 @@ if ($user->societe_id > 0) * Actions */ -$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; +$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks diff --git a/htdocs/core/class/cmeasuringunits.class.php b/htdocs/core/class/cmeasuringunits.class.php index 718db8dab11..03923733178 100644 --- a/htdocs/core/class/cmeasuringunits.class.php +++ b/htdocs/core/class/cmeasuringunits.class.php @@ -166,11 +166,10 @@ class CMeasuringUnits // extends CommonObject * @param int $id Id object * @param string $unit_type unit type * @param string $code Code - * @param string $label Label * @param string $short_label Short Label * @return int <0 if KO, >0 if OK */ - function fetch($id, $unit_type='', $code = '', $short_label = '') + function fetch($id, $unit_type = '', $code = '', $short_label = '') { global $langs; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 1d4ca11c4d3..478c69d4fe5 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -474,7 +474,11 @@ function measuring_units_string($unit, $measuring_style = '') global $langs, $db; require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php'; $measuringUnits= new CMeasuringUnits($db); - $result=$measuringUnits->fetchAll('','', 0, 0, array('t.code'=> $unit,'t.unit_type'=>$measuring_style,'t.active'=>1)); + $result = $measuringUnits->fetchAll('', '', 0, 0, array( + 't.code' => $unit, + 't.unit_type' => $measuring_style, + 't.active' => 1 + )); if ($result<0) { return -1; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 67a2431dea1..03c3ac47179 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -311,34 +311,36 @@ class FormProduct function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0) { //phpcs:enable - global $langs,$conf,$mysoc, $db; + global $langs, $conf, $mysoc, $db; $langs->load("other"); - $return=''; + $return = ''; - $measuring_units=array(); + $measuring_units = array(); - require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php'; - $measuringUnits= new CMeasuringUnits($db); - $result=$measuringUnits->fetchAll('','', 0, 0, array('t.unit_type'=>$measuring_style,'t.active'=>1)); - if ($result<0) { + require_once DOL_DOCUMENT_ROOT . '/core/class/cmeasuringunits.class.php'; + $measuringUnits = new CMeasuringUnits($db); + $result = $measuringUnits->fetchAll('', '', 0, 0, array( + 't.unit_type' => $measuring_style, + 't.active' => 1 + )); + if ($result < 0) { dol_print_error($db); - return -1; + return - 1; } else { - $return.= ''; + if ($adddefault) + $return .= ''; - foreach ($measuringUnits->records as $lines) - { - $return.= ''; } - //$return.= '>'.$value.''; - $return.= '>'.$langs->transnoentitiesnoconv($lines->label).''; - } - $return.= ''; + $return .= ''; } return $return; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index c1c8842af08..7989ea9c125 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -84,7 +84,7 @@ if (! $sortfield) if (! $sortorder) $sortorder = "DESC"; -$pdluoid=GETPOST('pdluoid','int'); +$pdluoid=GETPOST('pdluoid', 'int'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new MouvementStock($db); @@ -94,7 +94,7 @@ $formfile = new FormFile($db); // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label('movement'); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $arrayfields=array( 'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), @@ -129,14 +129,15 @@ $usercandelete = $user->rights->stock->mouvement->supprimer; if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { $year=''; $month=''; @@ -203,7 +204,9 @@ if ($action == "correct_stock") GETPOST("mouvement"), GETPOST("label", 'san_alpha'), GETPOST('unitprice'), - $eatby,$sellby,$batch, + $eatby, + $sellby, + $batch, GETPOST('inventorycode'), $origin_element, $origin_id @@ -258,7 +261,7 @@ if ($action == "transfert_stock" && ! $cancel) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); $action='transfert'; } - if (! GETPOST("nbpiece",'int')) + if (! GETPOST("nbpiece", 'int')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $error++; @@ -909,21 +912,36 @@ if ($resql) print "\n"; print ''; - if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'],$_SERVER["PHP_SELF"], "e.ref","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible - if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'],$_SERVER["PHP_SELF"], "m.type_mouvement","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['m.rowid']['checked'])) + print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['m.datem']['checked'])) + print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['p.ref']['checked'])) + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['p.label']['checked'])) + print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['m.batch']['checked'])) + print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['pl.eatby']['checked'])) + print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['pl.sellby']['checked'])) + print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['e.ref']['checked'])) + print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['m.fk_user_author']['checked'])) + print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.inventorycode']['checked'])) + print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.label']['checked'])) + print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.type_mouvement']['checked'])) + print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['origin']['checked'])) + print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['m.value']['checked'])) + print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['m.price']['checked'])) + print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -942,7 +960,7 @@ if ($resql) $arrayofuniqueproduct=array(); - while ($i < min($num,$limit)) + while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -1054,20 +1072,21 @@ if ($resql) if (! empty($arrayfields['m.type_mouvement']['checked'])) { // Type of movement - switch($objp->type_mouvement){ - case "0": - print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').''; - break; - case "1": - print ''.$langs->trans('StockDecreaseAfterCorrectTransfer').''; - break; - case "2": - print ''.$langs->trans('StockDecrease').''; - break; - case "3": - print ''.$langs->trans('StockIncrease').''; - break; - } + switch($objp->type_mouvement) + { + case "0": + print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').''; + break; + case "1": + print ''.$langs->trans('StockDecreaseAfterCorrectTransfer').''; + break; + case "2": + print ''.$langs->trans('StockDecrease').''; + break; + case "3": + print ''.$langs->trans('StockIncrease').''; + break; + } } if (! empty($arrayfields['origin']['checked'])) {