| @@ 313-325 (lines=13) @@ | ||
| 310 | if (isset($row[$headerByKey['class_category2']]) && StringUtil::isNotBlank($row[$headerByKey['class_category2']])) { |
|
| 311 | if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) { |
|
| 312 | $ClassCategory2 = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]); |
|
| 313 | if (!$ClassCategory2) { |
|
| 314 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 315 | $this->addErrors($message); |
|
| 316 | } else { |
|
| 317 | if ($ClassCategory1 && |
|
| 318 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 319 | ) { |
|
| 320 | $message = trans('csvimportcontroller.notsame', ['%line%' => $line, '%name1%' => $headerByKey['class_category1'], '%name2%' => $headerByKey['class_category2']]); |
|
| 321 | $this->addErrors($message); |
|
| 322 | } else { |
|
| 323 | $ProductClass->setClassCategory2($ClassCategory2); |
|
| 324 | } |
|
| 325 | } |
|
| 326 | } else { |
|
| 327 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 328 | $this->addErrors($message); |
|
| @@ 417-431 (lines=15) @@ | ||
| 414 | } else { |
|
| 415 | if (preg_match('/^\d+$/', $classCategoryId2)) { |
|
| 416 | $ClassCategory2 = $this->classCategoryRepository->find($classCategoryId2); |
|
| 417 | if (!$ClassCategory2) { |
|
| 418 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 419 | $this->addErrors($message); |
|
| 420 | } else { |
|
| 421 | if ($ClassCategory1 && |
|
| 422 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
|
| 423 | ) { |
|
| 424 | $message = trans('csvimportcontroller.notsame', [ |
|
| 425 | '%line%' => $line, |
|
| 426 | '%name1%' => $headerByKey['class_category1'], |
|
| 427 | '%name2%' => $headerByKey['class_category2'], |
|
| 428 | ]); |
|
| 429 | $this->addErrors($message); |
|
| 430 | } |
|
| 431 | } |
|
| 432 | } else { |
|
| 433 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]); |
|
| 434 | $this->addErrors($message); |
|