diff --git a/public/userarea/create_fixed_fields.php b/public/userarea/create_fixed_fields.php
index 61a598a..57eae37 100644
--- a/public/userarea/create_fixed_fields.php
+++ b/public/userarea/create_fixed_fields.php
@@ -30,6 +30,8 @@ if ((int)$stmt->fetchColumn() > 0) {
$fixedFields = [
// fixed_field_key, data_type
['ClienteResponsabile', 'INT'],
+ ['ClienteFornitore', 'INT'],
+ ['ClienteAnalisi', 'INT'],
['MoltiplicatorePrezzo', 'INT'],
['AnagraficaCertestObject', 'INT'],
['AnagraficaCertestService', 'INT'],
diff --git a/public/userarea/debug_commessa_api.php b/public/userarea/debug_commessa_api.php
new file mode 100644
index 0000000..7f70715
--- /dev/null
+++ b/public/userarea/debug_commessa_api.php
@@ -0,0 +1,290 @@
+No records found';
+ return;
+ }
+
+ $firstRow = reset($items);
+ if (!is_array($firstRow)) {
+ echo '
' . h(json_encode($items, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) . '
';
+ return;
+ }
+
+ $headers = [];
+ foreach ($items as $row) {
+ if (is_array($row)) {
+ $headers = array_unique(array_merge($headers, array_keys($row)));
+ }
+ }
+
+ echo '';
+ echo '
';
+ echo '';
+ foreach ($headers as $header) {
+ echo '| ' . h($header) . ' | ';
+ }
+ echo '
';
+
+ foreach ($items as $row) {
+ echo '';
+ foreach ($headers as $header) {
+ $value = $row[$header] ?? '';
+ if (is_array($value) || is_object($value)) {
+ $value = json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
+ echo '' . h($value) . ' | ';
+ } else {
+ echo '' . h($value) . ' | ';
+ }
+ }
+ echo '
';
+ }
+
+ echo '
';
+ echo '
';
+}
+
+try {
+ if ($entityId > 0) {
+ $api = VisualLimsApiClient::getInstance();
+
+ // Default expands for better debugging
+ if ($customExpand !== '') {
+ $expand = $customExpand;
+ } else {
+ if ($entityType === 'CommessaWeb') {
+ $expand = implode(',', [
+ 'CommesseCustomFields($expand=CustomField)',
+ 'Campioni'
+ ]);
+ } else {
+ $expand = implode(',', [
+ 'CommesseCustomFields($expand=CustomField)',
+ 'Campioni'
+ ]);
+ }
+ }
+
+ $rawEndpoint = $entityType . '(' . $entityId . ')?$expand=' . $expand;
+ $result = $api->get($rawEndpoint);
+ }
+} catch (Exception $e) {
+ $error = $e->getMessage();
+}
+?>
+
+
+
+
+
+
+ Debug Commessa API
+
+
+
+
+
+
+
+
Commessa / CommessaWeb API Inspector
+
+
+
+
+
+
+
Requested Endpoint
+
= h($rawEndpoint) ?>
+
+
+
+
+
+
+ API Error:
+ = h($error) ?>
+
+
+
+
+
+
+
Main Information
+
+
+ ID
+ = h($result['IdCommessa'] ?? $result['IdCommessaWeb'] ?? '') ?>
+
+
+ Code
+ = h($result['CodiceCommessa'] ?? '') ?>
+
+
+ Cliente
+ = h($result['Cliente'] ?? '') ?>
+
+
+ SchemaCustomField
+ = h($result['SchemaCustomField'] ?? '') ?>
+
+
+ Richiedente
+ = h($result['Richiedente'] ?? '') ?>
+
+
+ Descrizione
+ = h($result['Descrizione'] ?? '') ?>
+
+
+
+
+
+
Direct Properties
+
= h(json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) ?>
+
+
+
+
+
CommesseCustomFields
+ $field['IdCommesseCustomFields'] ?? '',
+ 'Valore' => $field['Valore'] ?? '',
+ 'CustomFieldId' => $field['CustomField']['IdCustomField'] ?? '',
+ 'Label' => $field['CustomField']['Descrizione'] ?? ($field['CustomField']['Name'] ?? ''),
+ 'Tipo' => $field['CustomField']['Tipo'] ?? '',
+ ];
+ }
+ renderArrayAsTable($fieldsRows);
+ ?>
+
+
+
+
+
+
+
+
+
Raw JSON
+
= h(json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) ?>
+
+ 0 && !$error): ?>
+
+
No data returned from API
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/userarea/error_log.txt b/public/userarea/error_log.txt
index 81f9982..70b7984 100644
--- a/public/userarea/error_log.txt
+++ b/public/userarea/error_log.txt
@@ -315,3 +315,4 @@
2026-02-28 21:01:27 [AnagraficaCertestService] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
2026-03-01 19:11:58 [AnagraficaCertestObject] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
2026-03-18 15:51:45 [AnagraficaCertestService] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
+2026-03-19 09:50:34 [AnagraficaCertestService] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
diff --git a/public/userarea/export_to_lims.php b/public/userarea/export_to_lims.php
index 7148733..d9e0929 100644
--- a/public/userarea/export_to_lims.php
+++ b/public/userarea/export_to_lims.php
@@ -101,6 +101,7 @@ try {
$anagraficaObject = !empty($result['anagrafica_certest_object_id']) ? (int) $result['anagrafica_certest_object_id'] : null;
$anagraficaService = !empty($result['anagrafica_certest_service_id']) ? (int) $result['anagrafica_certest_service_id'] : null;
$clienteFornitore = !empty($result['cliente_fornitore_id']) ? (int) $result['cliente_fornitore_id'] : null;
+ $clienteAnalisi = !empty($result['clienteAnalisi']) ? (int) $result['clienteAnalisi'] : null;
$consegnaRichiesta = !empty($result['consegna_richiesta']) ? $result['consegna_richiesta'] : null;
// 🔹 STEP 3: Fetch Parts (including idmatrice)
@@ -175,6 +176,7 @@ try {
"AnagraficaCertestObject" => $anagraficaObject,
"AnagraficaCertestService" => $anagraficaService,
"ClienteFornitore" => $clienteFornitore, // PLACEHOLDER — to be implemented
+ "ClienteAnalisi" => $clienteAnalisi, // PLACEHOLDER — to be implemented
// DeliveryRequest goes to Campione, not CommessaWeb
];
diff --git a/public/userarea/import_edit2.php b/public/userarea/import_edit2.php
index cb6d978..0409654 100644
--- a/public/userarea/import_edit2.php
+++ b/public/userarea/import_edit2.php
@@ -167,6 +167,8 @@ $fixedFieldsRaw = $fixedStmt->fetchAll(PDO::FETCH_ASSOC);
// Ordine desiderato: Cliente Responsabile prima, poi gli altri, ConsegnaRichiesta prima delle 3 speciali
$desiredOrder = [
'ClienteResponsabile',
+ 'ClienteFornitore',
+ 'ClienteAnalisi',
'AnagraficaCertestObject',
'AnagraficaCertestService',
'MoltiplicatorePrezzo',
@@ -174,8 +176,8 @@ $desiredOrder = [
// se ci sono altri campi fixed li mettiamo dopo
];
-// ClienteFornitore is rendered as a standalone column (like idclient), skip it in fixed fields
-$excludeFromFixed = ['ClienteFornitore'];
+// No exclusions: fixed fields will be rendered together at the end
+$excludeFromFixed = [];
$fixedFields = [];
$tempMap = [];
@@ -199,10 +201,11 @@ foreach ($tempMap as $f) {
// Maps logical fixed_field_key → real datadb column name (mirrors JS fixedAliasMap)
$fixedAliasMap = [
'ClienteResponsabile' => 'cliente_responsabile_id',
+ 'ClienteFornitore' => 'cliente_fornitore_id',
+ 'ClienteAnalisi' => 'clienteAnalisi',
'MoltiplicatorePrezzo' => 'moltiplicatore_prezzo_id',
'AnagraficaCertestObject' => 'anagrafica_certest_object_id',
'AnagraficaCertestService' => 'anagrafica_certest_service_id',
- 'ClienteFornitore' => 'cliente_fornitore_id',
'ConsegnaRichiesta' => 'consegna_richiesta',
];
@@ -966,15 +969,9 @@ function fixedDefaultValue(array $f): string
Recupero clienti in corso...
-
-
-
-
-
" . htmlspecialchars($mapping['field_label']) . "";
@@ -1245,13 +1242,9 @@ function fixedDefaultValue(array $f): string
-
-
-
+
$d['datadb_id'] == $row['iddatadb']);
$autoIndex = 0;
foreach ($allMappings as $mapping) {
@@ -1376,7 +1369,7 @@ function fixedDefaultValue(array $f): string
. (((int)$f['is_required'] === 1) ? "required" : "")
. ">";
} else {
- $isApiField = in_array($key, ['MoltiplicatorePrezzo', 'ClienteResponsabile', 'AnagraficaCertestObject', 'AnagraficaCertestService'], true);
+ $isApiField = in_array($key, ['MoltiplicatorePrezzo', 'ClienteResponsabile', 'ClienteFornitore', 'ClienteAnalisi', 'AnagraficaCertestObject', 'AnagraficaCertestService'], true);
$selectClass = $isApiField ? 'api-fixed-select' : '';
echo "