From 313e67d433dd492ae29e704b0d1bf2db0e31ae32 Mon Sep 17 00:00:00 2001 From: bMancone Date: Wed, 28 Dec 2011 11:36:45 +0000 Subject: [PATCH] // CSV Import: began adding Supply Orders git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11830 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/import/form.tpl | 129 +++++++++++++------- admin-dev/themes/template/import/view.tpl | 4 +- controllers/admin/AdminImportController.php | 30 ++++- docs/csv_import/supply_orders_import.csv | 3 + 4 files changed, 118 insertions(+), 48 deletions(-) create mode 100644 docs/csv_import/supply_orders_import.csv diff --git a/admin-dev/themes/template/import/form.tpl b/admin-dev/themes/template/import/form.tpl index 71a57eb4e..1ce4d55d5 100644 --- a/admin-dev/themes/template/import/form.tpl +++ b/admin-dev/themes/template/import/form.tpl @@ -71,51 +71,77 @@ } }); }; - -
- {l s='Upload'} -
- -
-
{l s='You can also upload your file by FTP and put it in'} {$path_import}. -
-
- -
-
- {l s='Allowed files are only UTF-8 and iso-8859-1 encoded ones'} -
-
-
- +{** + * Samples fieldset + *}
{l s='Sample files'} -
+
 
+ +{** + * Upload fieldset + *} +
+ {l s='Upload'} + + {l s='You can either click here to upload your own CSV file, or choose to use an existing one in the form below.'} + +
 
+ +
+
 
+{** + * Import fieldset + *}
-
+ +
{l s='Import'} - +
- {foreach $entities AS $entity => $i}
{if count($files_to_import)} - +
- ({count($files_to_import)} {if count($files_to_import) > 1} {l s='files available'}{else}{l s='file available'}{/if})
- +
+ +
- {foreach $languages AS $lang} {/foreach} + {l s='The locale must be installed'}
- +
@@ -168,28 +196,28 @@
-
-

{l s='Note that the category import does not support categories of the same name'}.

- -

{l s='Note that references are not specified as UNIQUE in the database'}.

+
+

{l s='Note that the category import does not support categories of the same name.'}

+

{l s='Note that you can have serveral products with the same reference.'}

{else} -
- {l s='No CSV file is available, please upload one file above.'}

- {l s='You can get many informations about CSV import at:'} http://www.prestashop.com/wiki/Troubleshooting_6/

- {l s='More about CSV format at: '} http://en.wikipedia.org/wiki/Comma-separated_values +
+ {l s='There is no CSV file available, please upload one using the form above.'} +

+ {l s='You can read informations on CSV import at:'} http://www.prestashop.com/wiki/Troubleshooting_6/

+ {l s='Read more about CSV format at: '} http://en.wikipedia.org/wiki/Comma-separated_values
{/if}
-
+
{l s='Fields available'} -
+
{$available_fields}
@@ -204,15 +232,26 @@ -

{l s='Your data'}

-
+

{l s='View your data'}

+
{l s='Save and load your matching configuration'} :

{l s='Save'}

diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 716608cb8..ce1a62d51 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -83,7 +83,8 @@ class AdminImportControllerCore extends AdminController $this->l('Customers'), $this->l('Addresses'), $this->l('Manufacturers'), - $this->l('Suppliers') + $this->l('Suppliers'), + $this->l('Supply Orders'), )); switch ((int)Tools::getValue('entity')) @@ -338,6 +339,33 @@ class AdminImportControllerCore extends AdminController 'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')), ); break; + // @since 1.5.0 + case $this->entities[$this->l('Supply Orders')]: + // required fields + $this->required_fields = array( + 'id_supplier', + 'id_warehouse', + 'reference', + 'date_delivery_expected', + ); + // available fields + $this->available_fields = array( + 'no' => array('label' => $this->l('Ignore this column')), + 'id' => array('label' => $this->l('ID')), + 'id_supplier' => array('label' => $this->l('Supplier ID *')), + 'id_lang' => array('label' => $this->l('Lang ID')), + 'id_warehouse' => array('label' => $this->l('Warehouse ID *')), + 'id_currency' => array('label' => $this->l('Currency ID *')), + 'reference' => array('label' => $this->l('Supply Order Reference *')), + 'date_delivery_expected' => array('label' => $this->l('Delivery Date (Y-M-D)*')), + 'discount_rate' => array('label' => $this->l('Discount Rate')), + ); + // default values + self::$default_values = array( + 'id_lang' => (int)Configuration::get('PS_LANG_DEFAULT'), + 'id_currency' => Currency::getDefaultCurrency()->id, + 'discount_rate' => '0', + ); } parent::__construct(); diff --git a/docs/csv_import/supply_orders_import.csv b/docs/csv_import/supply_orders_import.csv new file mode 100644 index 000000000..ac983a15e --- /dev/null +++ b/docs/csv_import/supply_orders_import.csv @@ -0,0 +1,3 @@ +"ID";"Supplier ID *";"Lang ID";"Warehouse ID*";"Currency ID";"Supply Order Reference *";"Expected Delivery Date";"Discount Rate" +;1;1;1;;"ref import 1";"2012-11-31"; +;1;;1;;"ref import 2";"2012-12-30";15