diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a7f395116b0..630e9fab8d7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -336,7 +336,7 @@ class Commande extends CommonOrder 'fk_mode_reglement' => array('type' => 'integer', 'label' => 'PaymentMode', 'enabled' => 1, 'visible' => -1, 'position' => 185), 'date_livraison' => array('type' => 'date', 'label' => 'DateDeliveryPlanned', 'enabled' => 1, 'visible' => -1, 'position' => 190, 'csslist' => 'nowraponall'), 'fk_shipping_method' => array('type' => 'integer', 'label' => 'ShippingMethod', 'enabled' => 1, 'visible' => -1, 'position' => 195), - 'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php', 'label' => 'Fk warehouse', 'enabled' => 'isModEnabled("stock")', 'visible' => -1, 'position' => 200), + 'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php', 'label' => 'DefaultWarehouse', 'enabled' => 'isModEnabled("stock")', 'visible' => -1, 'position' => 200, 'nodepth' => 1), 'fk_availability' => array('type' => 'integer', 'label' => 'Availability', 'enabled' => 1, 'visible' => -1, 'position' => 205), 'fk_input_reason' => array('type' => 'integer', 'label' => 'InputReason', 'enabled' => 1, 'visible' => -1, 'position' => 210), //'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215), @@ -856,7 +856,7 @@ class Commande extends CommonOrder */ public function cancel($idwarehouse = -1) { - global $conf, $user, $langs; + global $user, $langs; $error = 0; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 59a9f25598c..f0f1cd22712 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -32,7 +32,7 @@ * include DOL_DOCUMENT_ROOT.'/core/customreports.php'; */ - /** +/** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager @@ -322,6 +322,7 @@ $HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1); $MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1); $SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1); +$arrayoffilterfields = array(); $arrayofmesures = array(); $arrayofxaxis = array(); $arrayofgroupby = array(); @@ -375,6 +376,10 @@ foreach ($arrayoftype as $key => $val) { } } +$count = 0; +$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count); +$arrayoffilterfields = dol_sort_array($arrayoffilterfields, 'position', 'asc', 0, 0, 1); + $count = 0; $arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count); $arrayofmesures = dol_sort_array($arrayofmesures, 'position', 'asc', 0, 0, 1); @@ -387,10 +392,6 @@ $count = 0; $arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count); $arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1); -$count = 0; -$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count); -$arrayoffilterfields = dol_sort_array($arrayoffilterfields, 'position', 'asc', 0, 0, 1); - // Check parameters if ($action == 'viewgraph') { diff --git a/htdocs/core/lib/customreports.lib.php b/htdocs/core/lib/customreports.lib.php index 553e3f3681b..574faafeabb 100644 --- a/htdocs/core/lib/customreports.lib.php +++ b/htdocs/core/lib/customreports.lib.php @@ -523,10 +523,12 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof { global $langs, $extrafields, $db; + $MAXLEVEL = 2; + if (empty($object)) { // Protection against bad use of method return array(); } - if ($level >= 3) { // Limit scan on 2 levels max + if ($level > $MAXLEVEL) { // Limit scan on 2 levels max return $arrayoffields; } @@ -612,7 +614,11 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof if (class_exists($newobject)) { $tmpobject = new $newobject($db); $count++; - $arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $level + 1, $count, $tablepath); + if (!empty($val['nodepth'])) { + $arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $MAXLEVEL, $count, $tablepath); + } else { + $arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $level + 1, $count, $tablepath); + } } else { print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."
\n"; }