From d040a3f7f831520656261fc7db9854c31f37801d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Oct 2006 11:20:25 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20traces=20sur=20modele=20num=E9rota?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/commande/mod_commande_marbre.php | 8 +++++++- .../modules/facture/terre/terre.modules.php | 6 ++++++ .../modules/propale/mod_propale_marbre.php | 15 +++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/includes/modules/commande/mod_commande_marbre.php b/htdocs/includes/modules/commande/mod_commande_marbre.php index 93c1358d727..2b35d982e91 100644 --- a/htdocs/includes/modules/commande/mod_commande_marbre.php +++ b/htdocs/includes/modules/commande/mod_commande_marbre.php @@ -110,9 +110,14 @@ class mod_commande_marbre extends ModeleNumRefCommandes $row = $db->fetch_row($resql); if ($row) $coyymm = substr($row[0],0,6); } + else + { + dolibarr_syslog("mod_commande_marbre::getNextValue sql=".$sql); + return -1; + } // Si champ respectant le modèle a été trouvée - if (eregi('^'+$this->prefix+'[0-9][0-9][0-9][0-9]',$coyymm)) + if (eregi('^'.$this->prefix.'[0-9][0-9][0-9][0-9]',$coyymm)) { // Recherche rapide car restreint par un like sur champ indexé $posindice=8; @@ -133,6 +138,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes $yymm = strftime("%y%m",time()); $num = sprintf("%04s",$max+1); + dolibarr_syslog("mod_commande_marbre::getNextValue return ".$this->prefix."$yymm-$num"); return $this->prefix."$yymm-$num"; } diff --git a/htdocs/includes/modules/facture/terre/terre.modules.php b/htdocs/includes/modules/facture/terre/terre.modules.php index cdf3ed5b6b8..53b0a901d75 100644 --- a/htdocs/includes/modules/facture/terre/terre.modules.php +++ b/htdocs/includes/modules/facture/terre/terre.modules.php @@ -107,6 +107,11 @@ class mod_facture_terre extends ModeleNumRefFactures $row = $db->fetch_row($resql); if ($row) $fayymm = substr($row[0],0,6); } + else + { + dolibarr_syslog("mod_facture_terre::getNextValue sql=".$sql); + return -1; + } // Si champ respectant le modèle a été trouvée if (eregi('^'.$this->prefix.'[0-9][0-9][0-9][0-9]',$fayymm)) @@ -130,6 +135,7 @@ class mod_facture_terre extends ModeleNumRefFactures $yymm = strftime("%y%m",time()); $num = sprintf("%04s",$max+1); + dolibarr_syslog("mod_facture_terre::getNextValue return ".$this->prefix."$yymm-$num"); return $this->prefix."$yymm-$num"; } diff --git a/htdocs/includes/modules/propale/mod_propale_marbre.php b/htdocs/includes/modules/propale/mod_propale_marbre.php index 8bcfcdf39d5..8f6434a938b 100644 --- a/htdocs/includes/modules/propale/mod_propale_marbre.php +++ b/htdocs/includes/modules/propale/mod_propale_marbre.php @@ -37,6 +37,7 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php") class mod_propale_marbre extends ModeleNumRefPropales { + var $prefix='PR'; var $error=''; /** \brief Constructeur @@ -109,9 +110,14 @@ class mod_propale_marbre extends ModeleNumRefPropales $row = $db->fetch_row($resql); if ($row) $pryymm = substr($row[0],0,6); } - - // Si au moins un champ respectant le modèle a été trouvée - if (eregi('PR[0-9][0-9][0-9][0-9]',$pryymm)) + else + { + dolibarr_syslog("mod_propale_marbre::getNextValue sql=".$sql); + return -1; + } + + // Si champ respectant le modèle a été trouvée + if (eregi('^'.$this->prefix.'[0-9][0-9][0-9][0-9]',$pryymm)) { // Recherche rapide car restreint par un like sur champ indexé $posindice=8; @@ -132,7 +138,8 @@ class mod_propale_marbre extends ModeleNumRefPropales $yymm = strftime("%y%m",time()); $num = sprintf("%04s",$max+1); - return "PR$yymm-$num"; + dolibarr_syslog("mod_propale_marbre::getNextValue return ".$this->prefix."$yymm-$num"); + return $this->prefix."$yymm-$num"; } /** \brief Renvoie la référence de propale suivante non utilisée