Fix exclude credit note when searching situation invoice to use for next

This commit is contained in:
Laurent Destailleur 2020-05-25 00:21:09 +02:00
parent e29d2588cf
commit 2595f571c7

View File

@ -3582,10 +3582,11 @@ class Form
$opt = '<option value ="" selected></option>';
$sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc';
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'facture';
$sql.= ' WHERE entity IN ('.getEntity('invoice').')';
$sql.= ' AND situation_counter>=1';
$sql.= ' ORDER by situation_cycle_ref, situation_counter desc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture';
$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
$sql .= ' AND situation_counter>=1';
$sql .= ' AND type <> 2';
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
// Last seen cycle