|
29 | 29 | use Modules\Interventi\Intervento; |
30 | 30 | use Modules\Iva\Aliquota; |
31 | 31 | use Modules\Ordini\Stato as StatoOrdine; |
| 32 | +use Modules\Pagamenti\Pagamento; |
32 | 33 | use Plugins\AssicurazioneCrediti\AssicurazioneCrediti; |
33 | 34 | use Plugins\ExportFE\Interaction; |
34 | 35 |
|
|
427 | 428 |
|
428 | 429 | <div class="col-md-3"> |
429 | 430 | <?php |
430 | | - $pagamento = $dbo->fetchOne('SELECT `codice_modalita_pagamento_fe` FROM `co_pagamenti` WHERE `id` = '.prepare($record['idpagamento'])); |
431 | | - $show_riba_warning = $dir == 'entrata' && !empty($pagamento['codice_modalita_pagamento_fe']) && $pagamento['codice_modalita_pagamento_fe'] == 'MP12' && empty($record['id_banca_controparte']); |
432 | | - ?> |
433 | | - <span id="riba-warning" class="badge badge-warning pull-right"><?php echo tr('Nessuna banca di addebito selezionata'); ?></span> |
| 431 | + $pagamento = Pagamento::find($record['idpagamento'])->first(); |
| 432 | +if ($dir == 'entrata' && ($pagamento->isRiba() || $pagamento->isSepa()) && empty($record['id_banca_controparte'])) { |
| 433 | + $show_riba_warning = 1; |
| 434 | +} |
| 435 | +?> |
| 436 | + <span id="riba-warning" class="badge badge-warning pull-right"<?php echo $show_riba_warning ? '' : ' style="display: none;"'; ?>><?php echo tr('Nessuna banca di addebito selezionata'); ?></span> |
434 | 437 | {[ "type": "select", "label": "<?php echo tr('Pagamento'); ?>", "name": "idpagamento", "required": 1, "ajax-source": "pagamenti", "value": "$idpagamento$" ]} |
435 | 438 | </div> |
436 | 439 |
|
@@ -1078,8 +1081,9 @@ function checkRibaWarning() { |
1078 | 1081 | if ("'.($dir == 'entrata' ? 'true' : 'false').'") { |
1079 | 1082 | let pagamentoData = $("#idpagamento").selectData(); |
1080 | 1083 | let bancaControparte = $("#id_banca_controparte").val(); |
| 1084 | + let ribaSddCodes = ["MP12", "MP19", "MP20", "MP21"]; |
1081 | 1085 |
|
1082 | | - if (pagamentoData && pagamentoData.codice_modalita_pagamento_fe === "MP12" && !bancaControparte) { |
| 1086 | + if (pagamentoData && ribaSddCodes.includes(pagamentoData.codice_modalita_pagamento_fe) && !bancaControparte) { |
1083 | 1087 | $("#riba-warning").show(); |
1084 | 1088 | } else { |
1085 | 1089 | $("#riba-warning").hide(); |
@@ -1233,6 +1237,7 @@ function caricaRighe(id_riga) { |
1233 | 1237 |
|
1234 | 1238 | $(document).ready(function () { |
1235 | 1239 | caricaRighe(null); |
| 1240 | + checkRibaWarning(); |
1236 | 1241 |
|
1237 | 1242 | $("#data_registrazione").on("dp.change", function (e) { |
1238 | 1243 | let data_competenza = $("#data_competenza"); |
|
0 commit comments