Update api_products.class.php

This commit is contained in:
Laurent Destailleur 2020-09-04 12:56:06 +02:00 committed by GitHub
parent 334224cd2d
commit a6f6db6b54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -934,7 +934,7 @@ class Products extends DolibarrApi
$tmp->rang = $result->rang;
$tmp->entity = $result->entity;
$return[] = $tmp;
$return[] = $this->_cleanObjectDatas($tmp);
}
if (!count($return)) {
@ -980,7 +980,7 @@ class Products extends DolibarrApi
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val as pac2v";
$sql .= " JOIN ".MAIN_DB_PREFIX."product_attribute_combination as pac ON pac2v.fk_prod_combination = pac.rowid";
$sql .= " WHERE pac2v.fk_prod_attr = ".((int) $prodattr->id)." AND pac.entity IN (".getEntity('product').")";
$resql = $this->db->query($sql);
$obj = $this->db->fetch_object($resql);
$prodattr->is_used_by_products = (int) $obj->nb;
@ -1026,7 +1026,7 @@ class Products extends DolibarrApi
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val as pac2v";
$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').")";
$resql = $this->db->query($sql);
$obj = $this->db->fetch_object($resql);