|
@@ -26,8 +26,6 @@ class ApiProductListHelper
|
|
|
*/
|
|
*/
|
|
|
public function list($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0): array
|
|
public function list($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0): array
|
|
|
{
|
|
{
|
|
|
- ApiBbusLog::eventLog("{$sqlfilters}");
|
|
|
|
|
-
|
|
|
|
|
$obj_ret = array();
|
|
$obj_ret = array();
|
|
|
|
|
|
|
|
//$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
|
|
//$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
|
|
@@ -115,8 +113,9 @@ class ApiProductListHelper
|
|
|
|
|
|
|
|
// get child details
|
|
// get child details
|
|
|
$product_static->sub_products = $this->_getSubproducts($product_static);
|
|
$product_static->sub_products = $this->_getSubproducts($product_static);
|
|
|
-
|
|
|
|
|
- $obj_ret[] = $this->_cleanObjectDatas($product_static);
|
|
|
|
|
|
|
+ if($this->checkAvailableSpaces($obj->rowid)){
|
|
|
|
|
+ $obj_ret[] = $this->_cleanObjectDatas($product_static);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
$obj_ret[] = $obj->rowid;
|
|
$obj_ret[] = $obj->rowid;
|
|
@@ -150,6 +149,35 @@ class ApiProductListHelper
|
|
|
return $obj_ret;
|
|
return $obj_ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private function checkAvailableSpaces($product_id){
|
|
|
|
|
+ if($this->isEvent($product_id)){
|
|
|
|
|
+ $sql = "SELECT
|
|
|
|
|
+ ac.id,
|
|
|
|
|
+ ac.datep,
|
|
|
|
|
+ ace.max_num,
|
|
|
|
|
+ ace.participants,
|
|
|
|
|
+ ace.buffer
|
|
|
|
|
+ FROM llx_actioncomm as ac
|
|
|
|
|
+ LEFT JOIN llx_actioncomm_extrafields as ace ON ace.fk_object = ac.id
|
|
|
|
|
+ INNER JOIN llx_eventwizard_eventdetails as ed ON ac.fk_element = ed.rowid
|
|
|
|
|
+ INNER JOIN llx_eventwizard_eventproduct as ep ON ep.fk_eventdetails = ac.fk_element
|
|
|
|
|
+ WHERE ac.code = 'AC_EVENT'
|
|
|
|
|
+ AND ep.fk_product = {$product_id}
|
|
|
|
|
+ AND ac.datep > NOW()
|
|
|
|
|
+ ORDER BY ac.datep ASC";
|
|
|
|
|
+ $result = $this->db->query($sql);
|
|
|
|
|
+ return $this->db->num_rows($result) > 0;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private function isEvent($product_id){
|
|
|
|
|
+ $sql = "SELECT * FROM llx_eventwizard_eventproduct WHERE fk_product = {$product_id}";
|
|
|
|
|
+ $result = $this->db->query($sql);
|
|
|
|
|
+ return $this->db->num_rows($result) > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|