Merge branch '75-fix-bugs-and-add-diagnostics-for-uat-final' into 'master'

Resolve "Fix bugs and add diagnostics for UAT final"

Closes #75

See merge request jankstudio/resq!62
This commit is contained in:
Kendrick Chan 2018-04-06 05:47:50 +00:00
commit 00892ba367
4 changed files with 205825 additions and 2 deletions

File diff suppressed because it is too large Load diff

7
sql/clear_customer.sql Normal file
View file

@ -0,0 +1,7 @@
delete from invoice_item;
delete from invoice;
delete from ticket;
delete from jo_event;
delete from job_order;
delete from customer_vehicle;
delete from customer;

File diff suppressed because one or more lines are too long

View file

@ -252,11 +252,14 @@ class ImportCustomerCommand extends Command
protected function findVehicle($output, $row)
{
$output->writeln('[0] find vehicle');
// search for manufacturer
$mfg_name = trim($row[self::F_V_BRAND]);
$make = strtoupper(trim($row[self::F_V_MAKE]));
$model = trim($row[self::F_V_MODEL]);
$output->writeln('[5] checking mfg');
if (!isset($this->mfg_index[$mfg_name]))
{
$output->writeln('manufacturer not found: ' . $mfg_name . ' - ' . $make . ' - ' . $model);
@ -265,6 +268,7 @@ class ImportCustomerCommand extends Command
$mfg = $this->mfg_index[$mfg_name];
$mfg_id = $mfg->getID();
$output->writeln('[5] checking make');
// check if empty make
if (empty($make))
{
@ -274,6 +278,8 @@ class ImportCustomerCommand extends Command
// get first make
$first_make = reset($this->vehicle_index[$mfg_id]);
$first_model = reset($first_make);
if ($first_model == null)
$output->writeln('first_model null');
return $first_model;
}
@ -320,6 +326,8 @@ class ImportCustomerCommand extends Command
if (count($this->vehicle_index[$mfg_id][$make]) == 1)
{
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
if ($vehicle == null)
$output->writeln('vehicle[1] null');
return $vehicle;
}
@ -327,15 +335,17 @@ class ImportCustomerCommand extends Command
if ($model_index == '-')
{
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
if ($vehicle == null)
$output->writeln('vehicle[2] null');
return $vehicle;
}
// special cases
}
$output->writeln("vehicle make and model not found: $mfg_name - $make ($model_index)");
return null;
}
return $this->vehicle_index[$mfg_id][$make][$model_index];
}
protected function execute(InputInterface $input, OutputInterface $output)
@ -419,6 +429,7 @@ class ImportCustomerCommand extends Command
$vehicle = $this->findVehicle($output, $fields);
if ($vehicle != null)
{
$output->writeln('[1] vehicle found');
/*
// customer vehicle
$cv = new CustomerVehicle();
@ -449,6 +460,10 @@ class ImportCustomerCommand extends Command
$cv_row = str_replace('\\', '\\\\', implode('|', $cv_fields)) . "\n";
fputs($cv_file, $cv_row);
}
else
{
$output->writeln('[2] vehicle not found');
}
$row_num++;
/*