Fixing style errors.
This commit is contained in:
parent
ee4288fae3
commit
60fc9f5ecd
@ -223,7 +223,7 @@ class Products extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//this query will return total products with the filters given
|
//this query will return total products with the filters given
|
||||||
$sqlTotals = str_replace('SELECT t.rowid, t.ref, t.ref_ext','SELECT count(t.rowid) as total',$sql);
|
$sqlTotals = str_replace('SELECT t.rowid, t.ref, t.ref_ext', 'SELECT count(t.rowid) as total', $sql);
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
@ -260,7 +260,7 @@ class Products extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
|
//if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
|
||||||
if($pagination_data){
|
if ($pagination_data) {
|
||||||
$totalsResult = $this->db->query($sqlTotals);
|
$totalsResult = $this->db->query($sqlTotals);
|
||||||
$total = $this->db->fetch_object($totalsResult)->total;
|
$total = $this->db->fetch_object($totalsResult)->total;
|
||||||
|
|
||||||
@ -269,9 +269,9 @@ class Products extends DolibarrApi
|
|||||||
|
|
||||||
$obj_ret['data'] = $tmp;
|
$obj_ret['data'] = $tmp;
|
||||||
$obj_ret['pagination'] = [
|
$obj_ret['pagination'] = [
|
||||||
'total' => (int)$total,
|
'total' => (int) $total,
|
||||||
'page' => $page, //count starts from 0
|
'page' => $page, //count starts from 0
|
||||||
'page_count' => ceil((int)$total/$limit),
|
'page_count' => ceil((int) $total/$limit),
|
||||||
'limit' => $limit
|
'limit' => $limit
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user