From 701c57966faaee310067b532e2fd173d0a08784a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 4 Mar 2025 10:53:03 +0100 Subject: [PATCH] tab contact - field plz: numberformat validation only for Austria --- .../api/frontend/v1/stv/Kontakt.php | 22 +++++++++++++++---- .../Details/Kontakt/Address.js | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Kontakt.php b/application/controllers/api/frontend/v1/stv/Kontakt.php index fe6090c51..fd16fff06 100644 --- a/application/controllers/api/frontend/v1/stv/Kontakt.php +++ b/application/controllers/api/frontend/v1/stv/Kontakt.php @@ -157,11 +157,18 @@ class Kontakt extends FHCAPI_Controller { $this->form_validation->set_data(['address.plz' => $_POST['plz']]); - $this->form_validation->set_rules('address.plz', 'PLZ', 'required|numeric', [ + $this->form_validation->set_rules('address.plz', 'PLZ', 'required', [ 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']), - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ']) ]); + if(isset($_POST['nation']) && $_POST['nation'] == 'A') + { + $this->form_validation->set_rules('address.plz', 'PLZ', 'required|numeric', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']), + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ']) + ]); + } + if(isset($_POST['gemeinde']) && isset($_POST['ort']) && isset($_POST['nation']) && $_POST['nation'] == 'A') { $this->form_validation->set_rules('address.plz', 'Postleitzahl', 'callback_validateLocationCombination', [ @@ -225,11 +232,18 @@ class Kontakt extends FHCAPI_Controller $uid = getAuthUID(); - $this->form_validation->set_rules('address.plz', 'PLZ', 'required|numeric', [ + $this->form_validation->set_rules('address.plz', 'PLZ', 'required', [ 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']), - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ']) ]); + if(isset($_POST['nation']) && $_POST['nation'] == 'A') + { + $this->form_validation->set_rules('address.plz', 'PLZ', 'required|numeric', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']), + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ']) + ]); + } + if(isset($_POST['gemeinde']) && isset($_POST['ort']) && isset($_POST['nation']) && $_POST['nation'] == 'A') { $this->form_validation->set_rules('address.plz', 'Postleitzahl', 'callback_validateLocationCombination', [ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index 3aca019d4..13d3dcc12 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -372,7 +372,7 @@ export default{
- +