Fix classe per salvataggio vista

This commit is contained in:
loviuz 2024-03-31 01:17:33 +01:00
parent 62d372df0a
commit b72dce21dc
4 changed files with 8 additions and 58 deletions

View File

@ -113,7 +113,6 @@
"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,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Models\Clause;
use Models\Module;
use Modules\ModuleFields\ModuleField;
use Models\View;
switch (filter('op')) {
case 'update':
@ -76,7 +76,7 @@ switch (filter('op')) {
}
// Aggiornamento traduzione nome campo
$vista = ModuleField::find($id);
$vista = View::find($id);
$vista->setTranslation('name', $name);
// Aggiornamento dei permessi relativi
@ -156,7 +156,11 @@ switch (filter('op')) {
case 'test':
$module_query = Util\Query::getQuery(Module::find($id_record));
$dbo->fetchArray($module_query.' LIMIT 1');
try{
$dbo->fetchArray($module_query.' LIMIT 1');
} catch (PDOException $e) {
flash()->error(tr('Impossibile eseguire la query!'));
}
break;

View File

@ -39,8 +39,7 @@ 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">'.
$field->getTranslation('name').' <small class="text-muted">'.(new \Carbon\Carbon($field->created_at))->diffForHumans().'</small>
$field->getTranslation('name').' <small class="text-muted tip" title="'.(new \Carbon\Carbon($field->updated_at))->format('d/m/Y H:i').'">'.(new \Carbon\Carbon($field->updated_at))->diffForHumans().'</small>
</h3>
<div class="box-tools pull-right">

View File

@ -1,52 +0,0 @@
<?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');
}
}