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