| @@ 445-457 (lines=13) @@ | ||
| 442 | if (isset($row[$headerByKey['class_category2']]) && StringUtil::isNotBlank($row[$headerByKey['class_category2']])) { |
|
| 443 | if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) { |
|
| 444 | $ClassCategory2 = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]); |
|
| 445 | if (!$ClassCategory2) { |
|
| 446 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 447 | $this->addErrors($message); |
|
| 448 | } else { |
|
| 449 | if ($ClassCategory1 && |
|
| 450 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 451 | ) { |
|
| 452 | $message = trans('admin.common.csv_invalid_not_same', ['%line%' => $line, '%name1%' => $headerByKey['class_category1'], '%name2%' => $headerByKey['class_category2']]); |
|
| 453 | $this->addErrors($message); |
|
| 454 | } else { |
|
| 455 | $ProductClass->setClassCategory2($ClassCategory2); |
|
| 456 | } |
|
| 457 | } |
|
| 458 | } else { |
|
| 459 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 460 | $this->addErrors($message); |
|
| @@ 581-595 (lines=15) @@ | ||
| 578 | } else { |
|
| 579 | if (preg_match('/^\d+$/', $classCategoryId2)) { |
|
| 580 | $ClassCategory2 = $this->classCategoryRepository->find($classCategoryId2); |
|
| 581 | if (!$ClassCategory2) { |
|
| 582 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 583 | $this->addErrors($message); |
|
| 584 | } else { |
|
| 585 | if ($ClassCategory1 && |
|
| 586 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 587 | ) { |
|
| 588 | $message = trans('admin.common.csv_invalid_not_same', [ |
|
| 589 | '%line%' => $line, |
|
| 590 | '%name1%' => $headerByKey['class_category1'], |
|
| 591 | '%name2%' => $headerByKey['class_category2'], |
|
| 592 | ]); |
|
| 593 | $this->addErrors($message); |
|
| 594 | } |
|
| 595 | } |
|
| 596 | } else { |
|
| 597 | $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 598 | $this->addErrors($message); |
|