--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/github_19.0.3_mod_commande_fournisseur_muguet.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/client_mod_commande_fournisseur_muguet.php
@@ -57 +57 @@
- public $prefix = 'PO'; // PO for "Purchase Order"
+ public $prefix = 'CF';
@@ -65,3 +65,3 @@
- if (getDolGlobalInt('MAIN_VERSION_LAST_INSTALL') < 5) {
- $this->prefix = 'CF'; // We use old prefix
- }
+ global $conf;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) $this->prefix = 'PO'; // We use correct standard code "PO = Purchase Order"
@@ -73,2 +73 @@
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
+ * @return string Text with description
@@ -76 +75 @@
- public function info($langs)
+ public function info()
@@ -79 +78 @@
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -98,2 +97 @@
- * @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
@@ -101 +99 @@
- public function canBeActivated($object)
+ public function canBeActivated()
@@ -105,2 +103 @@
- $coyymm = '';
- $max = '';
+ $coyymm = ''; $max = '';
@@ -114 +111,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -116,4 +114 @@
- if ($row) {
- $coyymm = substr($row[0], 0, 6);
- $max = $row[0];
- }
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
@@ -121 +116,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))
+ {
@@ -123 +119,3 @@
- } else {
+ }
+ else
+ {
@@ -149 +147,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -151,5 +150,2 @@
- if ($obj) {
- $max = intval($obj->max);
- } else {
- $max = 0;
- }
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
@@ -160,4 +156,2 @@
- if (empty($date)) {
- $date = $object->date; // Creation date is order date for suppliers orders
- }
- $yymm = dol_print_date($date, "%y%m");
+ if (empty($date)) $date = $object->date; // Creation date is order date for suppliers orders
+ $yymm = strftime("%y%m", $date);
@@ -165,5 +159,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);
@@ -181 +172 @@
- * @return string Descriptive text
+ * @return string Texte descripif
--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/github_19.0.3_mod_commande_fournisseur_orchidee.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/client_mod_commande_fournisseur_orchidee.php
@@ -36,3 +36,3 @@
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
@@ -42,3 +42,3 @@
- * @var string Error code (or message)
- */
- public $error = '';
+ * @var string Error code (or message)
+ */
+ public $error = '';
@@ -59,9 +59,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, $langs;
+ /**
+ * Returns the description of the numbering model
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $db, $conf, $langs;
@@ -70 +69 @@
- $langs->loadLangs(array("bills", "admin"));
+ $langs->loadLangs(array("bills", "admin"));
@@ -89 +88 @@
- $texte .= '
'.$form->textwithpicto('', $tooltip, 1, 1).' | ';
+ $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).' | ';
@@ -91 +90 @@
- $texte .= ' | ';
+ $texte .= ' | ';
@@ -99 +98 @@
- }
+ }
@@ -101,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;
@@ -110,3 +109,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, '');
@@ -115 +114,2 @@
- if (!$numExample) {
+ if (!$numExample)
+ {
@@ -119 +119 @@
- }
+ }
@@ -126,4 +126,4 @@
- * @return string Value if OK, 0 if KO
- */
- public function getNextValue($objsoc = 0, $object = '')
- {
+ * @return string Value if OK, 0 if KO
+ */
+ public function getNextValue($objsoc = 0, $object = '')
+ {
@@ -135 +135 @@
- $mask = getDolGlobalString("COMMANDE_FOURNISSEUR_ORCHIDEE_MASK");
+ $mask = $conf->global->COMMANDE_FOURNISSEUR_ORCHIDEE_MASK;
@@ -137 +137,2 @@
- if (!$mask) {
+ if (!$mask)
+ {
@@ -148,4 +149,4 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Renvoie la reference de commande suivante non utilisee
- *
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Renvoie la reference de commande suivante non utilisee
+ *
@@ -154,7 +155,7 @@
- * @return string Descriptive text
- */
- public function commande_get_num($objsoc = 0, $object = '')
- {
- // phpcs:enable
- return $this->getNextValue($objsoc, $object);
- }
+ * @return string Texte descripif
+ */
+ public function commande_get_num($objsoc = 0, $object = '')
+ {
+ // phpcs:enable
+ return $this->getNextValue($objsoc, $object);
+ }
--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/github_19.0.3_modules_commandefournisseur.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_order/client_modules_commandefournisseur.php
@@ -32 +31,0 @@
-require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
@@ -41,8 +40,4 @@
- public $posxpicture;
- public $posxtva;
- public $posxup;
- public $posxqty;
- public $posxunit;
- public $posxdesc;
- public $posxdiscount;
- public $postotalht;
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
@@ -50,4 +44,0 @@
- public $tva;
- public $tva_array;
- public $localtax1;
- public $localtax2;
@@ -55,4 +46 @@
- public $atleastoneratenotnull = 0;
- public $atleastonediscount = 0;
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -62,3 +50,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,0 +57,2 @@
+ global $conf;
+
@@ -70 +60 @@
- $list = array();
+ $liste = array();
@@ -73 +63 @@
- $list = getListOfModels($db, $type, $maxfilenamelength);
+ $liste = getListOfModels($db, $type, $maxfilenamelength);
@@ -75 +65 @@
- return $list;
+ return $liste;
@@ -84 +74 @@
-abstract class ModeleNumRefSuppliersOrders extends CommonNumRefGenerator
+abstract class ModeleNumRefSuppliersOrders
@@ -86 +76,70 @@
- // 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 default description of numbering model
+ *
+ * @return string Description Text
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("orders");
+ return $langs->trans("NoDescription");
+ }
+
+ /** Returns a numbering example
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("orders");
+ return $langs->trans("NoExample");
+ }
+
+ /** Tests if existing numbers make problems with numbering
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
+
+ /** Returns next value assigned
+ *
+ * @return string Valeur
+ */
+ public function getNextValue()
+ {
+ 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");
+ }