Issues (232)

Extension/Controller/EditSettings.php (2 issues)

Labels
Severity
1
<?php
2
/*
3
 * Copyright (C) 2023 Joe Nilson <[email protected]>
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as
7
 * published by the Free Software Foundation, either version 3 of the
8
 * License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Lesser General Public License for more details.
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller;
19
20
use Closure;
21
use FacturaScripts\Core\Base\DataBase;
0 ignored issues
show
The type FacturaScripts\Core\Base\DataBase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
use FacturaScripts\Core\Tools;
23
24
class EditSettings
25
{
26
    public function execAfterAction(): Closure
27
    {
28
         return function($action) {
29
            //return $action;
30
            if ($action === 'fixfacturasprov') {
31
                $dataBase = new DataBase();
32
                $sqlType = " CONSTRAINT ";
33
                if (strtoupper(FS_DB_TYPE) === 'MYSQL') {
0 ignored issues
show
The constant FacturaScripts\Plugins\f...n\Controller\FS_DB_TYPE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
34
                    $sqlType = " INDEX ";
35
                    $dataBase->exec("set FOREIGN_KEY_CHECKS=0;");
36
                }
37
                $result = $dataBase->exec("ALTER TABLE facturasprov DROP " . $sqlType .
38
                                                " IF EXISTS uniq_empresancf_facturasprov;");
39
                if (strtoupper(FS_DB_TYPE) === 'MYSQL') {
40
                    $dataBase->exec("set FOREIGN_KEY_CHECKS=1;");
41
                }
42
                if ($result) {
43
                    Tools::log()->notice('success-drop-index-uniq_empresancf_facturasprov');
44
                } else {
45
                    Tools::log()->warning('error-drop-index-uniq_empresancf_facturasprov');
46
                }
47
48
49
            } elseif ($action === 'fixfacturascli') {
50
                Tools::log()->notice('fixfacturascli');
51
            }
52
         };
53
    }
54
55
}