From 71b1f91005d15fd043422bdbce7cc4d4592833d2 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Wed, 31 Jan 2024 14:23:46 +0100 Subject: [PATCH] Formattazione codice --- actions.php | 6 +-- core.php | 2 +- include/top.php | 6 +-- index.php | 13 +++--- modules/aggiornamenti/database.php | 14 +++---- modules/contratti/bulk.php | 2 +- modules/ddt/bulk.php | 2 +- modules/ddt/edit.php | 8 ++-- modules/emails/src/OAuth2/Microsoft.php | 2 +- modules/emails/src/OAuth2/MicrosoftLogin.php | 1 - modules/fatture/edit.php | 4 +- modules/interventi/add.php | 2 +- modules/interventi/ajax_tecnici.php | 2 +- modules/interventi/edit.php | 40 +++++++++---------- modules/interventi/modals/anteprima_firma.php | 2 +- modules/oauth/edit.php | 12 +++--- modules/oauth/init.php | 3 +- modules/ordini/bulk.php | 4 +- modules/preventivi/bulk.php | 2 +- modules/segmenti/edit.php | 2 +- modules/stato_servizi/actions.php | 6 +-- modules/utenti/actions.php | 16 ++++---- oauth2_login.php | 3 +- plugins/exportFE/src/FatturaElettronica.php | 5 +-- src/Auth.php | 2 +- src/HTMLBuilder/Manager/FieldManager.php | 5 +-- src/Models/OAuth2.php | 2 +- 27 files changed, 81 insertions(+), 87 deletions(-) diff --git a/actions.php b/actions.php index 6be3b51db..982155748 100755 --- a/actions.php +++ b/actions.php @@ -491,7 +491,7 @@ if ($structure->permission == 'rw') { $query = 'SELECT `id`, `html_name` AS `name` FROM `zz_fields` WHERE '.$custom_where; $customs = $dbo->fetchArray($query); - if (post('op')!='delete') { + if (post('op') != 'delete') { $values = []; foreach ($customs as $custom) { if (post($custom['name']) !== null) { @@ -502,7 +502,7 @@ if ($structure->permission == 'rw') { } // Inserimento iniziale - if (post('op')=='add') { + if (post('op') == 'add') { // Informazioni di log Filter::set('get', 'id_record', $id_record); @@ -516,7 +516,7 @@ if ($structure->permission == 'rw') { } // Aggiornamento - if (post('op')=='update') { + if (post('op') == 'update') { $query = 'SELECT `zz_field_record`.`id_field` FROM `zz_field_record` JOIN `zz_fields` ON `zz_fields`.`id` = `zz_field_record`.`id_field` WHERE id_record = '.prepare($id_record).' AND '.$custom_where; $customs_present = $dbo->fetchArray($query); $customs_present = array_column($customs_present, 'id_field'); diff --git a/core.php b/core.php index b64661f00..181d75819 100755 --- a/core.php +++ b/core.php @@ -221,7 +221,7 @@ if (!API\Response::isAPIRequest()) { // Impostazione del tema grafico di default $theme = !empty($config['theme']) ? $config['theme'] : 'default'; - + if ($continue) { // Periodo di visualizzazione dei record // Personalizzato diff --git a/include/top.php b/include/top.php index 0b50bf97e..45da4b3f3 100755 --- a/include/top.php +++ b/include/top.php @@ -336,9 +336,9 @@ if (Auth::check()) { } } -//Set the group theme -if (isset($user)){ - if ($user->getThemeAttribute()){ +// Set the group theme +if (isset($user)) { + if ($user->getThemeAttribute()) { $theme = $user->getThemeAttribute(); } } diff --git a/index.php b/index.php index 719e5bebf..c6eb83291 100755 --- a/index.php +++ b/index.php @@ -26,9 +26,10 @@ $op = filter('op'); $microsoft = null; -try { +try { $microsoft = $dbo->selectOne('zz_oauth2', '*', ['nome' => 'Microsoft', 'enabled' => 1, 'is_login' => 1]); -} catch (Exception $e) {} +} catch (Exception $e) { +} // LOGIN switch ($op) { @@ -179,15 +180,15 @@ echo ' required>

'.tr('Password dimenticata?').'

'; - if ($microsoft) { - echo ' +if ($microsoft) { + echo ' '; - } - echo ' +} +echo ' diff --git a/modules/aggiornamenti/database.php b/modules/aggiornamenti/database.php index 8fb7bc468..392807297 100644 --- a/modules/aggiornamenti/database.php +++ b/modules/aggiornamenti/database.php @@ -66,6 +66,7 @@ function settings_diff($expected, $current) ]; } } + return $difference; } @@ -222,9 +223,8 @@ if (!empty($results) || !empty($results_settings) || !empty($results_settings_ad '; } } - } - + if (!empty($results_settings)) { echo ' @@ -238,11 +238,11 @@ if (!empty($results) || !empty($results_settings) || !empty($results_settings_ad '; foreach ($results_settings as $key => $setting) { - if (!$setting['current']) { - $class = 'danger'; - } else { - $class = 'warning'; - } + if (!$setting['current']) { + $class = 'danger'; + } else { + $class = 'warning'; + } echo '
diff --git a/modules/contratti/bulk.php b/modules/contratti/bulk.php index d56312ed7..5371c0260 100755 --- a/modules/contratti/bulk.php +++ b/modules/contratti/bulk.php @@ -82,7 +82,7 @@ switch (post('op')) { }); } else { $fattura = $documenti->first(function ($item, $key) use ($id_anagrafica) { - return $item->anagrafica->id == $id_anagrafica ; + return $item->anagrafica->id == $id_anagrafica; }); } diff --git a/modules/ddt/bulk.php b/modules/ddt/bulk.php index 9d42f6cbf..b1b0df761 100755 --- a/modules/ddt/bulk.php +++ b/modules/ddt/bulk.php @@ -81,7 +81,7 @@ switch (post('op')) { }); } else { $fattura = $documenti->first(function ($item, $key) use ($id_anagrafica) { - return $item->anagrafica->id == $id_anagrafica ; + return $item->anagrafica->id == $id_anagrafica; }); } diff --git a/modules/ddt/edit.php b/modules/ddt/edit.php index 079ea9ebb..674d98082 100755 --- a/modules/ddt/edit.php +++ b/modules/ddt/edit.php @@ -234,7 +234,7 @@ if (!empty($id_sede_azienda)) { '; } - echo ' +echo ' @@ -367,9 +367,9 @@ if (!empty($id_sede_azienda)) { if (!empty($record['idvettore'])) { echo Modules::link('Anagrafiche', $record['idvettore'], null, null, 'class="pull-right"'); } - $esterno = $dbo->selectOne('dt_spedizione', 'esterno', [ - 'id' => $record['idspedizione'], - ])['esterno']; +$esterno = $dbo->selectOne('dt_spedizione', 'esterno', [ + 'id' => $record['idspedizione'], +])['esterno']; ?> {[ "type": "select", "label": "", "name": "idvettore", "ajax-source": "vettori", "value": "$idvettore$", "disabled": , "required": , "icon-after": "add||tipoanagrafica=Vettore&readonly_tipo=1|btn_idvettore|", "class": "" ]} diff --git a/modules/emails/src/OAuth2/Microsoft.php b/modules/emails/src/OAuth2/Microsoft.php index feb9b8374..5ec699fa2 100644 --- a/modules/emails/src/OAuth2/Microsoft.php +++ b/modules/emails/src/OAuth2/Microsoft.php @@ -21,7 +21,7 @@ class Microsoft extends Azure implements ProviderInterface 'https://outlook.office.com/SMTP.Send', // 'https://outlook.office.com/IMAP.AccessAsUser.All' ], - 'accessType' => 'offline' + 'accessType' => 'offline', ]; public function __construct(array $options = [], array $collaborators = []) diff --git a/modules/emails/src/OAuth2/MicrosoftLogin.php b/modules/emails/src/OAuth2/MicrosoftLogin.php index 98a33be28..94e159150 100644 --- a/modules/emails/src/OAuth2/MicrosoftLogin.php +++ b/modules/emails/src/OAuth2/MicrosoftLogin.php @@ -9,7 +9,6 @@ class MicrosoftLogin extends Azure implements ProviderInterface /** * Impostazioni native per la connessione. * - * * @var \string[][] */ protected static $options = [ diff --git a/modules/fatture/edit.php b/modules/fatture/edit.php index 0c9e6f3e5..4ff72a188 100755 --- a/modules/fatture/edit.php +++ b/modules/fatture/edit.php @@ -279,7 +279,7 @@ $query .= ' ORDER BY descrizione'; {[ "type": "select", "label": "'.tr('Stato').'", "name": "idstatodocumento", "required": 1, "values": "query='.$query.'", "value": "$idstatodocumento$", "class": "'.(($record['stato'] != 'Bozza' && !$abilita_genera) ? '' : 'unblockable').'", "extra": "onchange=\"return cambiaStato()\"" ]} @@ -498,7 +498,7 @@ if ($dir == 'entrata') { {[ "type": "select", "label": "'.tr("Dichiarazione d'intento").'", "name": "id_dichiarazione_intento", "help": "'.tr('Elenco delle dichiarazioni d\'intento definite all\'interno dell\'anagrafica del cliente').'.", "ajax-source": "dichiarazioni_intento", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "data": "'.$record['data'].'"},"value": "$id_dichiarazione_intento$", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|id_plugin='.Plugins::get('Dichiarazioni d\'Intento')['id'].'&id_parent='.$record['idanagrafica'].'", "extra": "'.((intval($block_edit)) ? 'disabled' : '').'" ]} '; } - echo ' +echo ' '; if ($dir == 'entrata') { diff --git a/modules/interventi/add.php b/modules/interventi/add.php index cd2011952..6cd0d800c 100755 --- a/modules/interventi/add.php +++ b/modules/interventi/add.php @@ -28,7 +28,7 @@ $richiesta = filter('richiesta'); $descrizione = filter('descrizione'); $id_tipo = filter('id_tipo'); -$origine_dashboard = get('ref') == "dashboard" ? true : false; +$origine_dashboard = get('ref') == 'dashboard' ? true : false; $module_anagrafiche = Modules::get('Anagrafiche'); $id_plugin_sedi = Plugins::get('Sedi')['id']; diff --git a/modules/interventi/ajax_tecnici.php b/modules/interventi/ajax_tecnici.php index f2d6a6e10..5e069540e 100755 --- a/modules/interventi/ajax_tecnici.php +++ b/modules/interventi/ajax_tecnici.php @@ -143,7 +143,7 @@ if (!empty($sessioni)) { // ORE echo ' - '.(((\Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_inizio'])->eq(\Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_fine']))) || (\Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_inizio'])->gt(\Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_fine'])))) ? '' : '').' + '.((Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_inizio'])->eq(Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_fine'])) || Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_inizio'])->gt(Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $sessione['orario_fine']))) ? '' : '').' {[ "type": "number", "name": "ore_'.$sessione['id'].'", "required": 1, "value": "'.numberFormat($ore, 'qta').'", "disabled": "1" ]} diff --git a/modules/interventi/edit.php b/modules/interventi/edit.php index 84c6c140b..c55ca8ba8 100755 --- a/modules/interventi/edit.php +++ b/modules/interventi/edit.php @@ -337,27 +337,27 @@ echo '
'; - echo input([ - 'type' => 'ckeditor', - 'label' => tr('Richiesta'), - 'name' => 'richiesta', - 'id' => 'richiesta_add', - 'required' => 1, - 'value' => $record['richiesta'], - 'extra' => 'style=\'max-height:80px;\'', - ]); - echo ' +echo input([ + 'type' => 'ckeditor', + 'label' => tr('Richiesta'), + 'name' => 'richiesta', + 'id' => 'richiesta_add', + 'required' => 1, + 'value' => $record['richiesta'], + 'extra' => 'style=\'max-height:80px;\'', +]); +echo '
'; - echo input([ - 'type' => 'ckeditor', - 'label' => tr('Descrizione'), - 'name' => 'descrizione', - 'id' => 'descrizione_add', - 'value' => $record['descrizione'], - 'extra' => 'style=\'max-height:80px;\'', - ]); - echo ' +echo input([ + 'type' => 'ckeditor', + 'label' => tr('Descrizione'), + 'name' => 'descrizione', + 'id' => 'descrizione_add', + 'value' => $record['descrizione'], + 'extra' => 'style=\'max-height:80px;\'', +]); +echo '
'; // Nascondo le note interne ai clienti @@ -592,7 +592,7 @@ if (!$block_edit) { ]).''; } - echo ' +echo ' diff --git a/modules/interventi/modals/anteprima_firma.php b/modules/interventi/modals/anteprima_firma.php index a831a134e..d2d3c128b 100644 --- a/modules/interventi/modals/anteprima_firma.php +++ b/modules/interventi/modals/anteprima_firma.php @@ -47,7 +47,7 @@ if (get('anteprima') !== null) { '; } -if ((setting('Sistema di firma') == 'Base') || isMobile() ){ +if ((setting('Sistema di firma') == 'Base') || isMobile()) { ?>
diff --git a/modules/oauth/edit.php b/modules/oauth/edit.php index faa7b52e4..a13e74314 100644 --- a/modules/oauth/edit.php +++ b/modules/oauth/edit.php @@ -49,16 +49,16 @@ include_once __DIR__.'/../../core.php'; {[ "type": "text", "label": "", "name": "client_secret", "value": "$client_secret$" ]} $field) { - $field['name'] = 'config['.$name.']'; - $field['value'] = $oauth2->config[$name]; + $config = $record['class']::getConfigInputs(); +foreach ($config as $name => $field) { + $field['name'] = 'config['.$name.']'; + $field['value'] = $oauth2->config[$name]; - echo ' + echo '
'.input($field).'
'; - } +} ?> diff --git a/modules/oauth/init.php b/modules/oauth/init.php index 38491336f..0053e7ffe 100644 --- a/modules/oauth/init.php +++ b/modules/oauth/init.php @@ -21,9 +21,8 @@ use Models\OAuth2; include_once __DIR__.'/../../core.php'; - if (isset($id_record)) { $record = $dbo->fetchOne('SELECT * FROM `zz_oauth2` WHERE id='.prepare($id_record)); $oauth2 = OAuth2::find($id_record); - $a=0; + $a = 0; } diff --git a/modules/ordini/bulk.php b/modules/ordini/bulk.php index f25a5ac09..0686b5ba2 100644 --- a/modules/ordini/bulk.php +++ b/modules/ordini/bulk.php @@ -70,7 +70,7 @@ switch (post('op')) { if (!empty($righe)) { ++$numero_totale; - // Ricerca fattura per anagrafica tra le registrate + // Ricerca fattura per anagrafica tra le registrate $id_sede = $raggruppamento == 'sede' ? $documento_import->idsede : 0; if ($raggruppamento == 'sede') { $fattura = $documenti->first(function ($item, $key) use ($id_anagrafica, $id_sede) { @@ -78,7 +78,7 @@ switch (post('op')) { }); } else { $fattura = $documenti->first(function ($item, $key) use ($id_anagrafica) { - return $item->anagrafica->id == $id_anagrafica ; + return $item->anagrafica->id == $id_anagrafica; }); } diff --git a/modules/preventivi/bulk.php b/modules/preventivi/bulk.php index 83bcb53d7..111bf506a 100755 --- a/modules/preventivi/bulk.php +++ b/modules/preventivi/bulk.php @@ -79,7 +79,7 @@ switch (post('op')) { }); } else { $fattura = $documenti->first(function ($item, $key) use ($id_anagrafica) { - return $item->anagrafica->id == $id_anagrafica ; + return $item->anagrafica->id == $id_anagrafica; }); } diff --git a/modules/segmenti/edit.php b/modules/segmenti/edit.php index 40daa7008..cdfd61c56 100755 --- a/modules/segmenti/edit.php +++ b/modules/segmenti/edit.php @@ -99,7 +99,7 @@ $_SESSION['module_'.$record['id_module']]['id_segment'] = $previous_module;
{[ "type": "select", "label": "'.tr('Gruppi con accesso').'", "name": "gruppi[]", "multiple": "1", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "value": "'; diff --git a/modules/stato_servizi/actions.php b/modules/stato_servizi/actions.php index 33fa8e302..46c545c41 100755 --- a/modules/stato_servizi/actions.php +++ b/modules/stato_servizi/actions.php @@ -394,7 +394,7 @@ switch (filter('op')) { // Formattazione dei contenuti dello storico foreach ($history as $key => $value) { - $history[$key]['size'] = (($history[$key]['size']) ? Filesystem::formatBytes($value['size']) : '-'); + $history[$key]['size'] = (($history[$key]['size']) ? FileSystem::formatBytes($value['size']) : '-'); // $history[$key]['invoices_size'] = Filesystem::formatBytes($value['invoices_size']); // $history[$key]['notifies_size'] = Filesystem::formatBytes($value['notifies_size']); } @@ -408,8 +408,8 @@ switch (filter('op')) { 'maxNumber' => $max_number, 'avviso_numero' => $avviso_numero, 'avviso_spazio' => $avviso_spazio, - 'spazio_totale' => Filesystem::formatBytes($spazio_totale), - 'spazio_occupato' => Filesystem::formatBytes($informazioni['size']), + 'spazio_totale' => FileSystem::formatBytes($spazio_totale), + 'spazio_occupato' => FileSystem::formatBytes($informazioni['size']), 'history' => $history, ]); diff --git a/modules/utenti/actions.php b/modules/utenti/actions.php index 8ec681ef4..e7a332376 100755 --- a/modules/utenti/actions.php +++ b/modules/utenti/actions.php @@ -26,24 +26,22 @@ $id_utente = filter('id_utente'); switch (filter('op')) { // Aggiunta nuovo gruppo case 'add': - $nome = filter('nome'); $id_module_start = filter('id_module_start') ?: null; $theme = filter('theme') ?: null; - + // Verifico che questo nome gruppo non sia giĆ  stato usato if ($dbo->fetchNum('SELECT nome FROM zz_groups WHERE nome='.prepare($nome)) == 0) { - - $dbo->insert('zz_groups', [ - 'nome' => $nome, - 'id_module_start' => $id_module_start, - 'theme' => $theme, - 'editable' => 1, + $dbo->insert('zz_groups', [ + 'nome' => $nome, + 'id_module_start' => $id_module_start, + 'theme' => $theme, + 'editable' => 1, ]); $id_record = $dbo->lastInsertedID(); - if ($id_module_start){ + if ($id_module_start) { $dbo->insert('zz_permissions', [ 'idgruppo' => $id_record, 'idmodule' => $id_module_start, diff --git a/oauth2_login.php b/oauth2_login.php index c015fb50d..5256c305f 100644 --- a/oauth2_login.php +++ b/oauth2_login.php @@ -59,7 +59,7 @@ if (empty($response['authorization_url'])) { if (empty($_GET['error'])) { if ($response['access_token']) { $username = $account->getProvider()->getUser($response['access_token']); - + if (!auth()->attempt($username, null, true)) { flash()->error(tr('Autenticazione fallita!')); } @@ -68,7 +68,6 @@ if (empty($_GET['error'])) { redirect($redirect); } - exit; } else { echo strip_tags($_GET['error']).'
'.strip_tags($_GET['error_description']).' diff --git a/plugins/exportFE/src/FatturaElettronica.php b/plugins/exportFE/src/FatturaElettronica.php index a2c364ae7..4657e1169 100755 --- a/plugins/exportFE/src/FatturaElettronica.php +++ b/plugins/exportFE/src/FatturaElettronica.php @@ -21,7 +21,6 @@ namespace Plugins\ExportFE; use FluidXml\FluidXml; use GuzzleHttp\Client; -use Modules; use Modules\Anagrafiche\Anagrafica; use Modules\Anagrafiche\Sede; use Modules\Banche\Banca; @@ -43,7 +42,7 @@ class FatturaElettronica /** @var Anagrafica Informazioni sull'anagrafica Cliente del documento */ protected $cliente = []; - /** @var Modules\Fatture\Fattura Informazioni sul documento */ + /** @var Fattura Informazioni sul documento */ protected $documento; /** @var Validator Oggetto dedicato alla validazione dell'XML */ @@ -314,7 +313,7 @@ class FatturaElettronica ])); // Aggiornamento effettivo - database()->update('co_documenti', [ + $result=database()->update('co_documenti', [ 'progressivo_invio' => $this->getDocumento()['progressivo_invio'], 'codice_stato_fe' => 'GEN', 'id_ricevuta_principale' => null, diff --git a/src/Auth.php b/src/Auth.php index 562ac0935..f8fadbed3 100755 --- a/src/Auth.php +++ b/src/Auth.php @@ -101,7 +101,7 @@ class Auth extends Util\Singleton * * @param string $username * @param string $password - * @param bool $force Forza il login solo tramite username (serve per l'autenticazione con Oauth2) + * @param bool $force Forza il login solo tramite username (serve per l'autenticazione con Oauth2) * * @return bool */ diff --git a/src/HTMLBuilder/Manager/FieldManager.php b/src/HTMLBuilder/Manager/FieldManager.php index 6d426bf61..ac1e29817 100755 --- a/src/HTMLBuilder/Manager/FieldManager.php +++ b/src/HTMLBuilder/Manager/FieldManager.php @@ -126,8 +126,8 @@ class FieldManager implements ManagerInterface return $result; } - - public function getValue($options, $name) { + public function getValue($options, $name) + { $database = database(); $query = 'SELECT `zz_fields`.*'.(isset($options['id_record']) ? ', `zz_field_record`.`value`' : '').' FROM `zz_fields`'; @@ -156,4 +156,3 @@ class FieldManager implements ManagerInterface return $results[0]['value']; } } - diff --git a/src/Models/OAuth2.php b/src/Models/OAuth2.php index 12f53d71b..1e783ea43 100644 --- a/src/Models/OAuth2.php +++ b/src/Models/OAuth2.php @@ -47,7 +47,7 @@ class OAuth2 extends Model $config = $this->config ?? []; $config = array_merge($config, [ 'clientId' => $this->client_id, - 'clientSecret' => $this->client_secret + 'clientSecret' => $this->client_secret, ]); $class = $this->class;