// stock management : Supplier order is now supply order, employee and product is now historized for sttock movements and supply order

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10121 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dSevere
2011-11-14 18:58:02 +00:00
parent 35150997c7
commit 5719c43481
20 changed files with 656 additions and 570 deletions
@@ -0,0 +1,74 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* Used in AdminSupplierOrdersController in order to retrieves products, given a pattern
* @since 1.5.0
*/
define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Gets cookie or logout */
require_once(dirname(__FILE__).'/init.php');
/* @var string Given this pattern, it will return a list of products */
$pattern = pSQL(Tools::getValue('q', false));
if (!$pattern || $pattern == '' || strlen($pattern) < 1)
die();
/* @var int Supplier id */
$id_supplier = (int)Tools::getValue('id_supplier', false);
/* @var int Lang used */
$id_lang = (int)Context::getContext()->language->id;
/* @var DbQuery query used */
$query = new DbQuery();
$query->select('
CONCAT(p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\')) as id,
p.reference,
IFNULL(p.ean13, \'\') as ean13,
IFNULL(p.upc, \'\') as upc,
md5(CONCAT(\''._COOKIE_KEY_.'\', p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\'))) as checksum,
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.name, \' - \', al.name SEPARATOR \', \')), pl.name) as name
');
$query->from('product p');
$query->innerJoin('product_lang pl ON (pl.id_product = p.id_product AND pl.id_lang = '.$id_lang.')');
$query->leftJoin('product_attribute pa ON (pa.id_product = p.id_product)');
$query->leftJoin('product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute)');
$query->leftJoin('attribute atr ON (atr.id_attribute = pac.id_attribute)');
$query->leftJoin('attribute_lang al ON (al.id_attribute = atr.id_attribute AND al.id_lang = '.$id_lang.')');
$query->leftJoin('attribute_group_lang agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$id_lang.')');
$query->where('pl.name LIKE \'%'.$pattern.'%\' OR p.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.is_virtual = 0 AND p.cache_is_pack = 0');
if ($id_supplier)
$query->where('p.id_supplier = '.$id_supplier);
$query->groupBy('pa.id_product_attribute');
$items = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
if ($items)
die(Tools::jsonEncode($items));
die();
@@ -19,7 +19,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9930 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
@@ -57,6 +57,7 @@
<tr class="nodrag nodrop">
<th style="width: 150px">{l s='Reference'}</th>
<th style="width: 50px">{l s='EAN13'}</th>
<th style="width: 50px">{l s='UPC'}</th>
<th>{l s='Name'}</th>
<th style="width: 100px">{l s='Unit Price TE'}</th>
<th style="width: 100px">{l s='Quantity'}</th>
@@ -79,7 +80,11 @@
<input type="hidden" name="input_ean13_{$product.id_product}_{$product.id_product_attribute}" value="{$product.ean13}" />
</td>
<td>
{$product.name}
{$product.upc}
<input type="hidden" name="input_upc_{$product.id_product}_{$product.id_product_attribute}" value="{$product.upc}" />
</td>
<td>
{$product.name_displayed}
<input type="hidden" name="input_name_{$product.id_product}_{$product.id_product_attribute}" value="{$product.name}" />
</td>
<td class="center">
@@ -131,7 +136,8 @@
'<tr style="height:50px;">'+
'<td>'+product_infos.reference+'<input type="hidden" name="input_check_'+product_infos.id+'" value="'+product_infos.checksum+'" /><input type="hidden" name="input_name_'+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.name+'<input type="hidden" name="input_name_'+product_infos.id+'" value="'+product_infos.name+'" /></td>'+
'<td>'+product_infos.upc+'<input type="hidden" name="input_ean13_'+product_infos.id+'" value="'+product_infos.upc+'" /></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="0" 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_discount_rate_'+product_infos.id+'" value="0" size="5" />%</td>'+
@@ -199,7 +205,7 @@
});
// set autocomplete on search field
$('#cur_product_name').autocomplete("ajax_supplier_order_products_list.php", {
$('#cur_product_name').autocomplete("ajax_supply_order_products_list.php", {
delay: 100,
minChars: 4,
autoFill: true,
@@ -19,7 +19,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10055 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
@@ -19,7 +19,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10055 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
@@ -31,33 +31,29 @@
<fieldset>
<legend>{l s='General informations'}</legend>
<table style="width: 400px;" classe="table">
<tr>
<td>{l s='Employee:'}</td>
<td>{$supplier_order_employee}</td>
</tr>
<tr>
<td>{l s='Creation date:'}</td>
<td>{$supplier_order_creation_date}</td>
<td>{$supply_order_creation_date}</td>
</tr>
<tr>
<td>{l s='Last update:'}</td>
<td>{$supplier_order_last_update}</td>
<td>{$supply_order_last_update}</td>
</tr>
<tr>
<td>{l s='Delivery expected:'}</td>
<td>{$supplier_order_expected}</td>
<td>{$supply_order_expected}</td>
</tr>
<tr>
<td>{l s='Warehouse:'}</td>
<td>{$supplier_order_warehouse}</td>
<td>{$supply_order_warehouse}</td>
</tr>
<tr>
<td>{l s='Currency:'}</td>
<td>{$supplier_order_currency->name}</td>
<td>{$supply_order_currency->name}</td>
</tr>
<tr>
<td>{l s='Global discount rate:'}</td>
<td>{$supplier_order_discount_rate} %</td>
<td>{$supply_order_discount_rate} %</td>
</tr>
</table>
</fieldset>
@@ -66,7 +62,7 @@
<div style="margin-top: 20px;">
<fieldset>
<legend>{l s='Products'}</legend>
{$supplier_order_detail_content}
{$supply_order_detail_content}
</fieldset>
</div>
@@ -84,15 +80,15 @@
</tr>
<tr>
<td>{l s='Total TE'}</td>
<td align="right">{$supplier_order_total_te}</td>
<td align="right">{$supply_order_total_te}</td>
</tr>
<tr>
<td>{l s='Discount'}</td>
<td align="right">{$supplier_order_discount_value_te}</td>
<td align="right">{$supply_order_discount_value_te}</td>
</tr>
<tr>
<td>{l s='Total with discount TE'}</td>
<td align="right">{$supplier_order_total_with_discount_te}</td>
<td align="right">{$supply_order_total_with_discount_te}</td>
</tr>
<tr>
<td bgcolor="#000000"></td>
@@ -100,11 +96,11 @@
</tr>
<tr>
<td>{l s='Total Tax'}</td>
<td align="right">{$supplier_order_total_tax}</td>
<td align="right">{$supply_order_total_tax}</td>
</tr>
<tr>
<td>{l s='Total TI'}</td>
<td align="right">{$supplier_order_total_ti}</td>
<td align="right">{$supply_order_total_ti}</td>
</tr>
<tr>
<td bgcolor="#000000"></td>
@@ -112,7 +108,7 @@
</tr>
<tr>
<td>{l s='TOTAL TO PAY'}</td>
<td align="right">{$supplier_order_total_ti}</td>
<td align="right">{$supply_order_total_ti}</td>
</tr>
</table>
</fieldset>