Fix: use getEntity if no rowid to compare
This commit is contained in:
parent
93a9430e49
commit
fd9c79fa7f
@ -399,8 +399,6 @@ class Account extends CommonObject
|
||||
*/
|
||||
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Deprecatîon warning
|
||||
if (is_numeric($oper)) {
|
||||
dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING);
|
||||
@ -416,7 +414,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE id=".$oper;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity IN (".getEntity('c_paiement').")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -102,7 +102,7 @@ class PaymentTerm // extends CommonObject
|
||||
$sql.= "decalage";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
|
||||
$sql.= " ".(! isset($this->entity)?$conf->entity:"'".$this->db->escape($this->entity)."'").",";
|
||||
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
||||
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
|
||||
@ -222,7 +222,7 @@ class PaymentTerm // extends CommonObject
|
||||
*/
|
||||
function getDefaultId()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$ret=0;
|
||||
|
||||
@ -230,7 +230,7 @@ class PaymentTerm // extends CommonObject
|
||||
$sql.= " t.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||
$sql.= " WHERE t.code = 'RECEP'";
|
||||
$sql.= " AND t.entity = " . $conf->entity;
|
||||
$sql.= " AND t.entity IN (".getEntity('c_payment_term').")";
|
||||
|
||||
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -595,8 +595,6 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
function calculate_date_lim_reglement($cond_reglement=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;
|
||||
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id;
|
||||
|
||||
@ -606,7 +604,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
|
||||
if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement;
|
||||
else {
|
||||
$sqltemp.= " WHERE c.entity = ".$conf->entity;
|
||||
$sqltemp.= " WHERE c.entity IN (".getEntity('c_payment_term').")";
|
||||
$sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'";
|
||||
}
|
||||
|
||||
|
||||
@ -2784,7 +2784,7 @@ class Form
|
||||
*/
|
||||
function load_cache_conditions_paiements()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$num = count($this->cache_conditions_paiements);
|
||||
if ($num > 0) return 0; // Cache already loaded
|
||||
@ -2793,7 +2793,7 @@ class Form
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
|
||||
$sql.= " WHERE entity = " . $conf->entity;
|
||||
$sql.= " WHERE entity IN (".getEntity('c_payment_term').")";
|
||||
$sql.= " AND active > 0";
|
||||
$sql.= " ORDER BY sortorder";
|
||||
|
||||
@ -2997,7 +2997,7 @@ class Form
|
||||
*/
|
||||
function load_cache_types_paiements()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$num=count($this->cache_types_paiements);
|
||||
if ($num > 0) return $num; // Cache already loaded
|
||||
@ -3008,7 +3008,7 @@ class Form
|
||||
|
||||
$sql = "SELECT id, code, libelle as label, type, active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
//if ($active >= 0) $sql.= " AND active = ".$active;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user