Debug
This commit is contained in:
parent
8026ee15df
commit
606217fefc
@ -1005,7 +1005,7 @@ class Products extends DolibarrApi
|
|||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid, ref, ref_ext, label, rang FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '".trim($ref)."' AND entity IN (".getEntity('product').")";
|
$sql = "SELECT rowid, ref, ref_ext, label, rang, entity FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '".trim($ref)."' AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1021,14 +1021,16 @@ class Products extends DolibarrApi
|
|||||||
$attr['ref_ext'] = $result->ref_ext;
|
$attr['ref_ext'] = $result->ref_ext;
|
||||||
$attr['label'] = $result->label;
|
$attr['label'] = $result->label;
|
||||||
$attr['rang'] = $result->rang;
|
$attr['rang'] = $result->rang;
|
||||||
|
$attr['entity'] = $result->entity;
|
||||||
|
|
||||||
$sql = "SELECT COUNT(*) count FROM ".MAIN_DB_PREFIX."product_attribute_combination2val pac2v";
|
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val as pac2v";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac2v.fk_prod_combination = pac.rowid";
|
$sql .= " JOIN ".MAIN_DB_PREFIX."product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid";
|
||||||
$sql .= " WHERE pac2v.fk_prod_attr = ".(int) $result->rowid." AND pac.entity IN (".getEntity('product').")";
|
$sql .= " WHERE pac2v.fk_prod_attr = ".((int) $result->rowid)." AND pac.entity IN (".getEntity('product').")";
|
||||||
$query = $this->db->query($sql);
|
|
||||||
$result = $this->db->fetch_object($query);
|
|
||||||
|
|
||||||
$attr["is_used_by_products"] = (bool) $result->count;
|
$resql = $this->db->query($sql);
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$attr["is_used_by_products"] = (int) $obj->nb;
|
||||||
|
|
||||||
return $attr;
|
return $attr;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user