Fix: debug

This commit is contained in:
Regis Houssin 2018-03-08 11:53:46 +01:00
parent fd9c79fa7f
commit 861a831e24
5 changed files with 9 additions and 13 deletions

View File

@ -66,7 +66,8 @@ class Setup extends DolibarrApi
$sql = "SELECT id, code, type, libelle as label, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.entity IN (".getEntity('c_paiement').")";
$sql.= " AND t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
@ -538,7 +539,8 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.entity IN (".getEntity('c_payment_term').")";
$sql.= " AND t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{

View File

@ -90,7 +90,6 @@ class PaymentTerm // extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
$sql.= "rowid,";
$sql.= "entity,";
$sql.= "code,";
$sql.= "sortorder,";
@ -101,7 +100,6 @@ class PaymentTerm // extends CommonObject
$sql.= "nbjour,";
$sql.= "decalage";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
$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)."'").",";

View File

@ -107,7 +107,7 @@ class Cpaiement
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'id,';
$sql.= 'entity,';
$sql.= 'code,';
$sql.= 'libelle,';
$sql.= 'type,';
@ -118,7 +118,7 @@ class Cpaiement
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
$sql .= ' '.(! isset($this->entity)?getEntity('c_paiement'):$this->entity).',';
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
@ -186,7 +186,8 @@ class Cpaiement
$sql .= " t.module";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) {
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
$sql .= ' AND t.code = ' . '\'' . $ref . '\'';
} else {
$sql .= ' WHERE t.id = ' . $id;
}

View File

@ -73,7 +73,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
if (empty($datev)) $datev=$datep;
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement');
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1);
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0;

View File

@ -121,11 +121,6 @@ function getEntity($element, $shared=1, $forceentity=null)
{
global $conf, $mc;
// For backward compatibilty
if ($element == 'actioncomm') $element='agenda';
if ($element == 'fichinter') $element='intervention';
if ($element == 'categorie') $element='category';
if (is_object($mc))
{
return $mc->getEntity($element, $shared, $forceentity);