Skip to content

Commit 49b93f3

Browse files
committed
style: formattazione stile codice
1 parent f31b672 commit 49b93f3

91 files changed

Lines changed: 555 additions & 566 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
use Modules\Checklists\Checklist;
2929
use Modules\Emails\Template;
3030
use Notifications\EmailNotification;
31-
use Util\Zip;
3231
use Permissions;
32+
use Util\Zip;
3333

3434
if (empty($structure) || empty($structure['enabled'])) {
3535
exit(tr('Accesso negato'));

api/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function serverError()
4444
$dbo->insert('zz_api_log', [
4545
'level' => 'warning',
4646
'message' => 'Richiesta API ricevuta',
47-
'name' => "API ".get('resource'),
47+
'name' => 'API '.get('resource'),
4848
'context' => json_encode([
4949
'token' => get('token'),
5050
'resource' => get('resource'),
@@ -68,7 +68,7 @@ function serverError()
6868
}
6969

7070
$result = json_decode((string) $response, true);
71-
$level = ($result['status']=='200' ? 'info' : 'error');
71+
$level = ($result['status'] == '200' ? 'info' : 'error');
7272
$dbo->update('zz_api_log', [
7373
'level' => $level,
7474
'message' => $result['message'],
@@ -77,7 +77,7 @@ function serverError()
7777
'resource' => get('resource'),
7878
'total-count' => $result['total-count'],
7979
]),
80-
],['id' => $id_log]);
80+
], ['id' => $id_log]);
8181

8282
json_decode((string) $response);
8383

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
exit;
8585
}
8686
}
87-
87+
8888
$module = Auth::firstModule();
8989

9090
if (!empty($module)) {

lib/util.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,14 @@ function adjustBrightness($hexCode, $adjustPercent)
600600

601601
if (!function_exists('blurEmail')) {
602602
/**
603-
* Funzione per offuscare parzialmente un indirizzo email
603+
* Funzione per offuscare parzialmente un indirizzo email.
604604
*
605605
* @param string $email Indirizzo email da offuscare
606+
*
606607
* @return string Email offuscata con asterischi
607608
*/
608-
function blurEmail($email) {
609+
function blurEmail($email)
610+
{
609611
if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
610612
return $email;
611613
}
@@ -618,21 +620,21 @@ function blurEmail($email) {
618620

619621
if ($username_length <= 2) {
620622
// Se il nome utente è molto corto, mostra solo il primo carattere
621-
$blurred_username = substr($username, 0, 1) . str_repeat('*', max(1, $username_length - 1));
623+
$blurred_username = substr($username, 0, 1).str_repeat('*', max(1, $username_length - 1));
622624
} elseif ($username_length <= 4) {
623625
// Per nomi utente corti, mostra primi 2 caratteri
624-
$blurred_username = substr($username, 0, 2) . str_repeat('*', $username_length - 2);
626+
$blurred_username = substr($username, 0, 2).str_repeat('*', $username_length - 2);
625627
} else {
626628
// Per nomi utente lunghi, mostra primi 2 e ultimi 1 carattere
627629
$visible_start = 2;
628630
$visible_end = 1;
629631
$stars_count = max(3, $username_length - $visible_start - $visible_end);
630632

631-
$blurred_username = substr($username, 0, $visible_start) .
632-
str_repeat('*', $stars_count) .
633+
$blurred_username = substr($username, 0, $visible_start).
634+
str_repeat('*', $stars_count).
633635
substr($username, -$visible_end);
634636
}
635637

636-
return $blurred_username . '@' . $domain;
638+
return $blurred_username.'@'.$domain;
637639
}
638640
}

mail.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121
use Models\Module;
22-
use Models\Upload;
2322
use Modules\Emails\Template;
2423

2524
include_once __DIR__.'/core.php';

modules/aggiornamenti/upload_modules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
if (file_exists($extraction_dir.'/VERSION')) {
4343
// Salva il file di configurazione
4444
$config = file_get_contents(base_dir().'/config.inc.php');
45-
45+
4646
// Rinomina la cartella vendor per evitare conflitti
4747
if (is_dir(base_dir().'/vendor')) {
4848
copyr(base_dir().'/vendor', base_dir().'/vendor.old');
@@ -153,7 +153,7 @@
153153
}
154154

155155
// Modules
156-
else{
156+
else {
157157
$insert['default'] = 0;
158158
}
159159

modules/ammortamenti/actions.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
include_once __DIR__.'/../../core.php';
2222

23-
use Modules\PrimaNota\Mastrino;
24-
use Modules\PrimaNota\Movimento;
23+
use Carbon\Carbon;
2524
use Modules\Fatture\Components\Articolo;
2625
use Modules\Fatture\Components\Riga;
27-
use Carbon\Carbon;
26+
use Modules\PrimaNota\Mastrino;
27+
use Modules\PrimaNota\Movimento;
2828

2929
switch (filter('op')) {
3030
case 'add_ammortamento':
@@ -47,37 +47,37 @@
4747
}
4848
}
4949
}
50-
50+
5151
// Elimino le righe di ammortamento precedenti
5252
$dbo->query('DELETE FROM `co_righe_ammortamenti` WHERE `id_riga` = '.prepare($id_record));
5353
foreach ($anni as $i => $anno) {
5454
$perc = $percentuale[$i];
55-
55+
5656
if ($perc) {
5757
// Calcolo importo in base alla percentuale
5858
$importo = $riga->subtotale * $perc / 100;
59-
59+
6060
// Creazione mastrino
6161
$data = Carbon::createFromDate($anno, 12, 31);
6262
$descrizione = 'Ammortamento del '.$data->format('d/m/Y').' - '.$perc.'%';
6363
$mastrino = Mastrino::build($descrizione, $data, false, true);
64-
64+
6565
// Movimento in dare (conto della riga)
6666
$movimento_dare = Movimento::build($mastrino, $id_conto_dare);
6767
$movimento_dare->setTotale($importo, 0);
6868
$movimento_dare->save();
69-
69+
7070
// Movimento in avere (conto selezionato)
7171
$movimento_avere = Movimento::build($mastrino, $id_conto_avere);
7272
$movimento_avere->setTotale(0, $importo);
7373
$movimento_avere->save();
74-
74+
7575
// Salvataggio record ammortamento
7676
$dbo->query('INSERT INTO `co_righe_ammortamenti` (`id_riga`, `anno`, `id_conto`, `percentuale`, `id_mastrino`) VALUES ('.prepare($id_record).', '.prepare($anno).', '.prepare($id_conto).', '.prepare($perc).', '.prepare($movimento_dare->idmastrino).')');
7777
}
7878
}
79-
79+
8080
flash()->info(tr('Ammortamenti registrati con successo!'));
81-
81+
8282
break;
8383
}

modules/ammortamenti/edit.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$numero_righe = count($righe_ammortamento);
2828

2929
// Calcola anno di inizio (anno del documento)
30-
$anno_inizio = date('Y', strtotime($documento['data_competenza']));
30+
$anno_inizio = date('Y', strtotime((string) $documento['data_competenza']));
3131

3232
$readonly = $anno_inizio == date('Y') ? 0 : 1;
3333

@@ -74,7 +74,7 @@
7474
</div>
7575

7676
<div class="col-md-6" style="margin-top: 25px">
77-
<button type="button" class="btn btn-info pull-right <?php echo ($readonly > 0 ? 'disabled' : ''); ?>" id="add-riga">
77+
<button type="button" class="btn btn-info pull-right <?php echo $readonly > 0 ? 'disabled' : ''; ?>" id="add-riga">
7878
<i class="fa fa-plus"></i> <?php echo tr('Aggiungi riga'); ?>
7979
</button>
8080
</div>
@@ -92,9 +92,9 @@
9292
</thead>
9393
<tbody id="righe-ammortamento">
9494
<?php
95-
// Righe esistenti
96-
foreach ($righe_ammortamento as $index => $riga) {
97-
echo '
95+
// Righe esistenti
96+
foreach ($righe_ammortamento as $index => $riga) {
97+
echo '
9898
<tr>
9999
<td>
100100
{[ "type": "text", "name": "anno['.$riga['id'].']", "value": "'.$riga['anno'].'", "disabled": "1", "class": "text-center" ]}
@@ -109,8 +109,8 @@
109109
'.($riga['id_mastrino'] ? Modules::link('Prima nota', $riga['id_mastrino'], 'Visualizza prima nota', null, 'class="btn btn-sm btn-primary"') : '').'
110110
</td>
111111
</tr>';
112-
}
113-
?>
112+
}
113+
?>
114114
</tbody>
115115
</table>
116116
</div>
@@ -123,13 +123,13 @@
123123

124124
<div class="alert alert-info text-center">
125125
<i class="fa fa-info-circle"></i> <?php echo tr('Ammortamento modificabile fino al 31/12/_ANNO_', [
126-
'_ANNO_' => $anno_inizio,
126+
'_ANNO_' => $anno_inizio,
127127
]); ?>
128128
</div>
129129

130130
<div class="row">
131131
<div class="col-md-12 text-center">
132-
<button type="button" class="btn btn-lg btn-primary <?php echo ($readonly ? 'disabled' : ''); ?>" id="btn-salva" onclick="applicaAmmortamento()">
132+
<button type="button" class="btn btn-lg btn-primary <?php echo $readonly ? 'disabled' : ''; ?>" id="btn-salva" onclick="applicaAmmortamento()">
133133
<?php echo tr('Applica ammortamento'); ?>
134134
</button>
135135
</div>

modules/ammortamenti/init.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1919
*/
2020

21-
use Models\OAuth2;
22-
2321
include_once __DIR__.'/../../core.php';
2422

2523
if (!empty($id_record)) {

modules/articoli/actions.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,27 @@
115115
// per evitare conflitti tra barcode e codici articolo
116116
$coincide_codice = Articolo::where([
117117
['codice', $barcode],
118-
['barcode', '=', '']
118+
['barcode', '=', ''],
119119
])->count() > 0;
120120

121-
$tentativi++;
122-
121+
++$tentativi;
123122
} while (($esistente_articoli || $esistente_barcode || $coincide_codice) && $tentativi < $max_tentativi);
124123

125124
// Se dopo tutti i tentativi non è stato trovato un barcode unico, non genera il barcode
126125
if ($tentativi >= $max_tentativi) {
127126
$barcode = null;
128127
flash()->warning(tr('Impossibile generare un barcode unico dopo _NUM_ tentativi', [
129-
'_NUM_' => $max_tentativi
128+
'_NUM_' => $max_tentativi,
130129
]));
131130
}
132131
}
133132

134-
$barcode = ($barcode ? $barcode : post('barcode'));
133+
$barcode = ($barcode ?: post('barcode'));
135134
if (!empty($barcode)) {
136135
$dbo->insert('mg_articoli_barcode', [
137-
'idarticolo' => $id_record,
138-
'barcode' => $barcode,
139-
]);
136+
'idarticolo' => $id_record,
137+
'barcode' => $barcode,
138+
]);
140139
}
141140

142141
if (isAjaxRequest()) {
@@ -528,19 +527,18 @@
528527
// per evitare conflitti tra barcode e codici articolo
529528
$coincide_codice = Articolo::where([
530529
['codice', $barcode],
531-
['barcode', '=', '']
530+
['barcode', '=', ''],
532531
])->count() > 0;
533532

534-
$tentativi++;
535-
533+
++$tentativi;
536534
} while (($esistente_articoli || $esistente_barcode || $coincide_codice) && $tentativi < $max_tentativi);
537535

538536
// Se dopo tutti i tentativi non è stato trovato un barcode unico, restituisce un errore
539537
if ($tentativi >= $max_tentativi) {
540538
echo json_encode([
541539
'error' => tr('Impossibile generare un barcode unico dopo _NUM_ tentativi', [
542-
'_NUM_' => $max_tentativi
543-
])
540+
'_NUM_' => $max_tentativi,
541+
]),
544542
]);
545543
} else {
546544
// Restituisce il barcode generato con successo

0 commit comments

Comments
 (0)