From 35cadfa40f2141ca722508d45a8ec7be4994b9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 17 Oct 2018 10:13:26 +0200 Subject: [PATCH] :ambulance: fix(PhoneNumberAttribute) Use pattern instead of method to validate phone numbers So that the pattern is also set in the HTML input issue #5910 --- .../attributes/class_PhoneNumberAttribute.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc index 539692c2d..9a5ced3fb 100644 --- a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc +++ b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc @@ -108,11 +108,15 @@ class phoneSelectDialog extends GenericDialog /*! \brief This class allow to handle easily an LDAP attribute that contains a phone number */ -class PhoneNumberAttribute extends TestValidateAttribute +class PhoneNumberAttribute extends StringAttribute { protected $trim = TRUE; - protected $testFunc = 'is_phone_nr'; protected $inputType = 'tel'; + + function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = '', $acl = '', $regexp = '/^[\/0-9 ()+*-]+$/', $example = NULL) + { + parent::__construct($label, $description, $ldapName, $required, $defaultValue, $acl, $regexp, $example); + } } /*! \brief Displays a text field and a button to select the phone from object list -- GitLab