// 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>
+75
View File
@@ -32,11 +32,31 @@
*/
class StockCore extends ObjectModel
{
/** @var int identifier of the warehouse */
public $id_warehouse;
/** @var int identifier of the product */
public $id_product;
/** @var int identifier of the product attribute if necessary */
public $id_product_attribute;
/** @var string Product reference */
public $reference;
/** @var int Product EAN13 */
public $ean13;
/** @var string UPC */
public $upc;
/** @var int the physical quantity in stock for the current product in the current warehouse */
public $physical_quantity;
/** @var int the usable quantity (for sale) of the current physical quantity */
public $usable_quantity;
/** @var int the unit price without tax forthe current product */
public $price_te;
protected $fieldsRequired = array(
@@ -54,6 +74,9 @@ class StockCore extends ObjectModel
'id_warehouse' => 'isUnsignedId',
'id_product' => 'isUnsignedId',
'id_product_attribute' => 'isUnsignedId',
'reference' => 'isReference',
'ean13' => 'isEan13',
'upc' => 'isUpc',
'physical_quantity' => 'isUnsignedInt',
'usable_quantity' => 'isInt',
'price_te' => 'isPrice',
@@ -68,9 +91,61 @@ class StockCore extends ObjectModel
$fields['id_warehouse'] = (int)$this->id_warehouse;
$fields['id_product'] = (int)$this->id_product;
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
$fields['reference'] = pSQL($this->reference);
$fields['ean13'] = pSQL($this->ean13);
$fields['upc'] = pSQL($this->upc);
$fields['physical_quantity'] = (int)$this->physical_quantity;
$fields['usable_quantity'] = (int)$this->usable_quantity;
$fields['price_te'] = (float)round($this->price_te, 6);
return $fields;
}
/**
* @see ObjectModel::update()
*/
public function update($null_values = false)
{
$this->getProductInformations();
return parent::update($null_values);
}
/**
* @see ObjectModel::add()
*/
public function add($autodate = true, $null_values = false)
{
$this->getProductInformations();
return parent::add($autodate, $null_values);
}
/**
* Try to get reference, ean13 and upc information on current product
* and store it in stock for stock_mvt integrity and history use
*/
protected function getProductInformations()
{
if ((int)$this->id_product_attribute > 0)
{
$query = new DbQuery();
$query->select('reference, ean13, upc');
$query->from('product_attribute');
$query->where('id_product = '.(int)$this->id_product);
$query->where('id_product_attribute = '.(int)$this->id_product_attribute);
foreach (Db::getInstance()->executeS($query) as $row)
{
$this->reference = $row['reference'];
$this->ean13 = $row['ean13'];
$this->upc = $row['upc'];
}
}
else {
$product = new Product((int)$this->id_product);
$this->reference = $product->reference;
$this->ean13 = $product->ean13;
$this->upc = $product->upc;
}
}
}
+10 -3
View File
@@ -33,15 +33,22 @@
*/
class StockAvailableCore extends ObjectModel
{
/** @var int identifier of the current product */
public $id_product;
/** @var int identifier of product attribute if necessary */
public $id_product_attribute;
/** @var int the shop associated to the current product and corresponding quantity */
public $id_shop;
/** @var int the quantity available for sale */
public $quantity = 0;
/** @var bool determine if the available stock value depends on physical stock */
public $depends_on_stock = 0;
/*
* @var bool it was previously in Product class
*/
/** @var bool determine if a product is out of stock - it was previously in Product class */
public $out_of_stock = 0;
protected $fieldsRequired = array(
+5 -1
View File
@@ -72,6 +72,8 @@ class StockManagerCore implements StockManagerInterface
'last_wa' => null,
'current_wa' => null,
'id_employee' => $context->employee->id,
'employee_firstname' => $context->employee->firstname,
'employee_lastname' => $context->employee->lastname,
'sign' => 1
);
@@ -257,6 +259,8 @@ class StockManagerCore implements StockManagerInterface
'last_wa' => $stock->price_te,
'current_wa' => $stock->price_te,
'id_employee' => $context->employee->id,
'employee_firstname' => $context->employee->firstname,
'employee_lastname' => $context->employee->lastname,
'sign' => -1
);
$stock_params = array(
@@ -583,7 +587,7 @@ class StockManagerCore implements StockManagerInterface
*/
protected function calculateWA($stock, $quantity, $price_te)
{
return ((($stock->physical_quantity * $stock->price_te) + ($quantity * $price_te)) / ($stock->physical_quantity + $quantity));
return (float)Tools::ps_round(((($stock->physical_quantity * $stock->price_te) + ($quantity * $price_te)) / ($stock->physical_quantity + $quantity)), 6);
}
/**
+26
View File
@@ -28,9 +28,29 @@
class StockMvtCore extends ObjectModel
{
public $id;
/**
* @var string The creation date of the movement
*/
public $date_add;
/**
* @var int The employee id, responsible of the movement
*/
public $id_employee;
/**
* @since 1.5.0
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @since 1.5.0
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @since 1.5.0
* @var int The stock id on wtich the movement is applied
@@ -118,6 +138,8 @@ class StockMvtCore extends ObjectModel
protected $fieldsValidate = array(
'date_add' => 'isDate',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'id_stock' => 'isUnsignedId',
'physical_quantity' => 'isUnsignedInt',
'id_stock_mvt_reason' => 'isUnsignedId',
@@ -145,6 +167,8 @@ class StockMvtCore extends ObjectModel
$this->validateFields();
$fields['date_add'] = pSQL($this->date_add);
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['id_stock'] = (int)$this->id_stock;
$fields['physical_quantity'] = (int)$this->physical_quantity;
$fields['id_stock_mvt_reason'] = (int)$this->id_stock_mvt_reason;
@@ -163,6 +187,7 @@ class StockMvtCore extends ObjectModel
public static function addMissingMvt($id_employee)
{
Tools::displayAsDeprecated();
/*
// Search missing stock movement on products without attributes
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
FROM '._DB_PREFIX_.'product p
@@ -204,5 +229,6 @@ class StockMvtCore extends ObjectModel
$mvt->id_stock_mvt_reason = _STOCK_MOVEMENT_MISSING_REASON_;
$mvt->add();
}
*/
}
}
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9991 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class SupplierOrderCore extends ObjectModel
class SupplyOrderCore extends ObjectModel
{
/**
* @var int Supplier
@@ -36,9 +36,9 @@ class SupplierOrderCore extends ObjectModel
public $id_supplier;
/**
* @var int Employee who initiated the order
* @var int The language id used on the delivery note
*/
public $id_employee;
public $id_lang;
/**
* @var int Warehouse where products will be delivered
@@ -48,7 +48,7 @@ class SupplierOrderCore extends ObjectModel
/**
* @var int State of the order
*/
public $id_supplier_order_state;
public $id_supply_order_state;
/**
* @var int Currency used for the order
@@ -112,9 +112,9 @@ class SupplierOrderCore extends ObjectModel
protected $fieldsRequired = array(
'id_supplier',
'id_employee',
'id_lang',
'id_warehouse',
'id_supplier_order_state',
'id_supply_order_state',
'id_currency',
'id_ref_currency',
'reference',
@@ -124,9 +124,9 @@ class SupplierOrderCore extends ObjectModel
protected $fieldsValidate = array(
'id_supplier' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'id_lang' => 'isUnsignedId',
'id_warehouse' => 'isUnsignedId',
'id_supplier_order_state' => 'isUnsignedId',
'id_supply_order_state' => 'isUnsignedId',
'id_currency' => 'isUnsignedId',
'id_ref_currency' => 'isUnsignedId',
'reference' => 'isGenericName',
@@ -144,21 +144,21 @@ class SupplierOrderCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order';
protected $table = 'supply_order';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order';
protected $identifier = 'id_supply_order';
public function getFields()
{
$this->validateFields();
$fields['id_supplier'] = (int)$this->id_supplier;
$fields['id_employee'] = (int)$this->id_employee;
$fields['id_lang'] = (int)$this->id_lang;
$fields['id_warehouse'] = (int)$this->id_warehouse;
$fields['id_supplier_order_state'] = (int)$this->id_supplier_order_state;
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
$fields['id_currency'] = (int)$this->id_currency;
$fields['id_ref_currency'] = (int)$this->id_ref_currency;
$fields['reference'] = pSQL($this->reference);
@@ -191,7 +191,7 @@ class SupplierOrderCore extends ObjectModel
}
/**
* @see ObjectModel::update()
* @see ObjectModel::add()
*/
public function add($autodate = true, $null_values = false)
{
@@ -263,7 +263,7 @@ class SupplierOrderCore extends ObjectModel
p.reference as reference,
p.ean13 as ean13');
$query->from('supplier_order_detail s');
$query->from('supply_order_detail s');
$query->innerjoin('product_lang pl ON (pl.id_product = s.id_product AND pl.id_lang = '.$id_lang.')');
@@ -273,9 +273,9 @@ class SupplierOrderCore extends ObjectModel
$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('s.id_supplier_order = '.(int)$this->id);
$query->where('s.id_supply_order = '.(int)$this->id);
$query->groupBy('s.id_supplier_order_detail');
$query->groupBy('s.id_supply_order_detail');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
@@ -293,12 +293,12 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.*');
$query->from('supplier_order_detail s');
$query->where('s.id_supplier_order = '.(int)$this->id);
$query->from('supply_order_detail s');
$query->where('s.id_supply_order = '.(int)$this->id);
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
return ObjectModel::hydrateCollection('SupplierOrderDetail', $results);
return ObjectModel::hydrateCollection('SupplyOrderDetail', $results);
}
@@ -311,8 +311,8 @@ class SupplierOrderCore extends ObjectModel
{
$query = new DbQuery();
$query->select('COUNT(*)');
$query->from('supplier_order_detail s');
$query->where('s.id_supplier_order = '.(int)$this->id);
$query->from('supply_order_detail s');
$query->where('s.id_supply_order = '.(int)$this->id);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) > 0);
}
@@ -327,8 +327,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.editable');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -343,8 +343,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.delivery_note');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -359,8 +359,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.receipt_state');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -372,10 +372,12 @@ class SupplierOrderCore extends ObjectModel
*/
protected function addHistory()
{
$history = new SupplierOrderHistory();
$history->id_supplier_order = $this->id;
$history->id_state = $this->id_supplier_order_state;
$history->id_employee = $this->id_employee;
$history = new SupplyOrderHistory();
$history->id_supply_order = $this->id;
$history->id_state = $this->id_supply_order_state;
$history->id_employee = (int)$this->context->employee->id;
$history->employee_firstname = pSQL($this->context->employee->firstname);
$history->employee_lastname = pSQL($this->context->employee->lastname);
$history->save();
}
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10014 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,12 +28,12 @@
/**
* @since 1.5.0
*/
class SupplierOrderDetailCore extends ObjectModel
class SupplyOrderDetailCore extends ObjectModel
{
/**
* @var int Supplier order
* @var int Supply order
*/
public $id_supplier_order;
public $id_supply_order;
/**
* @var int Product ordered
@@ -45,13 +45,33 @@ class SupplierOrderDetailCore extends ObjectModel
*/
public $id_product_attribute;
/**
* @var string Product reference
*/
public $reference;
/**
* @var int Product name
*/
public $name;
/**
* @var int Product EAN13
*/
public $ean13;
/**
* @var string UPC
*/
public $upc;
/**
* @var int Currency used to buy this particular product
*/
public $id_currency;
/**
* @var float Exchange rate between $id_currency and SupplierOrder::$id_ref_currency, at the time
* @var float Exchange rate between $id_currency and SupplyOrder::$id_ref_currency, at the time
*/
public $exchange_rate;
@@ -107,20 +127,21 @@ class SupplierOrderDetailCore extends ObjectModel
public $price_ti = 0;
/**
* @var float Tax value of the given product after applying the global order discount (i.e. if SupplierOrder::discount_rate is set)
* @var float Tax value of the given product after applying the global order discount (i.e. if SupplyOrder::discount_rate is set)
*/
public $tax_value_with_order_discount = 0;
/**
* @var float This is like $price_with_discount_te, considering the global order discount.
* (i.e. if SupplierOrder::discount_rate is set)
* (i.e. if SupplyOrder::discount_rate is set)
*/
public $price_with_order_discount_te = 0;
protected $fieldsRequired = array(
'id_supplier_order',
'id_supply_order',
'id_product',
'id_product_attribute',
'name',
'id_currency',
'exchange_rate',
'unit_price_te',
@@ -137,9 +158,13 @@ class SupplierOrderDetailCore extends ObjectModel
);
protected $fieldsValidate = array(
'id_supplier_order' => 'isUnsignedId',
'id_supply_order' => 'isUnsignedId',
'id_product' => 'isUnsignedId',
'id_product_attribute' => 'isUnsignedId',
'reference' => 'isReference',
'name' => 'isGenericName',
'ean13' => 'isEan13',
'upc' => 'isUpc',
'id_currency' => 'isUnsignedId',
'exchange_rate' => 'isFloat',
'unit_price_te' => 'isPrice',
@@ -159,12 +184,12 @@ class SupplierOrderDetailCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_detail';
protected $table = 'supply_order_detail';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_detail';
protected $identifier = 'id_supply_order_detail';
/**
* @see ObjectModel::getFields()
@@ -173,9 +198,13 @@ class SupplierOrderDetailCore extends ObjectModel
{
$this->validateFields();
$fields['id_supplier_order'] = (int)$this->id_supplier_order;
$fields['id_supply_order'] = (int)$this->id_supply_order;
$fields['id_product'] = (int)$this->id_product;
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
$fields['reference'] = pSQL($this->reference);
$fields['name'] = pSQL($this->name);
$fields['ean13'] = pSQL($this->ean13);
$fields['upc'] = pSQL($this->upc);
$fields['id_currency'] = (int)$this->id_currency;
$fields['exchange_rate'] = (float)$this->exchange_rate;
$fields['unit_price_te'] = (float)$this->unit_price_te;
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9659 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,18 +28,28 @@
/**
* @since 1.5.0
*/
class SupplierOrderHistoryCore extends ObjectModel
class SupplyOrderHistoryCore extends ObjectModel
{
/**
* @var int Supplier order
* @var int Supply order
*/
public $id_supplier_order;
public $id_supply_order;
/**
* @var int Employee
*/
public $id_employee;
/**
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @var int State
*/
@@ -51,15 +61,17 @@ class SupplierOrderHistoryCore extends ObjectModel
public $date_add;
protected $fieldsRequired = array(
'id_supplier_order',
'id_supply_order',
'id_employee',
'id_state',
'date_add'
);
protected $fieldsValidate = array(
'id_supplier_order' => 'isUnsignedId',
'id_supply_order' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'id_state' => 'isUnsignedId',
'date_add' => 'isDate'
);
@@ -67,19 +79,21 @@ class SupplierOrderHistoryCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_history';
protected $table = 'supply_order_history';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_history';
protected $identifier = 'id_supply_order_history';
public function getFields()
{
$this->validateFields();
$fields['id_supplier_order'] = (int)$this->id_supplier_order;
$fields['id_supply_order'] = (int)$this->id_supply_order;
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['id_state'] = (int)$this->id_state;
$fields['date_add'] = pSQL($this->date_add);
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9927 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,22 +28,32 @@
/**
* @since 1.5.0
*/
class SupplierOrderReceiptHistoryCore extends ObjectModel
class SupplyOrderReceiptHistoryCore extends ObjectModel
{
/**
* @var int Detail of the supplier order
* @var int Detail of the supply order
*/
public $id_supplier_order_detail;
public $id_supply_order_detail;
/**
* @var int Employee
*/
public $id_employee;
/**
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @var int State
*/
public $id_supplier_order_state;
public $id_supply_order_state;
/**
* @var int Quantity delivered
@@ -56,16 +66,18 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
public $date_add;
protected $fieldsRequired = array(
'id_supplier_order_detail',
'id_supplier_order_state',
'id_supply_order_detail',
'id_supply_order_state',
'id_employee',
'quantity'
);
protected $fieldsValidate = array(
'id_supplier_order_detail' => 'isUnsignedId',
'id_supplier_order_state' => 'isUnsignedId',
'id_supply_order_detail' => 'isUnsignedId',
'id_supply_order_state' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'quantity' => 'isUnsignedInt',
'date_add' => 'isDate'
);
@@ -73,20 +85,22 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_receipt_history';
protected $table = 'supply_order_receipt_history';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_receipt_history';
protected $identifier = 'id_supply_order_receipt_history';
public function getFields()
{
$this->validateFields();
$fields['id_supplier_order_detail'] = (int)$this->id_supplier_order_detail;
$fields['id_supplier_order_state'] = (int)$this->id_supplier_order_state;
$fields['id_supply_order_detail'] = (int)$this->id_supply_order_detail;
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['quantity'] = (int)$this->quantity;
$fields['date_add'] = pSQL($this->date_add);
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10019 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class SupplierOrderStateCore extends ObjectModel
class SupplyOrderStateCore extends ObjectModel
{
/**
* @var string Name of the state
@@ -81,12 +81,12 @@ class SupplierOrderStateCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_state';
protected $table = 'supply_order_state';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_state';
protected $identifier = 'id_supply_order_state';
/**
* @see ObjectModel::getFields()
@@ -114,21 +114,21 @@ class SupplierOrderStateCore extends ObjectModel
}
/**
* Gets the list of supplier order states
* Gets the list of supply order states
*
* @param int $id_state_referrer The state refferer id used to know what state is available after the current state refferer
* @param int $id_lang The language id
* @return array
*/
public static function getSupplierOrderStates($id_state_referrer = null, $id_lang = null)
public static function getSupplyOrderStates($id_state_referrer = null, $id_lang = null)
{
if ($id_lang == null)
$id_lang = Context::getContext()->language->id;
$query = new DbQuery();
$query->select('sl.name, s.id_supplier_order_state');
$query->from('supplier_order_state s');
$query->leftjoin('supplier_order_state_lang sl ON (s.id_supplier_order_state = sl.id_supplier_order_state AND sl.id_lang='.(int)$id_lang.')');
$query->select('sl.name, s.id_supply_order_state');
$query->from('supply_order_state s');
$query->leftjoin('supply_order_state_lang sl ON (s.id_supply_order_state = sl.id_supply_order_state AND sl.id_lang='.(int)$id_lang.')');
if (!is_null($id_state_referrer))
{
@@ -138,7 +138,7 @@ class SupplierOrderStateCore extends ObjectModel
$is_pending_receipt = false;
//check current state to see what state is available
$state = new SupplierOrderState((int)$id_state_referrer);
$state = new SupplyOrderState((int)$id_state_referrer);
if (Validate::isLoadedObject($state))
{
$is_receipt_state = $state->receipt_state;
@@ -147,7 +147,7 @@ class SupplierOrderStateCore extends ObjectModel
$is_pending_receipt = $state->pending_receipt;
}
$query->where('s.id_supplier_order_state <> '.$id_state_referrer);
$query->where('s.id_supply_order_state <> '.$id_state_referrer);
//check first if the order is editable
if ($is_editable)
+24 -7
View File
@@ -100,7 +100,7 @@ class AdminStockMvtControllerCore extends AdminController
'identifier' => 'id_stock_mvt_reason',
'visibility' => Shop::CONTEXT_ALL
),
'PS_STOCK_MVT_SUPPLIER_ORDER' => array(
'PS_STOCK_MVT_SUPPLY_ORDER' => array(
'title' => $this->l('Default reason when incrementing stock when a supplier order is received:'),
'cast' => 'intval',
'type' => 'select',
@@ -232,9 +232,23 @@ class AdminStockMvtControllerCore extends AdminController
// redifine fields display
$this->fieldsDisplay = array(
'product_reference' => array(
'title' => $this->l('Product Reference'),
'width' => 100,
'havingFilter' => true
),
'product_ean13' => array(
'title' => $this->l('Product EAN 13'),
'width' => 75,
'havingFilter' => true
),
'product_upc' => array(
'title' => $this->l('Product UPC'),
'width' => 75,
'havingFilter' => true
),
'product_name' => array(
'title' => $this->l('Product Name'),
'width' => 200,
'havingFilter' => true
),
'sign' => array(
@@ -267,11 +281,11 @@ class AdminStockMvtControllerCore extends AdminController
),
'reason' => array(
'title' => $this->l('Reason'),
'width' => 200,
'width' => 250,
'havingFilter' => true
),
'id_order' => array(
'title' => $this->l('ID Order'),
'title' => $this->l('Supply Order'),
'width' => 40
),
'employee' => array(
@@ -290,9 +304,13 @@ class AdminStockMvtControllerCore extends AdminController
// make new query
$this->_select = '
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) AS employee,
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name,
CONCAT(a.employee_lastname, \' \', a.employee_firstname) AS employee,
mrl.name AS reason,
w.id_currency as id_currency';
stock.reference AS product_reference,
stock.ean13 AS product_ean13,
stock.upc AS product_upc,
w.id_currency AS id_currency';
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
@@ -303,7 +321,6 @@ class AdminStockMvtControllerCore extends AdminController
a.id_stock_mvt_reason = mrl.id_stock_mvt_reason
AND mrl.id_lang = '.(int)$this->context->language->id.'
)
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = stock.id_product_attribute)
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (
@@ -1,215 +0,0 @@
<?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: 7300 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminSuppliersControllerCore extends AdminController
{
public function __construct()
{
$this->table = 'supplier';
$this->className = 'Supplier';
$this->addRowAction('view');
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->_select = 'COUNT(p.`id_product`) AS products';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_supplier` = p.`id_supplier`)';
$this->_group = 'GROUP BY a.`id_supplier`';
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
$this->fieldsDisplay = array(
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'logo' => array('title' => $this->l('Logo'), 'width' => 150, 'align' => 'center', 'image' => 'su', 'orderby' => false, 'search' => false),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'products' => array('title' => $this->l('Number of products'), 'width' => 70, 'align' => 'right', 'filter_type' => 'int', 'tmpTableFilter' => true),
'active' => array('title' => $this->l('Enabled'), 'width' => 70, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
parent::__construct();
}
public function initForm()
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Suppliers'),
'image' => '../img/admin/suppliers.gif'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name:'),
'name' => 'name',
'size' => 40,
'required' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}',
),
array(
'type' => 'text',
'label' => $this->l('Description:'),
'name' => 'description',
'size' => 33,
'lang' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}',
'p' => $this->l('Will appear in supplier list')
),
array(
'type' => 'file',
'label' => $this->l('Logo:'),
'name' => 'logo',
'display_image' => true,
'p' => $this->l('Upload supplier logo from your computer')
),
array(
'type' => 'text',
'label' => $this->l('Meta title:'),
'name' => 'smeta_title',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
),
array(
'type' => 'text',
'label' => $this->l('Meta description:'),
'name' => 'meta_description',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
),
array(
'type' => 'text',
'label' => $this->l('Meta keywords:'),
'name' => 'meta_keywords',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
),
array(
'type' => 'radio',
'label' => $this->l('Enable:'),
'name' => 'active',
'required' => false,
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
)
)
),
'submit' => array(
'title' => $this->l(' Save '),
'class' => 'button'
)
);
if (Shop::isFeatureActive())
{
$this->fields_form['input'][] = array(
'type' => 'group_shop',
'label' => $this->l('Shop association:'),
'name' => 'checkBoxShopAsso',
'values' => Shop::getTree()
);
}
// Set logo image
$image = cacheImage(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
$this->fields_value = array(
'image' => $image ? $image : false,
'size' => $image ? filesize(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg') / 1000 : false
);
return parent::initForm();
}
public function initView()
{
$products = $this->object->getProductsLite($this->context->language->id);
$total_product = count($products);
for ($i = 0; $i < $total_product; $i++)
{
$products[$i] = new Product($products[$i]['id_product'], false, $this->context->language->id);
// Build attributes combinaisons
$combinaisons = $products[$i]->getAttributeCombinaisons($this->context->language->id);
foreach ($combinaisons as $k => $combinaison)
{
$comb_array[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
$comb_array[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
$comb_array[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
$comb_array[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
$comb_array[$combinaison['id_product_attribute']]['attributes'][] = array(
$combinaison['group_name'],
$combinaison['attribute_name'],
$combinaison['id_attribute']
);
}
if (isset($comb_array))
{
foreach ($comb_array as $key => $product_attribute)
{
$list = '';
foreach ($product_attribute['attributes'] as $attribute)
$list .= $attribute[0].' - '.$attribute[1].', ';
$comb_array[$key]['attributes'] = rtrim($list, ', ');
}
isset($comb_array) ? $products[$i]->combinaison = $comb_array : '';
unset($comb_array);
}
}
$this->context->smarty->assign(array(
'supplier' => $this->object,
'products' => $products,
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
));
}
public function afterImageUpload()
{
/* Generate image with differents size */
if (($id_supplier = (int)(Tools::getValue('id_supplier'))) AND isset($_FILES) AND count($_FILES) AND file_exists(_PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'))
{
$imagesTypes = ImageType::getImagesTypes('suppliers');
foreach ($imagesTypes AS $k => $imageType)
{
$file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg';
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height']));
}
}
}
}
@@ -28,13 +28,13 @@
/**
* @since 1.5.0
*/
class AdminSupplierOrdersControllerCore extends AdminController
class AdminSupplyOrdersControllerCore extends AdminController
{
public function __construct()
{
$this->context = Context::getContext();
$this->table = 'supplier_order_state';
$this->className = 'SupplierOrderState';
$this->table = 'supply_order_state';
$this->className = 'SupplyOrderState';
$this->lang = true;
$this->fieldsDisplay = array(
@@ -110,27 +110,27 @@ class AdminSupplierOrdersControllerCore extends AdminController
{
parent::init();
if (Tools::isSubmit('addsupplier_order') ||
Tools::isSubmit('submitAddsupplier_order') ||
(Tools::isSubmit('updatesupplier_order') && Tools::isSubmit('id_supplier_order')))
if (Tools::isSubmit('addsupply_order') ||
Tools::isSubmit('submitAddsupply_order') ||
(Tools::isSubmit('updatesupply_order') && Tools::isSubmit('id_supply_order')))
{
// override table, lang, className and identifier for the current controller
$this->table = 'supplier_order';
$this->className = 'SupplierOrder';
$this->identifier = 'id_supplier_order';
$this->table = 'supply_order';
$this->className = 'SupplyOrder';
$this->identifier = 'id_supply_order';
$this->lang = false;
$this->action = 'new';
$this->display = 'add';
if (Tools::isSubmit('updatesupplier_order'))
if (Tools::isSubmit('updatesupply_order'))
if ($this->tabAccess['edit'] === '1')
$this->display = 'edit';
else
$this->_errors[] = Tools::displayError($this->l('You do not have permission to edit here.'));
}
if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supplier_order'))
if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supply_order'))
{
// change the display type in order to add specific actions to
$this->display = 'update_receipt';
@@ -146,14 +146,14 @@ class AdminSupplierOrdersControllerCore extends AdminController
*/
public function initForm()
{
if (Tools::isSubmit('addsupplier_order_state') ||
Tools::isSubmit('updatesupplier_order_state') ||
Tools::isSubmit('submitAddsupplier_order_state') ||
Tools::isSubmit('submitUpdatesupplier_order_state'))
if (Tools::isSubmit('addsupply_order_state') ||
Tools::isSubmit('updatesupply_order_state') ||
Tools::isSubmit('submitAddsupply_order_state') ||
Tools::isSubmit('submitUpdatesupply_order_state'))
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Supplier Order State'),
'title' => $this->l('Supply Order State'),
'image' => '../img/admin/edit.gif'
),
'input' => array(
@@ -267,20 +267,20 @@ class AdminSupplierOrdersControllerCore extends AdminController
)
);
if (Tools::isSubmit('addsupplier_order_state'))
$this->toolbar_title = $this->l('Stock : Add Supplier order state');
if (Tools::isSubmit('addsupply_order_state'))
$this->toolbar_title = $this->l('Stock : Add Supply order state');
else
{
$this->toolbar_title = $this->l('Stock : Update Supplier order state');
$this->toolbar_title = $this->l('Stock : Update Supply order state');
$id_supplier_order_state = Tools::getValue('id_supplier_order_state', 0);
$id_supply_order_state = Tools::getValue('id_supply_order_state', 0);
// only some fields are editable for initial states
if (in_array($id_supplier_order_state, array(1, 2, 3, 4, 5, 6)))
if (in_array($id_supply_order_state, array(1, 2, 3, 4, 5, 6)))
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Supplier Order State'),
'title' => $this->l('Supply Order State'),
'image' => '../img/admin/edit.gif'
),
'input' => array(
@@ -312,17 +312,17 @@ class AdminSupplierOrdersControllerCore extends AdminController
return parent::initForm();
}
if (Tools::isSubmit('addsupplier_order') ||
Tools::isSubmit('updatesupplier_order') ||
Tools::isSubmit('submitAddsupplier_order') ||
Tools::isSubmit('submitUpdatesupplier_order'))
if (Tools::isSubmit('addsupply_order') ||
Tools::isSubmit('updatesupply_order') ||
Tools::isSubmit('submitAddsupply_order') ||
Tools::isSubmit('submitUpdatesupply_order'))
{
if (Tools::isSubmit('addsupplier_order') || Tools::isSubmit('submitAddsupplier_order'))
$this->toolbar_title = $this->l('Stock : Create new supplier order');
if (Tools::isSubmit('addsupply_order') || Tools::isSubmit('submitAddsupply_order'))
$this->toolbar_title = $this->l('Stock : Create new supply order');
if (Tools::isSubmit('updatesupplier_order') || Tools::isSubmit('submitUpdatesupplier_order'))
$this->toolbar_title = $this->l('Stock : Manage supplier order');
if (Tools::isSubmit('updatesupply_order') || Tools::isSubmit('submitUpdatesupply_order'))
$this->toolbar_title = $this->l('Stock : Manage supply order');
$this->addJqueryUI('ui.datepicker');
@@ -335,6 +335,9 @@ class AdminSupplierOrdersControllerCore extends AdminController
//get suppliers list
$suppliers = Supplier::getSuppliers();
//get languages list
$languages = Language::getLanguages(true);
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Order informations'),
@@ -387,6 +390,18 @@ class AdminSupplierOrdersControllerCore extends AdminController
'p' => $this->l('The currency of the order'),
'hint' => $this->l('Be careful ! When changing this field, all products already added to the order will be removed.')
),
array(
'type' => 'select',
'label' => $this->l('Order Language:'),
'name' => 'id_lang',
'required' => true,
'options' => array(
'query' => $languages,
'id' => 'id_lang',
'name' => 'name'
),
'p' => $this->l('The language of the order')
),
array(
'type' => 'date',
'label' => $this->l('Delivery date:'),
@@ -425,8 +440,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
{
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
// actions filters on supplier orders list
if ($this->table == 'supplier_order')
// actions filters on supply orders list
if ($this->table == 'supply_order')
{
$nb_items = count($this->_list);
@@ -434,11 +449,11 @@ class AdminSupplierOrdersControllerCore extends AdminController
{
// if the current state doesn't allow order edit, skip the edit action
if ($this->_list[$i]['editable'] == 0)
$this->addRowActionSkipList('edit', $this->_list[$i]['id_supplier_order']);
$this->addRowActionSkipList('edit', $this->_list[$i]['id_supply_order']);
if ($this->_list[$i]['enclosed'] == 1)
$this->addRowActionSkipList('changestate', $this->_list[$i]['id_supplier_order']);
$this->addRowActionSkipList('changestate', $this->_list[$i]['id_supply_order']);
if (1 != $this->_list[$i]['pending_receipt'])
$this->addRowActionSkipList('updatereceipt', $this->_list[$i]['id_supplier_order']);
$this->addRowActionSkipList('updatereceipt', $this->_list[$i]['id_supply_order']);
}
}
}
@@ -449,8 +464,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
*/
public function initList()
{
$this->displayInformation($this->l('This interface allows you to manage supplier orders.').'<br />');
$this->displayInformation($this->l('Also, it allows you to add and edit your own supplier order states.'));
$this->displayInformation($this->l('This interface allows you to manage supply orders.').'<br />');
$this->displayInformation($this->l('Also, it allows you to add and edit your own supply order states.'));
// access
if (!($this->tabAccess['add'] === '1'))
@@ -480,9 +495,9 @@ class AdminSupplierOrdersControllerCore extends AdminController
unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
// override table, land, className and identifier for the current controller
$this->table = 'supplier_order';
$this->className = 'SupplierOrder';
$this->identifier = 'id_supplier_order';
$this->table = 'supply_order';
$this->className = 'SupplyOrder';
$this->identifier = 'id_supply_order';
$this->lang = false;
$this->addRowAction('updatereceipt');
@@ -508,10 +523,10 @@ class AdminSupplierOrdersControllerCore extends AdminController
'width' => 120,
'havingFilter' => true
),
'employee' => array(
/*'employee' => array(
'title' => $this->l('Employee'),
'havingFilter' => true
),
),*/
'supplier' => array(
'title' => $this->l('Supplier'),
'width' => 200,
@@ -563,7 +578,6 @@ class AdminSupplierOrdersControllerCore extends AdminController
// make new query
$this->_select = '
CONCAT(e.lastname, \' \', e.firstname) AS employee,
s.name AS supplier,
w.name AS warehouse,
stl.name AS state,
@@ -573,17 +587,16 @@ class AdminSupplierOrdersControllerCore extends AdminController
st.receipt_state,
st.pending_receipt,
st.color AS color,
a.id_supplier_order as id_pdf';
a.id_supply_order as id_pdf';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'supplier_order_state_lang` stl ON
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'supply_order_state_lang` stl ON
(
a.id_supplier_order_state = stl.id_supplier_order_state
a.id_supply_order_state = stl.id_supply_order_state
AND stl.id_lang = '.(int)$this->context->language->id.'
)
LEFT JOIN `'._DB_PREFIX_.'supplier_order_state` st ON a.id_supplier_order_state = st.id_supplier_order_state
LEFT JOIN `'._DB_PREFIX_.'supply_order_state` st ON a.id_supply_order_state = st.id_supply_order_state
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON a.id_supplier = s.id_supplier
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = a.id_warehouse)
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)';
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = a.id_warehouse)';
// init the toolbar according to the current list
$this->initToolbar();
@@ -603,19 +616,19 @@ class AdminSupplierOrdersControllerCore extends AdminController
*/
public function initChangeStateContent()
{
$id_supplier_order = (int)Tools::getValue('id_supplier_order', 0);
$id_supply_order = (int)Tools::getValue('id_supply_order', 0);
if ($id_supplier_order <= 0)
if ($id_supply_order <= 0)
{
$this->_errors[] = Tools::displayError($this->l('The specified supplier order is not valid'));
$this->_errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
return parent::initContent();
}
$supplier_order = new SupplierOrder($id_supplier_order);
$supply_order = new SupplyOrder($id_supply_order);
if (!Validate::isLoadedObject($supplier_order))
if (!Validate::isLoadedObject($supply_order))
{
$this->_errors[] = Tools::displayError($this->l('The specified supplier order is not valid'));
$this->_errors[] = Tools::displayError($this->l('The specified supply order is not valid'));
return parent::initContent();
}
@@ -625,29 +638,29 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->initToolbar();
// given the current state, loads available states
$states = SupplierOrderState::getSupplierOrderStates($supplier_order->id_supplier_order_state);
$states = SupplyOrderState::getSupplyOrderStates($supply_order->id_supply_order_state);
// loads languages
$this->getlanguages();
// defines the fields of the form to display
$this->fields_form[]['form'] = array(
'legend' => array(
'title' => $this->l('Supplier Order State'),
'title' => $this->l('Supply Order State'),
'image' => '../img/admin/cms.gif'
),
'input' => array(
array(
'type' => 'hidden',
'name' => 'id_supplier_order',
'name' => 'id_supply_order',
),
array(
'type' => 'select',
'label' => $this->l('New state of the order:'),
'name' => 'id_supplier_order_state',
'name' => 'id_supply_order_state',
'required' => true,
'options' => array(
'query' => $states,
'id' => 'id_supplier_order_state',
'id' => 'id_supply_order_state',
'name' => 'name'
),
'p' => $this->l('Choose the new state of your order')
@@ -671,8 +684,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
$helper->default_form_language = $this->default_form_language;
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
$helper->fields_value = array(
'id_supplier_order_state' => Tools::getValue('id_supplier', ''),
'id_supplier_order' => $id_supplier_order,
'id_supply_order_state' => Tools::getValue('id_supplier', ''),
'id_supply_order' => $id_supply_order,
);
// generates the form to display
@@ -691,23 +704,23 @@ class AdminSupplierOrdersControllerCore extends AdminController
/**
* Init the content of change state action
*/
public function initUpdateSupplierOrderContent()
public function initUpdateSupplyOrderContent()
{
$this->addJqueryPlugin('autocomplete');
// load supplier order
$id_supplier_order = (int)Tools::getValue('id_supplier_order', null);
// load supply order
$id_supply_order = (int)Tools::getValue('id_supply_order', null);
if ($id_supplier_order != null)
if ($id_supply_order != null)
{
$supplier_order = new SupplierOrder($id_supplier_order);
$supply_order = new SupplyOrder($id_supply_order);
$currency = new Currency($supplier_order->id_currency);
$currency = new Currency($supply_order->id_currency);
if (Validate::isLoadedObject($supplier_order))
if (Validate::isLoadedObject($supply_order))
{
// load products of this order
$products = $supplier_order->getEntries();
$products = $supply_order->getEntries();
$product_ids = array();
if (isset($this->order_products_errors) && is_array($this->order_products_errors))
@@ -734,7 +747,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->tpl_form_vars['products_list'] = $products;
$this->tpl_form_vars['product_ids'] = implode($product_ids, '|');
$this->tpl_form_vars['supplier_id'] = $supplier_order->id_supplier;
$this->tpl_form_vars['supplier_id'] = $supply_order->id_supplier;
$this->tpl_form_vars['currency'] = $currency;
}
}
@@ -753,16 +766,16 @@ class AdminSupplierOrdersControllerCore extends AdminController
*/
public function initUpdateReceiptContent()
{
$id_supplier_order = (int)Tools::getValue('id_supplier_order', null);
$id_supply_order = (int)Tools::getValue('id_supply_order', null);
// if there is no order to fetch
if (null == $id_supplier_order)
if (null == $id_supply_order)
return parent::initContent();
$supplier_order = new SupplierOrder($id_supplier_order);
$supply_order = new SupplyOrder($id_supply_order);
// if it's not a valid order
if (!Validate::isLoadedObject($supplier_order))
if (!Validate::isLoadedObject($supply_order))
return parent::initContent();
// re-defines fieldsDisplay
@@ -836,16 +849,16 @@ class AdminSupplierOrdersControllerCore extends AdminController
// attributes override
unset($this->_select, $this->_join, $this->_where, $this->_orderBy, $this->_orderWay, $this->_group, $this->_filterHaving, $this->_filter);
$this->table = 'supplier_order_detail';
$this->identifier = 'id_supplier_order_detail';
$this->className = 'SupplierOrderDetail';
$this->table = 'supply_order_detail';
$this->identifier = 'id_supply_order_detail';
$this->className = 'SupplyOrderDetail';
$this->list_simple_header = true;
$this->list_no_link = true;
$this->bulk_actions = array('Update' => array('text' => $this->l('Update selected'), 'confirm' => $this->l('Update selected items?')));
$this->addRowAction('details');
// sets toolbar title with order reference
$this->toolbar_title = sprintf($this->l('Reception of products for supplier order #%s'), $supplier_order->reference);
$this->toolbar_title = sprintf($this->l('Reception of products for supply order #%s'), $supply_order->reference);
// gets lang info
$this->lang = false;
@@ -853,7 +866,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
// gets values corresponding to fieldsDisplay
$this->_select = '
a.id_supplier_order_detail as id,
a.id_supply_order_detail as id,
a.quantity_received as quantity_received,
a.quantity_expected as quantity_expected,
IF (a.quantity_expected < a.quantity_received, 0, a.quantity_expected - a.quantity_received) as quantity_left,
@@ -868,19 +881,19 @@ class AdminSupplierOrdersControllerCore extends AdminController
LEFT JOIN '._DB_PREFIX_.'attribute atr ON (atr.id_attribute = pac.id_attribute)
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = atr.id_attribute AND al.id_lang = '.$lang_id.')
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$lang_id.')';
$this->_where = 'AND a.`id_supplier_order` = '.(int)$id_supplier_order;
$this->_group = 'GROUP BY a.id_supplier_order_detail';
$this->_where = 'AND a.`id_supply_order` = '.(int)$id_supply_order;
$this->_group = 'GROUP BY a.id_supply_order_detail';
// gets the list ordered by price desc, without limit
$this->getList($lang_id, 'quantity_expected', 'DESC', 0, false, false);
// defines action for POST
$action = '&id_supplier_order='.$id_supplier_order.'&submitUpdateReceipt';
$action = '&id_supply_order='.$id_supply_order.'&submitUpdateReceipt';
// renders list
$helper = new HelperList();
$this->setHelperDisplay($helper);
$helper->override_folder = 'supplier_orders_receipt_history/';
$helper->override_folder = 'supply_orders_receipt_history/';
//$helper->shopLinkType = '';
$helper->currentIndex = self::$currentIndex.$action;
@@ -906,16 +919,16 @@ class AdminSupplierOrdersControllerCore extends AdminController
// Manage the add stock form
if (Tools::isSubmit('changestate'))
$this->initChangeStateContent();
else if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supplier_order'))
else if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supply_order'))
$this->initUpdateReceiptContent();
else if (Tools::isSubmit('viewsupplier_order') && Tools::isSubmit('id_supplier_order'))
else if (Tools::isSubmit('viewsupply_order') && Tools::isSubmit('id_supply_order'))
{
$this->action = 'view';
$this->display = 'view';
parent::initContent();
}
else if (Tools::isSubmit('updatesupplier_order'))
$this->initUpdateSupplierOrderContent();
else if (Tools::isSubmit('updatesupply_order'))
$this->initUpdateSupplyOrderContent();
else
parent::initContent();
}
@@ -925,27 +938,27 @@ class AdminSupplierOrdersControllerCore extends AdminController
*/
public function manageOrderProducts()
{
// load supplier order
$id_supplier_order = (int)Tools::getValue('id_supplier_order', null);
// load supply order
$id_supply_order = (int)Tools::getValue('id_supply_order', null);
if ($id_supplier_order != null)
if ($id_supply_order != null)
{
$supplier_order = new SupplierOrder($id_supplier_order);
$supply_order = new SupplyOrder($id_supply_order);
$products_already_in_order = $supplier_order->getEntries();
$currency = new Currency($supplier_order->id_ref_currency);
$products_already_in_order = $supply_order->getEntries();
$currency = new Currency($supply_order->id_ref_currency);
if (Validate::isLoadedObject($supplier_order))
if (Validate::isLoadedObject($supply_order))
{
// tests if the supplier or currency have changed in the supplier order
// tests if the supplier or currency have changed in the supply order
$new_supplier_id = (int)Tools::getValue('id_supplier');
$new_currency_id = (int)Tools::getValue('id_currency');
if (($new_supplier_id != $supplier_order->id_supplier) ||
($new_currency_id != $supplier_order->id_currency))
if (($new_supplier_id != $supply_order->id_supplier) ||
($new_currency_id != $supply_order->id_currency))
{
// resets all products in this order
$supplier_order->resetProducts();
$supply_order->resetProducts();
}
else
{
@@ -969,13 +982,13 @@ class AdminSupplierOrdersControllerCore extends AdminController
if ($pos === false)
continue;
// Load / Create supplier order detail
$entry = new SupplierOrderDetail();
$id_supplier_order_detail = (int)Tools::getValue('input_id_'.$id, 0);
if ($id_supplier_order_detail > 0)
// Load / Create supply order detail
$entry = new SupplyOrderDetail();
$id_supply_order_detail = (int)Tools::getValue('input_id_'.$id, 0);
if ($id_supply_order_detail > 0)
{
$existing_entry = new SupplierOrderDetail($id_supplier_order_detail);
if (Validate::isLoadedObject($supplier_order))
$existing_entry = new SupplyOrderDetail($id_supply_order_detail);
if (Validate::isLoadedObject($supply_order))
$entry = &$existing_entry;
}
@@ -988,10 +1001,20 @@ class AdminSupplierOrdersControllerCore extends AdminController
$entry->tax_rate = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_tax_rate_'.$id, 0));
$entry->reference = Tools::getValue('input_reference_'.$id, '');
$entry->ean13 = Tools::getValue('input_ean13_'.$id, '');
$entry->name = Tools::getValue('input_name_'.$id, '');
$entry->upc = Tools::getValue('input_upc_'.$id, '');
//get the product name in the order language
$entry->name = Product::getProductName($entry->id_product, $entry->id_product_attribute, $supply_order->id_lang);
//get the product name displayed in the backoffice according to the employee language
$entry->name_displayed = Tools::getValue('input_name_'.$id, '');
if (empty($entry->name))
$entry->name = $entry->name_displayed;
$entry->exchange_rate = $currency->conversion_rate;
$entry->id_currency = $currency->id;
$entry->id_supplier_order = $supplier_order->id;
$entry->id_supply_order = $supply_order->id;
$errors = $entry->validateController();
@@ -1007,8 +1030,10 @@ class AdminSupplierOrdersControllerCore extends AdminController
'discount_rate' => $entry->discount_rate,
'tax_rate' => $entry->tax_rate,
'name' => $entry->name,
'name_displayed' => $entry->name_displayed,
'reference' => $entry->reference,
'ean13' => $entry->ean13,
'upc' => $entry->upc,
);
$error_str = '<ul>';
@@ -1036,7 +1061,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
if ($product_ok === false)
{
$entry = new SupplierOrderDetail($paio['id_supplier_order_detail']);
$entry = new SupplyOrderDetail($paio['id_supply_order_detail']);
$entry->delete();
}
}
@@ -1052,12 +1077,12 @@ class AdminSupplierOrdersControllerCore extends AdminController
public function postProcess()
{
// Checks access
if (Tools::isSubmit('submitAddsupplier_order') && !($this->tabAccess['add'] === '1'))
$this->_errors[] = Tools::displayError($this->l('You do not have the required permission to add a supplier order.'));
if (Tools::isSubmit('submitAddsupply_order') && !($this->tabAccess['add'] === '1'))
$this->_errors[] = Tools::displayError($this->l('You do not have the required permission to add a supply order.'));
if (Tools::isSubmit('submitUpdateReceipt') && !($this->tabAccess['edit'] === '1'))
$this->_errors[] = Tools::displayError($this->l('You do not have the required permission to edit an order.'));
// Global checks when add / update a supplier order
if (Tools::isSubmit('submitAddsupplier_order'))
// Global checks when add / update a supply order
if (Tools::isSubmit('submitAddsupply_order'))
{
$this->action = 'save';
@@ -1076,11 +1101,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
// specify employee
$_POST['id_employee'] = $this->context->employee->id;
// specify initial state
$_POST['id_supplier_order_state'] = 1; //defaut creation state
$_POST['id_supply_order_state'] = 1; //defaut creation state
// specify global reference currency
$_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id;
@@ -1094,47 +1116,47 @@ class AdminSupplierOrdersControllerCore extends AdminController
// Manage state change
if (Tools::isSubmit('submitChangestate')
&& Tools::isSubmit('id_supplier_order')
&& Tools::isSubmit('id_supplier_order_state'))
&& Tools::isSubmit('id_supply_order')
&& Tools::isSubmit('id_supply_order_state'))
{
if ($this->tabAccess['edit'] != '1')
$this->_errors[] = Tools::displayError($this->l('You do not have permissions to change order state.'));
// get state ID
$id_state = (int)Tools::getValue('id_supplier_order_state', 0);
$id_state = (int)Tools::getValue('id_supply_order_state', 0);
if ($id_state <= 0)
$this->_errors[] = Tools::displayError($this->l('The selected supplier order state is not valid.'));
$this->_errors[] = Tools::displayError($this->l('The selected supply order state is not valid.'));
// get supplier order ID
$id_supplier_order = (int)Tools::getValue('id_supplier_order', 0);
if ($id_supplier_order <= 0)
$this->_errors[] = Tools::displayError($this->l('The supplier order id is not valid.'));
// get supply order ID
$id_supply_order = (int)Tools::getValue('id_supply_order', 0);
if ($id_supply_order <= 0)
$this->_errors[] = Tools::displayError($this->l('The supply order id is not valid.'));
if (!count($this->_errors))
{
// try to load supplier order
$supplier_order = new SupplierOrder($id_supplier_order);
// try to load supply order
$supply_order = new SupplyOrder($id_supply_order);
if (Validate::isLoadedObject($supplier_order))
if (Validate::isLoadedObject($supply_order))
{
// get valid available possible states for this order
$states = SupplierOrderState::getSupplierOrderStates($supplier_order->id_supplier_order_state);
$states = SupplyOrderState::getSupplyOrderStates($supply_order->id_supply_order_state);
foreach ($states as $state)
{
// if state is valid, change it in the order
if ($id_state == $state['id_supplier_order_state'])
if ($id_state == $state['id_supply_order_state'])
{
// special case of validate state - check if there are products in the order
if ($supplier_order->isEditable() && !$supplier_order->hasEntries())
if ($supply_order->isEditable() && !$supply_order->hasEntries())
$this->_errors[] = Tools::displayError(
$this->l('It is not possible to change the state of this order because of no product are present in it')
);
if (!count($this->_errors))
{
$supplier_order->id_supplier_order_state = $state['id_supplier_order_state'];
if ($supplier_order->save())
$supply_order->id_supply_order_state = $state['id_supply_order_state'];
if ($supply_order->save())
{
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$redirect = self::$currentIndex.'&token='.$token;
@@ -1149,28 +1171,28 @@ class AdminSupplierOrdersControllerCore extends AdminController
}
}
if (Tools::isSubmit('submitUpdateReceipt') && Tools::isSubmit('id_supplier_order'))
if (Tools::isSubmit('submitUpdateReceipt') && Tools::isSubmit('id_supply_order'))
$this->postProcessUpdateReceipt();
parent::postProcess();
}
/**
* Helper function for AdminSupplierOrdersController::postProcess()
* Helper function for AdminSupplyOrdersController::postProcess()
*
* @see AdminSupplierOrdersController::postProcess()
* @see AdminSupplyOrdersController::postProcess()
*/
protected function postProcessUpdateReceipt()
{
// gets all box selected
$rows = Tools::getValue('supplier_order_detailBox');
$rows = Tools::getValue('supply_order_detailBox');
if (!$rows)
{
$this->_errors[] = Tools::displayError($this->l('You did not select any product to update'));
return;
}
// final array with id_supplier_order_detail and value to update
// final array with id_supply_order_detail and value to update
$to_update = array();
// gets quantity for each id_order_detail
foreach ($rows as $row)
@@ -1186,54 +1208,56 @@ class AdminSupplierOrdersControllerCore extends AdminController
return;
}
foreach ($to_update as $id_supplier_order_detail => $quantity)
foreach ($to_update as $id_supply_order_detail => $quantity)
{
$supplier_order_detail = new SupplierOrderDetail($id_supplier_order_detail);
$supplier_order = new SupplierOrder((int)Tools::getValue('id_supplier_order'));
$supply_order_detail = new SupplyOrderDetail($id_supply_order_detail);
$supply_order = new SupplyOrder((int)Tools::getValue('id_supply_order'));
if (Validate::isLoadedObject($supplier_order_detail) && Validate::isLoadedObject($supplier_order))
if (Validate::isLoadedObject($supply_order_detail) && Validate::isLoadedObject($supply_order))
{
// checks if quantity is valid
// It's possible to receive more quantity than expected in case of a shipping error from the supplier
if (!Validate::isInt($quantity) || $quantity <= 0)
$this->_errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supplier_order_detail);
$this->_errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supply_order_detail);
else // everything is valid : updates
{
// creates the history
$supplier_receipt_history = new SupplierOrderReceiptHistory();
$supplier_receipt_history->id_supplier_order_detail = (int)$id_supplier_order_detail;
$supplier_receipt_history = new SupplyOrderReceiptHistory();
$supplier_receipt_history->id_supply_order_detail = (int)$id_supply_order_detail;
$supplier_receipt_history->id_employee = (int)$this->context->employee->id;
$supplier_receipt_history->id_supplier_order_state = (int)$supplier_order->id_supplier_order_state;
$supplier_receipt_history->employee_firstname = pSQL($this->context->employee->firstname);
$supplier_receipt_history->employee_lastname = pSQL($this->context->employee->lastname);
$supplier_receipt_history->id_supply_order_state = (int)$supply_order->id_supply_order_state;
$supplier_receipt_history->quantity = (int)$quantity;
// updates quantity received
$supplier_order_detail->quantity_received += (int)$quantity;
$supply_order_detail->quantity_received += (int)$quantity;
// if current state is "Pending receipt", then we sets it to "Order received in part"
if (3 == $supplier_order->id_supplier_order_state)
$supplier_order->id_supplier_order_state = 4;
if (3 == $supply_order->id_supply_order_state)
$supply_order->id_supply_order_state = 4;
// Adds to stock
$warehouse = new Warehouse($supplier_order->id_warehouse);
$warehouse = new Warehouse($supply_order->id_warehouse);
if (!Validate::isLoadedObject($warehouse))
{
$this->_errors[] = Tools::displayError($this->l('Warehouse could not be loaded'));
return;
}
$manager = StockManagerFactory::getManager();
$res = $manager->addProduct($supplier_order_detail->id_product,
$supplier_order_detail->id_product_attribute,
$res = $manager->addProduct($supply_order_detail->id_product,
$supply_order_detail->id_product_attribute,
$warehouse,
(int)$quantity,
Configuration::get('PS_STOCK_MVT_SUPPLIER_ORDER'),
$supplier_order_detail->unit_price_te,
Configuration::get('PS_STOCK_MVT_SUPPLY_ORDER'),
$supply_order_detail->unit_price_te,
true,
$supplier_order->id);
$supply_order->id);
if ($res) // if product has been added
{
$supplier_receipt_history->add();
$supplier_order_detail->save();
$supplier_order->save();
$supply_order_detail->save();
$supply_order->save();
}
else
$this->_errors[] = Tools::displayError($this->l('Something went wrong when adding products in warehouse'));
@@ -1268,7 +1292,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
'action' => self::$cache_lang['Receipt'],
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_supplier_order_receipt.tpl');
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_supply_order_receipt.tpl');
}
/**
@@ -1289,7 +1313,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
'action' => self::$cache_lang['State'],
));
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_supplier_order_change_state.tpl');
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_supply_order_change_state.tpl');
}
/**
@@ -1302,15 +1326,15 @@ class AdminSupplierOrdersControllerCore extends AdminController
if (Tools::isSubmit('id'))
{
// overrides attributes
$this->identifier = 'id_supplier_order_history';
$this->table = 'supplier_order_history';
$this->identifier = 'id_supply_order_history';
$this->table = 'supply_order_history';
$this->display = 'list';
$this->lang = false;
// gets current lang id
$lang_id = (int)$this->context->language->id;
// gets supplier order id
$id_supplier_order = (int)Tools::getValue('id');
// gets supply order id
$id_supply_order = (int)Tools::getValue('id');
// creates new fieldsDisplay
unset($this->fieldsDisplay);
@@ -1344,15 +1368,15 @@ class AdminSupplierOrdersControllerCore extends AdminController
sos.`color` as color';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'supplier_order_state` sos ON (a.`id_state` = sos.`id_supplier_order_state`)
LEFT JOIN `'._DB_PREFIX_.'supplier_order_state_lang` sosl ON
LEFT JOIN `'._DB_PREFIX_.'supply_order_state` sos ON (a.`id_state` = sos.`id_supply_order_state`)
LEFT JOIN `'._DB_PREFIX_.'supply_order_state_lang` sosl ON
(
a.`id_state` = sosl.`id_supplier_order_state`
a.`id_state` = sosl.`id_supply_order_state`
AND sosl.`id_lang` = '.(int)$lang_id.'
)
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = a.`id_employee`)';
$this->_where = 'AND a.`id_supplier_order` = '.(int)$id_supplier_order;
$this->_where = 'AND a.`id_supply_order` = '.(int)$id_supply_order;
$this->_orderBy = 'a.`date_add`';
$this->_orderWay = 'DESC';
@@ -1372,14 +1396,14 @@ class AdminSupplierOrdersControllerCore extends AdminController
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
else if (Tools::isSubmit('id_supplier_order_detail'))
else if (Tools::isSubmit('id_supply_order_detail'))
{
$this->identifier = 'id_supplier_order_receipt_history';
$this->table = 'supplier_order_receipt_history';
$this->identifier = 'id_supply_order_receipt_history';
$this->table = 'supply_order_receipt_history';
$this->display = 'list';
$this->lang = false;
$lang_id = (int)$this->context->language->id;
$id_supplier_order_detail = (int)Tools::getValue('id_supplier_order_detail');
$id_supply_order_detail = (int)Tools::getValue('id_supply_order_detail');
unset($this->fieldsDisplay);
$this->fieldsDisplay = array(
@@ -1408,7 +1432,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
unset($this->_select, $this->_join, $this->_where, $this->_orderBy, $this->_orderWay, $this->_group, $this->_filterHaving, $this->_filter);
$this->_select = 'CONCAT(e.`lastname`, \' \', e.`firstname`) as employee';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = a.`id_employee`)';
$this->_where = 'AND a.`id_supplier_order_detail` = '.(int)$id_supplier_order_detail;
$this->_where = 'AND a.`id_supply_order_detail` = '.(int)$id_supply_order_detail;
// gets list and forces no limit clause in the request
$this->getList($lang_id, 'date_add', 'DESC', 0, false, false);
@@ -1438,9 +1462,9 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->show_toolbar = true;
$this->toolbar_fix = false;
$this->table = 'supplier_order_detail';
$this->identifier = 'id_supplier_order_detail';
$this->className = 'SupplierOrderDetail';
$this->table = 'supply_order_detail';
$this->identifier = 'id_supply_order_detail';
$this->className = 'SupplyOrderDetail';
$this->colorOnBackground = false;
$this->lang = false;
$this->list_simple_header = true;
@@ -1448,7 +1472,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
$lang_id = (int)$this->context->language->id;
// gets the id supplier to view
$id_supplier_order = (int)Tools::getValue('id_supplier_order');
$id_supply_order = (int)Tools::getValue('id_supply_order');
// just in case..
unset($this->_select, $this->_join, $this->_where, $this->_orderBy, $this->_orderWay, $this->_group, $this->_filterHaving, $this->_filter);
@@ -1467,28 +1491,28 @@ class AdminSupplierOrdersControllerCore extends AdminController
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = atr.id_attribute AND al.id_lang = '.$lang_id.')
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$lang_id.')';
$this->_where = 'AND a.`id_supplier_order` = '.(int)$id_supplier_order;
$this->_where = 'AND a.`id_supply_order` = '.(int)$id_supply_order;
$this->_group = 'GROUP BY a.id_product';
// gets global order information
$supplier_order = new SupplierOrder((int)$id_supplier_order);
$supply_order = new SupplyOrder((int)$id_supply_order);
if (Validate::isLoadedObject($supplier_order))
if (Validate::isLoadedObject($supply_order))
{
// gets the list ordered by price desc, without limit
$this->getList($lang_id, 'price_te', 'DESC', 0, false, false);
// gets the currency used in this order
$currency = new Currency($supplier_order->id_currency);
$currency = new Currency($supply_order->id_currency);
// gets the employee in charge of the order
$employee = new Employee($supplier_order->id_employee);
$employee = new Employee($supply_order->id_employee);
// gets the warehouse where products will be received
$warehouse = new Warehouse($supplier_order->id_warehouse);
$warehouse = new Warehouse($supply_order->id_warehouse);
// sets toolbar title with order reference
$this->toolbar_title = sprintf($this->l('Details on supplier order #%s'), $supplier_order->reference);
$this->toolbar_title = sprintf($this->l('Details on supply order #%s'), $supply_order->reference);
// re-defines fieldsDisplay
$this->fieldsDisplay = array(
@@ -1618,20 +1642,20 @@ class AdminSupplierOrdersControllerCore extends AdminController
// display these global order informations
$this->tpl_view_vars = array(
'supplier_order_detail_content' => $content,
'supplier_order_employee' => (Validate::isLoadedObject($employee) ? $employee->firstname.' '.$employee->lastname : ''),
'supplier_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
'supplier_order_reference' => $supplier_order->reference,
'supplier_order_creation_date' => Tools::displayDate($supplier_order->date_add, $lang_id, true),
'supplier_order_last_update' => Tools::displayDate($supplier_order->date_upd, $lang_id, true),
'supplier_order_expected' => Tools::displayDate($supplier_order->date_delivery_expected, $lang_id, true),
'supplier_order_discount_rate' => Tools::ps_round($supplier_order->discount_rate, 2),
'supplier_order_total_te' => Tools::displayPrice($supplier_order->total_te, $currency),
'supplier_order_discount_value_te' => Tools::displayPrice($supplier_order->discount_value_te, $currency),
'supplier_order_total_with_discount_te' => Tools::displayPrice($supplier_order->total_with_discount_te, $currency),
'supplier_order_total_tax' => Tools::displayPrice($supplier_order->total_tax, $currency),
'supplier_order_total_ti' => Tools::displayPrice($supplier_order->total_ti, $currency),
'supplier_order_currency' => $currency,
'supply_order_detail_content' => $content,
'supply_order_employee' => (Validate::isLoadedObject($employee) ? $employee->firstname.' '.$employee->lastname : ''),
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
'supply_order_reference' => $supply_order->reference,
'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $lang_id, true),
'supply_order_last_update' => Tools::displayDate($supply_order->date_upd, $lang_id, true),
'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, true),
'supply_order_discount_rate' => Tools::ps_round($supply_order->discount_rate, 2),
'supply_order_total_te' => Tools::displayPrice($supply_order->total_te, $currency),
'supply_order_discount_value_te' => Tools::displayPrice($supply_order->discount_value_te, $currency),
'supply_order_total_with_discount_te' => Tools::displayPrice($supply_order->total_with_discount_te, $currency),
'supply_order_total_tax' => Tools::displayPrice($supply_order->total_tax, $currency),
'supply_order_total_ti' => Tools::displayPrice($supply_order->total_ti, $currency),
'supply_order_currency' => $currency,
);
}
@@ -1640,23 +1664,23 @@ class AdminSupplierOrdersControllerCore extends AdminController
/**
* Callback used to display custom content for a given field
* @param int $id_supplier_order
* @param int $id_supply_order
* @param string $tr
* @return string $content
*/
public function printPDFIcons($id_supplier_order, $tr)
public function printPDFIcons($id_supply_order, $tr)
{
$supplier_order = new SupplierOrder((int)$id_supplier_order);
$supply_order = new SupplyOrder((int)$id_supply_order);
if (!Validate::isLoadedObject($supplier_order))
if (!Validate::isLoadedObject($supply_order))
return;
$supplier_order_state = new SupplierOrderState($supplier_order->id_supplier_order_state);
if (!Validate::isLoadedObject($supplier_order_state))
$supply_order_state = new SupplyOrderState($supply_order->id_supply_order_state);
if (!Validate::isLoadedObject($supply_order_state))
return;
$content = '<span style="width:20px; margin-right:5px;">';
if ($supplier_order_state->editable == false) // @TODO Decide what states are allowed
if ($supply_order_state->editable == false) // @TODO Decide what states are allowed
$content .= '<a href="#"><img src="../img/admin/pdf.gif" alt="invoice" /></a>';
else
$content .= '-';
+44 -31
View File
@@ -1965,9 +1965,11 @@ CREATE TABLE `PREFIX_stock_mvt` (
`id_stock_mvt` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_stock` INT(11) UNSIGNED NOT NULL,
`id_order` INT(11) UNSIGNED DEFAULT NULL,
`id_supplier_order` INT(11) UNSIGNED DEFAULT NULL,
`id_supply_order` INT(11) UNSIGNED DEFAULT NULL,
`id_stock_mvt_reason` INT(11) UNSIGNED NOT NULL,
`id_employee` INT(11) UNSIGNED NOT NULL,
`employee_lastname` varchar(32) DEFAULT '',
`employee_firstname` varchar(32) DEFAULT '',
`physical_quantity` INT(11) UNSIGNED NOT NULL,
`date_add` DATETIME NOT NULL,
`sign` tinyint(1) NOT NULL DEFAULT 1,
@@ -2001,6 +2003,9 @@ CREATE TABLE `PREFIX_stock` (
`id_warehouse` INT(11) UNSIGNED NOT NULL,
`id_product` INT(11) UNSIGNED NOT NULL,
`id_product_attribute` INT(11) UNSIGNED NOT NULL,
`reference` VARCHAR(32) NOT NULL,
`ean13` VARCHAR(13) DEFAULT NULL,
`upc` VARCHAR(12) DEFAULT NULL,
`physical_quantity` INT(11) UNSIGNED NOT NULL,
`usable_quantity` INT(11) UNSIGNED NOT NULL,
`price_te` DECIMAL(20,6) DEFAULT '0.000000',
@@ -2063,15 +2068,15 @@ CREATE TABLE `PREFIX_stock_available` (
KEY `id_product_attribute` (`id_product_attribute`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order` (
`id_supplier_order` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
CREATE TABLE `PREFIX_supply_order` (
`id_supply_order` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supplier` INT(11) UNSIGNED NOT NULL,
`id_employee` INT(11) UNSIGNED NOT NULL,
`id_lang` INT(11) UNSIGNED NOT NULL,
`id_warehouse` INT(11) UNSIGNED NOT NULL,
`id_supplier_order_state` INT(11) UNSIGNED NOT NULL,
`id_supply_order_state` INT(11) UNSIGNED NOT NULL,
`id_currency` INT(11) UNSIGNED NOT NULL,
`id_ref_currency` INT(11) UNSIGNED NOT NULL,
`reference` VARCHAR(32) DEFAULT NULL,
`reference` VARCHAR(32) NOT NULL,
`date_add` DATETIME NOT NULL,
`date_upd` DATETIME NOT NULL,
`date_delivery_expected` DATETIME DEFAULT NULL,
@@ -2081,18 +2086,22 @@ CREATE TABLE `PREFIX_supplier_order` (
`total_ti` DECIMAL(20,6) DEFAULT '0.000000',
`discount_rate` DECIMAL(20,6) DEFAULT '0.000000',
`discount_value_te` DECIMAL(20,6) DEFAULT '0.000000',
PRIMARY KEY (`id_supplier_order`),
PRIMARY KEY (`id_supply_order`),
KEY `id_supplier` (`id_supplier`),
KEY `id_warehouse` (`id_warehouse`),
KEY `reference` (`reference`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order_detail` (
`id_supplier_order_detail` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supplier_order` INT(11) UNSIGNED NOT NULL,
CREATE TABLE `PREFIX_supply_order_detail` (
`id_supply_order_detail` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supply_order` INT(11) UNSIGNED NOT NULL,
`id_currency` INT(11) UNSIGNED NOT NULL,
`id_product` INT(11) UNSIGNED NOT NULL,
`id_product_attribute` INT(11) UNSIGNED NOT NULL,
`id_currency` INT(11) UNSIGNED NOT NULL,
`reference` VARCHAR(32) NOT NULL,
`name` varchar(128) NOT NULL,
`ean13` VARCHAR(13) DEFAULT NULL,
`upc` VARCHAR(12) DEFAULT NULL,
`exchange_rate` DECIMAL(20,6) DEFAULT '0.000000',
`unit_price_te` DECIMAL(20,6) DEFAULT '0.000000',
`quantity_expected` INT(11) UNSIGNED NOT NULL,
@@ -2106,53 +2115,57 @@ CREATE TABLE `PREFIX_supplier_order_detail` (
`price_ti` DECIMAL(20,6) DEFAULT '0.000000',
`tax_value_with_order_discount` DECIMAL(20,6) DEFAULT '0.000000',
`price_with_order_discount_te` DECIMAL(20,6) DEFAULT '0.000000',
PRIMARY KEY (`id_supplier_order_detail`),
KEY `id_supplier_order` (`id_supplier_order`),
PRIMARY KEY (`id_supply_order_detail`),
KEY `id_supply_order` (`id_supply_order`),
KEY `id_product` (`id_product`),
KEY `id_product_attribute` (`id_product_attribute`),
KEY `id_product_product_attribute` (`id_product`, `id_product_attribute`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order_history` (
`id_supplier_order_history` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supplier_order` INT(11) UNSIGNED NOT NULL,
CREATE TABLE `PREFIX_supply_order_history` (
`id_supply_order_history` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supply_order` INT(11) UNSIGNED NOT NULL,
`id_employee` INT(11) UNSIGNED NOT NULL,
`employee_lastname` varchar(32) DEFAULT '',
`employee_firstname` varchar(32) DEFAULT '',
`id_state` INT(11) UNSIGNED NOT NULL,
`date_add` DATETIME NOT NULL,
PRIMARY KEY (`id_supplier_order_history`),
KEY `id_supplier_order` (`id_supplier_order`),
PRIMARY KEY (`id_supply_order_history`),
KEY `id_supply_order` (`id_supply_order`),
KEY `id_employee` (`id_employee`),
KEY `id_state` (`id_state`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order_state` (
`id_supplier_order_state` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
CREATE TABLE `PREFIX_supply_order_state` (
`id_supply_order_state` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`delivery_note` tinyint(1) NOT NULL DEFAULT 0,
`editable` tinyint(1) NOT NULL DEFAULT 0,
`receipt_state` tinyint(1) NOT NULL DEFAULT 0,
`pending_receipt` tinyint(1) NOT NULL DEFAULT 0,
`enclosed` tinyint(1) NOT NULL DEFAULT 0,
`color` VARCHAR(32) DEFAULT NULL,
PRIMARY KEY (`id_supplier_order_state`)
PRIMARY KEY (`id_supply_order_state`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order_state_lang` (
`id_supplier_order_state` INT(11) UNSIGNED NOT NULL,
CREATE TABLE `PREFIX_supply_order_state_lang` (
`id_supply_order_state` INT(11) UNSIGNED NOT NULL,
`id_lang` INT(11) UNSIGNED NOT NULL,
`name` VARCHAR(128) DEFAULT NULL,
PRIMARY KEY (`id_supplier_order_state`, `id_lang`)
PRIMARY KEY (`id_supply_order_state`, `id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_order_receipt_history` (
`id_supplier_order_receipt_history` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supplier_order_detail` INT(11) UNSIGNED NOT NULL,
CREATE TABLE `PREFIX_supply_order_receipt_history` (
`id_supply_order_receipt_history` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supply_order_detail` INT(11) UNSIGNED NOT NULL,
`id_employee` INT(11) UNSIGNED NOT NULL,
`id_supplier_order_state` INT(11) UNSIGNED NOT NULL,
`employee_lastname` varchar(32) DEFAULT '',
`employee_firstname` varchar(32) DEFAULT '',
`id_supply_order_state` INT(11) UNSIGNED NOT NULL,
`quantity` INT(11) UNSIGNED NOT NULL,
`date_add` DATETIME NOT NULL,
PRIMARY KEY (`id_supplier_order_receipt_history`),
KEY `id_supplier_order_detail` (`id_supplier_order_detail`),
KEY `id_supplier_order_state` (`id_supplier_order_state`)
PRIMARY KEY (`id_supply_order_receipt_history`),
KEY `id_supply_order_detail` (`id_supply_order_detail`),
KEY `id_supply_order_state` (`id_supply_order_state`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_supplier_rates` (
+10 -10
View File
@@ -333,7 +333,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
(157, 'PS_STOCK_MVT_TRANSFER_TO', '7', NOW(), NOW()),
(158, 'PS_STOCK_MVT_TRANSFER_FROM', '6', NOW(), NOW()),
(159, 'PS_CARRIER_DEFAULT_ORDER', '0', NOW(), NOW()),
(160, 'PS_STOCK_MVT_SUPPLIER_ORDER', '8', NOW(), NOW()),
(160, 'PS_STOCK_MVT_SUPPLY_ORDER', '8', NOW(), NOW()),
(161, 'PS_STOCK_CUSTOMER_ORDER_REASON', '3', NOW(), NOW());
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
@@ -950,7 +950,7 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(97, 'AdminStockManagement', 95, 2),
(98, 'AdminStockInstantState', 95, 4),
(99, 'AdminStockCover', 95, 5),
(100, 'AdminSupplierOrders', 95, 6),
(100, 'AdminSupplyOrders', 95, 6),
(101, 'AdminAttributeGenerator', -1, 0),
(102, 'AdminAccounting', 0, 16),
(103, 'AdminAccountingManagement', 102, 1),
@@ -979,7 +979,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 97, 'Stock Management'),
(1, 98, 'Stock instant state'),
(1, 99, 'Stock cover'),
(1, 100, 'Supplier orders'),
(1, 100, 'Supply orders'),
(1, 101, 'Combinations generator'),
(1, 102, 'Accounting'),
(1, 103, 'Account Number Management'),
@@ -1032,7 +1032,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 97, 'Stock Management'),
(3, 98, 'Stock instant state'),
(3, 99, 'Stock cover'),
(3, 100, 'Supplier orders'),
(3, 100, 'Supply orders'),
(3, 101, 'Combinations generator'),
(3, 102, 'Accounting'),
(3, 103, 'Account Number Management'),
@@ -1472,11 +1472,11 @@ INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `n
(7, 3, 'Transfer from another warehouse'),
(7, 4, 'Transfer from another warehouse'),
(7, 5, 'Transfer from another warehouse'),
(8, 1, 'Supplier Order'),
(8, 1, 'Supply Order'),
(8, 2, 'Commande fournisseur'),
(8, 3, 'Supplier Order'),
(8, 4, 'Supplier Order'),
(8, 5, 'Supplier Order');
(8, 3, 'Supply Order'),
(8, 4, 'Supply Order'),
(8, 5, 'Supply Order');
INSERT INTO `PREFIX_warehouse` (`id_warehouse`, `id_currency`, `id_address`, `id_employee`, `reference`, `name`, `management_type`) VALUES
(1, 1, 0, 1, 'default_warehouse', 'default warehouse', 'WA');
@@ -1539,7 +1539,7 @@ city State:name postcode
Country:name
phone' WHERE `PREFIX_address_format`.`id_country` = 4;
INSERT INTO `PREFIX_supplier_order_state` (`id_supplier_order_state`, `delivery_note`, `editable`, `receipt_state`, `pending_receipt`, `enclosed`, `color`) VALUES
INSERT INTO `PREFIX_supply_order_state` (`id_supply_order_state`, `delivery_note`, `editable`, `receipt_state`, `pending_receipt`, `enclosed`, `color`) VALUES
(1, 0, 1, 0, 0, 0, '#faab00'),
(2, 1, 0, 0, 0, 0, '#273cff'),
(3, 0, 0, 0, 1, 0, '#ff37f5'),
@@ -1547,7 +1547,7 @@ INSERT INTO `PREFIX_supplier_order_state` (`id_supplier_order_state`, `delivery_
(5, 0, 0, 1, 0, 1, '#00d60c'),
(6, 0, 0, 0, 0, 1, '#666666');
INSERT INTO `PREFIX_supplier_order_state_lang` (`id_supplier_order_state`, `id_lang`, `name`) VALUES
INSERT INTO `PREFIX_supply_order_state_lang` (`id_supply_order_state`, `id_lang`, `name`) VALUES
(1, 1, 'creation in progress'),
(1, 2, 'Création en cours'),
(1, 3, 'Création in progress'),