From 198b8c08ad9a2f7aa62c089509d3091533e77dc4 Mon Sep 17 00:00:00 2001 From: solocla Date: Mon, 11 May 2026 14:47:42 +0200 Subject: [PATCH] Revert "update scheme different obbligatorioweb" This reverts commit a3eb0f0a57ec9f7a10b3d5e4544c2706849d666c. --- public/userarea/update_schemajson.php | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/public/userarea/update_schemajson.php b/public/userarea/update_schemajson.php index 87250c8..70b346b 100644 --- a/public/userarea/update_schemajson.php +++ b/public/userarea/update_schemajson.php @@ -170,30 +170,10 @@ try { $newDataType = $custom_field['Tipo'] ?? 'Testo'; - /* - * Required logic: - * First read SchemiCustomFieldsDettagli.ObbligatorioWeb. - * - * Values: - * - "Si" => required for this schema - * - "No" => not required for this schema - * - "Predefinito" => use CustomField.ObbligatorioWeb - */ - $schemaRequired = trim((string)($field['ObbligatorioWeb'] ?? 'Predefinito')); - $customRequired = !empty($custom_field['ObbligatorioWeb']); - - if (strcasecmp($schemaRequired, 'Si') === 0) { - $isRequired = 1; - } elseif (strcasecmp($schemaRequired, 'No') === 0) { - $isRequired = 0; - } else { - $isRequired = $customRequired ? 1 : 0; - } - $data = [ ':schema_id' => $schema_id, ':data_type' => $newDataType, - ':is_required' => $isRequired, + ':is_required' => !empty($custom_field['ObbligatorioWeb']) ? 1 : 0, ':default_value' => $custom_field['ValoreDefault'] ?? null, ':has_list' => !empty($custom_field['Elenco']) ? 1 : 0, ':length' => $custom_field['Lunghezza'] ?? 0, @@ -202,7 +182,7 @@ try { ':max_value' => $custom_field['Massimo'] ?? null, ':default_curr_date' => !empty($custom_field['DefaultCurrDate']) ? 1 : 0, ':tablename' => $target_table, - ':field_label' => $custom_field['TitoloTraduzione'] ?? $custom_field['Titolo'] ?? '' + ':field_label' => $custom_field['TitoloTraduzione'] ?? '' ]; $checkStmt->execute([$template_id, $fieldId]); @@ -254,6 +234,7 @@ try { $response["success"] = true; $response["message"] = "Schema JSON updated, mappings synchronized, removed fields deleted, and changed fields updated successfully."; + } catch (Exception $e) { if (isset($pdo) && $pdo->inTransaction()) { $pdo->rollback(); @@ -262,4 +243,4 @@ try { $response["message"] = $e->getMessage(); } -echo json_encode($response); +echo json_encode($response); \ No newline at end of file