1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-29 23:14:55 +01:00

Fix salvataggio nome vista e migliorie minori

This commit is contained in:
loviuz 2024-03-31 01:06:03 +01:00
parent 22edea5520
commit 62d372df0a
5 changed files with 72 additions and 19 deletions

View File

@ -113,6 +113,7 @@
"Modules\\Partitario\\": ["modules/partitario/custom/src/", "modules/partitario/src/"],
"Modules\\StatoEmail\\": ["modules/stato_email/custom/src/", "modules/stato_email/src/"],
"Modules\\FileAdapters\\": ["modules/adattatori_archiviazione/custom/src/", "modules/adattatori_archiviazione/src/"],
"Modules\\ModuleFields\\": ["modules/viste/custom/src/", "modules/viste/src/"],
"Plugins\\ExportFE\\": ["plugins/exportFE/custom/src/", "plugins/exportFE/src/"],
"Plugins\\ImportFE\\": ["plugins/importFE/custom/src/", "plugins/importFE/src/"],
"Plugins\\ReceiptFE\\": ["plugins/receiptFE/custom/src/", "plugins/receiptFE/src/"],

View File

@ -21,6 +21,7 @@ include_once __DIR__.'/../../core.php';
use Models\Clause;
use Models\Module;
use Modules\ModuleFields\ModuleField;
switch (filter('op')) {
case 'update':
@ -68,15 +69,16 @@ switch (filter('op')) {
$id = post('id')[$c];
$dbo->update('zz_views', $array, ['id' => $id]);
$dbo->update('zz_views_lang', [
'name' => $name,
], ['id_record' => $id, 'id_lang' => Models\Locale::getDefault()->id]);
} elseif (!empty($query)) {
$array['order'] = orderValue('zz_views', 'id_module', $id_record);
$dbo->insert('zz_views', $array);
$id = $dbo->lastInsertedID();
}
// Aggiornamento traduzione nome campo
$vista = ModuleField::find($id);
$vista->setTranslation('name', $name);
// Aggiornamento dei permessi relativi
$dbo->sync('zz_group_view', ['id_vista' => $id], ['id_gruppo' => (array) post('gruppi')[$c]]);
} else {

View File

@ -59,7 +59,7 @@ echo '
<div class="row">
<div class="col-md-6">
{[ "type": "textarea", "label": "'.tr('Query di default').'", "name": "options", "value": '.json_encode(str_replace(']}', '] }', $record->options)).', "readonly": "1", "class": "autosize" ]}
{[ "type": "textarea", "label": "'.tr('Query originale').'", "name": "options", "value": '.json_encode(str_replace(']}', '] }', $record->options)).', "readonly": "1", "class": "autosize" ]}
</div>
<div class="col-md-6">

View File

@ -39,25 +39,15 @@ foreach ($fields as $key => $field) {
<div class="box collapsed-box box-'.($field->visible ? 'success' : 'danger').'">
<div class="box-header with-border">
<h3 class="box-title">'.
tr('Campo in posizione _POSITION_', [
'_POSITION_' => $field->order,
]).' ('.$field->getTranslation('name').') <span class="badge tip" title="'.tr('Modificato il ').Translator::timestampToLocale($field->updated_at).'" >'.Translator::timestampToLocale($field->created_at).'</span>
$field->getTranslation('name').' <small class="text-muted">'.(new \Carbon\Carbon($field->created_at))->diffForHumans().'</small>
</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-plus"></i>
<i class="fa fa-plus"></i>
</button>
</div>';
if ($editable) {
echo '
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-id="'.$field->id.'">
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>';
}
echo '
</div>
</div>
<div id="field-'.$field->id.'" class="box-body collapse">
<div class="row">
@ -129,7 +119,15 @@ foreach ($fields as $key => $field) {
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Ordina tramite').'", "name": "order_by['.$key.']", "value": "'.$field->order_by.'", "readonly": "'.(!$editable).'", "help": "'.tr("Query personalizzata per l'ordinamento (date e numeri formattati tramite query)").'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
</div>
</div>
</div>';
if ($editable) {
echo '
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-id="'.$field->id.'">
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>';
}
echo '
</div>
</div>';
}

View File

@ -0,0 +1,52 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Modules\ModuleFields;
use Models\Module;
use Common\SimpleModelTrait;
use Traits\RecordTrait;
use Illuminate\Database\Eloquent\Model;
class ModuleField extends Model
{
use SimpleModelTrait;
use RecordTrait;
protected $table = 'zz_views';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
protected $translatable = ['name'];
public function getModuleAttribute()
{
return 'Viste';
}
public function module()
{
return $this->belongsTo(Module::class, 'id_module');
}
}