Added checks in Product::deleteAction()
This commit is contained in:
@@ -154,7 +154,7 @@ class ContractModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
public static function countActive($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
@@ -215,6 +215,30 @@ class ContractModel {
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM (
|
||||
SELECT Contract.* FROM Contract
|
||||
LEFT JOIN Address ON (Contract.owner_id = Address.id)
|
||||
LEFT JOIN OrderProduct ON (Contract.orderproduct_id = OrderProduct.id)
|
||||
LEFT JOIN `Order` ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Contract.product_id = Product.id)
|
||||
WHERE $where
|
||||
GROUP BY Contract.id
|
||||
) contract";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
Reference in New Issue
Block a user