From 05c666c18bb667079cbb59f898d3f6df3c55eb8a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 1 Jul 2018 17:06:19 +0200 Subject: [PATCH] Fix: use numbering model corresponding to the entity of the object --- htdocs/comm/propal/class/propal.class.php | 13 ++++++++++--- htdocs/core/modules/propale/mod_propale_saphir.php | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 703ed95a1b2..c32f206ec52 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3347,12 +3347,19 @@ class Propal extends CommonObject global $conf,$langs; $langs->load("propal"); - if (! empty($conf->global->PROPALE_ADDON)) + $constant = 'PROPALE_ADDON_'.$this->entity; + + if (! empty($conf->global->$constant)) { + $classname = $conf->global->$constant; // for multicompany proposal sharing + } else { + $classname = $conf->global->PROPALE_ADDON; + } + + if (! empty($classname)) { $mybool=false; - $file = $conf->global->PROPALE_ADDON.".php"; - $classname = $conf->global->PROPALE_ADDON; + $file = $classname.".php"; // Include file with class $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index 7cea713aeaf..54d894c20b5 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -115,8 +115,14 @@ class mod_propale_saphir extends ModeleNumRefPropales require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; + $constant = 'PROPALE_SAPHIR_MASK_'.$propal->entity; + // On defini critere recherche compteur - $mask=$conf->global->PROPALE_SAPHIR_MASK; + if (! empty($conf->global->$constant)) { + $mask = $conf->global->$constant; // for multicompany proposal sharing + } else { + $mask = $conf->global->PROPALE_SAPHIR_MASK; + } if (! $mask) {