Make checks for mobile number format #394
This commit is contained in:
parent
cb95705848
commit
82baef50ee
1 changed files with 20 additions and 1 deletions
|
|
@ -45,7 +45,26 @@ class WarrantySMSCommand extends Command
|
||||||
|
|
||||||
foreach ($warrs as $w)
|
foreach ($warrs as $w)
|
||||||
{
|
{
|
||||||
error_log($w->getID());
|
error_log($w->getID() . ' - ' . $w->getMobileNumber());
|
||||||
|
// check valid number
|
||||||
|
$num = trim($w->getMobileNumber());
|
||||||
|
|
||||||
|
// should start with '9'
|
||||||
|
if ($num[0] != '9')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// should be 10 digits
|
||||||
|
if (strlen($num) != 10)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// should be numeric
|
||||||
|
if (!is_numeric($num))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
error_log('valid!');
|
||||||
|
|
||||||
|
// add 63 prefix
|
||||||
|
$num = '63' . $num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue