mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-22 14:27:42 +01:00
Aggiunto controllo per Anagrafiche con codici REA non validi
This commit is contained in:
parent
5f85920013
commit
8606b84f6a
@ -187,10 +187,16 @@ if ($database->isInstalled()){
|
||||
'minimum' => '5.7.0',
|
||||
'maximum' => '8.0.99',
|
||||
],
|
||||
|
||||
'sort_buffer_size' => [
|
||||
'type' => 'value',
|
||||
'description' => '>4M',
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
||||
foreach (App::getConfig()['db_options'] as $n => $v){
|
||||
/*foreach (App::getConfig()['db_options'] as $n => $v){
|
||||
|
||||
switch ($n){
|
||||
case 'sort_buffer_size':
|
||||
@ -201,7 +207,7 @@ if ($database->isInstalled()){
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Models\Cache;
|
||||
use Modules\Aggiornamenti\Controlli\ColonneDuplicateViste;
|
||||
use Modules\Aggiornamenti\Controlli\ReaValidi;
|
||||
use Modules\Aggiornamenti\Controlli\PluginDuplicati;
|
||||
use Modules\Aggiornamenti\Controlli\Controllo;
|
||||
use Modules\Aggiornamenti\Controlli\DatiFattureElettroniche;
|
||||
@ -59,6 +60,7 @@ switch (filter('op')) {
|
||||
DatiFattureElettroniche::class,
|
||||
ColonneDuplicateViste::class,
|
||||
PluginDuplicati::class,
|
||||
ReaValidi::class,
|
||||
];
|
||||
|
||||
$results = [];
|
||||
|
83
modules/aggiornamenti/src/Controlli/ReaValidi.php
Normal file
83
modules/aggiornamenti/src/Controlli/ReaValidi.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?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\Aggiornamenti\Controlli;
|
||||
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
|
||||
class ReaValidi extends Controllo
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return tr('Anagrafiche con codici REA non validi');
|
||||
}
|
||||
|
||||
public function getType($record)
|
||||
{
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
public function getOptions($record)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
$database = database();
|
||||
|
||||
/**
|
||||
* Verifico se i rea inseriti per le anagrafiche hanno una struttura valida.
|
||||
*/
|
||||
$anagrafiche_interessate = $database->fetchArray('SELECT
|
||||
an_anagrafiche.idanagrafica AS id,
|
||||
an_anagrafiche.codicerea,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
GROUP_CONCAT(an_tipianagrafiche.descrizione) AS tipi_anagrafica
|
||||
FROM an_anagrafiche
|
||||
INNER JOIN an_tipianagrafiche_anagrafiche ON an_tipianagrafiche_anagrafiche.idanagrafica = an_anagrafiche.idanagrafica
|
||||
INNER JOIN an_tipianagrafiche ON an_tipianagrafiche.idtipoanagrafica = an_tipianagrafiche_anagrafiche.idtipoanagrafica
|
||||
WHERE
|
||||
codicerea NOT REGEXP "^..-......$" AND codicerea != ""
|
||||
AND
|
||||
deleted_at IS NULL
|
||||
GROUP BY an_anagrafiche.idanagrafica');
|
||||
|
||||
foreach ($anagrafiche_interessate as $anagrafica) {
|
||||
|
||||
/*$tipi = explode(',', $anagrafica['tipi_anagrafica']);
|
||||
$cliente = in_array('Cliente', $tipi) && empty($anagrafica['idconto_cliente']);
|
||||
$fornitore = in_array('Fornitore', $tipi) && empty($anagrafica['idconto_fornitore']);*/
|
||||
|
||||
$this->addResult([
|
||||
'id' => $anagrafica['id'],
|
||||
'nome' => $anagrafica['ragione_sociale'],
|
||||
'descrizione' => tr('Il codice REA "_REA_" non è valido', [
|
||||
'_REA_' => $anagrafica['codicerea'],
|
||||
]),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function execute($record, $params = [])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user