diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 32149c8a849..d8629b92dd6 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -109,12 +109,11 @@ class mod_lot_advanced extends ModeleNumRefBatch $mysoc->code_client = $old_code_client; $mysoc->typent_code = $old_code_type; - if (!$numExample) - { + if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } return $numExample; - } + } /** * Return next free value @@ -123,8 +122,8 @@ class mod_lot_advanced extends ModeleNumRefBatch * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objprod, $object) - { + public function getNextValue($objprod, $object) + { global $db, $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -132,8 +131,7 @@ class mod_lot_advanced extends ModeleNumRefBatch // We get cursor rule $mask = $conf->global->BATCH_ADVANCED_MASK; - if (!$mask) - { + if (!$mask) { $this->error = 'NotConfigured'; return 0; } diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index 6bb9539f3df..0f069143ab1 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -53,9 +53,9 @@ class mod_lot_free extends ModeleNumRefBatch 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' /** @@ -78,9 +78,8 @@ class mod_lot_free extends ModeleNumRefBatch /** - * Return description of module + * Return description of module * - * @param Translate $langs Object langs * @return string Description of module */ public function info() @@ -103,5 +102,4 @@ class mod_lot_free extends ModeleNumRefBatch global $langs; return ''; } - } diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index 43c3ca49314..0d2b5a55139 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -57,7 +57,7 @@ class mod_lot_standard extends ModeleNumRefBatch public function info() { global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); } @@ -91,13 +91,11 @@ class mod_lot_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $row = $db->fetch_row($resql); 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 ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -125,14 +123,11 @@ class mod_lot_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $max = intval($obj->max); else $max = 0; - } - else - { + } else { dol_syslog("mod_lot_standard::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 2dcf6433ea7..89d70a8239d 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -36,9 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product_batch/modules_product_batc class mod_sn_advanced extends ModeleNumRefBatch { /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** @@ -52,14 +52,14 @@ class mod_sn_advanced extends ModeleNumRefBatch public $name = 'sn_advanced'; - /** - * Returns the description of the numbering model - * - * @return string Texte descripif - */ - public function info() - { - global $conf, $langs, $db; + /** + * Returns the description of the numbering model + * + * @return string Texte descripif + */ + public function info() + { + global $conf, $langs, $db; $langs->load("bills"); @@ -90,31 +90,30 @@ class mod_sn_advanced extends ModeleNumRefBatch $texte .= ''; return $texte; - } + } - /** - * 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; - $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, ''); $mysoc->code_client = $old_code_client; $mysoc->typent_code = $old_code_type; - if (!$numExample) - { + if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } return $numExample; - } + } /** * Return next free value @@ -123,8 +122,8 @@ class mod_sn_advanced extends ModeleNumRefBatch * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - public function getNextValue($objprod, $object) - { + public function getNextValue($objprod, $object) + { global $db, $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -132,8 +131,7 @@ class mod_sn_advanced extends ModeleNumRefBatch // We get cursor rule $mask = $conf->global->BATCH_ADVANCED_MASK; - if (!$mask) - { + if (!$mask) { $this->error = 'NotConfigured'; return 0; } diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index 9f34d4dc532..95e1bd20359 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -52,9 +52,9 @@ class mod_sn_free extends ModeleNumRefBatch 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,9 +77,8 @@ class mod_sn_free extends ModeleNumRefBatch /** - * Return description of module + * Return description of module * - * @param Translate $langs Object langs * @return string Description of module */ public function info() @@ -102,5 +101,4 @@ class mod_sn_free extends ModeleNumRefBatch global $langs; return ''; } - } diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index fc2f8f3156d..bef5efcd9f8 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -57,7 +57,7 @@ class mod_sn_standard extends ModeleNumRefBatch public function info() { global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); } @@ -91,13 +91,11 @@ class mod_sn_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $row = $db->fetch_row($resql); 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 ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -125,14 +123,11 @@ class mod_sn_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $max = intval($obj->max); else $max = 0; - } - else - { + } else { dol_syslog("mod_sn_standard::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 7cd189f96d6..42d4d052bfe 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -150,4 +150,4 @@ abstract class ModeleNumRefBatch if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } -} \ No newline at end of file +} diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 7fcd04b32f9..8cf0912a1ee 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -42,8 +42,7 @@ $value = GETPOST('value', 'alpha'); include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -if ($action == 'updateMaskLot') -{ +if ($action == 'updateMaskLot') { $maskconstbatch = GETPOST('maskconstLot', 'alpha'); $maskbatch = GETPOST('maskLot', 'alpha'); @@ -51,17 +50,13 @@ if ($action == 'updateMaskLot') if (!$res > 0) $error++; - if (!$error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } -} elseif ($action == 'updateMaskSN') -{ +} elseif ($action == 'updateMaskSN') { $maskconstbatch = GETPOST('maskconstSN', 'alpha'); $maskbatch = GETPOST('maskSN', 'alpha'); @@ -69,21 +64,16 @@ if ($action == 'updateMaskLot') if (!$res > 0) $error++; - if (!$error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } -} elseif ($action == 'setmodlot') -{ +} elseif ($action == 'setmodlot') { dolibarr_set_const($db, "LOT_ADDON", $value, 'chaine', 0, '', $conf->entity); -} elseif ($action == 'setmodsn') -{ +} elseif ($action == 'setmodsn') { dolibarr_set_const($db, "SN_ADDON", $value, 'chaine', 0, '', $conf->entity); } @@ -125,15 +115,12 @@ foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/product_batch/"); - if (is_dir($dir)) - { + if (is_dir($dir)) { $handle = opendir($dir); - if (is_resource($handle)) - { + if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { - if (substr($file, 0, 8) == 'mod_lot_' && substr($file, dol_strlen($file) - 3, 3) == 'php') - { + if (substr($file, 0, 8) == 'mod_lot_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); require_once $dir.$file.'.php'; @@ -144,8 +131,7 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - if ($module->isEnabled()) - { + if ($module->isEnabled()) { print '