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); $dupe_brands[] = strtoupper($clean_brand);
} }
// need to check if size has / // size hash
$pos = stripos($clean_size, '/'); if (!isset($this->batt_size_hash[$clean_size]))
$clean_sizes = [];
if ($pos == false)
{ {
// no '/' in size $size = new SAPBatterySize();
$clean_sizes[] = $this->normalizeName($clean_size); $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 else
{ {
// need to explode $dupe_sizes[] = strtoupper($clean_size);
$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);
}
} }
// battery hash // battery hash