Fix customer import bug #75
This commit is contained in:
parent
973d127244
commit
6918d44468
2 changed files with 204812 additions and 2 deletions
204795
data/cv_import.csv
204795
data/cv_import.csv
File diff suppressed because it is too large
Load diff
|
|
@ -252,11 +252,14 @@ class ImportCustomerCommand extends Command
|
||||||
|
|
||||||
protected function findVehicle($output, $row)
|
protected function findVehicle($output, $row)
|
||||||
{
|
{
|
||||||
|
$output->writeln('[0] find vehicle');
|
||||||
// search for manufacturer
|
// search for manufacturer
|
||||||
$mfg_name = trim($row[self::F_V_BRAND]);
|
$mfg_name = trim($row[self::F_V_BRAND]);
|
||||||
$make = strtoupper(trim($row[self::F_V_MAKE]));
|
$make = strtoupper(trim($row[self::F_V_MAKE]));
|
||||||
$model = trim($row[self::F_V_MODEL]);
|
$model = trim($row[self::F_V_MODEL]);
|
||||||
|
|
||||||
|
|
||||||
|
$output->writeln('[5] checking mfg');
|
||||||
if (!isset($this->mfg_index[$mfg_name]))
|
if (!isset($this->mfg_index[$mfg_name]))
|
||||||
{
|
{
|
||||||
$output->writeln('manufacturer not found: ' . $mfg_name . ' - ' . $make . ' - ' . $model);
|
$output->writeln('manufacturer not found: ' . $mfg_name . ' - ' . $make . ' - ' . $model);
|
||||||
|
|
@ -265,6 +268,7 @@ class ImportCustomerCommand extends Command
|
||||||
$mfg = $this->mfg_index[$mfg_name];
|
$mfg = $this->mfg_index[$mfg_name];
|
||||||
$mfg_id = $mfg->getID();
|
$mfg_id = $mfg->getID();
|
||||||
|
|
||||||
|
$output->writeln('[5] checking make');
|
||||||
// check if empty make
|
// check if empty make
|
||||||
if (empty($make))
|
if (empty($make))
|
||||||
{
|
{
|
||||||
|
|
@ -274,6 +278,8 @@ class ImportCustomerCommand extends Command
|
||||||
// get first make
|
// get first make
|
||||||
$first_make = reset($this->vehicle_index[$mfg_id]);
|
$first_make = reset($this->vehicle_index[$mfg_id]);
|
||||||
$first_model = reset($first_make);
|
$first_model = reset($first_make);
|
||||||
|
if ($first_model == null)
|
||||||
|
$output->writeln('first_model null');
|
||||||
return $first_model;
|
return $first_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,6 +326,8 @@ class ImportCustomerCommand extends Command
|
||||||
if (count($this->vehicle_index[$mfg_id][$make]) == 1)
|
if (count($this->vehicle_index[$mfg_id][$make]) == 1)
|
||||||
{
|
{
|
||||||
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
|
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
|
||||||
|
if ($vehicle == null)
|
||||||
|
$output->writeln('vehicle[1] null');
|
||||||
return $vehicle;
|
return $vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,15 +335,17 @@ class ImportCustomerCommand extends Command
|
||||||
if ($model_index == '-')
|
if ($model_index == '-')
|
||||||
{
|
{
|
||||||
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
|
$vehicle = reset($this->vehicle_index[$mfg_id][$make]);
|
||||||
|
if ($vehicle == null)
|
||||||
|
$output->writeln('vehicle[2] null');
|
||||||
return $vehicle;
|
return $vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special cases
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln("vehicle make and model not found: $mfg_name - $make ($model_index)");
|
$output->writeln("vehicle make and model not found: $mfg_name - $make ($model_index)");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->vehicle_index[$mfg_id][$make][$model_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
|
@ -419,6 +429,7 @@ class ImportCustomerCommand extends Command
|
||||||
$vehicle = $this->findVehicle($output, $fields);
|
$vehicle = $this->findVehicle($output, $fields);
|
||||||
if ($vehicle != null)
|
if ($vehicle != null)
|
||||||
{
|
{
|
||||||
|
$output->writeln('[1] vehicle found');
|
||||||
/*
|
/*
|
||||||
// customer vehicle
|
// customer vehicle
|
||||||
$cv = new CustomerVehicle();
|
$cv = new CustomerVehicle();
|
||||||
|
|
@ -449,6 +460,10 @@ class ImportCustomerCommand extends Command
|
||||||
$cv_row = str_replace('\\', '\\\\', implode('|', $cv_fields)) . "\n";
|
$cv_row = str_replace('\\', '\\\\', implode('|', $cv_fields)) . "\n";
|
||||||
fputs($cv_file, $cv_row);
|
fputs($cv_file, $cv_row);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$output->writeln('[2] vehicle not found');
|
||||||
|
}
|
||||||
|
|
||||||
$row_num++;
|
$row_num++;
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue