Revert "update scheme different obbligatorioweb"
This reverts commit a3eb0f0a57ec9f7a10b3d5e4544c2706849d666c.
This commit is contained in:
parent
28c467d55e
commit
198b8c08ad
@ -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);
|
||||
Loading…
x
Reference in New Issue
Block a user