This commit is contained in:
Pek5892 2024-03-22 15:30:25 +01:00
parent a6363ca6c5
commit 2df908b11c
2 changed files with 9 additions and 8 deletions

View File

@ -340,6 +340,7 @@ switch (post('op')) {
$new->data = $data; $new->data = $data;
$new->id_segment = $id_segment; $new->id_segment = $id_segment;
$new->numero = Fattura::getNextNumero($data, $dir, $id_segment); $new->numero = Fattura::getNextNumero($data, $dir, $id_segment);
$new->id_autofattura = null;
$new->save(); $new->save();

View File

@ -170,7 +170,7 @@ class Settings
} }
$result = ' $result = '
{[ "type": "select", "multiple": 0, "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}'; {[ "type": "select", "multiple": 0, "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
// Lista multipla // Lista multipla
@ -203,19 +203,19 @@ class Settings
} }
$result = ' $result = '
{[ "type": "select", "multiple": 1, "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.'][]", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}'; {[ "type": "select", "multiple": 1, "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.'][]", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
// Lista da query // Lista da query
elseif (preg_match('/^query=(.+?)$/', $setting->tipo, $m)) { elseif (preg_match('/^query=(.+?)$/', $setting->tipo, $m)) {
$result = ' $result = '
{[ "type": "select", "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "values": "'.str_replace('"', '\"', $setting->tipo).'", "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}'; {[ "type": "select", "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "values": "'.str_replace('"', '\"', $setting->tipo).'", "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
// Boolean (checkbox) // Boolean (checkbox)
elseif ($setting->tipo == 'boolean') { elseif ($setting->tipo == 'boolean') {
$result = ' $result = '
{[ "type": "checkbox", "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "placeholder": "'.tr('Attivo').'", "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}'; {[ "type": "checkbox", "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "placeholder": "'.tr('Attivo').'", "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
// Editor // Editor
@ -227,25 +227,25 @@ class Settings
'name' => 'setting['.$setting->id.']', 'name' => 'setting['.$setting->id.']',
'value' => $setting->valore, 'value' => $setting->valore,
'required' => intval($required), 'required' => intval($required),
'help' => $setting->help, 'help' => $setting->getTranslation('help'),
]); ]);
} }
// Campi di default // Campi di default
elseif (in_array($setting->tipo, ['textarea', 'timestamp', 'date', 'time'])) { elseif (in_array($setting->tipo, ['textarea', 'timestamp', 'date', 'time'])) {
$result = ' $result = '
{[ "type": "'.$setting->tipo.'", "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "value": '.json_encode($setting->valore).', "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}'; {[ "type": "'.$setting->tipo.'", "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "value": '.json_encode($setting->valore).', "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
// Campo di testo // Campo di testo
else { else {
$numerico = in_array($setting->tipo, ['integer', 'decimal']); $numerico = in_array($setting->tipo, ['integer', 'decimal']);
$tipo = preg_match('/password/i', $setting->nome, $m) ? 'password' : $setting->tipo; $tipo = preg_match('/password/i', $setting->getTranslation('title'), $m) ? 'password' : $setting->tipo;
$tipo = $numerico ? 'number' : 'text'; $tipo = $numerico ? 'number' : 'text';
$result = ' $result = '
{[ "type": "'.$tipo.'", "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "value": "'.$setting->valore.'"'.($numerico && $setting->tipo == 'integer' ? ', "decimals": 0' : '').', "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}'; {[ "type": "'.$tipo.'", "label": '.json_encode($setting->getTranslation('title')).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.']", "value": "'.$setting->valore.'"'.($numerico && $setting->tipo == 'integer' ? ', "decimals": 0' : '').', "required": "'.intval($required).'", "help": "'.$setting->getTranslation('help').'" ]}';
} }
return $result; return $result;