--- /tmp/dsg/dolibarr/htdocs/core/modules/reception/github_19.0.3_mod_reception_beryl.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/reception/client_mod_reception_beryl.php @@ -31,4 +31,4 @@ - public $version = 'dolibarr'; - public $prefix = 'RCP'; - public $error = ''; - public $nom = 'Beryl'; + public $version = 'dolibarr'; + public $prefix = 'RCP'; + public $error = ''; + public $nom = 'Beryl'; @@ -40,2 +40 @@ - * @param Translate $langs Lang object to use for output - * @return string Descriptive text + * @return string text description @@ -43,5 +42,5 @@ - public function info($langs) - { - global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); - } + public function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + } @@ -64,2 +63 @@ - * @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 conflit, true if ok @@ -67 +65 @@ - public function canBeActivated($object) + public function canBeActivated() @@ -71,2 +69 @@ - $coyymm = ''; - $max = ''; + $coyymm = ''; $max = ''; @@ -81 +78,2 @@ - if ($resql) { + if ($resql) + { @@ -83,4 +81 @@ - if ($row) { - $coyymm = substr($row[0], 0, 6); - $max = $row[0]; - } + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } @@ -88 +83,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)) + { @@ -101 +97 @@ - * @param Object $reception Reception object + * @param Object $shipment Shipment object @@ -104 +100 @@ - public function getNextValue($objsoc, $reception) + public function getNextValue($objsoc, $shipment) @@ -115 +111,2 @@ - if ($resql) { + if ($resql) + { @@ -117,6 +114,5 @@ - if ($obj) { - $max = intval($obj->max); - } else { - $max = 0; - } - } else { + if ($obj) $max = intval($obj->max); + else $max = 0; + } + else + { @@ -128 +124 @@ - $yymm = dol_print_date($date, "%y%m"); + $yymm = strftime("%y%m", $date); @@ -130,5 +126,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/reception/github_19.0.3_mod_reception_moonstone.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/reception/client_mod_reception_moonstone.php @@ -33,3 +33,3 @@ - public $version = 'dolibarr'; - public $error = ''; - public $nom = 'Moonstone'; + public $version = 'dolibarr'; + public $error = ''; + public $nom = 'Moonstone'; @@ -37,9 +37,8 @@ - /** - * Return default description of numbering model - * - * @param Translate $langs Lang object to use for output - * @return string Descriptive text - */ - public function info($langs) - { - global $langs, $db; + /** + * Return default description of numbering model + * + * @return string text description + */ + public function info() + { + global $conf, $langs, $db; @@ -65,2 +64,2 @@ - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= '  '; @@ -72 +71 @@ - } + } @@ -79,3 +78,3 @@ - public function getExample() - { - global $langs, $mysoc; + public function getExample() + { + global $conf, $langs, $mysoc; @@ -83,5 +82,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, null); + $old_code_client = $mysoc->code_client; + $old_code_type = $mysoc->typent_code; + $mysoc->code_client = 'CCCCCCCCCC'; + $mysoc->typent_code = 'TTTTTTTTTT'; + $numExample = $this->getNextValue($mysoc, ''); @@ -91 +90,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -95 +95 @@ - } + } @@ -100,3 +100,3 @@ - * @param Societe $objsoc Third party object - * @param Object|null $reception Reception object - * @return string Value if OK, 0 if KO + * @param Societe $objsoc Third party object + * @param Object $reception Reception object + * @return string Value if OK, 0 if KO @@ -104,3 +104,3 @@ - public function getNextValue($objsoc, $reception) - { - global $db; + public function getNextValue($objsoc, $reception) + { + global $db, $conf; @@ -110 +110 @@ - $mask = getDolGlobalString("RECEPTION_MOONSTONE_MASK"); + $mask = $conf->global->RECEPTION_MOONSTONE_MASK; @@ -112 +112,2 @@ - if (!$mask) { + if (!$mask) + { @@ -117,5 +118 @@ - if (!empty($reception)) { - $date = $reception->date_reception; - } else { - $date = dol_now(); - } + $date = $reception->date_reception; @@ -126 +123 @@ - } + } --- /tmp/dsg/dolibarr/htdocs/core/modules/reception/github_19.0.3_modules_reception.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/reception/client_modules_reception.php @@ -25,3 +25 @@ - -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'; @@ -34,2 +32,5 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** @@ -38,3 +39,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 @@ -44,0 +46,2 @@ + global $conf; + @@ -46 +49 @@ - $list = array(); + $liste = array(); @@ -49 +52 @@ - $list = getListOfModels($db, $type, $maxfilenamelength); + $liste = getListOfModels($db, $type, $maxfilenamelength); @@ -51 +54 @@ - return $list; + return $liste; @@ -59 +62 @@ -abstract class ModelNumRefReception extends CommonNumRefGenerator +abstract class ModelNumRefReception @@ -61 +64,74 @@ - // No overload code + public $error = ''; + + /** Return if a model can be used or not + * + * @return boolean true if model 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("reception"); + return $langs->trans("NoDescription"); + } + + /** + * Returns numbering example + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("reception"); + return $langs->trans("NoExample"); + } + + /** + * Test if existing numbers make problems with numbering + * + * @return boolean false if conflit, true if ok + */ + public function canBeActivated() + { + return true; + } + + /** + * Returns next value assigned + * + * @param Societe $objsoc Third party object + * @param Object $shipment Shipment object + * @return string Value + */ + public function getNextValue($objsoc, $shipment) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Returns version of the numbering model + * + * @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; + return $langs->trans("NotAvailable"); + }