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']."' OR a.assigned_by = '".$staff_info['staff_id']."' OR EXISTS ( SELECT b.staff_id FROM task_joinstaff b WHERE a.task_id = b.task_id AND b.staff_id = '".$staff_info['staff_id']."' LIMIT 1 ) ) AND a.status IN ( 'pending', 'assigned' ) LIMIT 1" ) ; if ( $select->num_rows > 0 ){ $status = '212' ; if ( $mysqli->query( "UPDATE task SET status = 'rejected', rejected_at = '".TODAYDATE."', rejected_by = '".$staff_info['staff_id']."', rejected_reason = '".$reason."' WHERE task_id = '".$task_id."'" ) ) { $status = '200' ; } } } } require( $require_sub.'footer.php' ) ; ?>