Bugfix
This commit is contained in:
parent
e858c09107
commit
bb41a50314
12
add.php
12
add.php
|
@ -37,19 +37,19 @@ echo '
|
|||
// Campi personalizzati
|
||||
echo '
|
||||
|
||||
<div class="hide" id="custom_fields_top">
|
||||
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "top" )}
|
||||
<div class="hide" id="custom_fields_top-add">
|
||||
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "top", "place": "add" )}
|
||||
</div>
|
||||
|
||||
<div class="hide" id="custom_fields_bottom">
|
||||
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "bottom" )}
|
||||
<div class="hide" id="custom_fields_bottom-add">
|
||||
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "bottom", "place": "add" )}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#form_'.$id_module.'-'.$id_plugin.' form:first").prepend($("#custom_fields_top").html());
|
||||
$("#form_'.$id_module.'-'.$id_plugin.' form:first").prepend($("#custom_fields_top-add").html());
|
||||
|
||||
$("#form_'.$id_module.'-'.$id_plugin.' form:first .panel").last().after($("#custom_fields_bottom").html());
|
||||
$("#form_'.$id_module.'-'.$id_plugin.' form:first .panel").last().after($("#custom_fields_bottom-add").html());
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ echo '
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{[ "type": "email", "label": "<?php echo tr('Oggetto') ?>", "name": "subject", "value": "$subject$" ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Oggetto') ?>", "name": "subject", "value": "$subject$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
|
|
@ -33,7 +33,7 @@ if (get('anteprima') !== null) {
|
|||
}
|
||||
|
||||
?>
|
||||
<form class="canvas" action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>" method="post" id="form-firma">
|
||||
<form action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>" method="post" id="form-firma" class="hide">
|
||||
<input type="hidden" name="op" value="firma">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
|
|
|
@ -100,6 +100,9 @@ class HTMLBuilder
|
|||
$result = !empty($class) ? $class->manage($json) : '';
|
||||
|
||||
$html = str_replace($value, !empty($result) ? $result : $value, $html);
|
||||
|
||||
// Ricorsione
|
||||
$html = self::replace($html);
|
||||
}
|
||||
|
||||
// Gestione del formato di input HTML semplificato
|
||||
|
@ -110,6 +113,9 @@ class HTMLBuilder
|
|||
$result = self::generate($json);
|
||||
|
||||
$html = str_replace($value, !empty($result) ? $result : $value, $html);
|
||||
|
||||
// Ricorsione
|
||||
$html = self::replace($html);
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
|
|
@ -30,6 +30,10 @@ class FieldManager implements ManagerInterface
|
|||
$query .= ' AND `id_record` = '.prepare($options['id_record']);
|
||||
}
|
||||
|
||||
if (isset($options['place']) && $options['place'] == 'add') {
|
||||
$query .= ' AND `on_add` = 1';
|
||||
}
|
||||
|
||||
$query .= ' AND `top` = '.((isset($options['position']) && $options['position'] == 'top') ? 1 : 0).' ORDER BY `order`';
|
||||
|
||||
$results = $database->fetchArray($query);
|
||||
|
@ -51,9 +55,19 @@ class FieldManager implements ManagerInterface
|
|||
|
||||
$field['value'] = isset($field['value']) ? $field['value'] : '';
|
||||
|
||||
$replace = [
|
||||
'value' => $field['value'],
|
||||
'label' => $field['name'],
|
||||
'name' => $field['html_name'],
|
||||
];
|
||||
|
||||
foreach ($replace as $key => $value) {
|
||||
$field['content'] = str_replace('|'.$key.'|', $value, $field['content']);
|
||||
}
|
||||
|
||||
$result .= '
|
||||
<div class="col-xs-4">
|
||||
'.str_replace('|value|', $field['value'], $field['content']).'
|
||||
'.$field['content'].'
|
||||
</div>';
|
||||
|
||||
if (($key + 1) % 3 == 0) {
|
||||
|
|
|
@ -223,14 +223,18 @@ UPDATE `zz_widgets` SET `help` = 'Fatturato IVA inclusa.' WHERE `zz_widgets`.`na
|
|||
|
||||
CREATE TABLE IF NOT EXISTS `zz_fields` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_module` int(11) NOT NULL,
|
||||
`id_module` int(11),
|
||||
`id_plugin` int(11),
|
||||
`name` varchar(255) NOT NULL,
|
||||
`html_name` varchar(255) NOT NULL,
|
||||
`content` text NOT NULL,
|
||||
`options` text,
|
||||
`order` int(11) NOT NULL,
|
||||
`on_add` boolean NOT NULL,
|
||||
`top` boolean NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_module`) REFERENCES `zz_modules`(`id`) ON DELETE CASCADE
|
||||
FOREIGN KEY (`id_plugin`) REFERENCES `zz_plugins`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue