--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/github_19.0.3_mod_supplier_proposal_marbre.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/client_mod_supplier_proposal_marbre.php @@ -30 +30 @@ - * Class to manage the Marbre numbering rule for Request for quotation + * Class to manage customer order numbering rules Marbre @@ -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 + { @@ -125,3 +123,3 @@ - * @param Societe $objsoc Object third party - * @param SupplierProposal $supplier_proposal Object commercial proposal - * @return string Next value + * @param Societe $objsoc Object third party + * @param Propal $supplier_proposal Object commercial proposal + * @return string Next value @@ -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/supplier_proposal/github_19.0.3_mod_supplier_proposal_saphir.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/client_mod_supplier_proposal_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 = ''; @@ -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 $langs, $db; + /** + * Return description of module + * + * @return string Texte descripif + */ + public function info() + { + global $conf, $langs, $db; @@ -87,2 +85,0 @@ - $mask = getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); - @@ -91 +88 @@ - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; @@ -93 +90 @@ - $texte .= '  '; + $texte .= '  '; @@ -101 +98 @@ - } + } @@ -103,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; @@ -112,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, ''); @@ -117 +114,2 @@ - if (!$numExample) { + if (!$numExample) + { @@ -121 +119 @@ - } + } @@ -126,3 +124,3 @@ - * @param Societe $objsoc Object third party - * @param SupplierProposal $supplier_proposal Object commercial proposal - * @return string Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param Propal $supplier_proposal Object supplier_proposal + * @return string Value if OK, 0 if KO @@ -137 +135 @@ - $mask = !getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK') ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; + $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; @@ -139 +137,2 @@ - if (!$mask) { + if (!$mask) + { @@ -144 +143 @@ - $date = $supplier_proposal->date; + $date = $supplier_proposal->datep; --- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/github_19.0.3_modules_supplier_proposal.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/client_modules_supplier_proposal.php @@ -31 +30,0 @@ -require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; @@ -40 +38,0 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -42,5 +40,12 @@ - * Return list of active generation modules - * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @var string Error code (or message) + */ + public $error = ''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates @@ -50 +55,3 @@ - // phpcs:enable + // phpcs:enable + global $conf; + @@ -52 +59 @@ - $list = array(); + $liste = array(); @@ -55 +62 @@ - $list = getListOfModels($db, $type, $maxfilenamelength); + $liste = getListOfModels($db, $type, $maxfilenamelength); @@ -57 +64 @@ - return $list; + return $liste; @@ -65 +72 @@ -abstract class ModeleNumRefSupplierProposal extends CommonNumRefGenerator +abstract class ModeleNumRefSupplierProposal @@ -67 +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("supplier_proposal"); + return $langs->trans("NoDescription"); + } + + /** + * Return an example of numbering + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("supplier_proposal"); + 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"); + }