From aaaad713470a2dbada31b0a2c68052d3bfe59bad Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 May 2019 12:10:58 +0200 Subject: [PATCH 1/8] FIX : do not include disabled modules tpl --- htdocs/core/class/commonobject.class.php | 68 ++++++++++++++++++------ 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f0fe7bf437c..22c96f0f589 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3715,16 +3715,25 @@ 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) + $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + if (!empty($module) && empty($conf->$module->enabled)) continue; + + 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 { $res=include $tpl; // for debug } - if ($res) break; + if ($res > 0) break; } } @@ -3967,16 +3976,25 @@ 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) + $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + if (!empty($module) && empty($conf->$module->enabled)) continue; + + 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 { $res=include $tpl; // for debug } - if ($res) break; + if ($res > 0) break; } } @@ -3990,16 +4008,25 @@ 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) + $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + if (!empty($module) && empty($conf->$module->enabled)) continue; + + 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 { $res=include $tpl; // for debug } - if ($res) break; + if ($res > 0) break; } } } @@ -4186,16 +4213,25 @@ 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) + $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + if (!empty($module) && empty($conf->$module->enabled)) continue; + + 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 { $res=include $tpl; // for debug } - if ($res) break; + if ($res > 0) break; } } From abc7c2f0f8deead444bc41727cc36099d517a014 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 May 2019 12:33:40 +0200 Subject: [PATCH 2/8] test include return on TRUE --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 22c96f0f589..5034e4c4899 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3733,7 +3733,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res > 0) break; + if ($res === TRUE) break; } } @@ -3994,7 +3994,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res > 0) break; + if ($res === TRUE) break; } } @@ -4026,7 +4026,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res > 0) break; + if ($res === TRUE) break; } } } @@ -4231,7 +4231,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res > 0) break; + if ($res === TRUE) break; } } From 545cdd07623163eda45df13a92f7ef4a5a16cf9d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 May 2019 12:54:24 +0200 Subject: [PATCH 3/8] test include return on FALSE --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5034e4c4899..eae3f566d2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3733,7 +3733,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res === TRUE) break; + if ($res !== FALSE) break; } } @@ -3994,7 +3994,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res === TRUE) break; + if ($res !== FALSE) break; } } @@ -4026,7 +4026,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res === TRUE) break; + if ($res !== FALSE) break; } } } @@ -4231,7 +4231,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res === TRUE) break; + if ($res !== FALSE) break; } } From 83d883c36a9d36c4a687939e04d7686d1bada205 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 May 2019 15:14:34 +0200 Subject: [PATCH 4/8] finally eldy is always right --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index eae3f566d2f..b64ae066cb1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3733,7 +3733,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res !== FALSE) break; + if ($res) break; } } @@ -3994,7 +3994,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res !== FALSE) break; + if ($res) break; } } @@ -4026,7 +4026,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res !== FALSE) break; + if ($res) break; } } } @@ -4231,7 +4231,7 @@ abstract class CommonObject } else { $res=include $tpl; // for debug } - if ($res !== FALSE) break; + if ($res) break; } } From a853764f6d7226db4481e2d0cbf56b12926a518a Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Tue, 28 May 2019 15:03:36 +0200 Subject: [PATCH 5/8] FIX productaccount buylist with pages --- htdocs/accountancy/admin/productaccount.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 389dd8df7b8..67d6920ced5 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -279,7 +279,8 @@ if ($result) if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account); if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid); - + if ($accounting_product_mode) $param.="&accounting_product_mode=".urlencode($accounting_product_mode); + print '
'; if ($optioncss != '') print ''; print ''; From bdd54ae24583536d63baf2bac4679efe369a415c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 30 May 2019 11:42:28 +0200 Subject: [PATCH 6/8] FIX missing llx_const encrypt --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8bc8d691bbd..80d144249d1 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 @@ -269,8 +269,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 From cd75794aaac0b9e98711e707e2cfe1a595395abe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2019 11:38:54 +0200 Subject: [PATCH 7/8] FIX #11169 #11202 --- htdocs/core/class/extrafields.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 415998f5eb7..752818f1520 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1861,7 +1861,7 @@ class ExtraFields 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']; @@ -1892,7 +1892,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]; From f2088a084f4a366e4e06b8a85bdfa79448e0626f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2019 11:53:30 +0200 Subject: [PATCH 8/8] Fix error management --- htdocs/contact/card.php | 46 +++++++++++++------------ htdocs/core/class/extrafields.class.php | 1 - 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9289c156fdb..2ad2e5e2e99 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -377,21 +377,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'; + } } } @@ -500,8 +503,8 @@ else $linkback=''; print load_fiche_titre($title,$linkback,'title_companies.png'); - // Affiche les erreurs - dol_htmloutput_errors(is_numeric($error)?'':$error,$errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) { @@ -775,8 +778,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) { @@ -1073,11 +1076,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/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 752818f1520..32313e75d3a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1901,7 +1901,6 @@ class ExtraFields $error_field_required[] = $langs->transnoentitiesnoconv($value); } } - if (in_array($key_type,array('date'))) { // Clean parameters