// Updated CSV Import

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11970 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2012-01-02 10:11:53 +00:00
parent 99eccea21f
commit a3d8def0a6
2 changed files with 78 additions and 58 deletions
@@ -199,7 +199,7 @@
<p>{l s='Note that you can have serveral products with the same reference.'}</p> <p>{l s='Note that you can have serveral products with the same reference.'}</p>
</div> </div>
<div class="warn import_supply_orders_details" style="margin-top: 20px; display:none"> <div class="warn import_supply_orders_details" style="margin-top: 20px; display:none">
<p>{l s='Importing Supply Order Details will first reset the products ordered.'}</p> <p>{l s='Importing Supply Order Details will first reset the products ordered, if any.'}</p>
</div> </div>
{if !count($files_to_import)} {if !count($files_to_import)}
<div class="warn" style="margin-top: 20px;"> <div class="warn" style="margin-top: 20px;">
+77 -57
View File
@@ -76,7 +76,7 @@ class AdminImportControllerCore extends AdminController
public function __construct() public function __construct()
{ {
$this->entities = array_flip(array( $this->entities = array(
$this->l('Categories'), $this->l('Categories'),
$this->l('Products'), $this->l('Products'),
$this->l('Combinations'), $this->l('Combinations'),
@@ -84,9 +84,21 @@ class AdminImportControllerCore extends AdminController
$this->l('Addresses'), $this->l('Addresses'),
$this->l('Manufacturers'), $this->l('Manufacturers'),
$this->l('Suppliers'), $this->l('Suppliers'),
$this->l('SupplyOrders'), );
$this->l('SupplyOrdersDetails'),
)); // @since 1.5.0
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
$this->entities = array_merge(
$this->entities,
array(
$this->l('SupplyOrders'),
$this->l('SupplyOrdersDetails'),
)
);
}
$this->entities = array_flip($this->entities);
switch ((int)Tools::getValue('entity')) switch ((int)Tools::getValue('entity'))
{ {
@@ -342,59 +354,65 @@ class AdminImportControllerCore extends AdminController
break; break;
// @since 1.5.0 // @since 1.5.0
case $this->entities[$this->l('SupplyOrders')]: case $this->entities[$this->l('SupplyOrders')]:
// required fields if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->required_fields = array( {
'id_supplier', // required fields
'id_warehouse', $this->required_fields = array(
'reference', 'id_supplier',
'date_delivery_expected', 'id_warehouse',
); 'reference',
// available fields 'date_delivery_expected',
$this->available_fields = array( );
'no' => array('label' => $this->l('Ignore this column')), // available fields
'id' => array('label' => $this->l('ID')), $this->available_fields = array(
'id_supplier' => array('label' => $this->l('Supplier ID *')), 'no' => array('label' => $this->l('Ignore this column')),
'id_lang' => array('label' => $this->l('Lang ID')), 'id' => array('label' => $this->l('ID')),
'id_warehouse' => array('label' => $this->l('Warehouse ID *')), 'id_supplier' => array('label' => $this->l('Supplier ID *')),
'id_currency' => array('label' => $this->l('Currency ID *')), 'id_lang' => array('label' => $this->l('Lang ID')),
'reference' => array('label' => $this->l('Supply Order Reference *')), 'id_warehouse' => array('label' => $this->l('Warehouse ID *')),
'date_delivery_expected' => array('label' => $this->l('Delivery Date (Y-M-D)*')), 'id_currency' => array('label' => $this->l('Currency ID *')),
'discount_rate' => array('label' => $this->l('Discount Rate')), 'reference' => array('label' => $this->l('Supply Order Reference *')),
'is_template' => array('label' => $this->l('Template')), 'date_delivery_expected' => array('label' => $this->l('Delivery Date (Y-M-D)*')),
); 'discount_rate' => array('label' => $this->l('Discount Rate')),
// default values 'is_template' => array('label' => $this->l('Template')),
self::$default_values = array( );
'id_lang' => (int)Configuration::get('PS_LANG_DEFAULT'), // default values
'id_currency' => Currency::getDefaultCurrency()->id, self::$default_values = array(
'discount_rate' => '0', 'id_lang' => (int)Configuration::get('PS_LANG_DEFAULT'),
'is_template' => '0', 'id_currency' => Currency::getDefaultCurrency()->id,
); 'discount_rate' => '0',
'is_template' => '0',
);
}
break; break;
// @since 1.5.0 // @since 1.5.0
case $this->entities[$this->l('SupplyOrdersDetails')]: case $this->entities[$this->l('SupplyOrdersDetails')]:
// required fields if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->required_fields = array( {
'supply_order_reference', // required fields
'id_product', $this->required_fields = array(
'unit_price_te', 'supply_order_reference',
'quantity_expected', 'id_product',
); 'unit_price_te',
// available fields 'quantity_expected',
$this->available_fields = array( );
'no' => array('label' => $this->l('Ignore this column')), // available fields
'supply_order_reference' => array('label' => $this->l('Supply Order Reference *')), $this->available_fields = array(
'id_product' => array('label' => $this->l('Product ID *')), 'no' => array('label' => $this->l('Ignore this column')),
'id_product_attribute' => array('label' => $this->l('Product Attribute ID')), 'supply_order_reference' => array('label' => $this->l('Supply Order Reference *')),
'unit_price_te' => array('label' => $this->l('Unit Price (te) *')), 'id_product' => array('label' => $this->l('Product ID *')),
'quantity_expected' => array('label' => $this->l('Quantity Expected *')), 'id_product_attribute' => array('label' => $this->l('Product Attribute ID')),
'discount_rate' => array('label' => $this->l('Discount Rate')), 'unit_price_te' => array('label' => $this->l('Unit Price (te) *')),
'tax_rate' => array('label' => $this->l('Tax Rate')), 'quantity_expected' => array('label' => $this->l('Quantity Expected *')),
); 'discount_rate' => array('label' => $this->l('Discount Rate')),
// default values 'tax_rate' => array('label' => $this->l('Tax Rate')),
self::$default_values = array( );
'discount_rate' => '0', // default values
'tax_rate' => '0', self::$default_values = array(
); 'discount_rate' => '0',
'tax_rate' => '0',
);
}
} }
parent::__construct(); parent::__construct();
@@ -438,7 +456,7 @@ class AdminImportControllerCore extends AdminController
'files_to_import' => $files_to_import, 'files_to_import' => $files_to_import,
'languages' => Language::getLanguages(false), 'languages' => Language::getLanguages(false),
'id_language' => $this->context->language->id, 'id_language' => $this->context->language->id,
'available_fields' => $this->getAvailableFields() 'available_fields' => $this->getAvailableFields(),
); );
return parent::renderForm(); return parent::renderForm();
@@ -2104,11 +2122,13 @@ class AdminImportControllerCore extends AdminController
break; break;
// @since 1.5.0 // @since 1.5.0
case $this->entities[$this->l('SupplyOrders')]: case $this->entities[$this->l('SupplyOrders')]:
$this->supplyOrdersImport(); if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersImport();
break; break;
// @since 1.5.0 // @since 1.5.0
case $this->entities[$this->l('SupplyOrdersDetails')]: case $this->entities[$this->l('SupplyOrdersDetails')]:
$this->supplyOrdersDetailsImport(); if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersDetailsImport();
break; break;
default: default:
$this->_errors[] = $this->l('no entity selected'); $this->_errors[] = $this->l('no entity selected');