Fix blank phone number issue #274

This commit is contained in:
Kendrick Chan 2019-11-21 09:10:58 +08:00
parent 142e34ba31
commit 575bf21639

View file

@ -127,10 +127,19 @@ class CreateCustomerFromWarrantyCommand extends Command
$cust_found = false;
foreach ($w_mobile_array as $w_mobile_num)
{
$w_mobile_num = trim($w_mobile_num);
// empty mobile num
if (empty($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...");
@ -249,6 +258,7 @@ class CreateCustomerFromWarrantyCommand extends Command
fclose($fh);
$output->writeln('');
$output->writeln('Total warranties: ' . $total_warr);
$output->writeln('Total warranties with no mobile number: ' . $total_inv_warr);
$output->writeln('Total customers added: ' . $total_cust_added);