diff --git a/src/Command/CreateCustomerFromWarrantyCommand.php b/src/Command/CreateCustomerFromWarrantyCommand.php index 38758990..bfac02d8 100644 --- a/src/Command/CreateCustomerFromWarrantyCommand.php +++ b/src/Command/CreateCustomerFromWarrantyCommand.php @@ -130,12 +130,26 @@ class CreateCustomerFromWarrantyCommand extends Command if (empty($w_mobile_num)) 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 // TODO: we need to check proper phone number format // 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 if (strlen($w_mobile_num <= 2)) continue; + */ error_log(''); error_log("($total_warr) processing $w_mobile_num from warranty...");