|
21 | 21 | include_once __DIR__.'/../../core.php'; |
22 | 22 |
|
23 | 23 | use Models\Module; |
| 24 | +use Modules\Fatture\Stato; |
24 | 25 | use Modules\Anagrafiche\Anagrafica; |
25 | 26 | use Modules\Banche\Banca; |
26 | 27 | use Modules\Fatture\Fattura; |
|
123 | 124 | $dir = $fattura->direzione; |
124 | 125 |
|
125 | 126 | // 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'])) { |
127 | 128 | ++$counter; |
128 | 129 | continue; |
129 | 130 | } |
|
243 | 244 | ]); |
244 | 245 | } |
245 | 246 |
|
246 | | -if (!empty($id_records) && get('origine') == 'fatture' && !empty($counter)) { |
| 247 | +if (!empty($id_records) && get('origine') == 'fatture' && $counter > 0) { |
247 | 248 | $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()); |
252 | 251 |
|
253 | 252 | echo ' |
254 | 253 | <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 | + ]).' |
261 | 262 | </div>'; |
262 | 263 | } |
263 | 264 | if (!empty(get('id_anagrafica'))) { |
|
0 commit comments