--- /tmp/dsg/dolibarr/htdocs/core/modules/propale/github_19.0.3_mod_propale_marbre.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/propale/client_mod_propale_marbre.php @@ -30 +30 @@ - * Class to manage business proposition rules Marbre + * Class to manage customer order numbering rules Marbre @@ -50 +50 @@ - * @see $name + * @see name @@ -63,2 +63 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string Text with description @@ -66 +65 @@ - public function info($langs) + public function info() @@ -69 +68 @@ - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); @@ -88,2 +87 @@ - * @param Object $object Object we need next value for - * @return boolean false if KO (there is a conflict), true if OK + * @return boolean false if conflict, true if ok @@ -91 +89 @@ - public function canBeActivated($object) + public function canBeActivated() @@ -95,2 +93 @@ - $pryymm = ''; - $max = ''; + $pryymm = ''; $max = ''; @@ -105 +102,2 @@ - if ($resql) { + if ($resql) + { @@ -107,4 +105 @@ - if ($row) { - $pryymm = substr($row[0], 0, 6); - $max = $row[0]; - } + if ($row) { $pryymm = substr($row[0], 0, 6); $max = $row[0]; } @@ -113 +108,2 @@ - if (!$pryymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $pryymm)) { + if (!$pryymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $pryymm)) + { @@ -115 +111,3 @@ - } else { + } + else + { @@ -141 +139,2 @@ - if ($resql) { + if ($resql) + { @@ -143,6 +142,5 @@ - if ($obj) { - $max = intval($obj->max); - } else { - $max = 0; - } - } else { + if ($obj) $max = intval($obj->max); + else $max = 0; + } + else + { @@ -154 +152 @@ - $yymm = dol_print_date($date, "%y%m"); + $yymm = strftime("%y%m", $date); @@ -156,5 +154,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/propale/github_19.0.3_mod_propale_saphir.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/propale/client_mod_propale_saphir.php @@ -37,3 +37,3 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ @@ -43,3 +43,3 @@ - * @var string Error code (or message) - */ - public $error = ''; + * @var string Error code (or message) + */ + public $error = ''; @@ -50 +50 @@ - * @see $name + * @see name @@ -60,9 +60,8 @@ - /** - * Return description of module - * - * @param Translate $langs Lang object to use for output - * @return string Descriptive text - */ - public function info($langs) - { - global $conf, $langs, $db; + /** + * Return description of module + * + * @return string Texte descripif + */ + public function info() + { + global $conf, $langs, $db; @@ -89,2 +88 @@ - $mask = !getDolGlobalString('PROPALE_SAPHIR_MASK') ? '' : $conf->global->PROPALE_SAPHIR_MASK; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; @@ -92 +90 @@ - $texte .= '  '; + $texte .= '  '; @@ -100 +98 @@ - } + } @@ -102,8 +100,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; @@ -111,5 +109,5 @@ - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); + $old_code_client = $mysoc->code_client; + $old_code_type = $mysoc->typent_code; + $mysoc->code_client = 'CCCCCCCCCC'; + $mysoc->typent_code = 'TTTTTTTTTT'; + $numExample = $this->getNextValue($mysoc, ''); @@ -119 +117,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -123 +122 @@ - } + } @@ -139 +138 @@ - $mask = !getDolGlobalString('PROPALE_SAPHIR_MASK') ? '' : $conf->global->PROPALE_SAPHIR_MASK; + $mask = $conf->global->PROPALE_SAPHIR_MASK; @@ -141 +140,2 @@ - if (!$mask) { + if (!$mask) + { @@ -149 +149 @@ - $date = empty($propal->date) ? dol_now() : $propal->date; + $date = $propal->date; --- /tmp/dsg/dolibarr/htdocs/core/modules/propale/github_19.0.3_modules_propale.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/propale/client_modules_propale.php @@ -31 +30,0 @@ -require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; @@ -40,16 +39,4 @@ - public $posxpicture; - public $posxtva; - public $posxup; - public $posxqty; - public $posxunit; - public $posxdesc; - public $posxdiscount; - public $postotalht; - - public $tva; - public $tva_array; - public $localtax1; - public $localtax2; - - public $atleastonediscount = 0; - public $atleastoneratenotnull = 0; + /** + * @var string Error code (or message) + */ + public $error = ''; @@ -58 +45 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -62,3 +49,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 @@ -68 +55,3 @@ - // phpcs:enable + // phpcs:enable + global $conf; + @@ -70 +59 @@ - $list = array(); + $liste = array(); @@ -73 +62 @@ - $list = getListOfModels($db, $type, $maxfilenamelength); + $liste = getListOfModels($db, $type, $maxfilenamelength); @@ -75 +64 @@ - return $list; + return $liste; @@ -81 +70 @@ - * Parent class for numbering rules of proposals + * Classe mere des modeles de numerotation des references de propales @@ -83 +72 @@ -abstract class ModeleNumRefPropales extends CommonNumRefGenerator +abstract class ModeleNumRefPropales @@ -85 +74,79 @@ - // 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; + } + + /** + * Renvoi la description par defaut du modele de numerotation + * + * @return string Texte descripif + */ + public function info() + { + global $langs; + $langs->load("propale"); + return $langs->trans("NoDescription"); + } + + /** + * Return an example of numbering + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("propale"); + 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; + } + + /** + * Renvoi prochaine valeur attribuee + * + * @param Societe $objsoc Object third party + * @param Propal $propal Object commercial proposal + * @return string Valeur + */ + public function getNextValue($objsoc, $propal) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Renvoi version du module numerotation + * + * @return string Valeur + */ + 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"); + }