diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3020f9af822..e145d665672 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2010-2018 Philippe Grand + * Copyright (C) 2010-2021 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013-2014 Florian Henry @@ -121,7 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -$usercancreateintervention = $user->rights->ficheinter->creer; +$usercancreateintervention = $user->hasRight('ficheinter', 'creer'); $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php @@ -260,10 +260,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 63cac253976..7cde7e6f886 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -66,13 +66,13 @@ if ($action == 'builddoc' && $permissiontoadd) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && isset($object->thirdparty->default_lang)) { $newlang = $object->thirdparty->default_lang; // for proposal, order, invoice, ... } - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && isset($object->default_lang)) { $newlang = $object->default_lang; // for thirdparty } if (!empty($newlang)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index be91f51d4ee..5cdb83194f4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1701,7 +1701,7 @@ abstract class CommonObject $idtype = $this->barcode_type; if (empty($idtype) && $idtype != '0') { // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined - if ($this->element == 'product') { + if ($this->element == 'product' && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } elseif ($this->element == 'societe') { $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4e4a199600f..c3ee160f0f0 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1718,7 +1718,7 @@ class ExtraFields $sql = 'SELECT '.$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; - if (strpos($InfoFieldList[4], 'extra') !== false) { + if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; } if ($selectkey == 'rowid' && empty($value)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 74f6ed83ee2..b6edc35b94a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2010-2019 Philippe Grand + * Copyright (C) 2010-2021 Philippe Grand * Copyright (C) 2011 Herve Prot * Copyright (C) 2012-2016 Marcos GarcĂ­a * Copyright (C) 2012 Cedric Salvador @@ -7855,6 +7855,11 @@ class Form if (empty($conf->expedition->enabled)) { continue; // Do not show if module disabled } + } elseif ($objecttype == 'ficheinter') { + $tplpath = 'fichinter'; + if (empty($conf->ficheinter->enabled)) { + continue; // Do not show if module disabled + } } elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; } elseif ($objecttype == 'order_supplier') { diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 9a90fa945bb..0c645099f56 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -170,9 +170,9 @@ class modBlockedLog extends DolibarrModules $sql = array(); // If already used, we add an entry to show we enable module - require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; + require_once DOL_DOCUMENT_ROOT . '/blockedlog/class/blockedlog.class.php'; - $object = new stdClass(); + $object = new stdClass(); $object->id = 1; $object->element = 'module'; $object->ref = 'systemevent'; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 784eeb006c3..356b9ca6f51 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -77,6 +77,11 @@ class modFicheinter extends DolibarrModules $this->const = array(); $r = 0; + if (!isset($conf->ficheinter) || !isset($conf->ficheinter->enabled)) { + $conf->ficheinter = new stdClass(); + $conf->ficheinter->enabled = 0; + } + $this->const[$r][0] = "FICHEINTER_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "soleil"; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 99b7e7e188b..9663bea4756 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -233,7 +233,7 @@ class Propalmergepdfproduct extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t"; $sql .= " WHERE t.fk_product = ".((int) $product_id); - if ($conf->global->MAIN_MULTILANGS && !empty($lang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($lang)) { $sql .= " AND t.lang = '".$this->db->escape($lang)."'"; } @@ -248,7 +248,7 @@ class Propalmergepdfproduct extends CommonObject $line->fk_product = $obj->fk_product; $line->file_name = $obj->file_name; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $line->lang = $obj->lang; } $line->fk_user_author = $obj->fk_user_author; @@ -258,7 +258,7 @@ class Propalmergepdfproduct extends CommonObject $line->import_key = $obj->import_key; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $this->lines[$obj->file_name.'_'.$obj->lang] = $line; } else { $this->lines[$obj->file_name] = $line;