From 0f60af27132a6c452b45f28394205db5a3839d82 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 23 Mar 2023 18:19:13 +0100 Subject: [PATCH] Fix pr-banche-bic-non-obbligatorio --- modules/banche/actions.php | 1 + modules/banche/add.php | 4 +++- modules/banche/edit.php | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/banche/actions.php b/modules/banche/actions.php index 4fb8fcfa2..f8f2daa6e 100755 --- a/modules/banche/actions.php +++ b/modules/banche/actions.php @@ -102,6 +102,7 @@ switch (filter('op')) { echo json_encode([ 'id_nazione' => [ 'id' => $nazione->id, + 'iso2' => $nazione->iso2, 'text' => $nazione->nome, ], 'bank_code' => $iban->getBankCode(), diff --git a/modules/banche/add.php b/modules/banche/add.php index 91c3613a6..ecb21d3a1 100755 --- a/modules/banche/add.php +++ b/modules/banche/add.php @@ -119,10 +119,12 @@ echo ' success: function (response) { compilaCampi(response); - if (response.id_nazione.text === "Italia"){ + if (response.id_nazione.iso2 === "IT"){ bic.setRequired(false); + $("label[for=bic]").html(''); } else { bic.setRequired(true); + $("label[for=bic]").html('*'); } }, error: function() { diff --git a/modules/banche/edit.php b/modules/banche/edit.php index 63e62cb0e..959255f3c 100644 --- a/modules/banche/edit.php +++ b/modules/banche/edit.php @@ -192,10 +192,12 @@ if (!empty($numero_documenti)) { success: function (response) { compilaCampi(response); - if (response.id_nazione.text === "Italia"){ + if (response.id_nazione.iso2 === "IT"){ bic.setRequired(false); + $("label[for=bic]").html(''); } else { bic.setRequired(true); + $("label[for=bic]").html('*'); } }, error: function() {