diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7ba063f8f79..c1c30c6826e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -53,7 +53,7 @@ class Conf public $modules = array(); // List of activated modules public $modules_parts = array(); // List of modules parts - + // TODO Remove all thoose tabs with one generic public $sms_engine_modules = array(); public $css_modules = array(); @@ -163,8 +163,8 @@ class Conf $modulename = strtolower($reg[1]); $partname = strtolower($reg[2]); $varname = $partname.'_modules'; // TODO deprecated - if (! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated - if (! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } + if (! isset($this->$varname) || ! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated + if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } $arrValue = dol_json_decode($value,true); if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; else if (in_array($partname,array('login','menus','triggers'))) $value = '/'.$modulename.'/core/'.$partname.'/'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de0358270bd..25bec4c1ccb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -147,7 +147,7 @@ if (! function_exists('json_decode')) /** * Function that encodes data in json format - * + * * @param mixed $elements PHP object to json encode * @return string Json encoded string */ @@ -166,7 +166,7 @@ function dol_json_encode($elements) function dol_json_decode($json, $assoc=false) { $out=''; - $out = unserialize($json); // For compatibility, test if serialized + $out = @unserialize($json); // For compatibility, test if serialized if (empty($out)) $out = json_decode($json, $assoc); return $out; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c57a28febf1..febfae62f18 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -309,7 +309,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) { migrate_mode_reglement($db,$langs,$conf); - + // Reload modules migrate_reload_modules($db,$langs,$conf); @@ -1193,7 +1193,7 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf) /** * Mise a jour des totaux lignes de facture - * + * * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf @@ -3209,10 +3209,10 @@ function migrate_shipping_delivery2($db,$langs,$conf) function migrate_actioncomm_element($db,$langs,$conf) { print ''; - + print '
'; print ''.$langs->trans('MigrationActioncommElement')."
\n"; - + $elements = array( 'propal' => 'propalrowid', 'order' => 'fk_commande', @@ -3221,7 +3221,7 @@ function migrate_actioncomm_element($db,$langs,$conf) 'order_supplier' => 'fk_supplier_order', 'invoice_supplier' => 'fk_supplier_invoice' ); - + foreach($elements as $type => $field) { $result = $db->DDLDescTable(MAIN_DB_PREFIX."actioncomm",$field); @@ -3229,20 +3229,20 @@ function migrate_actioncomm_element($db,$langs,$conf) if ($obj) { dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field); - + $db->begin(); - + $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET "; $sql.= "fk_element = ".$field.", elementtype = '".$type."'"; $sql.= " WHERE ".$field." IS NOT NULL"; $sql.= " AND fk_element IS NULL"; $sql.= " AND elementtype IS NULL"; - + $resql = $db->query($sql); if ($resql) { $db->commit(); - + // DDL commands must not be inside a transaction // We will drop at next version because a migrate should be runnable several times if it fails. //$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field; @@ -3260,7 +3260,7 @@ function migrate_actioncomm_element($db,$langs,$conf) print $langs->trans('AlreadyDone')."
\n"; } } - + print ''; } @@ -3275,10 +3275,10 @@ function migrate_actioncomm_element($db,$langs,$conf) function migrate_mode_reglement($db,$langs,$conf) { print ''; - + print '
'; print ''.$langs->trans('MigrationPaymentMode')."
\n"; - + $elements = array( 'old_id' => array(5,8,9,10,11), 'new_id' => array(50,51,52,53,54), @@ -3286,13 +3286,13 @@ function migrate_mode_reglement($db,$langs,$conf) 'tables' => array('commande_fournisseur','commande','facture_rec','facture','propal') ); $count=0; - + foreach($elements['old_id'] as $key => $old_id) { $error=0; - + dolibarr_install_syslog("upgrade2::migrate_mode_reglement code=".$elements['code'][$key]); - + $sqlSelect = "SELECT id"; $sqlSelect.= " FROM ".MAIN_DB_PREFIX."c_paiement"; $sqlSelect.= " WHERE id = ".$old_id; @@ -3305,9 +3305,9 @@ function migrate_mode_reglement($db,$langs,$conf) if ($num) { $count++; - + $db->begin(); - + $sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET "; $sql.= "id = ".$elements['new_id'][$key]; $sql.= " WHERE id = ".$old_id; @@ -3330,7 +3330,7 @@ function migrate_mode_reglement($db,$langs,$conf) } print ". "; } - + if (! $error) { $db->commit(); @@ -3349,10 +3349,10 @@ function migrate_mode_reglement($db,$langs,$conf) } } } - + if ($count == 0) print $langs->trans('AlreadyDone')."
\n"; - - + + print ''; } @@ -3501,36 +3501,6 @@ function migrate_reload_modules($db,$langs,$conf) $mod->init('noboxes'); } } - if (! empty($conf->global->MAIN_MODULE_PHENIX)) - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Phenix"); - $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modPhenix.class.php'); - if ($res) { - $mod=new modPhenix($db); - $mod->remove('noboxes'); - $mod->init(); - } - } - if (! empty($conf->global->MAIN_MODULE_WEBCALENDAR)) - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Webcalendar"); - $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modWebcalendar.class.php'); - if ($res) { - $mod=new modWebcalendar($db); - $mod->remove('noboxes'); - $mod->init(); - } - } - if (! empty($conf->global->MAIN_MODULE_MANTIS)) - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Mantis"); - $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modMantis.class.php'); - if ($res) { - $mod=new modMantis($db); - $mod->remove('noboxes'); - $mod->init(); - } - } if (! empty($conf->global->MAIN_MODULE_SOCIETE)) { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe");