Remove split. #502

This commit is contained in:
Korina Cordero 2020-09-22 06:32:48 +00:00
parent bb06937a44
commit ae6c2da1de

View file

@ -111,44 +111,23 @@ class ImportSAPBatteryCommand extends Command
$dupe_brands[] = strtoupper($clean_brand);
}
// need to check if size has /
$pos = stripos($clean_size, '/');
$clean_sizes = [];
if ($pos == false)
// size hash
if (!isset($this->batt_size_hash[$clean_size]))
{
// no '/' in size
$clean_sizes[] = $this->normalizeName($clean_size);
$size = new SAPBatterySize();
$size->setName(strtoupper($clean_size));
$em->persist($size);
$this->batt_size_hash[$clean_size] = $size;
// add to list of added sizes
error_log('Adding size ' . strtoupper($clean_size));
$added_sizes[strtoupper($clean_size)] = strtoupper($clean_size);
}
else
{
// need to explode
$sizes = explode('/', $clean_size);
foreach ($sizes as $size)
{
$clean_sizes[] = $this->normalizeName(trim($size));
}
}
foreach ($clean_sizes as $c_size)
{
// size hash
if (!isset($this->batt_size_hash[$c_size]))
{
$size = new SAPBatterySize();
$size->setName(strtoupper($c_size));
$em->persist($size);
$this->batt_size_hash[$c_size] = $size;
// add to list of added sizes
error_log('Adding size ' . strtoupper($c_size));
$added_sizes[strtoupper($c_size)] = strtoupper($c_size);
}
else
{
$dupe_sizes[] = strtoupper($c_size);
}
$dupe_sizes[] = strtoupper($clean_size);
}
// battery hash