From 52f65a9e61f82500e6e5161a1c11d5218c99c523 Mon Sep 17 00:00:00 2001 From: Sajo <75281007+sajotrei@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:50:28 +0200 Subject: [PATCH 1/5] feat(banche): gestisci stato attivo --- modules/banche/actions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/banche/actions.php b/modules/banche/actions.php index f7ca9367d..e0ef47c91 100755 --- a/modules/banche/actions.php +++ b/modules/banche/actions.php @@ -63,7 +63,8 @@ $banca->codice_sia = post('codice_sia'); $banca->commissioni_riba_insolute = post('commissioni_riba_insolute'); - $banca->predefined = post('predefined'); + $banca->enabled = post('enabled'); + $banca->predefined = $banca->enabled ? post('predefined') : 0; $banca->save(); From c6ef587e5746d7d68acdd10f1fdb450d86845530 Mon Sep 17 00:00:00 2001 From: Sajo <75281007+sajotrei@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:50:39 +0200 Subject: [PATCH 2/5] fix(banche): escludi disabilitate dalla banca predefinita --- modules/banche/src/Banca.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/banche/src/Banca.php b/modules/banche/src/Banca.php index 24423c467..3d47e65ad 100644 --- a/modules/banche/src/Banca.php +++ b/modules/banche/src/Banca.php @@ -51,6 +51,7 @@ public static function build(?Anagrafica $anagrafica = null, $nome = null, $iban $model->nome = $nome; $model->iban = $iban; $model->bic = $bic; + $model->enabled = 1; // Salvataggio delle informazioni $model->save(); @@ -84,11 +85,20 @@ public function save(array $options = []) protected function fixPredefined() { + $enabled = $this->enabled ?? true; $predefined = $this->predefined ?? false; - // Selezione automatica per primo record + // Una banca disabilitata non può essere predefinita. + if (empty($enabled)) { + $this->attributes['predefined'] = 0; + + return; + } + + // Selezione automatica per primo record attivo. $count = self::where('id_anagrafica', $this->id_anagrafica) ->where('id', '!=', $this->id) + ->where('enabled', 1) ->count(); if (empty($predefined) && empty($count)) { $predefined = true; From 0ae7ec17b584f8ce28c67ad9949302d1df08f6c1 Mon Sep 17 00:00:00 2001 From: Sajo <75281007+sajotrei@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:50:48 +0200 Subject: [PATCH 3/5] feat(banche): nascondi banche disabilitate nelle select --- modules/banche/ajax/select.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/banche/ajax/select.php b/modules/banche/ajax/select.php index 6b280c275..5c81fb86e 100644 --- a/modules/banche/ajax/select.php +++ b/modules/banche/ajax/select.php @@ -34,6 +34,7 @@ if (empty($filter)) { $where[] = 'deleted_at IS NULL'; + $where[] = 'enabled = 1'; } $where[] = 'id_anagrafica='.prepare($superselect['id_anagrafica']); From 15aaaf2e03869866f7918faef46e698d568ef23e Mon Sep 17 00:00:00 2001 From: Sajo <75281007+sajotrei@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:51:58 +0200 Subject: [PATCH 4/5] feat(banche): aggiungi stato attivo nella scheda --- modules/banche/edit.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/banche/edit.php b/modules/banche/edit.php index 64808fe89..445fb5f4d 100644 --- a/modules/banche/edit.php +++ b/modules/banche/edit.php @@ -43,7 +43,11 @@ {[ "type": "checkbox", "label": "", "name": "predefined", "value": "$predefined$", "disabled": "" ]} -