fix travcis

This commit is contained in:
florian HENRY 2019-02-13 10:28:08 +01:00
parent e2d13c0e1f
commit de87321c15
5 changed files with 86 additions and 62 deletions

View File

@ -81,7 +81,7 @@ if ($user->societe_id > 0)
* Actions * Actions
*/ */
$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; $entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity;
//$parameters = array('socid' => $id); //$parameters = array('socid' => $id);
//$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks

View File

@ -166,11 +166,10 @@ class CMeasuringUnits // extends CommonObject
* @param int $id Id object * @param int $id Id object
* @param string $unit_type unit type * @param string $unit_type unit type
* @param string $code Code * @param string $code Code
* @param string $label Label
* @param string $short_label Short Label * @param string $short_label Short Label
* @return int <0 if KO, >0 if OK * @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; global $langs;

View File

@ -474,7 +474,11 @@ function measuring_units_string($unit, $measuring_style = '')
global $langs, $db; global $langs, $db;
require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php';
$measuringUnits= new CMeasuringUnits($db); $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) { if ($result<0) {
return -1; return -1;

View File

@ -311,34 +311,36 @@ class FormProduct
function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0) function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
{ {
//phpcs:enable //phpcs:enable
global $langs,$conf,$mysoc, $db; global $langs, $conf, $mysoc, $db;
$langs->load("other"); $langs->load("other");
$return=''; $return = '';
$measuring_units=array(); $measuring_units = array();
require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/cmeasuringunits.class.php';
$measuringUnits= new CMeasuringUnits($db); $measuringUnits = new CMeasuringUnits($db);
$result=$measuringUnits->fetchAll('','', 0, 0, array('t.unit_type'=>$measuring_style,'t.active'=>1)); $result = $measuringUnits->fetchAll('', '', 0, 0, array(
if ($result<0) { 't.unit_type' => $measuring_style,
't.active' => 1
));
if ($result < 0) {
dol_print_error($db); dol_print_error($db);
return -1; return - 1;
} else { } else {
$return.= '<select class="flat" name="'.$name.'">'; $return .= '<select class="flat" name="' . $name . '">';
if ($adddefault) $return.= '<option value="0">'.$langs->trans("Default").'</option>'; if ($adddefault)
$return .= '<option value="0">' . $langs->trans("Default") . '</option>';
foreach ($measuringUnits->records as $lines) foreach ( $measuringUnits->records as $lines ) {
{ $return .= '<option value="' . $lines->code . '"';
$return.= '<option value="'.$lines->code.'"'; if ($key == $default) {
if ($key == $default) $return .= ' selected';
{ }
$return.= ' selected'; // $return.= '>'.$value.'</option>';
$return .= '>' . $langs->transnoentitiesnoconv($lines->label) . '</option>';
} }
//$return.= '>'.$value.'</option>'; $return .= '</select>';
$return.= '>'.$langs->transnoentitiesnoconv($lines->label).'</option>';
}
$return.= '</select>';
} }
return $return; return $return;

View File

@ -84,7 +84,7 @@ if (! $sortfield)
if (! $sortorder) if (! $sortorder)
$sortorder = "DESC"; $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 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new MouvementStock($db); $object = new MouvementStock($db);
@ -94,7 +94,7 @@ $formfile = new FormFile($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('movement'); $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( $arrayfields=array(
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), '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('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array(); $parameters = array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $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'); if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Do we click on purge search criteria ? // 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=''; $year='';
$month=''; $month='';
@ -203,7 +204,9 @@ if ($action == "correct_stock")
GETPOST("mouvement"), GETPOST("mouvement"),
GETPOST("label", 'san_alpha'), GETPOST("label", 'san_alpha'),
GETPOST('unitprice'), GETPOST('unitprice'),
$eatby,$sellby,$batch, $eatby,
$sellby,
$batch,
GETPOST('inventorycode'), GETPOST('inventorycode'),
$origin_element, $origin_element,
$origin_id $origin_id
@ -258,7 +261,7 @@ if ($action == "transfert_stock" && ! $cancel)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
$action='transfert'; $action='transfert';
} }
if (! GETPOST("nbpiece",'int')) if (! GETPOST("nbpiece", 'int'))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$error++; $error++;
@ -909,21 +912,36 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
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.rowid']['checked']))
if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $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['m.datem']['checked']))
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $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['p.ref']['checked']))
if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $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['p.label']['checked']))
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 print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
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.batch']['checked']))
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $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['pl.eatby']['checked']))
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); print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $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['pl.sellby']['checked']))
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $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['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 // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -942,7 +960,7 @@ if ($resql)
$arrayofuniqueproduct=array(); $arrayofuniqueproduct=array();
while ($i < min($num,$limit)) while ($i < min($num, $limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -1054,20 +1072,21 @@ if ($resql)
if (! empty($arrayfields['m.type_mouvement']['checked'])) if (! empty($arrayfields['m.type_mouvement']['checked']))
{ {
// Type of movement // Type of movement
switch($objp->type_mouvement){ switch($objp->type_mouvement)
case "0": {
print '<td align="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>'; case "0":
break; print '<td align="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
case "1": break;
print '<td align="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>'; case "1":
break; print '<td align="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>';
case "2": break;
print '<td align="center">'.$langs->trans('StockDecrease').'</td>'; case "2":
break; print '<td align="center">'.$langs->trans('StockDecrease').'</td>';
case "3": break;
print '<td align="center">'.$langs->trans('StockIncrease').'</td>'; case "3":
break; print '<td align="center">'.$langs->trans('StockIncrease').'</td>';
} break;
}
} }
if (! empty($arrayfields['origin']['checked'])) if (! empty($arrayfields['origin']['checked']))
{ {