| @@ 178-183 (lines=6) @@ | ||
| 175 | } else { |
|
| 176 | if (preg_match('/^\d+$/', $row[$headerByKey['id']])) { |
|
| 177 | $Product = $this->productRepository->find($row[$headerByKey['id']]); |
|
| 178 | if (!$Product) { |
|
| 179 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['id']]); |
|
| 180 | $this->addErrors($message); |
|
| 181 | ||
| 182 | return $this->renderWithError($form, $headers); |
|
| 183 | } |
|
| 184 | } else { |
|
| 185 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['id']]); |
|
| 186 | $this->addErrors($message); |
|
| @@ 184-189 (lines=6) @@ | ||
| 181 | ||
| 182 | return $this->renderWithError($form, $headers); |
|
| 183 | } |
|
| 184 | } else { |
|
| 185 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['id']]); |
|
| 186 | $this->addErrors($message); |
|
| 187 | ||
| 188 | return $this->renderWithError($form, $headers); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | if (StringUtil::isBlank($row[$headerByKey['status']])) { |
|
| @@ 198-203 (lines=6) @@ | ||
| 195 | } else { |
|
| 196 | if (preg_match('/^\d+$/', $row[$headerByKey['status']])) { |
|
| 197 | $ProductStatus = $this->productStatusRepository->find($row[$headerByKey['status']]); |
|
| 198 | if (!$ProductStatus) { |
|
| 199 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['status']]); |
|
| 200 | $this->addErrors($message); |
|
| 201 | } else { |
|
| 202 | $Product->setStatus($ProductStatus); |
|
| 203 | } |
|
| 204 | } else { |
|
| 205 | $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['status']]); |
|
| 206 | $this->addErrors($message); |
|