--- /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/github_19.0.3_mod_arctic.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/client_mod_arctic.php @@ -35,4 +35,4 @@ - /** - * Dolibarr version of the loaded document - * @var string - */ + /** + * Dolibarr version of the loaded document + * @var string + */ @@ -60,8 +60,7 @@ - * Returns the description of the numbering model - * - * @param Translate $langs Lang object to use for output - * @return string Descriptive text - */ - public function info($langs) - { - global $db, $langs; + * Returns the description of the numbering model + * + * @return string Texte descripif + */ + public function info() + { + global $db, $conf, $langs; @@ -88 +87 @@ - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; @@ -90 +89 @@ - $texte .= '  '; + $texte .= '  '; @@ -98 +97 @@ - } + } @@ -100,8 +99,8 @@ - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $conf, $langs, $mysoc; + /** + * Return an example of numbering + * + * @return string Example + */ + public function getExample() + { + global $conf, $langs, $mysoc; @@ -109,3 +108,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, ''); @@ -114 +113,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -118 +118 @@ - } + } @@ -127,2 +127,2 @@ - public function getNextValue($objsoc = 0, $object = '') - { + public function getNextValue($objsoc = 0, $object = '') + { @@ -134 +134 @@ - $mask = getDolGlobalString("FICHINTER_ARTIC_MASK"); + $mask = $conf->global->FICHINTER_ARTIC_MASK; @@ -136 +136,2 @@ - if (!$mask) { + if (!$mask) + { @@ -144 +145 @@ - } + } @@ -150 +151 @@ - * @param Societe $objsoc Object third party + * @param Societe $objsoc Object third party @@ -152,6 +153,6 @@ - * @return string Next free value - */ - public function getNumRef($objsoc, $objforref) - { - return $this->getNextValue($objsoc, $objforref); - } + * @return string Next free value + */ + public function getNumRef($objsoc, $objforref) + { + return $this->getNextValue($objsoc, $objforref); + } --- /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/github_19.0.3_mod_pacific.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/client_mod_pacific.php @@ -33,4 +33,4 @@ - /** - * Dolibarr version of the loaded document - * @var string - */ + /** + * Dolibarr version of the loaded document + * @var string + */ @@ -62,8 +62,7 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text - */ - public function info($langs) - { - global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); - } + * @return string Text with description + */ + public function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + } @@ -85,2 +84 @@ - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @return boolean false if conflict, true if ok @@ -88 +86 @@ - public function canBeActivated($object) + public function canBeActivated() @@ -94,2 +92 @@ - $fayymm = ''; - $max = ''; + $fayymm = ''; $max = ''; @@ -104 +101,2 @@ - if ($resql) { + if ($resql) + { @@ -106,4 +104 @@ - if ($row) { - $fayymm = substr($row[0], 0, 6); - $max = $row[0]; - } + if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; } @@ -111 +106,2 @@ - if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { + if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) + { @@ -113 +109,3 @@ - } else { + } + else + { @@ -139 +137,2 @@ - if ($resql) { + if ($resql) + { @@ -141,5 +140,2 @@ - if ($obj) { - $max = intval($obj->max); - } else { - $max = 0; - } + if ($obj) $max = intval($obj->max); + else $max = 0; @@ -150 +146 @@ - $yymm = dol_print_date($date, "%y%m"); + $yymm = strftime("%y%m", $date); @@ -152,5 +148,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); --- /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/github_19.0.3_modules_fichinter.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/fichinter/client_modules_fichinter.php @@ -30 +29,0 @@ -require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; @@ -37,0 +37,6 @@ + /** + * @var string Error code (or message) + */ + public $error = ''; + + @@ -48,0 +54,2 @@ + global $conf; + @@ -63 +70 @@ -abstract class ModeleNumRefFicheinter extends CommonNumRefGenerator +abstract class ModeleNumRefFicheinter @@ -65 +72,77 @@ - // 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; + } + + /** + * Returns the default description of the numbering template + * + * @return string Descriptive text + */ + public function info() + { + global $langs; + $langs->load("ficheinter"); + return $langs->trans("NoDescription"); + } + + /** + * Return a numbering example + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("ficheinter"); + return $langs->trans("NoExample"); + } + + /** + * Checks if the numbers already in the database do not + * cause conflicts that would prevent this numbering working. + * + * @return boolean false if conflict, true if ok + */ + public function canBeActivated() + { + return true; + } + + /** + * Return the next assigned value + * + * @return string Value + */ + public function getNextValue() + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Return the version of the numbering module + * + * @return string Value + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("NotAvailable"); + } @@ -85 +168 @@ - global $conf, $langs; + global $conf, $langs, $user; @@ -93,2 +176,4 @@ - if (!dol_strlen($modele)) { - if (getDolGlobalString('FICHEINTER_ADDON_PDF')) { + if (!dol_strlen($modele)) + { + if (!empty($conf->global->FICHEINTER_ADDON_PDF)) + { @@ -96 +181,3 @@ - } else { + } + else + { @@ -103 +190,2 @@ - if (!empty($tmp[1])) { + if (!empty($tmp[1])) + { @@ -109,3 +197 @@ - $file = ''; - $classname = ''; - $filefound = 0; + $file = ''; $classname = ''; $filefound = 0; @@ -113,5 +199,5 @@ - if (is_array($conf->modules_parts['models'])) { - $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); - } - foreach ($dirmodels as $reldir) { - foreach (array('doc', 'pdf') as $prefix) { + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + foreach (array('doc', 'pdf') as $prefix) + { @@ -122 +208,2 @@ - if (file_exists($file)) { + if (file_exists($file)) + { @@ -128,3 +215 @@ - if ($filefound) { - break; - } + if ($filefound) break; @@ -134 +219,2 @@ - if ($filefound) { + if ($filefound) + { @@ -142 +228,2 @@ - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) { + if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) + { @@ -150 +237,3 @@ - } else { + } + else + { @@ -155 +244,3 @@ - } else { + } + else + {