1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of FacturaScripts |
4
|
|
|
* Copyright (C) 2021 Carlos Garcia Gomez <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU Lesser General Public License as |
8
|
|
|
* published by the Free Software Foundation, either version 3 of the |
9
|
|
|
* License, or (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU Lesser General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
17
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace FacturaScripts\Core\Lib\ExtendedController; |
21
|
|
|
|
22
|
|
|
use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
23
|
|
|
|
24
|
|
|
trait LogAuditTrait |
25
|
|
|
{ |
26
|
|
|
public function createViewLogAudit(string $viewName = 'ListLogMessage') |
27
|
|
|
{ |
28
|
|
|
$this->addListView($viewName, 'LogMessage', 'history', 'fas fa-history'); |
|
|
|
|
29
|
|
|
$this->views[$viewName]->addOrderBy(['time'], 'date', 2); |
30
|
|
|
$this->views[$viewName]->addSearchFields(['message', 'original']); |
31
|
|
|
|
32
|
|
|
// disable columns |
33
|
|
|
$this->views[$viewName]->disableColumn('channel'); |
34
|
|
|
$this->views[$viewName]->disableColumn('url'); |
35
|
|
|
|
36
|
|
|
// disable buttons |
37
|
|
|
$this->setSettings($viewName, 'btnDelete', false); |
|
|
|
|
38
|
|
|
$this->setSettings($viewName, 'btnNew', false); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function loadDataLogAudit($view, $model, $modelid) |
42
|
|
|
{ |
43
|
|
|
$where = [ |
44
|
|
|
new DataBaseWhere('model', $model), |
45
|
|
|
new DataBaseWhere('modelcode', $modelid) |
46
|
|
|
]; |
47
|
|
|
$view->loadData('', $where); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|