Fix valorizzazione campi personalizzati

This commit is contained in:
Beppe 2024-01-31 09:12:25 +01:00
parent 992d0bc57e
commit 8966998511
2 changed files with 7 additions and 7 deletions

View File

@ -491,7 +491,7 @@ if ($structure->permission == 'rw') {
$query = 'SELECT `id`, `html_name` AS `name` FROM `zz_fields` WHERE '.$custom_where;
$customs = $dbo->fetchArray($query);
if (!string_starts_with(post('op'), 'delete')) {
if (post('op')!='delete') {
$values = [];
foreach ($customs as $custom) {
if (post($custom['name']) !== null) {
@ -502,7 +502,7 @@ if ($structure->permission == 'rw') {
}
// Inserimento iniziale
if (string_starts_with(post('op'), 'add')) {
if (post('op')=='add') {
// Informazioni di log
Filter::set('get', 'id_record', $id_record);
@ -516,7 +516,7 @@ if ($structure->permission == 'rw') {
}
// Aggiornamento
elseif (string_starts_with(post('op'), 'update')) {
if (post('op')=='update') {
$query = 'SELECT `zz_field_record`.`id_field` FROM `zz_field_record` JOIN `zz_fields` ON `zz_fields`.`id` = `zz_field_record`.`id_field` WHERE id_record = '.prepare($id_record).' AND '.$custom_where;
$customs_present = $dbo->fetchArray($query);
$customs_present = array_column($customs_present, 'id_field');

View File

@ -275,11 +275,11 @@ if (empty($record) || !$has_access) {
// Campi personalizzati
echo '
<div class="hide" id="custom_fields_top-edit">
<div class="hide" id="custom_fields_top-edit_'.$id_module.'-'.$id_plugin.'">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "position": "top" )}
</div>
<div class="hide" id="custom_fields_bottom-edit">
<div class="hide" id="custom_fields_bottom-edit_'.$id_module.'-'.$id_plugin.'">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )}
</div>
@ -299,10 +299,10 @@ if (empty($record) || !$has_access) {
}
// Campi a inizio form
aggiungiContenuto(form, "#custom_fields_top-edit", {}, true);
aggiungiContenuto(form, "#custom_fields_top-edit_'.$id_module.'-'.$id_plugin.'", {}, true);
// Campi a fine form
aggiungiContenuto(last, "#custom_fields_bottom-edit", {});
aggiungiContenuto(last, "#custom_fields_bottom-edit_'.$id_module.'-'.$id_plugin.'", {});
});
</script>';