Files
itflow/api/v1/services/read.php
johnnyq ade9d5aac3 Services modernization: new services list with Needs attention, Review due, High importance, No review set, Starred and Archived views, dependency chips, in-place importance, bulk importance/category/review schedule, mark reviewed, star, archive/restore/delete and CSV/PDF export; new service page with service facts, backup and recovery, who to call (vendor and client contact details), auto-saving notes and tabs for the assets it runs on, logins, domains and certificates, documents, tickets and history; compact quick look; shared add/edit form with importance, category suggestions, a review schedule and dependency pickers on add; review modal with checklist and history note; attention flags for expiring or expired domains and certificates, certificate check problems, infrastructure out of warranty or out of action, and archived records still linked; Report a problem opens a prefilled ticket linked to the service, plus a service_tickets table, ticket page services list and link/unlink from both sides; services, domains and certificates added to the generic link system, legacy service link actions routed through it with same-client checks; services shown on the asset, contact and vendor pages, the asset/domain/certificate/credential quick looks, the document Linked card, the client overview (card, attention items, upcoming reviews), the dashboard, calendar, global search, client PDF pack and nightly review notifications; archived services left out of nav counts and lookups; services read endpoint in the API; demo data review schedules; database update 2.8.7 (archive and review columns, wider category and backup, link table dedupe with primary keys, service_domains foreign keys, service_tickets)
2026-10-15 17:32:09 -04:00

31 lines
1.4 KiB
PHP

<?php
require_once '../validate_api_key.php';
require_once '../require_get_method.php';
// Archived ones only when asked for (?archived=1)
$archived_query = intval($_GET['archived'] ?? 0) === 1 ? '' : 'AND service_archived_at IS NULL';
if (isset($_GET['service_id'])) {
// Specific service via ID (single)
$id = intval($_GET['service_id']);
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_id = $id " . apiClientScopeSql('service_client_id'));
} elseif (isset($_GET['service_name'])) {
// Service by name
$name = mysqli_real_escape_string($mysqli, $_GET['service_name']);
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE service_name = '$name' $archived_query " . apiClientScopeSql('service_client_id') . " ORDER BY service_id LIMIT $limit OFFSET $offset");
} elseif (isset($_GET['review_due'])) {
// Due for review in the next 30 days, or overdue
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE " . serviceReviewDueSql() . " AND service_archived_at IS NULL " . apiClientScopeSql('service_client_id') . " ORDER BY service_review_due LIMIT $limit OFFSET $offset");
} else {
// All services (by client ID or all in general if key permits)
$sql = mysqli_query($mysqli, "SELECT * FROM services WHERE 1=1 $archived_query " . apiClientScopeSql('service_client_id') . " ORDER BY service_id LIMIT $limit OFFSET $offset");
}
// Output
require_once "../read_output.php";