Complete port of all 163 API endpoints from Lucee/CFML to PHP 8.3. Shared helpers in api/helpers.php (DB, auth, request/response, security). PDO prepared statements throughout. Same JSON response shapes as CFML.
37 lines
940 B
PHP
37 lines
940 B
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
global $businessId;
|
|
|
|
$data = readJsonBody();
|
|
$servicePointId = (int) ($data['ServicePointID'] ?? 0);
|
|
|
|
if ($servicePointId <= 0) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'missing_servicepoint_id', 'MESSAGE' => 'ServicePointID is required']);
|
|
}
|
|
|
|
$q = queryOne("
|
|
SELECT ID, BusinessID, Name, Code, TypeID, IsActive, SortOrder
|
|
FROM ServicePoints
|
|
WHERE ID = ? AND BusinessID = ?
|
|
LIMIT 1
|
|
", [$servicePointId, $businessId]);
|
|
|
|
if (!$q) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'not_found']);
|
|
}
|
|
|
|
jsonResponse([
|
|
'OK' => true,
|
|
'ERROR' => '',
|
|
'SERVICEPOINT' => [
|
|
'ServicePointID' => (int) $q['ID'],
|
|
'BusinessID' => (int) $q['BusinessID'],
|
|
'Name' => $q['Name'],
|
|
'Code' => $q['Code'] ?? '',
|
|
'TypeID' => (int) $q['TypeID'],
|
|
'IsActive' => (int) $q['IsActive'],
|
|
'SortOrder' => (int) $q['SortOrder'],
|
|
],
|
|
]);
|