From 77b9f18ef092f285730af5cd3b30229914589377 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jan 2007 20:17:36 +0000 Subject: [PATCH] Fix: Corrections sur compteur commandes marbre --- .../includes/modules/commande/mod_commande_marbre.php | 11 ++++++----- .../includes/modules/facture/terre/terre.modules.php | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/includes/modules/commande/mod_commande_marbre.php b/htdocs/includes/modules/commande/mod_commande_marbre.php index 43c3b02311e..3e392bbf88c 100644 --- a/htdocs/includes/modules/commande/mod_commande_marbre.php +++ b/htdocs/includes/modules/commande/mod_commande_marbre.php @@ -76,21 +76,20 @@ class mod_commande_marbre extends ModeleNumRefCommandes $sql = "SELECT MAX(ref)"; $sql.= " FROM ".MAIN_DB_PREFIX."commande"; + $sql.= " WHERE ref like '".$this->prefix."%'"; $resql=$db->query($sql); if ($resql) { $row = $db->fetch_row($resql); if ($row) $coyymm = substr($row[0],0,6); } - if (! $coyymm || eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$coyymm)) - { - return true; - } - else + if ($coyymm && ! eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$coyymm)) { $this->error='Une commande commençant par $coyymm existe en base et est incompatible avec cette numérotation. Supprimer la ou renommer la pour activer ce module.'; return false; } + + return true; } /** \brief Renvoi prochaine valeur attribuée @@ -104,6 +103,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes $coyymm=''; $sql = "SELECT MAX(ref)"; $sql.= " FROM ".MAIN_DB_PREFIX."commande"; + $sql.= " WHERE ref like '".$this->prefix."%'"; + $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/includes/modules/facture/terre/terre.modules.php b/htdocs/includes/modules/facture/terre/terre.modules.php index 05d6b4530fa..3f64944fc49 100644 --- a/htdocs/includes/modules/facture/terre/terre.modules.php +++ b/htdocs/includes/modules/facture/terre/terre.modules.php @@ -82,7 +82,7 @@ class mod_facture_terre extends ModeleNumRefFactures $row = $db->fetch_row($resql); if ($row) $fayymm = substr($row[0],0,6); } - if ($fayymm && eregi($this->prefixinvoice.'[0-9][0-9][0-9][0-9]',$fayymm)) + if ($fayymm && ! eregi($this->prefixinvoice.'[0-9][0-9][0-9][0-9]',$fayymm)) { $this->error=$langs->trans('TerreNumRefModelError'); return false; @@ -100,7 +100,7 @@ class mod_facture_terre extends ModeleNumRefFactures $row = $db->fetch_row($resql); if ($row) $fayymm = substr($row[0],0,6); } - if ($fayymm && eregi($this->prefixcreditnote.'[0-9][0-9][0-9][0-9]',$fayymm)) + if ($fayymm && ! eregi($this->prefixcreditnote.'[0-9][0-9][0-9][0-9]',$fayymm)) { $this->error=$langs->trans('TerreNumRefModelError'); return false;