Commit 35cadfa4 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

: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
Showing with 6 additions and 2 deletions
+6 -2
...@@ -108,11 +108,15 @@ class phoneSelectDialog extends GenericDialog ...@@ -108,11 +108,15 @@ class phoneSelectDialog extends GenericDialog
/*! \brief This class allow to handle easily an LDAP attribute that contains a phone number /*! \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 $trim = TRUE;
protected $testFunc = 'is_phone_nr';
protected $inputType = 'tel'; protected $inputType = 'tel';
function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = '', $acl = '', $regexp = '/^[\/0-9 ()+*-]+$/', $example = NULL)
  • :arrow_down_small: Remove this method "__construct" to simply inherit it. :blue_book:

    By Ghost User on 2018-10-17T08:20:44 (imported from GitLab)

Please register or sign in to reply
{
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 /*! \brief Displays a text field and a button to select the phone from object list
......
  • SonarQube analysis reported 1 issue

    • :arrow_down_small: 1 minor

    Watch the comments in this conversation to review them.

    By Ghost User on 2018-10-17T08:20:45 (imported from GitLab)

Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment