[FIX] Database::execute() → Database::query() in 5 controller
Database non ha metodo execute() — corretto in: InviteController, ServicesController, WebhookController, NormativeController, WhistleblowingController. Causa del HTTP 500 su tutti gli endpoint /api/invites/*. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
c906a6eff3
commit
9ccf2a72b5
@@ -95,7 +95,7 @@ class ServicesController extends BaseController
|
||||
|
||||
// Aggiorna last_used_at (async: non blocchiamo su errore)
|
||||
try {
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'UPDATE api_keys SET last_used_at = NOW() WHERE id = ?',
|
||||
[$record['id']]
|
||||
);
|
||||
@@ -329,7 +329,7 @@ class ServicesController extends BaseController
|
||||
$firstName = $parts[0] ?? $email;
|
||||
$lastName = $parts[1] ?? '';
|
||||
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO users (email, password_hash, first_name, last_name, role, status)
|
||||
VALUES (?, ?, ?, ?, ?, "active")',
|
||||
[$email, '', $firstName, $lastName, $role]
|
||||
@@ -345,7 +345,7 @@ class ServicesController extends BaseController
|
||||
[$userId, $orgId]
|
||||
);
|
||||
if (!$membership) {
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO user_organizations (user_id, organization_id, role) VALUES (?, ?, ?)',
|
||||
[$userId, $orgId, $role]
|
||||
);
|
||||
@@ -558,7 +558,7 @@ class ServicesController extends BaseController
|
||||
$orgId = (int) $existing['id'];
|
||||
} else {
|
||||
// ── 4. Crea organizzazione ───────────────────────────────────
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO organizations
|
||||
(name, legal_form, vat_number, fiscal_code, ateco_code, ateco_description,
|
||||
legal_address, pec, phone, annual_turnover_eur, employees,
|
||||
@@ -602,7 +602,7 @@ class ServicesController extends BaseController
|
||||
if ($existingUser) {
|
||||
$userId = (int) $existingUser['id'];
|
||||
} else {
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO users (email, password_hash, first_name, last_name, role, status,
|
||||
phone, job_title, must_change_password)
|
||||
VALUES (?,?,?,?,\'super_admin\',\'active\',?,?,1)',
|
||||
@@ -618,7 +618,7 @@ class ServicesController extends BaseController
|
||||
[$userId, $orgId]
|
||||
);
|
||||
if (!$mem) {
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO user_organizations (user_id, organization_id, role) VALUES (?,?,\'super_admin\')',
|
||||
[$userId, $orgId]
|
||||
);
|
||||
@@ -635,12 +635,12 @@ class ServicesController extends BaseController
|
||||
: date('Y-m-d H:i:s', strtotime('+12 months'));
|
||||
|
||||
// Revoca eventuali chiavi lg231-integration precedenti (idempotency)
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'UPDATE api_keys SET is_active=0 WHERE organization_id=? AND name LIKE \'lg231-integration-%\'',
|
||||
[$orgId]
|
||||
);
|
||||
|
||||
Database::execute(
|
||||
Database::query(
|
||||
'INSERT INTO api_keys (organization_id, name, key_prefix, key_hash, scopes, is_active, expires_at, created_by)
|
||||
VALUES (?,?,?,?,?,1,?,?)',
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user