Merge branch 'fix/export' into develop

This commit is contained in:
Michael RICOIS 2018-01-08 11:17:05 +01:00
commit 4631bb5674

View File

@ -55,26 +55,8 @@ class Export
$result = Db::getInstance()->executeS($sql);
if (count($result) > 0) {
foreach($result as $k => $p) {
$result[$k]['pelliculage'] = '';
$result[$k]['emballage'] = '';
$result[$k]['delivery_date'] = '';
if ($p['id_configurator'] != 0) {
$configList = ConfiguratorStorage::getOptProductFlatten($p['id_configurator']);
foreach ($configList as $config) {
if ($config['reference'] == 'PELLICULAGE') {
foreach($config['value'] as $v) {
$result[$k]['pelliculage']= $v;
}
}
if ($config['reference'] == 'EMBALLAGE') {
foreach($config['value'] as $v) {
$result[$k]['emballage']= $v;
}
}
}
}
// customer_thread (id_order), customer_message (id_customer_message) message
$sql = "SELECT message FROM ps_customer_message cm, ps_customer_thread ct
WHERE ct.id_order=".$p['id_order']." AND ct.id_customer=".$p['id_customer']." AND cm.id_customer_thread=ct.id_customer_thread";
@ -109,8 +91,6 @@ class Export
array('label' => 'code_pays_livr', 'col' => 'country',),
array('label' => 'Date_livraison', 'col' => 'delivery_date'), // Message
array('label' => 'Date_facturation', 'col' => 'invoice_date'),
array('label' => 'type papier', 'col' => 'emballage'),
array('label' => 'finition papier', 'col' => 'pelliculage'),
array('label' => 'Déduction_échantillon', 'col' => ''),
array('label' => 'mode paiement', 'col' => 'payment'),
array('label' => 'Reference BC', 'col' => ''),
@ -248,6 +228,8 @@ class Export
$result[$k]['TXT'] = '';
$result[$k]['parfums1'] = '';
$result[$k]['parfums2'] = '';
$result[$k]['pelliculage'] = '';
$result[$k]['emballage'] = '';
if ($p['id_configurator'] != 0) {
$configList = ConfiguratorStorage::getOptProductFlatten($p['id_configurator']);
@ -260,7 +242,16 @@ class Export
$parfumCpt++;
}
}
if ($config['reference'] == 'PELLICULAGE') {
foreach($config['value'] as $v) {
$result[$k]['pelliculage']= $v;
}
}
if ($config['reference'] == 'EMBALLAGE') {
foreach($config['value'] as $v) {
$result[$k]['emballage']= $v;
}
}
// Standard
if (!empty($result[$k]['TXT'])) {
$result[$k]['TXT'].= "\n";
@ -276,13 +267,24 @@ class Export
}
}
}
// Theme name
$result[$k]['theme']= '';
$themeName = Db::getInstance()->getValue("SELECT name FROM `"._DB_PREFIX_."simulator_theme` st
LEFT JOIN `"._DB_PREFIX_."product` p ON (p.`id_simulator_theme`=st.`id_simulator_theme`)
WHERE p.`id_product`=".$p['product_id']);
if (!empty($themeName)) {
$result[$k]['theme'] = $themeName;
}
}
}
$header = array(
array('label' => 'ID_fact', 'col' => 'id_order'),
array('label' => 'ref_article', 'col' => 'reference'),
array('label' => 'Thème', 'col' => 'product_name'),
array('label' => 'type papier', 'col' => 'emballage'),
array('label' => 'finition papier', 'col' => 'pelliculage'),
array('label' => 'Thème', 'col' => 'theme'),
array('label' => 'Qualité_1', 'col' => 'parfums1'),
array('label' => 'Qualité_2', 'col' => 'parfums2'),
array('label' => 'Quantité', 'col' => 'quantity'),