This commit is contained in:
meusinfirmary
2025-05-29 13:21:59 +07:00
parent 3b9d94620a
commit 77bc5f10a6
29 changed files with 2206 additions and 2247 deletions

View File

@ -107,33 +107,70 @@ class Zone extends Model
// ;");
}
// public static function getActiveZones($client_group_id = 0, $type = 0, $workflow_type = 0)
// {
// $where_client_group_id = "";
// if ($client_group_id != 0) {
// $where_client_group_id = " AND z.client_group_id = " . $client_group_id;
// }
// $where_type = "";
// if ($type != 0) {
// $where_type = " AND z.type = " . $type;
// }
// $where_workflow_type = "";
// if ($workflow_type != 0) {
// $where_workflow_type = " AND z.workflow_type = " . $workflow_type;
// }
// return DB::select(
// "SELECT
// z.*
// FROM t_zones as z WHERE z.dlt is null AND z.status = " .
// Zone::STATUS_ACTIVE .
// $where_client_group_id .
// $where_type .
// $where_workflow_type .
// " ;"
// );
// }
public static function getActiveZones($client_group_id = 0, $type = 0, $workflow_type = 0)
{
$where_client_group_id = "";
if ($client_group_id != 0) {
$where_client_group_id = " AND z.client_group_id = " . $client_group_id;
$where_client_group_id = " AND z.client_group_id = " . intval($client_group_id);
}
$where_type = "";
if ($type != 0) {
$where_type = " AND z.type = " . $type;
if (is_array($type)) {
$type_list = implode(",", array_map("intval", $type));
$where_type = " AND z.type IN (" . $type_list . ")";
} else {
$where_type = " AND z.type = " . intval($type);
}
}
$where_workflow_type = "";
if ($workflow_type != 0) {
$where_workflow_type = " AND z.workflow_type = " . $workflow_type;
$where_workflow_type = " AND z.workflow_type = " . intval($workflow_type);
}
return DB::select(
$sql =
"SELECT
z.*
FROM t_zones as z WHERE z.dlt is null AND z.status = " .
Zone::STATUS_ACTIVE .
$where_client_group_id .
$where_type .
$where_workflow_type .
" ;"
);
FROM t_zones as z
WHERE z.dlt IS NULL
AND z.status = " .
Zone::STATUS_ACTIVE .
$where_client_group_id .
$where_type .
$where_workflow_type .
";";
return DB::select($sql);
}
public static function showZoneById($zid)