--- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codeclient_elephant.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codeclient_elephant.php @@ -4,7 +4,6 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand - * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,30 +39,18 @@ */ public $name = 'Elephant'; - /** - * @var int Code modifiable - */ - public $code_modifiable; - - /** - * @var int Code modifiable si il est invalide - */ - public $code_modifiable_invalide; - - /** - * @var int Code modifiables si il est null - */ - public $code_modifiable_null; - - /** - * @var int Code facultatif - */ - public $code_null; - - /** - * Dolibarr version of the loaded document - * @var string - */ + public $code_modifiable; // Code modifiable + + public $code_modifiable_invalide; // Code modifiable si il est invalide + + public $code_modifiable_null; // Code modifiables si il est null + + public $code_null; // Code facultatif + + /** + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** @@ -71,20 +58,11 @@ */ public $code_auto; - /** - * @var string search string - */ - public $searchcode; - - /** - * @var int Nombre de chiffres du compteur - */ - public $numbitcounter; - - /** - * @var int thirdparty prefix is required when using {pre} - */ - public $prefixIsRequired; + public $searchcode; // String de recherche + + public $numbitcounter; // Nombre de chiffres du compteur + + public $prefixIsRequired; // Le champ prefix du tiers doit etre renseigne quand on utilise {pre} /** @@ -102,7 +80,7 @@ /** - * Return description of module + * Return description of module * * @param Translate $langs Object langs * @return string Description of module @@ -160,41 +138,56 @@ */ public function getExample($langs, $objsoc = 0, $type = -1) { - $examplecust = ''; - $examplesup = ''; - $errmsg = array( - "ErrorBadMask", - "ErrorCantUseRazIfNoYearInMask", - "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", - ); - if ($type != 1) { + if ($type == 0 || $type == -1) + { $examplecust = $this->getNextValue($objsoc, 0); - if (!$examplecust) { + if (!$examplecust) + { $examplecust = $langs->trans('NotConfigured'); } - if (in_array($examplecust, $errmsg)) { + if ($examplecust == "ErrorBadMask") + { $langs->load("errors"); $examplecust = $langs->trans($examplecust); } - } - if ($type != 0) { + if ($examplecust == "ErrorCantUseRazIfNoYearInMask") + { + $langs->load("errors"); + $examplecust = $langs->trans($examplecust); + } + if ($examplecust == "ErrorCantUseRazInStartedYearIfNoYearMonthInMask") + { + $langs->load("errors"); + $examplecust = $langs->trans($examplecust); + } + } + if ($type == 1 || $type == -1) + { $examplesup = $this->getNextValue($objsoc, 1); - if (!$examplesup) { + if (!$examplesup) + { $examplesup = $langs->trans('NotConfigured'); } - if (in_array($examplesup, $errmsg)) { + if ($examplesup == "ErrorBadMask") + { $langs->load("errors"); $examplesup = $langs->trans($examplesup); } - } - - if ($type == 0) { - return $examplecust; - } elseif ($type == 1) { - return $examplesup; - } else { - return $examplecust.'
'.$examplesup; - } + if ($examplesup == "ErrorCantUseRazIfNoYearInMask") + { + $langs->load("errors"); + $examplesup = $langs->trans($examplesup); + } + if ($examplesup == "ErrorCantUseRazInStartedYearIfNoYearMonthInMask") + { + $langs->load("errors"); + $examplesup = $langs->trans($examplesup); + } + } + + if ($type == 0) return $examplecust; + if ($type == 1) return $examplesup; + return $examplecust.'
'.$examplesup; } /** @@ -212,8 +205,8 @@ // Get Mask value $mask = ''; - if ($type == 0) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; - if ($type == 1) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER; + if ($type == 0) $mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; + if ($type == 1) $mask = $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER; if (!$mask) { $this->error = 'NotConfigured'; @@ -225,11 +218,13 @@ { $field = 'code_client'; //$where = ' AND client in (1,2)'; - } elseif ($type == 1) + } + elseif ($type == 1) { $field = 'code_fournisseur'; //$where = ' AND fournisseur = 1'; - } else return -1; + } + else return -1; $now = dol_now(); @@ -239,7 +234,7 @@ } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Check if mask/numbering use prefix * @@ -247,7 +242,7 @@ */ public function verif_prefixIsUsed() { - // phpcs:enable + // phpcs:enable global $conf; $mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; @@ -272,8 +267,7 @@ * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired - * -5 NotConfigured - Setup empty so any value may be ok or not - * -6 Other (see this->error) + * -5 Other (see this->error) */ public function verif($db, &$code, $soc, $type) { @@ -287,10 +281,13 @@ if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { $result = 0; - } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) + } + elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) { $result = -2; - } else { + } + else + { // Get Mask value $mask = ''; if ($type == 0) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; @@ -300,11 +297,12 @@ $this->error = 'NotConfigured'; return -5; } + $result = check_value($mask, $code); if (is_string($result)) { $this->error = $result; - return -6; + return -5; } } @@ -313,7 +311,7 @@ } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi si un code est pris ou non (par autre tiers) * @@ -325,10 +323,10 @@ */ public function verif_dispo($db, $code, $soc, $type = 0) { - // phpcs:enable + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; - if ($type == 1) $sql .= " WHERE code_fournisseur = '".$db->escape($code)."'"; - else $sql .= " WHERE code_client = '".$db->escape($code)."'"; + if ($type == 1) $sql .= " WHERE code_fournisseur = '".$code."'"; + else $sql .= " WHERE code_client = '".$code."'"; if ($soc->id > 0) $sql .= " AND rowid <> ".$soc->id; $resql = $db->query($sql); @@ -337,10 +335,14 @@ if ($db->num_rows($resql) == 0) { return 0; - } else { + } + else + { return -1; } - } else { + } + else + { return -2; } } --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codeclient_leopard.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codeclient_leopard.php @@ -52,9 +52,9 @@ public $code_null; // Code facultatif /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** @@ -77,7 +77,7 @@ /** - * Return description of module + * Return description of module * * @param Translate $langs Object langs * @return string Description of module @@ -126,7 +126,8 @@ if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { $result = 0; - } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) + } + elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) { $result = -2; } --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codeclient_monkey.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codeclient_monkey.php @@ -46,9 +46,9 @@ public $code_null; // Code facultatif /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** @@ -81,7 +81,7 @@ /** - * Return description of module + * Return description of module * * @param Translate $langs Object langs * @return string Description of module @@ -118,22 +118,22 @@ global $db, $conf, $mc; $field = ''; - $prefix = ''; + $prefix = ''; if ($type == 0) { $field = 'code_client'; - $prefix = $this->prefixcustomer; + $prefix = $this->prefixcustomer; } elseif ($type == 1) { $field = 'code_fournisseur'; - $prefix = $this->prefixsupplier; + $prefix = $this->prefixsupplier; } else { - return -1; - } - - // First, we get the max value (reponse immediate car champ indexe) - $posindice = strlen($prefix) + 6; - $sql = "SELECT MAX(CAST(SUBSTRING(".$field." FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL + return -1; + } + + // First, we get the max value (reponse immediate car champ indexe) + $posindice = strlen($prefix) + 6; + $sql = "SELECT MAX(CAST(SUBSTRING(".$field." FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE ".$field." LIKE '".$db->escape($prefix)."____-%'"; + $sql .= " WHERE ".$field." LIKE '".$prefix."____-%'"; $sql .= " AND entity IN (".getEntity('societe').")"; dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); @@ -144,7 +144,9 @@ $obj = $db->fetch_object($resql); if ($obj) $max = intval($obj->max); else $max = 0; - } else { + } + else + { return -1; } @@ -182,24 +184,33 @@ if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { $result = 0; - } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) + } + elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))) { $result = -2; - } else { + } + else + { if ($this->verif_syntax($code) >= 0) { $is_dispo = $this->verif_dispo($db, $code, $soc, $type); if ($is_dispo <> 0) { $result = -3; - } else { + } + else + { $result = 0; } - } else { + } + else + { if (dol_strlen($code) == 0) { $result = -2; - } else { + } + else + { $result = -1; } } @@ -210,7 +221,7 @@ } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi si un code est pris ou non (par autre tiers) * @@ -222,12 +233,12 @@ */ public function verif_dispo($db, $code, $soc, $type = 0) { - // phpcs:enable + // phpcs:enable global $conf, $mc; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; - if ($type == 1) $sql .= " WHERE code_fournisseur = '".$db->escape($code)."'"; - else $sql .= " WHERE code_client = '".$db->escape($code)."'"; + if ($type == 1) $sql .= " WHERE code_fournisseur = '".$code."'"; + else $sql .= " WHERE code_client = '".$code."'"; $sql .= " AND entity IN (".getEntity('societe').")"; if ($soc->id > 0) $sql .= " AND rowid <> ".$soc->id; @@ -238,16 +249,20 @@ if ($db->num_rows($resql) == 0) { return 0; - } else { + } + else + { return -1; } - } else { + } + else + { return -2; } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi si un code respecte la syntaxe * @@ -256,13 +271,15 @@ */ public function verif_syntax($code) { - // phpcs:enable + // phpcs:enable $res = 0; if (dol_strlen($code) < 11) { $res = -1; - } else { + } + else + { $res = 0; } return $res; --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codecompta_aquarium.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codecompta_aquarium.php @@ -37,9 +37,9 @@ public $name = 'Aquarium'; /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' public $prefixcustomeraccountancycode; @@ -54,11 +54,11 @@ */ public function __construct() { - global $conf; + global $conf; if (!isset($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) || trim($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) == '') $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER = '411'; - if (!isset($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) || trim($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) == '') $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER = '401'; + if (!isset($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) || trim($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) == '') $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER = '401'; $this->prefixcustomeraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER; - $this->prefixsupplieraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER; + $this->prefixsupplieraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER; } @@ -70,12 +70,12 @@ */ public function info($langs) { - global $conf; - global $form; + global $conf; + global $form; $langs->load("companies"); - $tooltip = ''; + $tooltip = ''; $texte = '
'; $texte .= ''; $texte .= ''; @@ -85,18 +85,16 @@ $s1 = $form->textwithpicto('', $tooltip, 1, 1); $s2 = $form->textwithpicto('', $tooltip, 1, 1); $texte .= ''; - // trans remove html entities - $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, '{s2}')."
\n"; - $texte .= $langs->trans("ModuleCompanyCodeSupplier".$this->name, '{s1}')."
\n"; - $texte = str_replace(array('{s1}', '{s2}'), array($s1, $s2), $texte); + $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."
\n"; + $texte .= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."
\n"; $texte .= "
\n"; if (!isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || !empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte .= $langs->trans('RemoveSpecialChars').' = '.yn(1)."
\n"; //if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_ALPHA').' = '.yn($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)."
\n"; if (!empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) $texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."
\n"; $texte .= ''; $texte .= ''; - $texte .= ''; - $texte .= '
'; + $texte .= ''; + $texte .= ''; return $texte; } @@ -113,13 +111,13 @@ { $s = ''; $s .= $this->prefixcustomeraccountancycode.'CUSTCODE'; - $s .= "
\n"; - $s .= $this->prefixsupplieraccountancycode.'SUPPCODE'; - return $s; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + $s .= "
\n"; + $s .= $this->prefixsupplieraccountancycode.'SUPPCODE'; + return $s; + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set accountancy account code for a third party into this->code * @@ -130,7 +128,7 @@ */ public function get_code($db, $societe, $type = '') { - // phpcs:enable + // phpcs:enable global $conf; $i = 0; @@ -143,11 +141,14 @@ { $codetouse = (!empty($societe->code_client) ? $societe->code_client : 'CUSTCODE'); $prefix = $this->prefixcustomeraccountancycode; - } elseif ($type == 'supplier') + } + elseif ($type == 'supplier') { $codetouse = (!empty($societe->code_fournisseur) ? $societe->code_fournisseur : 'SUPPCODE'); $prefix = $this->prefixsupplieraccountancycode; - } else { + } + else + { $this->error = 'Bad value for parameter type'; return -1; } @@ -170,7 +171,9 @@ if (!$is_dispo) { $this->code = $codetouse; - } else { + } + else + { // Pour retour $this->code = $codetouse; } @@ -207,11 +210,15 @@ { dol_syslog("mod_codecompta_aquarium::verif code '".$code."' available"); return 1; // Dispo - } else { + } + else + { dol_syslog("mod_codecompta_aquarium::verif code '".$code."' not available"); return 0; // Non dispo } - } else { + } + else + { $this->error = $db->error()." sql=".$sql; return -1; // Erreur } --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codecompta_digitaria.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codecompta_digitaria.php @@ -32,30 +32,30 @@ */ class mod_codecompta_digitaria extends ModeleAccountancyCode { - /** - * @var string model name - */ - public $name = 'Digitaria'; - - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' - - /** - * Prefix customer accountancy code - * @var string - */ - public $prefixcustomeraccountancycode; - - /** - * Prefix supplier accountancy code - * @var string - */ - public $prefixsupplieraccountancycode; - - public $position = 30; + /** + * @var string model name + */ + public $name = 'Digitaria'; + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + + /** + * Prefix customer accountancy code + * @var string + */ + public $prefixcustomeraccountancycode; + + /** + * Prefix supplier accountancy code + * @var string + */ + public $prefixsupplieraccountancycode; + + public $position = 30; /** @@ -63,16 +63,16 @@ */ public function __construct() { - global $conf, $langs; - if (!isset($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER = '411'; - if (!isset($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER = '401'; - $this->prefixcustomeraccountancycode = $conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER; - $this->prefixsupplieraccountancycode = $conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER; - - if (!isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER = '5'; - if (!isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER = '5'; - $this->customeraccountancycodecharacternumber = $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER; - $this->supplieraccountancycodecharacternumber = $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER; + global $conf, $langs; + if (!isset($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER = '411'; + if (!isset($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER = '401'; + $this->prefixcustomeraccountancycode = $conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER; + $this->prefixsupplieraccountancycode = $conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER; + + if (!isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER = '5'; + if (!isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER = '5'; + $this->customeraccountancycodecharacternumber = $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER; + $this->supplieraccountancycodecharacternumber = $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER; } /** @@ -83,39 +83,37 @@ */ public function info($langs) { - global $conf, $form; - - $tooltip = ''; - $texte = '
'; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $s1 = $form->textwithpicto('', $tooltip, 1, 1); - $s2 = $form->textwithpicto('', $tooltip, 1, 1); - $s3 = $form->textwithpicto('', $tooltip, 1, 1); - $s4 = $form->textwithpicto('', $tooltip, 1, 1); - $texte .= ''; - $texte .= ''; - $texte .= '
'; - // trans remove html entities - $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, '{s2}', '{s4}')."
\n"; - $texte .= $langs->trans("ModuleCompanyCodeSupplier".$this->name, '{s1}', '{s3}')."
\n"; - $texte = str_replace(array('{s1}', '{s2}', '{s3}', '{s4}'), array($s1, $s2, $s3, $s4), $texte); - $texte .= "
\n"; - // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) - if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $texte .= $langs->trans('RemoveSpecialChars').' = '.yn(1)."
\n"; - // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. - if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) $texte .= $langs->trans('COMPANY_DIGITARIA_CLEAN_REGEX').' = '.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX."
\n"; - // Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default) - if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) $texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."
\n"; - $texte .= '
'; - $texte .= '
'; - - return $texte; + global $conf, $form; + + $tooltip = ''; + $texte = '
'; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $s1 = $form->textwithpicto('', $tooltip, 1, 1); + $s2 = $form->textwithpicto('', $tooltip, 1, 1); + $s3 = $form->textwithpicto('', $tooltip, 1, 1); + $s4 = $form->textwithpicto('', $tooltip, 1, 1); + $texte .= ''; + $texte .= ''; + $texte .= '
'; + $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2, $s4)."
\n"; + $texte .= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1, $s3)."
\n"; + $texte .= "
\n"; + // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) + if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $texte .= $langs->trans('RemoveSpecialChars').' = '.yn(1)."
\n"; + // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. + if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) $texte .= $langs->trans('COMPANY_DIGITARIA_CLEAN_REGEX').' = '.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX."
\n"; + // Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default) + if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) $texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."
\n"; + $texte .= '
'; + $texte .= '
'; + + return $texte; } /** @@ -128,21 +126,21 @@ */ public function getExample($langs, $objsoc = 0, $type = -1) { - global $conf, $mysoc; - - $s = $langs->trans("ThirdPartyName").": ".$mysoc->name; - $s .= "
\n"; - - if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $thirdpartylabelexample = preg_replace('/([^a-z0-9])/i', '', $mysoc->name); - $s .= "
\n"; - $s .= $this->prefixcustomeraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->customeraccountancycodecharacternumber)); - $s .= "
\n"; - $s .= $this->prefixsupplieraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->supplieraccountancycodecharacternumber)); - return $s; - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** + global $conf, $mysoc; + + $s = $langs->trans("ThirdPartyName").": ".$mysoc->name; + $s .= "
\n"; + + if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $thirdpartylabelexample = preg_replace('/([^a-z0-9])/i', '', $mysoc->name); + $s .= "
\n"; + $s .= $this->prefixcustomeraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->customeraccountancycodecharacternumber)); + $s .= "
\n"; + $s .= $this->prefixsupplieraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->supplieraccountancycodecharacternumber)); + return $s; + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Set accountancy account code for a third party into this->code * * @param DoliDB $db Database handler @@ -152,117 +150,128 @@ */ public function get_code($db, $societe, $type = '') { - // phpcs:enable - global $conf; - $i = 0; - $this->code = ''; - - $disponibility = 0; + // phpcs:enable + global $conf; + $i = 0; + $this->code = ''; if (is_object($societe)) { - dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : '')); + dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : '')); if ($type == 'supplier') { - $codetouse = $societe->name; - $prefix = $this->prefixsupplieraccountancycode; - $width = $this->supplieraccountancycodecharacternumber; - } elseif ($type == 'customer') - { - $codetouse = $societe->name; - $prefix = $this->prefixcustomeraccountancycode; - $width = $this->customeraccountancycodecharacternumber; - } else { - $this->error = 'Bad value for parameter type'; - return -1; + $codetouse = $societe->name; + $prefix = $this->prefixsupplieraccountancycode; + $width = $this->supplieraccountancycodecharacternumber; } - - // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) - if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse); - // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. - if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) // Example: $conf->global->COMPANY_DIGITARIA_CLEAN_REGEX='^..(..)..'; - { - $codetouse = preg_replace('/'.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX.'/', '\1\2\3', $codetouse); - } - - $this->code = $prefix.strtoupper(substr($codetouse, 0, $width)); - dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code); - - // Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default) - if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) - { - $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); - - while ($disponibility <> 0 && $i < 100) { - $widthsupplier = $this->supplieraccountancycodecharacternumber; - $widthcustomer = $this->customeraccountancycodecharacternumber; - - if ($i <= 9) { - $a = 1; - } - if ($i >= 10 && $i <= 99) { - $a = 2; - } - - if ($type == 'supplier') { - $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthsupplier - $a)).$i; - } elseif ($type == 'customer') { - $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthcustomer - $a)).$i; - } - $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); - - $i++; - } - } else { - $disponibility == 0; - } + elseif ($type == 'customer') + { + $codetouse = $societe->name; + $prefix = $this->prefixcustomeraccountancycode; + $width = $this->customeraccountancycodecharacternumber; + } + else + { + $this->error = 'Bad value for parameter type'; + return -1; + } + + // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) + if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse); + // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. + if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) // Example: $conf->global->COMPANY_DIGITARIA_CLEAN_REGEX='^..(..)..'; + { + $codetouse = preg_replace('/'.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX.'/', '\1\2\3', $codetouse); + } + + $this->code = $prefix.strtoupper(substr($codetouse, 0, $width)); + dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code); + + // Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default) + if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) + { + $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); + + while ($disponibility <> 0 && $i < 100) { + $widthsupplier = $this->supplieraccountancycodecharacternumber; + $widthcustomer = $this->customeraccountancycodecharacternumber; + + if ($i <= 9) { + $a = 1; + } + if ($i >= 10 && $i <= 99) { + $a = 2; + } + + if ($type == 'supplier') { + $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthsupplier - $a)).$i; + } elseif ($type == 'customer') { + $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthcustomer - $a)).$i; + } + $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); + + $i++; + } + } else { + $disponibility == 0; + } } - if ($disponibility == 0) { - return 0; // return ok - } else { - return -1; // return ko - } - } - - /** - * Check accountancy account code for a third party into this->code - * - * @param DoliDB $db Database handler - * @param string $code Code of third party - * @param int $type 'customer' or 'supplier' - * @return int >=0 if OK, <0 if KO - */ - public function checkIfAccountancyCodeIsAlreadyUsed($db, $code, $type = '') - { - if ($type == 'supplier') - { - $typethirdparty = 'code_compta_fournisseur'; - } elseif ($type == 'customer') - { - $typethirdparty = 'code_compta'; - } else { - $this->error = 'Bad value for parameter type'; - return -1; - } - - $sql = "SELECT ".$typethirdparty." FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE ".$typethirdparty." = '".$db->escape($code)."'"; - - $resql = $db->query($sql); - if ($resql) - { - if ($db->num_rows($resql) == 0) - { - dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' available"); - return 0; // Available - } else { - dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' not available"); - return -1; // Not available - } - } else { - $this->error = $db->error()." sql=".$sql; - return -2; // Error - } - } + if ($disponibility == 0) + { + return 0; // return ok + } + else + { + return -1; // return ko + } + } + + /** + * Check accountancy account code for a third party into this->code + * + * @param DoliDB $db Database handler + * @param string $code Code of third party + * @param int $type 'customer' or 'supplier' + * @return int >=0 if OK, <0 if KO + */ + public function checkIfAccountancyCodeIsAlreadyUsed($db, $code, $type = '') + { + if ($type == 'supplier') + { + $typethirdparty = 'code_compta_fournisseur'; + } + elseif ($type == 'customer') + { + $typethirdparty = 'code_compta'; + } + else + { + $this->error = 'Bad value for parameter type'; + return -1; + } + + $sql = "SELECT ".$typethirdparty." FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE ".$typethirdparty." = '".$code."'"; + + $resql = $db->query($sql); + if ($resql) + { + if ($db->num_rows($resql) == 0) + { + dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' available"); + return 0; // Available + } + else + { + dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' not available"); + return -1; // Not available + } + } + else + { + $this->error = $db->error()." sql=".$sql; + return -2; // Error + } + } } --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_mod_codecompta_panicum.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_mod_codecompta_panicum.php @@ -36,9 +36,9 @@ public $name = 'Panicum'; /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' public $position = 10; @@ -76,7 +76,7 @@ return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set accountancy account code for a third party into this->code * @@ -87,7 +87,7 @@ */ public function get_code($db, $societe, $type = '') { - // phpcs:enable + // phpcs:enable $this->code = ''; if (is_object($societe)) { --- /tmp/dsg/dolibarr/htdocs/core/modules/societe/github_modules_societe.class.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/societe/client_modules_societe.class.php @@ -28,7 +28,8 @@ /** - * Parent class for third parties models of doc generators + * \class ModeleThirdPartyDoc + * \brief Parent class for third parties models of doc generators */ abstract class ModeleThirdPartyDoc extends CommonDocGenerator { @@ -61,7 +62,8 @@ } /** - * Parent class for third parties code generators + * \class ModeleThirdPartyCode + * \brief Parent class for third parties code generators */ abstract class ModeleThirdPartyCode { @@ -69,12 +71,6 @@ * @var string Error code (or message) */ public $error = ''; - - /** - * @var array Error code (or message) array - */ - public $errors; - /** Renvoi la description par defaut du modele de numerotation * @@ -144,17 +140,11 @@ 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"); - } + 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"); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -163,7 +153,7 @@ * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show - * @return array|int List of numbers + * @return array List of numbers */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -172,15 +162,19 @@ $sql = ""; $resql = $db->query($sql); - if ($resql) { + if ($resql) + { $num = $db->num_rows($resql); $i = 0; - while ($i < $num) { + while ($i < $num) + { $row = $db->fetch_row($resql); $liste[$row[0]] = $row[1]; $i++; } - } else { + } + else + { return -1; } return $liste; @@ -199,39 +193,37 @@ global $conf; $langs->load("admin"); - $strikestart = ''; - $strikeend = ''; - if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) { - $strikestart = ''; - $strikeend = ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; - } $s = ''; - if ($type == -1) { - $s .= $langs->trans("Name").': '.$this->getNom($langs).'
'; - } elseif ($type == -1) { - $s .= $langs->trans("Version").': '.$this->getVersion().'
'; - } elseif ($type == 0) { - $s .= $langs->trans("CustomerCodeDesc").'
'; - } elseif ($type == 1) { - $s .= $langs->trans("SupplierCodeDesc").'
'; - } - if ($type != -1) { - $s .= $langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
'; - } + if ($type == -1) $s .= $langs->trans("Name").': '.$this->getNom($langs).'
'; + if ($type == -1) $s .= $langs->trans("Version").': '.$this->getVersion().'
'; + if ($type == 0) $s .= $langs->trans("CustomerCodeDesc").'
'; + if ($type == 1) $s .= $langs->trans("SupplierCodeDesc").'
'; + if ($type != -1) $s .= $langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
'; $s .= '
'; $s .= ''.$langs->trans("ThisIsModuleRules").':
'; - if ($type == 0) { - $s .= $langs->trans("RequiredIfCustomer").': '.$strikestart; - $s .= yn(!$this->code_null, 1, 2).$strikeend; + if ($type == 0) + { + $s .= $langs->trans("RequiredIfCustomer").': '; + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ''; + $s .= yn(!$this->code_null, 1, 2); + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; $s .= '
'; - } elseif ($type == 1) { - $s .= $langs->trans("RequiredIfSupplier").': '.$strikestart; - $s .= yn(!$this->code_null, 1, 2).$strikeend; + } + if ($type == 1) + { + $s .= $langs->trans("RequiredIfSupplier").': '; + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ''; + $s .= yn(!$this->code_null, 1, 2); + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; $s .= '
'; - } elseif ($type == -1) { - $s .= $langs->trans("Required").': '.$strikestart; - $s .= yn(!$this->code_null, 1, 2).$strikeend; + } + if ($type == -1) + { + $s .= $langs->trans("Required").': '; + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ''; + $s .= yn(!$this->code_null, 1, 2); + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; $s .= '
'; } $s .= $langs->trans("CanBeModifiedIfOk").': '; @@ -240,18 +232,16 @@ $s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'
'; $s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'
'; $s .= '
'; - if ($type == 0 || $type == -1) { + if ($type == 0 || $type == -1) + { $nextval = $this->getNextValue($soc, 0); - if (empty($nextval)) { - $nextval = $langs->trans("Undefined"); - } + if (empty($nextval)) $nextval = $langs->trans("Undefined"); $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': '.$nextval.'
'; } - if ($type == 1 || $type == -1) { + if ($type == 1 || $type == -1) + { $nextval = $this->getNextValue($soc, 1); - if (empty($nextval)) { - $nextval = $langs->trans("Undefined"); - } + if (empty($nextval)) $nextval = $langs->trans("Undefined"); $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Supplier").')' : '').': '.$nextval.''; } return $s; @@ -329,17 +319,11 @@ 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"); - } + 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"); } /** @@ -357,27 +341,23 @@ $langs->load("admin"); $s = ''; - if ($type == -1) { - $s .= $langs->trans("Name").': '.$this->name.'
'; - $s .= $langs->trans("Version").': '.$this->getVersion().'
'; - } + if ($type == -1) $s .= $langs->trans("Name").': '.$this->name.'
'; + if ($type == -1) $s .= $langs->trans("Version").': '.$this->getVersion().'
'; //$s.='
'; //$s.=''.$langs->trans("ThisIsModuleRules").':
'; $s .= '
'; - if ($type == 0 || $type == -1) { + if ($type == 0 || $type == -1) + { $result = $this->get_code($db, $soc, 'customer'); $nextval = $this->code; - if (empty($nextval)) { - $nextval = $langs->trans("Undefined"); - } + if (empty($nextval)) $nextval = $langs->trans("Undefined"); $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': '.$nextval.'
'; } - if ($type == 1 || $type == -1) { + if ($type == 1 || $type == -1) + { $result = $this->get_code($db, $soc, 'supplier'); $nextval = $this->code; - if (empty($nextval)) { - $nextval = $langs->trans("Undefined"); - } + if (empty($nextval)) $nextval = $langs->trans("Undefined"); $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Supplier").')' : '').': '.$nextval.''; } return $s;