Skip to content

Commit 6457cf5

Browse files
committed
fix: avviso aggiunta registrazione contabile da bulk
1 parent 05cc9e9 commit 6457cf5

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

modules/primanota/add.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
include_once __DIR__.'/../../core.php';
2222

2323
use Models\Module;
24+
use Modules\Fatture\Stato;
2425
use Modules\Anagrafiche\Anagrafica;
2526
use Modules\Banche\Banca;
2627
use Modules\Fatture\Fattura;
@@ -123,7 +124,7 @@
123124
$dir = $fattura->direzione;
124125

125126
// Inclusione delle sole fatture in stato Emessa, Parzialmente pagato o Pagato
126-
if (!in_array($fattura->stato->getTranslation('title'), ['Emessa', 'Parzialmente pagato', 'Pagato'])) {
127+
if (!in_array($fattura->stato->name, ['Emessa', 'Parzialmente pagato', 'Pagato'])) {
127128
++$counter;
128129
continue;
129130
}
@@ -243,21 +244,21 @@
243244
]);
244245
}
245246

246-
if (!empty($id_records) && get('origine') == 'fatture' && !empty($counter)) {
247+
if (!empty($id_records) && get('origine') == 'fatture' && $counter > 0) {
247248
$descrizione_stati = [];
248-
$stati = $database->fetchArray("SELECT * FROM `co_statidocumento` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento`.`id` = `co_statidocumento_lang`.`id_record` AND `co_statidocumento_lang`.`id_lang` = ".prepare(Models\Locale::getDefault()->id).") WHERE `name` IN ('Emessa', 'Parzialmente pagato', 'Pagato') ORDER BY `name`");
249-
foreach ($stati as $stato) {
250-
$descrizione_stati[] = '<i class="'.$stato['icona'].'"></i> <small>'.$stato['title'].'</small>';
251-
}
249+
$stati = Stato::whereIn('name', ['Emessa', 'Parzialmente pagato', 'Pagato'])->get()->pluck('name');
250+
$descrizione_stati = implode(', ', $stati->toArray());
252251

253252
echo '
254253
<div class="alert alert-info">
255-
<p>'.tr('Solo le fatture in stato _STATE_ possono essere registrate contabilmente ignorate', [
256-
'_STATE_' => implode(', ', $descrizione_stati),
257-
]).'.</p>
258-
<p><b>'.tr('Sono state ignorate _NUM_ fatture', [
259-
'_NUM_' => $counter,
260-
]).'.</b></p>
254+
'.tr('Solo le fatture in stato _STATE_ possono essere registrate contabilmente', [
255+
'_STATE_' => '<strong>'.$descrizione_stati.'</strong>',
256+
]).'.
257+
</div>
258+
<div class="alert alert-warning">
259+
'.tr('Fatture ignorate: _NUM_', [
260+
'_NUM_' => '<strong>'.$counter.'</strong>',
261+
]).'
261262
</div>';
262263
}
263264
if (!empty(get('id_anagrafica'))) {

0 commit comments

Comments
 (0)