Skip to content

Commit

Permalink
Merge pull request #146 from marsante/phonevalidator
Browse files Browse the repository at this point in the history
fix:  error  when non-breaking space in phone
  • Loading branch information
MedShake authored Aug 11, 2023
2 parents a96dc6a + 8cb19fa commit 8668ffe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fd8de60b9b00116d2bf86975782fe1d3235ab14ec36fa650fd43acb9bbe451ad
3ea88b81e74bb5f2313b6e611feccdd9303a7b15308159df41e23e19f2010f4e
6 changes: 3 additions & 3 deletions fonctions/validators.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@

GUMP::add_validator("mobilphone", function ($field, $input, $param = NULL) {
if (empty($input[$field])) return TRUE;
$find = preg_match('/^0[6-7]{1}(([0-9]{2}){4})|((\s[0-9]{2}){4})|((-[0-9]{2}){4})$/i', $input[$field]);
$find = preg_match('/^0[6-7]{1}(([0-9]{2}){4})|((\s[0-9]{2}){4})|((\xc2\xa0[0-9]{2}){4})|((-[0-9]{2}){4})$/i', $input[$field]);
if ($find != '1') return FALSE;
else return TRUE;
}, 'Le champ {field} n\'est pas un numéro de téléphone mobile valide');

GUMP::add_validator("phone", function ($field, $input, $param = NULL) {
if (empty($input[$field])) return TRUE;
$find = preg_match('/^0[1-6]{1}(([0-9]{2}){4})|((\s[0-9]{2}){4})|((-[0-9]{2}){4})$/i', $input[$field]);
$find = preg_match('/^0[1-6]{1}(([0-9]{2}){4})|((\s[0-9]{2}){4})|((\xc2\xa0[0-9]{2}){4})|((-[0-9]{2}){4})$/i', $input[$field]);
if ($find != '1') return FALSE;
else return TRUE;
}, 'Le champ {field} n\'est pas un numéro de téléphone valide');

GUMP::add_validator("genericPhone", function ($field, $input, $param = NULL) {
if (empty($input[$field])) return TRUE;
$find = preg_match('/^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/mix', $input[$field]);
$find = preg_match('/^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.\xc2\xa0.-]*\d{2}){4}$/mix', $input[$field]);
if ($find != '1') return FALSE;
else return TRUE;
}, 'Le champ {field} n\'est pas un numéro de téléphone international valide');
Expand Down
2 changes: 1 addition & 1 deletion upgrade/base/sqlInstall.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ INSERT IGNORE INTO `prescriptions` (`cat`, `label`, `description`, `fromID`, `to

-- system
INSERT IGNORE INTO `system` (`name`, `groupe`, `value`) VALUES
('base', 'module', 'v8.0.2'),
('base', 'module', 'v8.0.3'),
('state', 'system', 'normal');

-- univtags_type
Expand Down
2 changes: 2 additions & 0 deletions upgrade/base/sqlUpgrade_v8.0.2_v8.0.3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Mise à jour n° de version
UPDATE `system` SET `value`='v8.0.3' WHERE `name`='base' and `groupe`='module';
2 changes: 1 addition & 1 deletion versionMedShakeEHR-base.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0.2
v8.0.3

0 comments on commit 8668ffe

Please sign in to comment.