FIX : need an order by in case we found other invoice with same number but not same date
This commit is contained in:
parent
484b4371c1
commit
09ba059c21
@ -178,6 +178,7 @@ class mod_facture_mars extends ModeleNumRefFactures
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||||
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
$sql.= " ORDER BY ref DESC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -194,6 +194,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||||
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
$sql.= " ORDER BY ref DESC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user