From aec01a95fc328610d118cd092f90b2be346d24fd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 17:48:52 +0100 Subject: [PATCH] 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 .= '