Fix: Corrections sur compteur commandes marbre

This commit is contained in:
Laurent Destailleur 2007-01-07 20:17:36 +00:00
parent a4eb2a1663
commit 77b9f18ef0
2 changed files with 8 additions and 7 deletions

View File

@ -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)
{

View File

@ -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;