From 6e0832fb3893aa5874951ea744dcc4f9f2d62f9e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 15:59:39 +0100 Subject: [PATCH 01/12] FIX WIP avoid warning with php 8.0 --- htdocs/core/boxes/box_commandes.php | 4 ++-- htdocs/core/boxes/box_contracts.php | 2 +- htdocs/core/boxes/box_factures.php | 4 ++-- htdocs/core/boxes/box_factures_fourn.php | 4 ++-- htdocs/core/boxes/box_graph_invoices_permonth.php | 8 ++++---- .../boxes/box_graph_invoices_supplier_permonth.php | 9 +++++---- htdocs/core/boxes/box_graph_orders_permonth.php | 8 ++++---- .../boxes/box_graph_orders_supplier_permonth.php | 8 ++++---- .../core/boxes/box_graph_product_distribution.php | 10 +++++----- htdocs/core/boxes/box_graph_propales_permonth.php | 14 ++++++++------ htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_propales.php | 4 ++-- htdocs/core/boxes/box_supplier_orders.php | 4 ++-- htdocs/core/class/dolgraph.class.php | 8 ++++---- htdocs/core/menus/standard/eldy.lib.php | 8 +++----- htdocs/index.php | 10 +++++----- 16 files changed, 54 insertions(+), 53 deletions(-) diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 3f7875ce7d4..9b020a05711 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -83,7 +83,7 @@ class box_commandes extends ModeleBoxes $societestatic = new Societe($this->db); $userstatic = new User($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerOrders", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max)); if ($user->rights->commande->lire) { @@ -108,7 +108,7 @@ class box_commandes extends ModeleBoxes if (!empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql .= " AND c.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 9350bae2da9..0fa10b43fd8 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -92,7 +92,7 @@ class box_contracts extends ModeleBoxes $sql .= " AND c.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC "; + if (! empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 011342d8a30..20e83fb442c 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -81,7 +81,7 @@ class box_factures extends ModeleBoxes $langs->load("bills"); - $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerBills", $max); + $text = $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerBills", $max); $this->info_box_head = array( 'text' => $text, 'limit'=> dol_strlen($text) @@ -106,7 +106,7 @@ class box_factures extends ModeleBoxes $sql .= " AND f.entity IN (".getEntity('invoice').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; else $sql .= " ORDER BY f.tms DESC, f.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index d3c1ccd9017..0be9d7bbd6f 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -81,7 +81,7 @@ class box_factures_fourn extends ModeleBoxes $thirdpartystatic = new Fournisseur($this->db); $this->info_box_head = array( - 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierBills", $max) + 'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max) ); if ($user->rights->fournisseur->facture->lire) @@ -104,7 +104,7 @@ class box_factures_fourn extends ModeleBoxes $sql .= " AND f.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; else $sql .= " ORDER BY f.tms DESC, f.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 983bb75cbc3..4ef11019cd3 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -112,10 +112,10 @@ class box_graph_invoices_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 1490f5ea6e9..d346bae36d9 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -109,13 +109,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); + if (empty($year)) $year = $nowarray['year']; if (empty($endyear)) $endyear = $nowarray['year']; $startyear = $endyear - 1; $mode = 'supplier'; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index d9c26620553..b1059dc02ff 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -112,10 +112,10 @@ class box_graph_orders_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 765c6324516..354aa071946 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -111,10 +111,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 407c66177b5..8c6049c720b 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -95,11 +95,11 @@ class box_graph_product_distribution extends ModeleBoxes $showpropalnb = GETPOST($param_showpropalnb, 'alpha'); $showordernb = GETPOST($param_showordernb, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $year = $tmparray['year']; - $showinvoicenb = $tmparray['showinvoicenb']; - $showpropalnb = $tmparray['showpropalnb']; - $showordernb = $tmparray['showordernb']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $year = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $showinvoicenb = (!empty($tmparray['showinvoicenb']) ? $tmparray['showinvoicenb'] : ''); + $showpropalnb = (!empty($tmparray['showpropalnb']) ? $tmparray['showpropalnb'] : ''); + $showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : ''); } if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; } if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index de1a1f8de83..5014c4b3817 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -112,10 +112,10 @@ class box_graph_propales_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); @@ -176,8 +176,10 @@ class box_graph_propales_permonth extends ModeleBoxes //$datatype2 = array('lines','bars'); $filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png'; + if (!empty($mode)) { + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png'; + } $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 893bb2273ab..5d1e944d805 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->db = $db; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - $tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock'); + $tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f98e0f1e347..6efd56c01db 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -81,7 +81,7 @@ class box_propales extends ModeleBoxes $propalstatic = new Propal($this->db); $societestatic = new Societe($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max)); if ($user->rights->propale->lire) { @@ -96,7 +96,7 @@ class box_propales extends ModeleBoxes $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY p.datep DESC, p.ref DESC "; else $sql .= " ORDER BY p.tms DESC, p.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 151c1df6bcb..5074d403231 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -79,7 +79,7 @@ class box_supplier_orders extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; $thirdpartystatic = new Fournisseur($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierOrders", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierOrders", $max)); if ($user->rights->fournisseur->commande->lire) { @@ -98,7 +98,7 @@ class box_supplier_orders extends ModeleBoxes $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 5fcc7b00c91..e880e186e5b 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -964,7 +964,7 @@ class DolGraph $array_of_ykeys = array_keys($valarray); $alabelexists = 1; $tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3); - if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array + if (isset($tmpykey[2]) && (!empty($tmpykey[2]) || $tmpykey[2] == '0')) { // This is a 'Group by' array $tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]); $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null); $arrayofgroupslegend[$i] = array( @@ -1203,7 +1203,7 @@ class DolGraph $foundnegativecolor = 0; $usecolorvariantforgroupby = 0; // We used a 'group by' and we have too many colors so we generated color variants per - if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by. + if (!empty($arrayofgroupslegend) && is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by. $nbofcolorneeds = count($arrayofgroupslegend); $nbofcolorsavailable = count($theme_datacolor); if ($nbofcolorneeds > $nbofcolorsavailable) { @@ -1278,7 +1278,7 @@ class DolGraph $this->stringtoshow .= '{'; $this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', '; $this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', '; - $this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', '; + $this->stringtoshow .= 'pointStyle: \'' . ((!empty($this->type[$i]) && $this->type[$i] == 'linesnopoint') ? 'line' : 'circle') . '\', '; $this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', '; if ($isfunnel) { $this->stringtoshow .= 'borderWidth: \'2\', '; @@ -1287,7 +1287,7 @@ class DolGraph } $this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', '; $this->stringtoshow .= 'backgroundColor: \'' . $color . '\', '; - if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', '; + if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', '; $this->stringtoshow .='data: ['; if ($isfunnel) { $this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']'; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 85b63a6f4e3..810f2087430 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -206,9 +206,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu_arr[] = array( 'name' => 'Projet', 'link' => '/projet/index.php?mainmenu=project&leftmenu=', - 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2) - ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2) ? "Leads" : "Projects") - : "Projects", + 'title' => (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ? "Leads" : "Projects"), 'level' => 0, 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, @@ -743,11 +741,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); $warnpicto = ''; - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningPHPMailD")); } - if (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); } diff --git a/htdocs/index.php b/htdocs/index.php index a4060278c50..399c9cfa035 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -312,7 +312,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $boxstatItem .= ''; $boxstatItem .= '
'; $boxstatItem .= ''.$text.'
'; - $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; + $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.(!empty($board->nb[$val]) ? $board->nb[$val] : 0).''; $boxstatItem .= '
'; $boxstatItem .= '
'; @@ -675,7 +675,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { // get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links $keyIndex = array_search($globalStatsKey, $keys); - $classe = $classes[$keyIndex]; + $classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : ''); if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) { $groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0; @@ -762,7 +762,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } if ($showweather && !empty($isIntopOpenedDashBoard)) { - $appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : ''; + $appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : ''); $weather = getWeatherStatus($totallate); $text = ''; @@ -889,7 +889,7 @@ print '
'; * Show widgets (boxes) */ -$boxlist .= '
'; +$boxlist = '
'; $boxlist .= '
'; if (!empty($nbworkboardcount)) @@ -914,7 +914,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) } if (!empty($boxstatFromHook) || !empty($boxstatItems)) { - $boxstat .= ''."\n"; + $boxstat = ''."\n"; $boxstat .= '
'; $boxstat .= ''; $boxstat .= ''; From 20cd9cbbc7ca4dcd52dc5f001a0409a6bb650b0b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 16:25:29 +0100 Subject: [PATCH 02/12] FIX avoid warning php 8.0 --- htdocs/admin/company.php | 26 +++++++++++------------ htdocs/core/class/translate.class.php | 2 +- htdocs/core/modules/modStock.class.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 8 +++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index b82f0fcd765..cac436955f5 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -393,18 +393,18 @@ print ''."\n"; +print 'global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'>'."\n"; // Address print ''."\n"; +print ''."\n"; // Zip print ''."\n"; +print ''."\n"; print ''."\n"; +print ''."\n"; // Country print ''."\n"; // Phone print ''; +print ''; print ''."\n"; // Fax print ''; +print ''; print ''."\n"; // Email print ''; +print ''; print ''."\n"; // Web print ''; +print ''; print ''."\n"; // Barcode @@ -457,7 +457,7 @@ if (!empty($conf->barcode->enabled)) { print ''; + print ''; print ''; } @@ -534,7 +534,7 @@ print ''; // Note print ''; +print ''; print ''; print '
'.$langs->trans( // Name print '
'; -print 'global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'>
'; -print '
'; -print '
'; -print '
'; @@ -431,25 +431,25 @@ print '
'; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print '
'; print ''; print ''; - print '
'; -print '
'; @@ -549,17 +549,17 @@ $langs->load("companies"); // Managing Director(s) print ''; -print ''; +print ''; // GDPR contact print ''; print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print ''; -print ''; +print ''; // Capital print ''; -print ''; +print ''; // Juridical Status print ''; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 11e67104f9a..ac9285363d7 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -731,7 +731,7 @@ class Translate */ public function transcountry($str, $countrycode) { - if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode"); + if (!empty($this->tab_translate["$str$countrycode"])) return $this->trans("$str$countrycode"); else return $this->trans($str); } diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c15f041d21d..1e36bcb66ff 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -254,7 +254,7 @@ class modStock extends DolibarrModules $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; // Export stock including batch number - if ($conf->productbatch->enabled) + if (!empty($conf->productbatch->enabled)) { $langs->load("productbatch"); diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 937ee63a68c..44d3c0199ac 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -81,9 +81,9 @@ $(document).ready(function () { @@ -113,7 +113,7 @@ if ($disablenofollow) echo '';
- + From 325c2b03f839044b27fd185193e481b9ce5b0329 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 16:43:41 +0100 Subject: [PATCH 03/12] FIX step by step --- htdocs/admin/accountant.php | 24 ++++++++--------- htdocs/admin/company_socialnetworks.php | 6 ++--- htdocs/admin/modules.php | 26 ++++++++++++++----- htdocs/admin/openinghours.php | 14 +++++----- htdocs/core/modules/DolibarrModules.class.php | 1 + htdocs/core/modules/modStock.class.php | 2 +- htdocs/includes/parsedown/Parsedown.php | 2 +- 7 files changed, 45 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 7a1d5b66ece..c8fccb6073d 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -114,57 +114,57 @@ print ''.$langs->trans( // Name print ''; -print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Address print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; // Country print ''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); -print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); +print $form->select_country((!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : GETPOST('country_id', 'int')), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''."\n"; print ''; -$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); +$formcompany->select_departement((!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : GETPOST('state_id', 'alpha')), (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : GETPOST('country_id', 'int')), 'state_id'); print ''."\n"; print ''; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Web print ''; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Code print ''; -print ''."\n"; +print ''."\n"; // Note print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php index 5cbdb948b4a..93c6739d37d 100644 --- a/htdocs/admin/company_socialnetworks.php +++ b/htdocs/admin/company_socialnetworks.php @@ -117,11 +117,11 @@ foreach ($listofnetworks as $key => $value) { $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL'; $networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).''; + print ''.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).''; print ''."\n"; } } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e9984316394..4fc07fa1172 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -497,13 +497,19 @@ if ($mode == 'common' || $mode == 'commonkanban') { dol_set_focus('#search_keyword'); print '
'; - if ($optioncss != '') { + print ''; + if (isset($optioncss) && $optioncss != '') { print ''; } - print ''; - print ''; - print ''; - print ''; + if (isset($sortfield) && $sortfield != '') { + print ''; + } + if (isset($sortorder) && $sortorder != '') { + print ''; + } + if (isset($page) && $page != '') { + print ''; + } print ''; print dol_get_fiche_head($head, 'modules', '', -1); @@ -1001,7 +1007,7 @@ if ($mode == 'marketplace') {
- get_products($categorie); ?> + get_products(!empty($categorie) ? $categorie: ''); ?>
@@ -1082,28 +1088,36 @@ if ($mode == 'deploy') { $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { + $maxphp = preg_replace('/k$/i', '', $maxphp); $maxphp = $maxphp * 1; } if (preg_match('/m$/i', $maxphp)) { + $maxphp = preg_replace('/m$/i', '', $maxphp); $maxphp = $maxphp * 1024; } if (preg_match('/g$/i', $maxphp)) { + $maxphp = preg_replace('/g$/i', '', $maxphp); $maxphp = $maxphp * 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { + $maxphp = preg_replace('/t$/i', '', $maxphp); $maxphp = $maxphp * 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { + $maxphp2 = preg_replace('/k$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1; } if (preg_match('/m$/i', $maxphp2)) { + $maxphp2 = preg_replace('/m$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024; } if (preg_match('/g$/i', $maxphp2)) { + $maxphp2 = preg_replace('/g$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { + $maxphp2 = preg_replace('/t$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; } // Now $max and $maxphp and $maxphp2 are in Kb diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index c3cbcb3d0ae..d50be27e97b 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -95,37 +95,37 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') print ''; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; print ''; print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 510ec8ef55a..cfcb85054d2 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -622,6 +622,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $content=''; $pathoffile = $this->getDescLongReadmeFound(); if ($pathoffile) // Mostly for external modules diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1e36bcb66ff..5ae6688a31f 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -327,7 +327,7 @@ class modStock extends DolibarrModules 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product' ); // We define here only fields that use another icon that the one defined into export_icon - if ($conf->productbatch->enabled) + if (!empty($conf->productbatch->enabled)) { $this->export_fields_array[$r]['sm.batch'] = 'Batch'; $this->export_TypeFields_array[$r]['sm.batch'] = 'Text'; diff --git a/htdocs/includes/parsedown/Parsedown.php b/htdocs/includes/parsedown/Parsedown.php index df718bce111..cc110c318c8 100644 --- a/htdocs/includes/parsedown/Parsedown.php +++ b/htdocs/includes/parsedown/Parsedown.php @@ -1182,7 +1182,7 @@ class Parsedown 'src' => $Link['element']['attributes']['href'], 'alt' => $Link['element']['text'], // @CHANGE LDR - 'class' => $Link['element']['attributes']['class'] + 'class' => (!empty($Link['element']['attributes']['class']) ? $Link['element']['attributes']['class'] : '') ), ), ); From aec01a95fc328610d118cd092f90b2be346d24fd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 17:48:52 +0100 Subject: [PATCH 04/12] FIX again and again --- htdocs/admin/system/phpinfo.php | 40 +++++++++++++++---- htdocs/comm/card.php | 2 +- htdocs/core/class/commonobject.class.php | 8 ++-- htdocs/core/class/extrafields.class.php | 9 ++++- htdocs/core/class/html.formactions.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 40 +++++++++++++++---- htdocs/core/lib/company.lib.php | 15 ++++--- .../tpl/extrafields_list_search_input.tpl.php | 2 +- .../tpl/extrafields_list_search_title.tpl.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 4 +- htdocs/societe/consumption.php | 7 ++-- htdocs/societe/paymentmodes.php | 4 +- 12 files changed, 97 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index cf38687f66f..388b61c75cf 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -51,15 +51,39 @@ if (isset($title)) // Check PHP setup is OK $maxphp = @ini_get('upload_max_filesize'); // In unknown -if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1; -if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024; -if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024; -if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024; +if (preg_match('/k$/i', $maxphp)) { + $maxphp = preg_replace('/k$/i', '', $maxphp); + $maxphp = $maxphp * 1; +} +if (preg_match('/m$/i', $maxphp)) { + $maxphp = preg_replace('/m$/i', '', $maxphp); + $maxphp = $maxphp * 1024; +} +if (preg_match('/g$/i', $maxphp)) { + $maxphp = preg_replace('/g$/i', '', $maxphp); + $maxphp = $maxphp * 1024 * 1024; +} +if (preg_match('/t$/i', $maxphp)) { + $maxphp = preg_replace('/t$/i', '', $maxphp); + $maxphp = $maxphp * 1024 * 1024 * 1024; +} $maxphp2 = @ini_get('post_max_size'); // In unknown -if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1; -if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024; -if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024; -if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; +if (preg_match('/k$/i', $maxphp2)) { + $maxphp2 = preg_replace('/k$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1; +} +if (preg_match('/m$/i', $maxphp2)) { + $maxphp2 = preg_replace('/m$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024; +} +if (preg_match('/g$/i', $maxphp2)) { + $maxphp2 = preg_replace('/g$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024 * 1024; +} +if (preg_match('/t$/i', $maxphp2)) { + $maxphp2 = preg_replace('/t$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; +} if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) { $langs->load("errors"); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 93316384c2a..53e498fe303 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -87,7 +87,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $hookmanager->initHooks(array('thirdpartycomm', 'globalcard')); // Security check -$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); +$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); if ($object->id > 0) { if (!($object->client > 0) || empty($user->rights->societe->lire)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index de4f2bc367c..3336dbda078 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -601,7 +601,7 @@ abstract class CommonObject if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : ''))))); $ret = ''; - if ($option && $this->civility_code) + if (!empty($option) && !empty($this->civility_code)) { if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' '; else $ret .= $this->civility_code.' '; @@ -720,7 +720,7 @@ abstract class CommonObject $out = ''; $outdone = 0; - $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); + $coords = $this->getFullAddress(1, ', ', (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) ? $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT : 0)); if ($coords) { if (!empty($conf->use_javascript_ajax)) @@ -1407,7 +1407,7 @@ abstract class CommonObject } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { $modulename = 'fournisseur'; } - if ($conf->{$modulename}->enabled) { + if (!empty($conf->{$modulename}->enabled)) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); $transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); @@ -6846,7 +6846,7 @@ abstract class CommonObject $value = $getposttemp; } } else { - $value = $this->array_options["options_".$key]; // No GET, no POST, no default value, so we take value of object. + $value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object. } //var_dump($keyprefix.' - '.$key.' - '.$keysuffix.' - '.$keyprefix.'options_'.$key.$keysuffix.' - '.$this->array_options["options_".$key.$keysuffix].' - '.$getposttemp.' - '.$value); break; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2daf4c835e9..cf499bbde5d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1097,7 +1097,12 @@ class ExtraFields foreach ($param['options'] as $key => $val) { if ((string) $key == '') continue; - list($val, $parent) = explode('|', $val); + $valarray = explode('|', $val); + $val = $valarray[0]; + $parent = ''; + if (!empty($valarray[1])) { + $parent = $valarray[1]; + } $out .= '
'; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index f182fb39cbd..8945daa23f8 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -290,6 +290,11 @@ if ($action == 'create') { // Id $parent_rowid = GETPOST('menuId', 'int'); + $parent_mainmenu = ''; + $parent_leftmenu = ''; + $parent_langs = ''; + $parent_level = ''; + if (GETPOST('menuId', 'int')) { $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int'); $res = $db->query($sql); @@ -328,8 +333,8 @@ if ($action == 'create') { } else { print ''; } print ''.$langs->trans('DetailType').''; @@ -370,8 +375,8 @@ if ($action == 'create') { // Target print ''.$langs->trans('Target').''.$langs->trans('DetailTarget').''; // Enabled diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index a1ebb21838b..045332bb2d9 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -367,7 +367,7 @@ if ($conf->use_javascript_ajax) $remainingdata = array(); foreach ($data as $datar) { - if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; + if (empty($datar['rowid']) || !empty($tree_recur_alreadyadded[$datar['rowid']])) continue; $remainingdata[] = $datar; } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 16a1c42ddaa..008e5277bc3 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -161,7 +161,7 @@ print '
'; print ''; print ''; -$selected = $conf->global->MAIN_PDF_FORMAT; +$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : ''); if (empty($selected)) $selected = dol_getDefaultFormat(); // Show pdf format @@ -320,13 +320,13 @@ print ''; print ''; print ''."\n"; } - $perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label)); + $perm_libelle = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label)); print ''; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 0349f8a3435..9290a0459d0 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -155,7 +155,7 @@ print ''; print ''; print ''; print ''; @@ -164,7 +164,7 @@ print ''; print ''; print ''; print ''; @@ -173,7 +173,7 @@ print ''; print ''; print ''; print ''; @@ -182,7 +182,7 @@ print ''; print ''; print ''; print ''; @@ -191,7 +191,7 @@ print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 30085d3f1f1..86db4fab6e2 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -241,8 +241,8 @@ print ''; foreach ($arrayhandler as $key => $module) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if (!empty($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->isEnabled()) { diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index ea5ea2983fd..d51ff3ae558 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -116,7 +116,7 @@ print ''; print ''; print ''; print ''; // Action column print ''; print ''; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 80fdbc2f4a2..22f669966f3 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -99,7 +99,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC"; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC"; else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC"; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0710416f1fe..f523e2a40a2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1073,8 +1073,8 @@ class FormFile if (empty($relativepath)) { $relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/'; - if ($object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath - if ($object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.'; + if (!empty($object->element) && $object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath + if (!empty($object->element) && $object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.'; } // For backward compatiblity, we detect file stored into an old path if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $filearray[0]['level1name'] == 'photos') diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index a4cb7a603dd..91691cbec54 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -106,7 +106,8 @@ class InfoBox if (is_object($user)) $sql .= " AND b.fk_user IN (0,".$user->id.")"; else $sql .= " AND b.fk_user = 0"; $sql .= " ORDER BY b.box_order"; - } else // available + } + else // available { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; @@ -150,7 +151,7 @@ class InfoBox // box properties $box->rowid = (empty($obj->rowid) ? '' : $obj->rowid); $box->id = (empty($obj->box_id) ? '' : $obj->box_id); - $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0' + $box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0' $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); $box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user); $box->sourcefile = $relsourcefile; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index e4de8b0c833..9df0f8d9ddf 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -163,7 +163,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print ''; $ulprinted++; } - print "\n".'
  • '; + print "\n".'
  • '; if ($showfk) { print '
  • '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("ShowDetailsInPDFPageFoot").''; -print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); +print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)); print '
    '.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").''; //if (! empty($conf->global->MAIN_MULTILANGS)) //{ -print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); +print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); //} else { // print ''.$langs->trans("MultiLangNotEnabled").''; //} diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 4905f4f2497..3d37b2a7c8a 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -166,7 +166,7 @@ if ($result) if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) { // TODO Define familyposition - $family = $modules[$obj->module]->family_position; + $family = (!empty($modules[$obj->module]->family_position) ? $modules[$obj->module]->family_position : ''); $familyposition = 0; $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.","; $sqlupdate .= " family_position = ".$familyposition; @@ -214,7 +214,7 @@ if ($result) print '
    '.$langs->trans("MAIN_PROXY_USE").''; print ''; -print $form->selectyesno('MAIN_PROXY_USE', $conf->global->MAIN_PROXY_USE, 1); +print $form->selectyesno('MAIN_PROXY_USE', (!empty($conf->global->MAIN_PROXY_USE) ? $conf->global->MAIN_PROXY_USE : 0), 1); print '
    '.$langs->trans("MAIN_PROXY_HOST").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_PORT").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_USER").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_PASS").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MaxSizeForUploadedFiles").'.'; $max = @ini_get('upload_max_filesize'); -if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit", $max * 1024, $langs->trans("Kb")).'.'; +if (isset($max)) print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.'; else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index c31f1c07093..dfaa8e576de 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -40,9 +40,9 @@ $transkey = GETPOST('transkey', 'alphanohtml'); $transvalue = GETPOST('transvalue', 'restricthtml'); -$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'searchkey'; +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -62,9 +62,9 @@ $hookmanager->initHooks(array('admintranslation', 'globaladmin')); */ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } -$parameters = array('socid'=>$socid); +$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'); @@ -217,14 +217,14 @@ print '
    '; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); +if (isset($optioncss) && $optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($langcode) $param .= '&langcode='.urlencode($langcode); if ($transkey) $param .= '&transkey='.urlencode($transkey); if ($transvalue) $param .= '&transvalue='.urlencode($transvalue); -print 'entity) && $debug) ? '?debug=1' : '').'" method="POST">'; -if ($optioncss != '') print ''; +print 'entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">'; +if (isset($optioncss) && $optioncss != '') print ''; print ''; print ''; print ''; @@ -472,7 +472,7 @@ if ($mode == 'searchkey') print '
    '; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + $searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1); print $searchpicto; print '
    '; // Note print ''; +print ''; print ''; print '
    '; @@ -194,7 +194,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print ''; $ulprinted++; } - print "\n".'
  • '; + print "\n".'
  • '; if ($showfk) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; +print ''; print ''; print '
    '; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 913112e04e6..0cf23e0593f 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -498,7 +498,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; //var_dump($conf->global->THEME_ELDY_BACKBODY); if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''); if ($color) print ''; @@ -539,7 +539,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("TopMenuBackgroundColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''); if ($color) print ''; @@ -580,7 +580,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("LeftMenuBackgroundColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''); if ($color) print ''; @@ -601,7 +601,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("TextTitleColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } @@ -621,7 +621,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } @@ -641,7 +641,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleTextColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } @@ -661,7 +661,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleTextlinkColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default")); } @@ -682,7 +682,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableLineOddColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''); if ($color) print ''; @@ -703,7 +703,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableLineEvenColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''); if ($color) print ''; @@ -744,7 +744,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("LinkColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''); if ($color) print ''; @@ -781,12 +781,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print ''; //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); + if (!empty($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' '; } else { if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), ''); if ($color) { if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print ''; else print $langs->trans("Default"); @@ -818,12 +818,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print ''; //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); + if (!empty($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' '; } else { if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), ''); if ($color) { if ($color != 'e6edf0') print ''; else print $langs->trans("Default"); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 810f2087430..06320794a64 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -803,8 +803,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); } } } From 7832fa213f4da99a5c6bdae77809fd17a1009168 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 Dec 2020 11:34:59 +0100 Subject: [PATCH 06/12] FIX Stickler line exceeds 500 characters; contains 527 characters --- htdocs/core/class/html.formactions.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index fe70c482d21..cbd17b30568 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -202,7 +202,8 @@ class FormActions $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage); + $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } From c647c78ee0d2366b14af8bea763c601c6a3ed7dd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 Dec 2020 14:02:53 +0100 Subject: [PATCH 07/12] FIX restore GETPOSTISSET --- htdocs/admin/accountant.php | 2 +- htdocs/admin/company.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index c8fccb6073d..3647c10f5ea 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -164,7 +164,7 @@ print ''; -print '
    '; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index cac436955f5..fd3f7505778 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -534,7 +534,7 @@ print '
  • '; -print '
    '; From d0d94276669bc0bbc04bd9db6e645917eee5e37f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 2 Jan 2021 17:23:25 +0100 Subject: [PATCH 08/12] FIX regression --- htdocs/admin/delais.php | 552 ++++++++++++++++++++-------------------- 1 file changed, 272 insertions(+), 280 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 62b0c6ec53d..0b8c639622f 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -35,127 +35,127 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'aZ09'); $modules = array( - 'agenda' => array( - array( - 'code' => 'MAIN_DELAY_ACTIONS_TODO', - 'img' => 'action' - ) - ), - 'projet' => array( - array( - 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', - 'img' => 'project' - ), - array( - 'code' => 'MAIN_DELAY_TASKS_TODO', - 'img' => 'projecttask' - ) - ), - 'propal' => array( - array( - 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', - 'img' => 'propal' - ), - array( - 'code' => 'MAIN_DELAY_PROPALS_TO_BILL', - 'img' => 'propal' - ) - ), - 'commande' => array( - array( - 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS', - 'img' => 'order' - ) - ), - 'facture' => array( - array( - 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED', - 'img' => 'bill' - ) - ), - 'fournisseur' => array( - array( - 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', - 'img' => 'order' - ), - array( - 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY', - 'img' => 'bill' - ) - ), - 'service' => array( - array( - 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES', - 'img' => 'service' - ), - array( - 'code' => 'MAIN_DELAY_RUNNING_SERVICES', - 'img' => 'service' - ) - ), - 'banque' => array( - array( - 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE', - 'img' => 'account' - ), - array( - 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT', - 'img' => 'account' - ) - ), - 'adherent' => array( - array( - 'code' => 'MAIN_DELAY_MEMBERS', - 'img' => 'user' - ) - ), - 'expensereport' => array( - array( - 'code' => 'MAIN_DELAY_EXPENSEREPORTS', - 'img' => 'trip' - ), - /* TODO Enable this - array( - 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', - 'img' => 'trip' - )*/ - ), - 'holiday' => array( - array( - 'code' => 'MAIN_DELAY_HOLIDAYS', - 'img' => 'holiday' - ), - ), + 'agenda' => array( + array( + 'code' => 'MAIN_DELAY_ACTIONS_TODO', + 'img' => 'action' + ) + ), + 'projet' => array( + array( + 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', + 'img' => 'project' + ), + array( + 'code' => 'MAIN_DELAY_TASKS_TODO', + 'img' => 'projecttask' + ) + ), + 'propal' => array( + array( + 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', + 'img' => 'propal' + ), + array( + 'code' => 'MAIN_DELAY_PROPALS_TO_BILL', + 'img' => 'propal' + ) + ), + 'commande' => array( + array( + 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS', + 'img' => 'order' + ) + ), + 'facture' => array( + array( + 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED', + 'img' => 'bill' + ) + ), + 'fournisseur' => array( + array( + 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', + 'img' => 'order' + ), + array( + 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY', + 'img' => 'bill' + ) + ), + 'service' => array( + array( + 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES', + 'img' => 'service' + ), + array( + 'code' => 'MAIN_DELAY_RUNNING_SERVICES', + 'img' => 'service' + ) + ), + 'banque' => array( + array( + 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE', + 'img' => 'account' + ), + array( + 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT', + 'img' => 'account' + ) + ), + 'adherent' => array( + array( + 'code' => 'MAIN_DELAY_MEMBERS', + 'img' => 'user' + ) + ), + 'expensereport' => array( + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS', + 'img' => 'trip' + ), + /* TODO Enable this + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', + 'img' => 'trip' + )*/ + ), + 'holiday' => array( + array( + 'code' => 'MAIN_DELAY_HOLIDAYS', + 'img' => 'holiday' + ), + ), ); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) { - $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) { - $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_MEMBERS)) { - $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) { - $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; + $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } @@ -166,30 +166,30 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if ($action == 'update') { - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - if (GETPOST($delay['code']) != '') - { - dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); - } - } - } - } - - dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity); - - // For update value with percentage - $plus = ''; - if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; - // Update values - for ($i = 0; $i < 4; $i++) { - if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); - } + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + if (GETPOST($delay['code']) != '') + { + dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); + } + } + } + } + + dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity); + + // For update value with percentage + $plus = ''; + if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; + // Update values + for ($i = 0; $i < 4; $i++) { + if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); + } } @@ -209,164 +209,156 @@ print "
    \n"; if ($action == 'edit') { - print ''; - print ''; - print ''; - - print ''; - print ''; - - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); - print ''; - print ''; - print ''; - } - } - } - - print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; - print ' '.$langs->trans("days").'
    '; - - print '
    '; - - // Show if meteo is enabled - print ''; - print ''; - - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; - print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); - print '
    '; + print ''; + print ''; + print ''; + + print ''; + print ''; + + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); + print ''; + print ''; + print ''; + } + } + } + + print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; + print ' '.$langs->trans("days").'
    '; + + print '
    '; + + // Show if meteo is enabled + print ''; + print ''; + + print ''; + print ''; + + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; + print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); + print '
    '; } else { - /* + /* * Show parameters */ - - print ''; - print ''; - - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); - print ''; - print ''; - print ''; - print ''; - } - } - } - - print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''.$value.' '.$langs->trans("days").'
    '; - - print '
    '; - - // Show if meteo is enabled - print ''; - print ''; - - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; - if (!isset($conf->global->MAIN_DISABLE_METEO)) $conf->global->MAIN_DISABLE_METEO = 0; - print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; - print '
    '; + + print ''; + print ''; + + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); + print ''; + print ''; + print ''; + print ''; + } + } + } + + print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''.$value.' '.$langs->trans("days").'
    '; + + print '
    '; + + // Show if meteo is enabled + print ''; + print ''; + + print ''; + print ''; + + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; + print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; + print '
    '; } print '
    '; -if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) { - // Show logo for weather - print ''.$langs->trans("DescWeather").' '; - - if ($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); - $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); - if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; - else $str_mode_enabled = $str_mode_percentage; - print ''.$str_mode_enabled.''; - print ''; - - print '

    '; - } else { - if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled'); - else print $langs->trans('MeteoPercentageModEnabled'); - print '

    '; - } - - $offset = 0; - $cursor = 10; // By default - //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; - //if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; - $level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0; - $level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1; - $level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2; - $level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3; - $level4 = $offset + 4 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL4)) $level4 = $conf->global->MAIN_METEO_LEVEL4; - $text = ''; $options = 'class="valignmiddle" height="60px"'; - - - if ($action == 'edit') { - print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; - - print '
    '; - print '
    '; - print img_weather($text, 0, $options); - print ' <= '; - print '
    '; - print img_weather($text, 1, $options); - print ' <= '; - print '
    '; - print img_weather($text, 2, $options); - print ' <= '; - print '
    '; - print img_weather($text, 3, $options); - print ' <= '; - print '
    '; - print img_weather($text, 4, $options); - print ' <= '; - print '
    '; - print '
    '; - - print '
    '; - - print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; - - print '
    '; - print '
    '; - print img_weather($text, 0, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 1, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 2, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 3, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 4, $options); - print ' <=  %'; - print '
    '; - print '
    '; - - print '
    '; - - ?> +if ($conf->global->MAIN_DISABLE_METEO != 1) { + // Show logo for weather + print ''.$langs->trans("DescWeather").' '; + + if ($action == 'edit') { + $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); + $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); + if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; + else $str_mode_enabled = $str_mode_percentage; + print ''.$str_mode_enabled.''; + print ''; + + print '

    '; + } else { + if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled'); + else print $langs->trans('MeteoPercentageModEnabled'); + print '

    '; + } + + $offset = 0; + $cursor = 10; // By default + //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; + //if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; + $level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0; + $level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1; + $level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2; + $level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3; + $text = ''; $options = 'class="valignmiddle" height="60px"'; + + + if ($action == 'edit') { + print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; + + print '
    '; + print '
    '; + print img_weather($text, 0, $options); + print ' <= '; + print '
    '; + print img_weather($text, 1, $options); + print ' <= '; + print '
    '; + print img_weather($text, 2, $options); + print ' <= '; + print '
    '; + print img_weather($text, 3, $options); + print ' <= '; + print '
    '; + print '
    '; + + print '
    '; + + print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; + + print '
    '; + print '
    '; + print img_weather($text, 0, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 1, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 2, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 3, $options); + print ' <=  %'; + print '
    '; + print '
    '; + + print '
    '; + + ?>