Fix can not distinct which credit note are in select list
This commit is contained in:
parent
cd814d420b
commit
8d3df7ea57
@ -1188,12 +1188,17 @@ class Form
|
|||||||
// On recherche les remises
|
// On recherche les remises
|
||||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||||
$sql.= " re.description, re.fk_facture_source";
|
$sql.= " re.description, re.fk_facture_source";
|
||||||
|
if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST)) $sql.= ", f.facnumber";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
|
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
|
||||||
|
if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture f ON (f.rowid = re.fk_facture_source)";
|
||||||
$sql.= " WHERE re.fk_soc = ".(int) $socid;
|
$sql.= " WHERE re.fk_soc = ".(int) $socid;
|
||||||
$sql.= " AND re.entity = " . $conf->entity;
|
$sql.= " AND re.entity = " . $conf->entity;
|
||||||
if ($filter) $sql.= " AND ".$filter;
|
if ($filter) $sql.= " AND ".$filter;
|
||||||
$sql.= " ORDER BY re.description ASC";
|
$sql.= " ORDER BY re.description ASC";
|
||||||
|
|
||||||
|
// Prevent sql error on the ambiguous column
|
||||||
|
if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST)) $sql = preg_replace('/(.*)(?!re\.)fk_facture_source(.*)/m', '\1 re.fk_facture_source \2', $sql);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1225,6 +1230,8 @@ class Form
|
|||||||
$disabled=' disabled';
|
$disabled=' disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->facnumber)) $desc=$desc.' - '.$obj->facnumber;
|
||||||
|
|
||||||
print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
|
print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user