query( "SELECT * FROM task a WHERE a.deleted_at IS NULL AND a.task_id = '".$task_id."' AND a.created_by = '".$staff_info['staff_id']."' AND a.status IN ( 'pending', 'assigned', 'resubmit', 'progress', 'completed', 'confirmed' ) LIMIT 1" ) ; if ( $select->num_rows > 0 ){ $status = '303' ; $row = $select->fetch_assoc() ; if ( $mysqli->query( "UPDATE task SET status = 'cancelled' WHERE task_id = '".$task_id."'" ) ) { $mysqli->query( "INSERT INTO task_rejected ( `task_id`, `staff_id`, `remark` ) VALUES ( '".$task_id."', '".$staff_info['staff_id']."', '".$reason."' )" ) ; $status = '200' ; // push to notification $related_staffid = getTaskRelatedStaff( $task_id, $row['created_by'], $row['assigned_by'] ) ; foreach ( $related_staffid as $k => $v ){ pushToUserCron( 'task', $task_id, $v, 'Task Cancelled', 'Task ( '.$row['task_so'].' ) has been cancelled' ) ; } } } } } require( $require_sub.'footer.php' ) ; ?>