// Fixed #PSTEST-527

This commit is contained in:
bMancone
2012-01-24 16:43:27 +00:00
parent be5fd03749
commit aa7f30121c
3 changed files with 28 additions and 22 deletions
@@ -59,6 +59,7 @@
<th style="width: 150px">{l s='Reference'}</th> <th style="width: 150px">{l s='Reference'}</th>
<th style="width: 50px">{l s='EAN13'}</th> <th style="width: 50px">{l s='EAN13'}</th>
<th style="width: 50px">{l s='UPC'}</th> <th style="width: 50px">{l s='UPC'}</th>
<th style="width: 150px">{l s='Supplier Reference'}</th>
<th>{l s='Name'}</th> <th>{l s='Name'}</th>
<th style="width: 100px">{l s='Unit Price TE'}</th> <th style="width: 100px">{l s='Unit Price TE'}</th>
<th style="width: 100px">{l s='Quantity'}</th> <th style="width: 100px">{l s='Quantity'}</th>
@@ -84,6 +85,10 @@
{$product.upc} {$product.upc}
<input type="hidden" name="input_upc_{$product.id_product}_{$product.id_product_attribute}" value="{$product.upc}" /> <input type="hidden" name="input_upc_{$product.id_product}_{$product.id_product_attribute}" value="{$product.upc}" />
</td> </td>
<td>
{$product.supplier_reference}
<input type="hidden" name="input_supplier_reference_{$product.id_product}_{$product.id_product_attribute}" value="{$product.supplier_reference}" />
</td>
<td> <td>
{$product.name_displayed} {$product.name_displayed}
<input type="hidden" name="input_name_{$product.id_product}_{$product.id_product_attribute}" value="{$product.name}" /> <input type="hidden" name="input_name_{$product.id_product}_{$product.id_product_attribute}" value="{$product.name}" />
@@ -147,6 +152,7 @@
'<td>'+product_infos.reference+'<input type="hidden" name="input_check_'+product_infos.id+'" value="'+product_infos.checksum+'" /><input type="hidden" name="input_reference_'+product_infos.id+'" value="'+product_infos.reference+'" /></td>'+ '<td>'+product_infos.reference+'<input type="hidden" name="input_check_'+product_infos.id+'" value="'+product_infos.checksum+'" /><input type="hidden" name="input_reference_'+product_infos.id+'" value="'+product_infos.reference+'" /></td>'+
'<td>'+product_infos.ean13+'<input type="hidden" name="input_ean13_'+product_infos.id+'" value="'+product_infos.ean13+'" /></td>'+ '<td>'+product_infos.ean13+'<input type="hidden" name="input_ean13_'+product_infos.id+'" value="'+product_infos.ean13+'" /></td>'+
'<td>'+product_infos.upc+'<input type="hidden" name="input_upc_'+product_infos.id+'" value="'+product_infos.upc+'" /></td>'+ '<td>'+product_infos.upc+'<input type="hidden" name="input_upc_'+product_infos.id+'" value="'+product_infos.upc+'" /></td>'+
'<td>'+product_infos.supplier_reference+'<input type="hidden" name="input_supplier_reference_'+product_infos.id+'" value="'+product_infos.supplier_reference+'" /></td>'+
'<td>'+product_infos.name+'<input type="hidden" name="input_name_displayed_'+product_infos.id+'" value="'+product_infos.name+'" /></td>'+ '<td>'+product_infos.name+'<input type="hidden" name="input_name_displayed_'+product_infos.id+'" value="'+product_infos.name+'" /></td>'+
'<td class="center">{$currency->prefix}&nbsp;<input type="text" name="input_unit_price_te_'+product_infos.id+'" value="'+product_infos.unit_price_te+'" size="8" />&nbsp;{$currency->suffix}</td>'+ '<td class="center">{$currency->prefix}&nbsp;<input type="text" name="input_unit_price_te_'+product_infos.id+'" value="'+product_infos.unit_price_te+'" size="8" />&nbsp;{$currency->suffix}</td>'+
'<td class="center"><input type="text" name="input_quantity_expected_'+product_infos.id+'" value="0" size="5" /></td>'+ '<td class="center"><input type="text" name="input_quantity_expected_'+product_infos.id+'" value="0" size="5" /></td>'+
@@ -226,7 +232,7 @@
matchContains: true, matchContains: true,
mustMatch:false, mustMatch:false,
scroll:false, scroll:false,
cacheLength:20, cacheLength:0,
dataType: 'json', dataType: 'json',
extraParams: { extraParams: {
id_supplier: '{$supplier_id}', id_supplier: '{$supplier_id}',
@@ -244,14 +250,14 @@
if (jQuery.inArray(row.id, product_ids) == -1) if (jQuery.inArray(row.id, product_ids) == -1)
return { return {
data: row, data: row,
result: row.reference + ' - ' + row.name, result: row.supplier_reference + ' - ' + row.name,
value: row.id value: row.id
} }
}); });
return res; return res;
}, },
formatItem: function(item) { formatItem: function(item) {
return item.reference + ' - ' + item.name; return item.supplier_reference + ' - ' + item.name;
} }
}).result(function(event, item){ }).result(function(event, item){
product_infos = item; product_infos = item;
@@ -906,6 +906,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$entry->discount_rate = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_discount_rate_'.$id, 0)); $entry->discount_rate = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_discount_rate_'.$id, 0));
$entry->tax_rate = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_tax_rate_'.$id, 0)); $entry->tax_rate = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_tax_rate_'.$id, 0));
$entry->reference = Tools::getValue('input_reference_'.$id, ''); $entry->reference = Tools::getValue('input_reference_'.$id, '');
$entry->supplier_reference = Tools::getValue('input_supplier_reference_'.$id, '');
$entry->ean13 = Tools::getValue('input_ean13_'.$id, ''); $entry->ean13 = Tools::getValue('input_ean13_'.$id, '');
$entry->upc = Tools::getValue('input_upc_'.$id, ''); $entry->upc = Tools::getValue('input_upc_'.$id, '');
@@ -915,9 +916,6 @@ class AdminSupplyOrdersControllerCore extends AdminController
if (empty($entry->name)) if (empty($entry->name))
$entry->name = ''; $entry->name = '';
//get the product supplier reference
$entry->supplier_reference = ProductSupplier::getProductSupplierReference($entry->id_product, $entry->id_product_attribute, $supply_order->id_supplier);
if ($entry->supplier_reference == null) if ($entry->supplier_reference == null)
$entry->supplier_reference = ''; $entry->supplier_reference = '';
@@ -944,6 +942,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
'name' => $entry->name, 'name' => $entry->name,
'name_displayed' => $entry->name_displayed, 'name_displayed' => $entry->name_displayed,
'reference' => $entry->reference, 'reference' => $entry->reference,
'supplier_reference' => $entry->supplier_reference,
'ean13' => $entry->ean13, 'ean13' => $entry->ean13,
'upc' => $entry->upc, 'upc' => $entry->upc,
); );
@@ -1563,6 +1562,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$query = new DbQuery(); $query = new DbQuery();
$query->select(' $query->select('
CONCAT(p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\')) as id, CONCAT(p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\')) as id,
ps.product_supplier_reference as supplier_reference,
IFNULL(pa.reference, IFNULL(p.reference, \'\')) as reference, IFNULL(pa.reference, IFNULL(p.reference, \'\')) as reference,
IFNULL(pa.ean13, IFNULL(p.ean13, \'\')) as ean13, IFNULL(pa.ean13, IFNULL(p.ean13, \'\')) as ean13,
IFNULL(pa.upc, IFNULL(p.upc, \'\')) as upc, IFNULL(pa.upc, IFNULL(p.upc, \'\')) as upc,
@@ -1580,14 +1580,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
$query->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$id_lang); $query->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$id_lang);
$query->leftJoin('product_supplier', 'ps', 'ps.id_product = p.id_product'); $query->leftJoin('product_supplier', 'ps', 'ps.id_product = p.id_product');
$query->where('pl.name LIKE \'%'.$pattern.'%\' OR p.reference LIKE \'%'.$pattern.'%\''); $query->where('(pl.name LIKE \'%'.$pattern.'%\' OR p.reference LIKE \'%'.$pattern.'%\' OR ps.product_supplier_reference LIKE \'%'.$pattern.'%\')');
$query->where('p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))'); $query->where('p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))');
$query->where('p.is_virtual = 0 AND p.cache_is_pack = 0'); $query->where('p.is_virtual = 0 AND p.cache_is_pack = 0');
if ($id_supplier) if ($id_supplier)
$query->where('ps.id_supplier = '.$id_supplier.' OR p.id_supplier = '.$id_supplier); $query->where('ps.id_supplier = '.$id_supplier.' OR p.id_supplier = '.$id_supplier);
$query->groupBy('pa.id_product_attribute'); $query->groupBy('p.id_product, pa.id_product_attribute');
$items = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); $items = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
+14 -14
View File
@@ -81,15 +81,15 @@
<div style="font-size: 6pt;"> <div style="font-size: 6pt;">
<table style="width: 100%;"> <table style="width: 100%;">
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Reference' pdf='true'}</td> <td style="width: 13%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Reference' pdf='true'}</td>
<td style="width: 31%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Designation' pdf='true'}</td> <td style="width: 21%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Designation' pdf='true'}</td>
<td style="width: 4%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Qty' pdf='true'}</td> <td style="width: 6%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Qty' pdf='true'}</td>
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Unit Price TE' pdf='true'}</td> <td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Unit Price TE' pdf='true'}</td>
<td style="width: 11%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)' pdf='true'}</td> <td style="width: 11%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)' pdf='true'}</td>
<td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Discount Rate' pdf='true'}</td> <td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Discount Rate' pdf='true'}</td>
<td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)' pdf='true'}</td> <td style="width: 11%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)' pdf='true'}</td>
<td style="width: 7%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax rate' pdf='true'}</td> <td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax rate' pdf='true'}</td>
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI' pdf='true'}</td> <td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI' pdf='true'}</td>
</tr> </tr>
{* for each product ordered *} {* for each product ordered *}
{foreach $supply_order_details as $supply_order_detail} {foreach $supply_order_details as $supply_order_detail}
@@ -142,27 +142,27 @@
<div style="font-size: 6pt;"> <div style="font-size: 6pt;">
<table style="width: 30%;"> <table style="width: 30%;">
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->total_te} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->total_te} {$currency->suffix}</td>
</tr> </tr>
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Order Discount'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Order Discount' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->discount_value_te} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->discount_value_te} {$currency->suffix}</td>
</tr> </tr>
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->total_with_discount_te} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->total_with_discount_te} {$currency->suffix}</td>
</tr> </tr>
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax value'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax value' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->total_tax} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->total_tax} {$currency->suffix}</td>
</tr> </tr>
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->total_ti} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->total_ti} {$currency->suffix}</td>
</tr> </tr>
<tr style="line-height:6px; border: none"> <tr style="line-height:6px; border: none">
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='TOTAL TO PAY'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='TOTAL TO PAY' pdf='true'}</td>
<td>{$currency->prefix} {$supply_order->total_ti} {$currency->suffix}</td> <td>{$currency->prefix} {$supply_order->total_ti} {$currency->suffix}</td>
</tr> </tr>
</table> </table>