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.
32 lines
959 B
PHP
32 lines
959 B
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
global $businessId;
|
|
|
|
$data = readJsonBody();
|
|
$bizId = $businessId;
|
|
if ($bizId <= 0) $bizId = (int) ($data['BusinessID'] ?? 0);
|
|
if ($bizId <= 0) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'no_business_selected']);
|
|
}
|
|
|
|
$servicePointId = (int) ($data['ServicePointID'] ?? 0);
|
|
if ($servicePointId <= 0) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'missing_service_point_id', 'MESSAGE' => 'ServicePointID is required']);
|
|
}
|
|
|
|
queryTimed("
|
|
UPDATE ServicePoints SET BeaconMinor = NULL
|
|
WHERE ID = ? AND BusinessID = ?
|
|
", [$servicePointId, $bizId]);
|
|
|
|
$qCheck = queryOne("
|
|
SELECT ID FROM ServicePoints WHERE ID = ? AND BusinessID = ? LIMIT 1
|
|
", [$servicePointId, $bizId]);
|
|
|
|
if (!$qCheck) {
|
|
apiAbort(['OK' => false, 'ERROR' => 'not_found', 'DEBUG_ServicePointID' => $servicePointId, 'DEBUG_BusinessID' => $bizId]);
|
|
}
|
|
|
|
jsonResponse(['OK' => true, 'ERROR' => '', 'ServicePointID' => $servicePointId]);
|