Filter valid phone numbers and convert the 09XXXXXXXXX format to 9XXXXXXXXX #274
This commit is contained in:
parent
fba5d9cb86
commit
2b21db6c01
1 changed files with 14 additions and 0 deletions
|
|
@ -130,12 +130,26 @@ class CreateCustomerFromWarrantyCommand extends Command
|
||||||
if (empty($w_mobile_num))
|
if (empty($w_mobile_num))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// does it fit our 09XXXXXXXXX pattern?
|
||||||
|
if (preg_match('/^09[0-9]{9}$/', $w_mobile_num))
|
||||||
|
{
|
||||||
|
// remove first '0'
|
||||||
|
$w_mobile_num = substr($w_mobile_num, 1);
|
||||||
|
error_log("CONVERTED TO $w_mobile_num");
|
||||||
|
}
|
||||||
|
|
||||||
|
// does it fit our 9XXXXXXXXX pattern?
|
||||||
|
if (!preg_match('/^9[0-9]{9}$/', $w_mobile_num))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
// min length 2
|
// min length 2
|
||||||
// TODO: we need to check proper phone number format
|
// TODO: we need to check proper phone number format
|
||||||
// format should be '9XXXXXXXXX'
|
// format should be '9XXXXXXXXX'
|
||||||
// TODO: if format doesn't fit and there's a 0 or 63 prefix, we should be able to detect and convert
|
// TODO: if format doesn't fit and there's a 0 or 63 prefix, we should be able to detect and convert
|
||||||
if (strlen($w_mobile_num <= 2))
|
if (strlen($w_mobile_num <= 2))
|
||||||
continue;
|
continue;
|
||||||
|
*/
|
||||||
|
|
||||||
error_log('');
|
error_log('');
|
||||||
error_log("($total_warr) processing $w_mobile_num from warranty...");
|
error_log("($total_warr) processing $w_mobile_num from warranty...");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue