--- /tmp/dsg/dolibarr/htdocs/core/modules/expensereport/github_19.0.3_mod_expensereport_jade.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expensereport/client_mod_expensereport_jade.php
@@ -60,4 +60,3 @@
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
- */
- public function info($langs)
+ * @return string Text with description
+ */
+ public function info()
@@ -85,4 +84,3 @@
- * @param Object $object Object we need next value for
- * @return boolean false if conflict, true if ok
- */
- public function canBeActivated($object)
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
@@ -92,2 +90 @@
- $coyymm = '';
- $max = '';
+ $coyymm = ''; $max = '';
@@ -102 +99,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -104,6 +102,4 @@
- if ($row) {
- $coyymm = substr($row[0], 0, 6);
- $max = $row[0];
- }
- }
- if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
+ }
+ if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
+ {
@@ -129 +125,2 @@
- if (getDolGlobalString('EXPENSEREPORT_USE_OLD_NUMBERING_RULE')) {
+ if ($conf->global->EXPENSEREPORT_USE_OLD_NUMBERING_RULE)
+ {
@@ -131 +128,2 @@
- if ($object->fk_user_author > 0) {
+ if ($object->fk_user_author > 0)
+ {
@@ -136,2 +134,2 @@
- $expld_car = (!getDolGlobalString('NDF_EXPLODE_CHAR')) ? "-" : $conf->global->NDF_EXPLODE_CHAR;
- $num_car = (!getDolGlobalString('NDF_NUM_CAR_REF')) ? "5" : $conf->global->NDF_NUM_CAR_REF;
+ $expld_car = (empty($conf->global->NDF_EXPLODE_CHAR)) ? "-" : $conf->global->NDF_EXPLODE_CHAR;
+ $num_car = (empty($conf->global->NDF_NUM_CAR_REF)) ? "5" : $conf->global->NDF_NUM_CAR_REF;
@@ -163,3 +161 @@
- if (getDolGlobalString('EXPENSE_REPORT_PREFIX')) {
- $prefix = $conf->global->EXPENSE_REPORT_PREFIX;
- }
+ if (!empty($conf->global->EXPENSE_REPORT_PREFIX)) $prefix = $conf->global->EXPENSE_REPORT_PREFIX;
@@ -168 +164 @@
- $sqlbis = 'UPDATE '.MAIN_DB_PREFIX.'expensereport SET ref_number_int = '.((int) $ref_number_int).' WHERE rowid = '.((int) $object->id);
+ $sqlbis = 'UPDATE '.MAIN_DB_PREFIX.'expensereport SET ref_number_int = '.$ref_number_int.' WHERE rowid = '.$object->id;
@@ -170 +166,2 @@
- if (!$resqlbis) {
+ if (!$resqlbis)
+ {
@@ -187 +184,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -189,6 +187,5 @@
- if ($obj) {
- $max = intval($obj->max);
- } else {
- $max = 0;
- }
- } else {
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
+ }
+ else
+ {
@@ -200 +197,2 @@
- if (empty($date)) {
+ if (empty($date))
+ {
@@ -205,7 +203,4 @@
- $yymm = dol_print_date($date, "%y%m");
-
- 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);
- }
+ $yymm = strftime("%y%m", $date);
+
+ 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/expensereport/github_19.0.3_mod_expensereport_sand.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expensereport/client_mod_expensereport_sand.php
@@ -34,3 +34,3 @@
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
@@ -57,9 +57,8 @@
- /**
- * 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, $conf, $langs;
+ /**
+ * Returns the description of the numbering model
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $db, $conf, $langs;
@@ -86,2 +85 @@
- $mask = !getDolGlobalString('EXPENSEREPORT_SAND_MASK') ? '' : $conf->global->EXPENSEREPORT_SAND_MASK;
- $texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).' | ';
+ $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).' | ';
@@ -89 +87 @@
- $texte .= ' | ';
+ $texte .= ' | ';
@@ -97 +95 @@
- }
+ }
@@ -99,8 +97,8 @@
- /**
- * Return an example of numbering
- *
- * @return string Example
- */
- public function getExample()
- {
- global $db, $conf, $langs, $user;
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $db, $conf, $langs, $user;
@@ -108,3 +106,3 @@
- $exp = new ExpenseReport($db);
- $exp->initAsSpecimen();
- $exp->fk_user_author = $user->id;
+ $exp = new ExpenseReport($db);
+ $exp->initAsSpecimen();
+ $exp->fk_user_author = $user->id;
@@ -112 +110 @@
- $numExample = $this->getNextValue($exp);
+ $numExample = $this->getNextValue($exp);
@@ -114 +112,2 @@
- if (!$numExample) {
+ if (!$numExample)
+ {
@@ -118 +117 @@
- }
+ }
@@ -120,9 +119,9 @@
- /**
- * Return next free value
- *
- * @param Object $object Object we need next value for
- * @return string Value if KO, <0 if KO
- */
- public function getNextValue($object)
- {
- global $db, $conf;
+ /**
+ * Return next free value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Value if KO, <0 if KO
+ */
+ public function getNextValue($object)
+ {
+ global $db, $conf;
@@ -133 +132 @@
- $mask = !getDolGlobalString('EXPENSEREPORT_SAND_MASK') ? '' : $conf->global->EXPENSEREPORT_SAND_MASK;
+ $mask = $conf->global->EXPENSEREPORT_SAND_MASK;
@@ -135 +134,2 @@
- if (!$mask) {
+ if (!$mask)
+ {
@@ -141 +141,2 @@
- if (empty($date)) {
+ if (empty($date))
+ {
@@ -147 +148,2 @@
- if ($object->fk_user_author > 0) {
+ if ($object->fk_user_author > 0)
+ {
@@ -155 +157 @@
- }
+ }
--- /tmp/dsg/dolibarr/htdocs/core/modules/expensereport/github_19.0.3_modules_expensereport.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/expensereport/client_modules_expensereport.php
@@ -19 +18,0 @@
-require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
@@ -27 +26,7 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -30,5 +35,5 @@
- *
- * @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
+ */
@@ -37 +42,3 @@
- // phpcs:enable
+ // phpcs:enable
+ global $conf;
+
@@ -63 +70 @@
- return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
@@ -67 +74,2 @@
- * Parent class for numbering masks of expense reports
+ * \class ModeleNumRefExpenseReport
+ * \brief Parent class for numbering masks of expense reports
@@ -69 +77,2 @@
-abstract class ModeleNumRefExpenseReport extends CommonNumRefGenerator
+
+abstract class ModeleNumRefExpenseReport
@@ -71 +80,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;
+ }
+
+ /**
+ * Returns the default description of the numbering model
+ *
+ * @return string Descriptive text
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("orders");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Returns an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("trips");
+ return $langs->trans("NoExample");
+ }
+
+ /**
+ * Test whether the numbers already in force in the base do not cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
+
+ /**
+ * Returns next assigned value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Value
+ */
+ public function getNextValue($object)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
+
+ /**
+ * Returns 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");
+ }