diff --git a/app/time_conditions/time_conditions.php b/app/time_conditions/time_conditions.php index 12e55944c8..bb1f27d309 100644 --- a/app/time_conditions/time_conditions.php +++ b/app/time_conditions/time_conditions.php @@ -131,8 +131,7 @@ $sql .= " limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); + $dialplans = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //show the content @@ -173,7 +172,7 @@ echo "\n"; echo "\n"; echo "\n"; - if (permission_exists('dialplan_delete') && $result_count > 0) { + if (permission_exists('time_condition_delete') && is_array($dialplans)) { echo ""; } echo th_order_by('dialplan_name', $text['label-name'], $order_by, $order, $app_uuid, null, (($search != '') ? "search=".$search : null)); @@ -194,8 +193,8 @@ echo "\n"; echo "\n"; - if ($result_count > 0) { - foreach($result as $row) { + if (is_array($dialplans)) { + foreach($dialplans as $row) { $app_uuid = $row['app_uuid']; $tr_link = "href='".PROJECT_PATH."/app/time_conditions/time_condition_edit.php?id=".escape($row['dialplan_uuid']).(($app_uuid != '') ? "&app_uuid=".escape($app_uuid) : null)."'";