Refactor ProductPriceImport -> ProductPricesImport

modifié:         core/lib/Thelia/Config/Resources/import.xml
	renommé:         core/lib/Thelia/ImportExport/Import/Type/ProductPriceImport.php -> core/lib/Thelia/ImportExport/Import/Type/ProductPricesImport.php
	modifié:         core/lib/Thelia/Tests/ImportExport/Import/ProductPriceImportTest.php
This commit is contained in:
Benjamin Perche
2014-07-21 14:53:19 +02:00
parent 0e3ae84cb8
commit a54ce50eb1
3 changed files with 44 additions and 42 deletions

View File

@@ -20,7 +20,7 @@
</import_descriptive> </import_descriptive>
</import> </import>
<import id="thelia.import.price" class="Thelia\ImportExport\Import\Type\ProductPriceImport" category_id="thelia.import.products"> <import id="thelia.import.price" class="Thelia\ImportExport\Import\Type\ProductPricesImport" category_id="thelia.import.products">
<import_descriptive locale="fr_FR"> <import_descriptive locale="fr_FR">
<title>Importez vos prix</title> <title>Importez vos prix</title>
</import_descriptive> </import_descriptive>

View File

@@ -22,11 +22,11 @@ use Thelia\Model\ProductPriceQuery;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
/** /**
* Class ProductPriceImport * Class ProductPricesImport
* @package Thelia\ImportExport\Import\Type * @package Thelia\ImportExport\Import\Type
* @author Benjamin Perche <bperche@openstudio.fr> * @author Benjamin Perche <bperche@openstudio.fr>
*/ */
class ProductPriceImport extends ImportHandler class ProductPricesImport extends ImportHandler
{ {
/** /**
* @return string|array * @return string|array
@@ -63,6 +63,7 @@ class ProductPriceImport extends ImportHandler
$translator = Translator::getInstance(); $translator = Translator::getInstance();
while (null !== $row = $data->popRow()) { while (null !== $row = $data->popRow()) {
if (count($row) > 1) {
$obj = ProductSaleElementsQuery::create()->findOneByRef($row["ref"]); $obj = ProductSaleElementsQuery::create()->findOneByRef($row["ref"]);
if ($obj === null) { if ($obj === null) {
@@ -110,6 +111,7 @@ class ProductPriceImport extends ImportHandler
$this->importedRows++; $this->importedRows++;
} }
} }
}
return $errors; return $errors;
} }

View File

@@ -14,7 +14,7 @@ namespace Thelia\Tests\ImportExport\Import;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Thelia\Controller\Admin\ImportController; use Thelia\Controller\Admin\ImportController;
use Thelia\Core\FileFormat\Formatting\Formatter\JsonFormatter; use Thelia\Core\FileFormat\Formatting\Formatter\JsonFormatter;
use Thelia\ImportExport\Import\Type\ProductPriceImport; use Thelia\ImportExport\Import\Type\ProductPricesImport;
use Thelia\Model\Currency; use Thelia\Model\Currency;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Tests\Controller\ControllerTestBase; use Thelia\Tests\Controller\ControllerTestBase;
@@ -49,7 +49,7 @@ class ProductPriceImportTest extends ControllerTestBase
{ {
parent::setUp(); parent::setUp();
$this->import = new ProductPriceImport($this->container); $this->import = new ProductPricesImport($this->container);
} }