diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e310d3e0b6d..97dd835bda0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -376,21 +376,24 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; - $result = $object->update($contactid, $user); - - if ($result > 0) { - // Categories association - $categories = GETPOST('contcats', 'array'); - $object->setCategories($categories); - - $object->old_lastname=''; - $object->old_firstname=''; - $action = 'view'; - } - else + if (! $error) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'edit'; + $result = $object->update($contactid, $user); + + if ($result > 0) { + // Categories association + $categories = GETPOST('contcats', 'array'); + $object->setCategories($categories); + + $object->old_lastname=''; + $object->old_firstname=''; + $action = 'view'; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } } } @@ -505,7 +508,7 @@ else $linkback=''; print load_fiche_titre($title, $linkback, 'title_companies.png'); - // Affiche les erreurs + // Show errors dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) @@ -800,8 +803,8 @@ else $objsoc = new Societe($db); $objsoc->fetch($object->socid); - // Affiche les erreurs - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) { @@ -1122,11 +1125,10 @@ else { $objsoc = new Societe($db); - /* - * Fiche en mode visualisation - */ + // View mode - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); dol_fiche_head($head, 'card', $title, -1, 'contact'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ede8070405a..a064e611c2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3876,9 +3876,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4131,9 +4138,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4154,9 +4168,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4356,9 +4377,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 22e9dbf663c..8e0cf0946dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1970,7 +1970,7 @@ class ExtraFields public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') { global $_POST, $langs; - $nofillrequired='';// For error when required field left blank + $nofillrequired=0;// For error when required field left blank $error_field_required = array(); if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; @@ -2001,7 +2001,8 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') + if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index c0ab1631d8c..f639db56ab5 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -270,8 +270,8 @@ CREATE TABLE llx_pos_cash_fence( -- Withdrawals / Prelevements -UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; -UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_END_TO_END')__ where name = __ENCRYPT('END_TO_END')__; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_USTRD')__ where name = __ENCRYPT('USTRD')__; -- Delete duplicate accounting account, but only if not used