| @@ 357-369 (lines=13) @@ | ||
| 354 | if (isset($row[$headerByKey['class_category2']]) && StringUtil::isNotBlank($row[$headerByKey['class_category2']])) { |
|
| 355 | if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) { |
|
| 356 | $ClassCategory2 = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]); |
|
| 357 | if (!$ClassCategory2) { |
|
| 358 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 359 | $this->addErrors($message); |
|
| 360 | } else { |
|
| 361 | if ($ClassCategory1 && |
|
| 362 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 363 | ) { |
|
| 364 | $message = trans('admin.common.csv_invalid_not_same', ['%line%' => $line, '%name1%' => $headerByKey['class_category1'], '%name2%' => $headerByKey['class_category2']]); |
|
| 365 | $this->addErrors($message); |
|
| 366 | } else { |
|
| 367 | $ProductClass->setClassCategory2($ClassCategory2); |
|
| 368 | } |
|
| 369 | } |
|
| 370 | } else { |
|
| 371 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 372 | $this->addErrors($message); |
|
| @@ 462-476 (lines=15) @@ | ||
| 459 | } else { |
|
| 460 | if (preg_match('/^\d+$/', $classCategoryId2)) { |
|
| 461 | $ClassCategory2 = $this->classCategoryRepository->find($classCategoryId2); |
|
| 462 | if (!$ClassCategory2) { |
|
| 463 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 464 | $this->addErrors($message); |
|
| 465 | } else { |
|
| 466 | if ($ClassCategory1 && |
|
| 467 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 468 | ) { |
|
| 469 | $message = trans('admin.common.csv_invalid_not_same', [ |
|
| 470 | '%line%' => $line, |
|
| 471 | '%name1%' => $headerByKey['class_category1'], |
|
| 472 | '%name2%' => $headerByKey['class_category2'], |
|
| 473 | ]); |
|
| 474 | $this->addErrors($message); |
|
| 475 | } |
|
| 476 | } |
|
| 477 | } else { |
|
| 478 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 479 | $this->addErrors($message); |
|