--- /tmp/dsg/dolibarr/htdocs/core/modules/contract/github_19.0.3_mod_contract_magre.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/client_mod_contract_magre.php @@ -34,3 +34,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -64,2 +64 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string text description @@ -67,3 +66,3 @@ - public function info($langs) - { - global $langs, $db; + public function info() + { + global $conf, $langs, $db; @@ -89,2 +88,2 @@ - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= '  '; @@ -96 +95 @@ - } + } @@ -103,3 +102,3 @@ - public function getExample() - { - global $langs, $mysoc; + public function getExample() + { + global $conf, $langs, $mysoc; @@ -107,3 +106,3 @@ - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); + $old_code_client = $mysoc->code_client; + $mysoc->code_client = 'CCCCCCCCCC'; + $numExample = $this->getNextValue($mysoc, ''); @@ -112 +111,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -116 +116 @@ - } + } @@ -125,3 +125,3 @@ - public function getNextValue($objsoc, $contract) - { - global $db; + public function getNextValue($objsoc, $contract) + { + global $db, $conf; @@ -131 +131 @@ - $mask = getDolGlobalString("CONTRACT_MAGRE_MASK"); + $mask = $conf->global->CONTRACT_MAGRE_MASK; @@ -133 +133,2 @@ - if (!$mask) { + if (!$mask) + { @@ -143 +144 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -150,6 +151,6 @@ - */ - public function contract_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } + */ + public function contract_get_num($objsoc, $objforref) + { + // phpcs:enable + return $this->getNextValue($objsoc, $objforref); + } --- /tmp/dsg/dolibarr/htdocs/core/modules/contract/github_19.0.3_mod_contract_olive.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/client_mod_contract_olive.php @@ -35 +35 @@ - /** + /** @@ -56,3 +56,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -70,2 +70 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string Description of module @@ -73 +72 @@ - public function info($langs) + public function info() @@ -79,10 +77,0 @@ - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - return ''; @@ -99,0 +89 @@ + global $langs; @@ -124 +114,2 @@ - if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED')) { + if (empty($code) && $this->code_null && empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) + { @@ -126 +117,3 @@ - } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED'))) { + } + elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED))) + { --- /tmp/dsg/dolibarr/htdocs/core/modules/contract/github_19.0.3_mod_contract_serpis.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/client_mod_contract_serpis.php @@ -32,3 +32,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -65,2 +65 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string text description @@ -68,5 +67,5 @@ - public function info($langs) - { - global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); - } + public function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + } @@ -89,2 +88 @@ - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @return boolean false if conflit, true if ok @@ -92 +90 @@ - public function canBeActivated($object) + public function canBeActivated() @@ -96,2 +94 @@ - $coyymm = ''; - $max = ''; + $coyymm = ''; $max = ''; @@ -106 +103,2 @@ - if ($resql) { + if ($resql) + { @@ -108,4 +106 @@ - if ($row) { - $coyymm = substr($row[0], 0, 6); - $max = $row[0]; - } + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } @@ -113 +108,2 @@ - if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { + if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) + { @@ -140 +136,2 @@ - if ($resql) { + if ($resql) + { @@ -142,6 +139,5 @@ - if ($obj) { - $max = intval($obj->max); - } else { - $max = 0; - } - } else { + if ($obj) $max = intval($obj->max); + else $max = 0; + } + else + { @@ -153 +149 @@ - $yymm = dol_print_date($date, "%y%m"); + $yymm = strftime("%y%m", $date); @@ -155,5 +151,2 @@ - if ($max >= (pow(10, 4) - 1)) { - $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - } else { - $num = sprintf("%04s", $max + 1); - } + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is + else $num = sprintf("%04s", $max + 1); @@ -166 +159 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -176 +169 @@ - // phpcs:enable + // phpcs:enable --- /tmp/dsg/dolibarr/htdocs/core/modules/contract/github_19.0.3_modules_contract.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/client_modules_contract.php @@ -32,2 +32 @@ -require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; @@ -41 +40,7 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * @var string Error code (or message) + */ + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -45,3 +50,3 @@ - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates @@ -49 +54 @@ - public static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) @@ -51 +56,3 @@ - // phpcs:enable + // phpcs:enable + global $conf; + @@ -53 +60 @@ - $list = array(); + $liste = array(); @@ -56 +63 @@ - $list = getListOfModels($db, $type, $maxfilenamelength); + $liste = getListOfModels($db, $type, $maxfilenamelength); @@ -58 +65 @@ - return $list; + return $liste; @@ -66 +73 @@ -class ModelNumRefContracts extends CommonNumRefGenerator +class ModelNumRefContracts @@ -68 +75,78 @@ - // No overload code + /** + * @var string Error code (or message) + */ + public $error = ''; + + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + public function isEnabled() + { + return true; + } + + /** + * Return default description of numbering model + * + * @return string text description + */ + public function info() + { + global $langs; + $langs->load("contracts"); + return $langs->trans("NoDescription"); + } + + /** + * Return numbering example + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("contracts"); + return $langs->trans("NoExample"); + } + + /** + * Test if existing numbers make problems with numbering + * + * @return boolean false if conflict, true if ok + */ + public function canBeActivated() + { + return true; + } + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $contract contract object + * @return string Value + */ + public function getNextValue($objsoc, $contract) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Return numbering version module + * + * @return string Value + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; + return $langs->trans("NotAvailable"); + }