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