1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright (C) 2019 Joe Zegarra. |
5
|
|
|
* |
6
|
|
|
* This library is free software; you can redistribute it and/or |
7
|
|
|
* modify it under the terms of the GNU Lesser General Public |
8
|
|
|
* License as published by the Free Software Foundation; either |
9
|
|
|
* version 3 of the License, or (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This library 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 GNU |
14
|
|
|
* Lesser General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU Lesser General Public |
17
|
|
|
* License along with this library; if not, write to the Free Software |
18
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
19
|
|
|
* MA 02110-1301 USA |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Controller; |
23
|
|
|
|
24
|
|
|
use FacturaScripts\Core\Tools; |
25
|
|
|
use FacturaScripts\Dinamic\Lib\AssetManager; |
|
|
|
|
26
|
|
|
use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
|
|
|
|
27
|
|
|
use FacturaScripts\Core\Lib\ExtendedController\ListController; |
|
|
|
|
28
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Description of ListNCFTipoMovimiento |
32
|
|
|
* |
33
|
|
|
* @author Joe Zegarra |
34
|
|
|
*/ |
35
|
|
|
class ListNCFTipoMovimiento extends ListController |
36
|
|
|
{ |
37
|
|
|
public function getPageData(): array |
38
|
|
|
{ |
39
|
|
|
$pageData = parent::getPageData(); |
40
|
|
|
$pageData['menu'] = 'accounting'; |
41
|
|
|
$pageData['submenu'] = 'Republica Dominicana'; |
42
|
|
|
$pageData['title'] = 'ncf-movement-types'; |
43
|
|
|
$pageData['icon'] = 'fas fa-list'; |
44
|
|
|
|
45
|
|
|
return $pageData; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function addRestoreButton($viewName) |
49
|
|
|
{ |
50
|
|
|
$restoreButton = [ |
51
|
|
|
'color' => 'danger', |
52
|
|
|
'icon' => 'fas fa-undo', |
53
|
|
|
'label' => 'restore-original-data', |
54
|
|
|
'title' => 'restore-original-data', |
55
|
|
|
'type' => 'action', |
56
|
|
|
'action' => 'restore-data', |
57
|
|
|
'hint' => 'restore-original-data', |
58
|
|
|
'confirm' => true |
59
|
|
|
]; |
60
|
|
|
$this->addButton($viewName, $restoreButton); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
protected function createViews() |
64
|
|
|
{ |
65
|
|
|
$this->addView( |
66
|
|
|
'ListNCFTipoMovimiento-1', |
67
|
|
|
'NCFTipoMovimiento', |
68
|
|
|
'sales', |
69
|
|
|
'fas fa-store' |
70
|
|
|
); |
71
|
|
|
$this->addSearchFields('ListNCFTipoMovimiento-1', ['tipomovimiento','codigo','descripcion']); |
72
|
|
|
$this->addOrderBy('ListNCFTipoMovimiento-1', ['id'], 'code'); |
73
|
|
|
$this->addOrderBy('ListNCFTipoMovimiento-1', ['descripcion'], 'description'); |
74
|
|
|
$this->addRestoreButton('ListNCFTipoMovimiento-1'); |
75
|
|
|
|
76
|
|
|
$this->addView('ListNCFTipoMovimiento-2', 'NCFTipoMovimiento', 'purchases', 'fas fa-credit-card'); |
77
|
|
|
$this->addSearchFields('ListNCFTipoMovimiento-2', ['tipomovimiento','codigo','descripcion']); |
78
|
|
|
$this->addOrderBy('ListNCFTipoMovimiento-2', ['id'], 'code'); |
79
|
|
|
$this->addOrderBy('ListNCFTipoMovimiento-2', ['descripcion'], 'description'); |
80
|
|
|
$this->addRestoreButton('ListNCFTipoMovimiento-2'); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
protected function execPreviousAction($action) |
84
|
|
|
{ |
85
|
|
|
switch ($action) { |
86
|
|
|
case 'restore-data': |
87
|
|
|
$this->views['ListNCFTipoMovimiento-1']->model->restoreData(); |
88
|
|
|
Tools::log()->notice('restored-original-data'); |
89
|
|
|
break; |
90
|
|
|
case 'busca_movimiento': |
91
|
|
|
$this->setTemplate(false); |
92
|
|
|
$tipomovimiento = new NCFTipoMovimiento(); |
93
|
|
|
$where = [new DatabaseWhere('tipomovimiento', $_REQUEST['tipomovimiento'])]; |
94
|
|
|
$movimientos = $tipomovimiento->all($where); |
95
|
|
|
if ($movimientos) { |
96
|
|
|
//header('Content-Type: application/json'); |
97
|
|
|
echo json_encode(['movimientos' => $movimientos]); |
98
|
|
|
} else { |
99
|
|
|
echo ''; |
100
|
|
|
} |
101
|
|
|
break; |
102
|
|
|
default: |
103
|
|
|
parent::execPreviousAction($action); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
protected function loadData($viewName, $view) |
108
|
|
|
{ |
109
|
|
|
switch ($viewName) { |
110
|
|
|
case 'ListNCFTipoMovimiento-1': |
111
|
|
|
$where = [new DataBaseWhere('tipomovimiento', 'VEN')]; |
112
|
|
|
$view->loadData('', $where); |
113
|
|
|
break; |
114
|
|
|
|
115
|
|
|
case 'ListNCFTipoMovimiento-2': |
116
|
|
|
$where = [new DataBaseWhere('tipomovimiento', 'COM')]; |
117
|
|
|
$view->loadData('', $where); |
118
|
|
|
break; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths