--- /tmp/dsg/dolibarr/htdocs/core/modules/expedition/github_19.0.3_mod_expedition_ribera.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expedition/client_mod_expedition_ribera.php
@@ -34,3 +34,3 @@
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
@@ -59,2 +59 @@
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
+ * @return string text description
@@ -62,3 +61,3 @@
- public function info($langs)
- {
- global $langs, $db;
+ public function info()
+ {
+ global $conf, $langs, $db;
@@ -84,2 +83,2 @@
- $texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).' | ';
- $texte .= ' | ';
+ $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).' | ';
+ $texte .= ' | ';
@@ -91 +90 @@
- }
+ }
@@ -98,3 +97,3 @@
- public function getExample()
- {
- global $conf, $langs, $mysoc;
+ public function getExample()
+ {
+ global $conf, $langs, $mysoc;
@@ -102,5 +101,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, '');
@@ -110 +109,2 @@
- if (!$numExample) {
+ if (!$numExample)
+ {
@@ -114 +114 @@
- }
+ }
@@ -123,2 +123,2 @@
- public function getNextValue($objsoc, $shipment)
- {
+ public function getNextValue($objsoc, $shipment)
+ {
@@ -129 +129 @@
- $mask = getDolGlobalString('EXPEDITION_RIBERA_MASK');
+ $mask = $conf->global->EXPEDITION_RIBERA_MASK;
@@ -131 +131,2 @@
- if (empty($mask)) {
+ if (!$mask)
+ {
@@ -143 +144 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -151,5 +152,5 @@
- public function expedition_get_num($objsoc, $objforref)
- {
- // phpcs:enable
- return $this->getNextValue($objsoc, $objforref);
- }
+ public function expedition_get_num($objsoc, $objforref)
+ {
+ // phpcs:enable
+ return $this->getNextValue($objsoc, $objforref);
+ }
--- /tmp/dsg/dolibarr/htdocs/core/modules/expedition/github_19.0.3_mod_expedition_safor.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expedition/client_mod_expedition_safor.php
@@ -32,3 +32,3 @@
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
@@ -60,2 +60 @@
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
+ * @return string text description
@@ -63,5 +62,5 @@
- public function info($langs)
- {
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
- }
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
@@ -75 +74 @@
- public function getExample()
+ public function getExample()
@@ -84,2 +83 @@
- * @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
@@ -87 +85 @@
- public function canBeActivated($object)
+ public function canBeActivated()
@@ -91,2 +89 @@
- $coyymm = '';
- $max = '';
+ $coyymm = ''; $max = '';
@@ -101 +98,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -103,4 +101 @@
- if ($row) {
- $coyymm = substr($row[0], 0, 6);
- $max = $row[0];
- }
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
@@ -108 +103,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))
+ {
@@ -124 +120 @@
- public function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
@@ -135 +131,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -137,6 +134,5 @@
- if ($obj) {
- $max = intval($obj->max);
- } else {
- $max = 0;
- }
- } else {
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
+ }
+ else
+ {
@@ -147,2 +143,2 @@
- $date = $shipment->date_creation;
- $yymm = dol_print_date($date, "%y%m");
+ $date = time();
+ $yymm = strftime("%y%m", $date);
@@ -150,5 +146,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);
@@ -160 +153 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -168 +161 @@
- public function expedition_get_num($objsoc, $objforref)
+ public function expedition_get_num($objsoc, $objforref)
@@ -170 +163 @@
- // phpcs:enable
+ // phpcs:enable
--- /tmp/dsg/dolibarr/htdocs/core/modules/expedition/github_19.0.3_modules_expedition.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expedition/client_modules_expedition.php
@@ -32,4 +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';
@@ -42 +39,7 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -46,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
@@ -52 +55,3 @@
- // phpcs:enable
+ // phpcs:enable
+ global $conf;
+
@@ -67 +72 @@
-abstract class ModelNumRefExpedition extends CommonNumRefGenerator
+abstract class ModelNumRefExpedition
@@ -69 +74,77 @@
- // No overload code
+ /**
+ * @var string Error code (or message)
+ */
+ 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("sendings");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Returns numbering example
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("sendings");
+ 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;
+ }
+
+ /**
+ * 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");
+ 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");
+ }