// Removing some id_warehouse
// Adding some checks with advanced_stock_management product attribute git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11375 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -54,39 +54,6 @@
|
|||||||
statesShipped.push({$state['id_order_state']});
|
statesShipped.push({$state['id_order_state']});
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
||||||
{literal}
|
|
||||||
function showWarehouseList()
|
|
||||||
{
|
|
||||||
{/literal}{if (count($warehouse_list) > 1)}{literal}
|
|
||||||
$('#warehouse').show();
|
|
||||||
{/literal}{/if}{literal}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideWarehouseList()
|
|
||||||
{
|
|
||||||
$('#warehouse').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
hideWarehouseList();
|
|
||||||
$("input.datepicker").datepicker({
|
|
||||||
prevText: '',
|
|
||||||
nextText: '',
|
|
||||||
dateFormat: 'yy-mm-dd'
|
|
||||||
});
|
|
||||||
$('#id_order_state').change(function() {
|
|
||||||
if ($.inArray(parseInt($(this).val()), statesShipped) >= 0)
|
|
||||||
{
|
|
||||||
showWarehouseList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hideWarehouseList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
{/literal}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{if ($HOOK_INVOICE)}
|
{if ($HOOK_INVOICE)}
|
||||||
@@ -130,11 +97,6 @@
|
|||||||
<option value="{$state['id_order_state']}" {if $state['id_order_state'] == $currentState->id}selected="selected"{/if}>{$state['name']|stripslashes}</option>
|
<option value="{$state['id_order_state']}" {if $state['id_order_state'] == $currentState->id}selected="selected"{/if}>{$state['name']|stripslashes}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
<select name="id_warehouse" id="warehouse">
|
|
||||||
{foreach from=$warehouse_list item=warehouse}
|
|
||||||
<option value="{$warehouse['id_warehouse']}">{$warehouse['name']}</option>
|
|
||||||
{/foreach}
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="id_order" value="{$order->id}" />
|
<input type="hidden" name="id_order" value="{$order->id}" />
|
||||||
<input type="submit" name="submitState" value="{l s='Add'}" class="button" />
|
<input type="submit" name="submitState" value="{l s='Add'}" class="button" />
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<td valign="top" style="vertical-align:top;">
|
<td valign="top" style="vertical-align:top;">
|
||||||
<input {if $product->advanced_stock_management == 1 && $stock_management_active == 1}value="on" checked="checked" {/if} {if $stock_management_active == 0}disabled="disabled" {/if}
|
<input {if $product->advanced_stock_management == 1 && $stock_management_active == 1}value="on" checked="checked" {/if} {if $stock_management_active == 0}disabled="disabled" {/if}
|
||||||
type="checkbox" name="advanced_stock_management" class="advanced_stock_management" id="advanced_stock_management" />
|
type="checkbox" name="advanced_stock_management" class="advanced_stock_management" id="advanced_stock_management" />
|
||||||
<label style="float:none;font-weight:normal" for="depends_on_stock_1">{l s='I want to use the advanced stock management system for this product'} {if $stock_management_active == 0} - <b>{l s='Not possible if stock management is not enabled'}</b>{/if}</label>
|
<label style="float:none;font-weight:normal" for="advanced_stock_management">{l s='I want to use the advanced stock management system for this product'} {if $stock_management_active == 0} - <b>{l s='Not possible if stock management is not enabled'}</b>{/if}</label>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1231,7 +1231,10 @@ class AdminControllerCore extends Controller
|
|||||||
{
|
{
|
||||||
if (Tab::checkTabRights($tab['id_tab']) === true)
|
if (Tab::checkTabRights($tab['id_tab']) === true)
|
||||||
{
|
{
|
||||||
if ($tab['name'] == 'Stock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0)
|
if ($tab['name'] == 'Stock'
|
||||||
|
&& Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0
|
||||||
|
&& (int)$product['advanced_stock_management'] == 1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
unset($tabs[$index]);
|
unset($tabs[$index]);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+3
-2
@@ -380,7 +380,8 @@ class CartCore extends ObjectModel
|
|||||||
p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`, p.`price`, p.`weight`,
|
p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`, p.`price`, p.`weight`,
|
||||||
stock.`quantity` quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`active`, p.`date_add`,
|
stock.`quantity` quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`active`, p.`date_add`,
|
||||||
p.`date_upd`, t.`id_tax`, tl.`name` AS tax, t.`rate`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
p.`date_upd`, t.`id_tax`, tl.`name` AS tax, t.`rate`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery, p.`wholesale_price`');
|
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery, p.`wholesale_price`,
|
||||||
|
p.advanced_stock_management');
|
||||||
|
|
||||||
// Build FROM
|
// Build FROM
|
||||||
$sql->from('cart_product', 'cp');
|
$sql->from('cart_product', 'cp');
|
||||||
@@ -1358,7 +1359,7 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
$product['warehouse_list'] = array();
|
$product['warehouse_list'] = array();
|
||||||
|
|
||||||
if ($stock_management_active)
|
if ($stock_management_active && (int)$product['advanced_stock_management'] == 1)
|
||||||
{
|
{
|
||||||
$warehouse_list = Warehouse::getProductWarehouseList($product['id_product'], $product['id_product_attribute']);
|
$warehouse_list = Warehouse::getProductWarehouseList($product['id_product'], $product['id_product_attribute']);
|
||||||
// Does the product is in stock ?
|
// Does the product is in stock ?
|
||||||
|
|||||||
+1
-1
@@ -3060,7 +3060,7 @@ class ProductCore extends ObjectModel
|
|||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
$sql = new DbQuery();
|
$sql = new DbQuery();
|
||||||
$sql->select('p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`');
|
$sql->select('p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`, p.advanced_stock_management');
|
||||||
$sql->from('category_product', 'cp');
|
$sql->from('category_product', 'cp');
|
||||||
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
|
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
|
||||||
$sql->join($context->shop->addSqlAssociation('product', 'p'));
|
$sql->join($context->shop->addSqlAssociation('product', 'p'));
|
||||||
|
|||||||
@@ -448,6 +448,8 @@ class OrderCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_detail` od
|
FROM `'._DB_PREFIX_.'order_detail` od
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||||
|
ON p.id_product = od.product_id
|
||||||
WHERE od.`id_order` = '.(int)($this->id));
|
WHERE od.`id_order` = '.(int)($this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,7 +608,9 @@ class OrderCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
protected function setProductCurrentStock(&$product)
|
protected function setProductCurrentStock(&$product)
|
||||||
{
|
{
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['id_warehouse'] > 0)
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& (int)$product['advanced_stock_management'] == 1
|
||||||
|
&& (int)$product['id_warehouse'] > 0)
|
||||||
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], (int)$product['id_warehouse'], true);
|
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], (int)$product['id_warehouse'], true);
|
||||||
else
|
else
|
||||||
$product['current_stock'] = '--';
|
$product['current_stock'] = '--';
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function changeIdOrderState($new_order_state, $id_order, $id_warehouse = null)
|
public function changeIdOrderState($new_order_state, $id_order)
|
||||||
{
|
{
|
||||||
if ($new_order_state != NULL)
|
if ($new_order_state != NULL)
|
||||||
{
|
{
|
||||||
@@ -75,58 +75,71 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
/* Best sellers */
|
/* Best sellers */
|
||||||
$newOS = new OrderState((int)($new_order_state), $order->id_lang);
|
$newOS = new OrderState((int)($new_order_state), $order->id_lang);
|
||||||
$oldOrderStatus = OrderHistory::getLastOrderState((int)$id_order);
|
$oldOrderStatus = OrderHistory::getLastOrderState((int)$id_order);
|
||||||
$cart = Cart::getCartByOrderId($id_order);
|
|
||||||
$isValidated = $this->isValidated();
|
$isValidated = $this->isValidated();
|
||||||
if (Validate::isLoadedObject($cart))
|
if (Validate::isLoadedObject($order))
|
||||||
foreach ($cart->getProducts() as $product)
|
foreach ($order->getProductsDetail() as $product)
|
||||||
{
|
{
|
||||||
/* If becoming logable => adding sale */
|
/* If becoming logable => adding sale */
|
||||||
if ($newOS->logable AND (!$oldOrderStatus OR !$oldOrderStatus->logable))
|
if ($newOS->logable AND (!$oldOrderStatus OR !$oldOrderStatus->logable))
|
||||||
{
|
{
|
||||||
ProductSale::addProductSale($product['id_product'], $product['cart_quantity']);
|
ProductSale::addProductSale($product['product_id'], $product['product_quantity']);
|
||||||
}
|
}
|
||||||
/* If becoming unlogable => removing sale */
|
/* If becoming unlogable => removing sale */
|
||||||
else if (!$newOS->logable AND ($oldOrderStatus AND $oldOrderStatus->logable))
|
else if (!$newOS->logable AND ($oldOrderStatus AND $oldOrderStatus->logable))
|
||||||
{
|
{
|
||||||
ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']);
|
ProductSale::removeProductSale($product['product_id'], $product['product_quantity']);
|
||||||
// @since 1.5.0
|
// @since 1.5.0
|
||||||
StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity'], $order->id_shop);
|
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && !$isValidated AND $newOS->logable AND isset($oldOrderStatus) AND $oldOrderStatus AND $oldOrderStatus->id == Configuration::get('PS_OS_ERROR'))
|
if ((!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') || (int)$product['advanced_stock_management'] != 1)
|
||||||
StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity'], $order->id_shop);
|
&& !$isValidated
|
||||||
|
&& $newOS->logable
|
||||||
|
&& isset($oldOrderStatus)
|
||||||
|
&& $oldOrderStatus
|
||||||
|
&& $oldOrderStatus->id == Configuration::get('PS_OS_ERROR')
|
||||||
|
)
|
||||||
|
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop);
|
||||||
// If order is shipped for the first time and
|
// If order is shipped for the first time and
|
||||||
// if we use advanced stock management system, decrement stock preperly.
|
// if we use advanced stock management system, decrement stock preperly.
|
||||||
// The product is removed from the physical stock. $id_warehouse is needed
|
// The product is removed from the physical stock. $id_warehouse is needed
|
||||||
// @TODO Checks $id_warehouse
|
// @TODO Checks $id_warehouse
|
||||||
else if ($newOS->shipped == 1 && $oldOrderStatus->shipped == 0 && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
else if ($newOS->shipped == 1
|
||||||
|
&& $oldOrderStatus->shipped == 0
|
||||||
|
&& Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& (int)$product['advanced_stock_management'] == 1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$manager = StockManagerFactory::getManager();
|
$manager = StockManagerFactory::getManager();
|
||||||
$warehouse = new Warehouse($id_warehouse);
|
$warehouse = new Warehouse($product['id_warehouse']);
|
||||||
|
|
||||||
$manager->removeProduct(
|
$manager->removeProduct(
|
||||||
$product['id_product'],
|
$product['product_id'],
|
||||||
$product['id_product_attribute'],
|
$product['product_attribute_id'],
|
||||||
$warehouse,
|
$warehouse,
|
||||||
$product['cart_quantity'],
|
$product['product_quantity'],
|
||||||
Configuration::get('PS_STOCK_CUSTOMER_ORDER_REASON'),
|
Configuration::get('PS_STOCK_CUSTOMER_ORDER_REASON'),
|
||||||
true,
|
true,
|
||||||
(int)$id_order
|
(int)$id_order
|
||||||
);
|
);
|
||||||
|
|
||||||
if (StockAvailable::dependsOnStock($product['id_product'], $order->id_shop))
|
if (StockAvailable::dependsOnStock($product['product_id'], $order->id_shop))
|
||||||
StockAvailable::synchronize($product['id_product']);
|
StockAvailable::synchronize($product['product_id']);
|
||||||
else
|
else
|
||||||
StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], -(int)$product['cart_quantity'], $order->id_shop);
|
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int)$product['product_quantity'], $order->id_shop);
|
||||||
}
|
}
|
||||||
else if ($newOS->shipped == 0 && $oldOrderStatus->shipped == 1 && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
else if ($newOS->shipped == 0
|
||||||
|
&& $oldOrderStatus->shipped == 1
|
||||||
|
&& Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& (int)$product['advanced_stock_management'] == 1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$manager = StockManagerFactory::getManager();
|
$manager = StockManagerFactory::getManager();
|
||||||
$mvts = StockMvt::getNegativeStockMvts($order->id, $product['id_product'], $product['id_product_attribute'], $product['cart_quantity']);
|
$mvts = StockMvt::getNegativeStockMvts($order->id, $product['product_id'], $product['product_attribute_id'], $product['cart_quantity']);
|
||||||
foreach ($mvts as $mvt)
|
foreach ($mvts as $mvt)
|
||||||
{
|
{
|
||||||
$manager->addProduct(
|
$manager->addProduct(
|
||||||
$product['id_product'],
|
$product['product_id'],
|
||||||
$product['id_product_attribute'],
|
$product['id_product_attribute'],
|
||||||
new Warehouse($mvt['id_warehouse']),
|
new Warehouse($mvt['id_warehouse']),
|
||||||
$mvt['physical_quantity'],
|
$mvt['physical_quantity'],
|
||||||
@@ -136,10 +149,10 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StockAvailable::dependsOnStock($product['id_product'], $order->id_shop))
|
if (StockAvailable::dependsOnStock($product['product_id'], $order->id_shop))
|
||||||
StockAvailable::synchronize($product['id_product']);
|
StockAvailable::synchronize($product['product_id']);
|
||||||
else
|
else
|
||||||
StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity'], $order->id_shop);
|
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['physical_quantity'], $order->id_shop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ class OrderInvoiceCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_detail` od
|
FROM `'._DB_PREFIX_.'order_detail` od
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||||
|
ON p.id_product = od.product_id
|
||||||
WHERE od.`id_order` = '.(int)$this->id_order.'
|
WHERE od.`id_order` = '.(int)$this->id_order.'
|
||||||
AND od.`id_order_invoice` = '.(int)$this->id);
|
AND od.`id_order_invoice` = '.(int)$this->id);
|
||||||
}
|
}
|
||||||
@@ -173,7 +175,12 @@ class OrderInvoiceCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
protected function setProductCurrentStock(&$product)
|
protected function setProductCurrentStock(&$product)
|
||||||
{
|
{
|
||||||
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], null, true);
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& (int)$product['advanced_stock_management'] == 1
|
||||||
|
&& (int)$product['id_warehouse'] > 0)
|
||||||
|
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], null, true);
|
||||||
|
else
|
||||||
|
$product['current_stock'] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -226,29 +226,24 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$history = new OrderHistory();
|
$history = new OrderHistory();
|
||||||
$history->id_order = (int)$id_order;
|
$history->id_order = (int)$id_order;
|
||||||
$history->id_employee = (int)$this->context->employee->id;
|
$history->id_employee = (int)$this->context->employee->id;
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && !(int)Tools::getValue('id_warehouse'))
|
$history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order));
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while changing the status.');
|
$order = new Order((int)$order->id);
|
||||||
else
|
$carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang));
|
||||||
{
|
$templateVars = array();
|
||||||
$history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order), (int)Tools::getValue('id_warehouse'));
|
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') AND $order->shipping_number)
|
||||||
$order = new Order((int)$order->id);
|
$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
|
||||||
$carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang));
|
else if ($history->id_order_state == Configuration::get('PS_OS_CHEQUE'))
|
||||||
$templateVars = array();
|
$templateVars = array(
|
||||||
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') AND $order->shipping_number)
|
'{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''),
|
||||||
$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
|
'{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : ''));
|
||||||
else if ($history->id_order_state == Configuration::get('PS_OS_CHEQUE'))
|
elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE'))
|
||||||
$templateVars = array(
|
$templateVars = array(
|
||||||
'{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''),
|
'{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''),
|
||||||
'{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : ''));
|
'{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''),
|
||||||
elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE'))
|
'{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : ''));
|
||||||
$templateVars = array(
|
if ($history->addWithemail(true, $templateVars))
|
||||||
'{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''),
|
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token);
|
||||||
'{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''),
|
$this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
||||||
'{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : ''));
|
|
||||||
if ($history->addWithemail(true, $templateVars))
|
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token);
|
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -439,7 +434,13 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
// @since 1.5.0 : Advanced Stock Management
|
// @since 1.5.0 : Advanced Stock Management
|
||||||
$product_to_inject = new Product($order_detail->product_id, false, $this->context->language->id, $order->id_shop);
|
$product_to_inject = new Product($order_detail->product_id, false, $this->context->language->id, $order->id_shop);
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $order_detail->id_warehouse != 0)
|
|
||||||
|
$product = new Product($order_detail->product_id);
|
||||||
|
|
||||||
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& $product->advanced_stock_management
|
||||||
|
&& $order_detail->id_warehouse != 0
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$mvts = StockMvt::getNegativeStockMvts(
|
$mvts = StockMvt::getNegativeStockMvts(
|
||||||
$order_detail->id_order,
|
$order_detail->id_order,
|
||||||
@@ -989,10 +990,15 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
// gets warehouses to ship products, if and only if advanced stock management is activated
|
// gets warehouses to ship products, if and only if advanced stock management is activated
|
||||||
$warehouse_list = null;
|
$warehouse_list = null;
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
|
||||||
|
$order_details = $order->getOrderDetailList();
|
||||||
|
foreach ($order_details as $order_detail)
|
||||||
{
|
{
|
||||||
$order_details = $order->getOrderDetailList();
|
$product = new Product($order_detail['product_id']);
|
||||||
foreach ($order_details as $order_detail)
|
|
||||||
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||||
|
&& $product->advanced_stock_management
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
|
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
|
||||||
foreach ($warehouses as $warehouse)
|
foreach ($warehouses as $warehouse)
|
||||||
@@ -1098,7 +1104,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
if (!isset($combinations[$attribute['id_product_attribute']]['qty_in_stock']))
|
if (!isset($combinations[$attribute['id_product_attribute']]['qty_in_stock']))
|
||||||
$combinations[$attribute['id_product_attribute']]['qty_in_stock']= StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], $attribute['id_product_attribute'], (int)$this->context->shop->getID());
|
$combinations[$attribute['id_product_attribute']]['qty_in_stock']= StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], $attribute['id_product_attribute'], (int)$this->context->shop->getID());
|
||||||
|
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['advanced_stock_management'] == 1)
|
||||||
$product['warehouse_list'][$attribute['id_product_attribute']] = Warehouse::getProductWarehouseList($product['id_product'], $attribute['id_product_attribute']);
|
$product['warehouse_list'][$attribute['id_product_attribute']] = Warehouse::getProductWarehouseList($product['id_product'], $attribute['id_product_attribute']);
|
||||||
else
|
else
|
||||||
$product['warehouse_list'][$attribute['id_product_attribute']] = array();
|
$product['warehouse_list'][$attribute['id_product_attribute']] = array();
|
||||||
@@ -1107,7 +1113,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['advanced_stock_management'] == 1)
|
||||||
$product['warehouse_list'][0] = Warehouse::getProductWarehouseList($product['id_product']);
|
$product['warehouse_list'][0] = Warehouse::getProductWarehouseList($product['id_product']);
|
||||||
else
|
else
|
||||||
$product['warehouse_list'][0] = array();
|
$product['warehouse_list'][0] = array();
|
||||||
|
|||||||
@@ -3747,10 +3747,10 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
return Tools::jsonEncode(array('error' => 'Undefined value'));
|
return Tools::jsonEncode(array('error' => 'Undefined value'));
|
||||||
if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0)
|
if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0)
|
||||||
return Tools::jsonEncode(array('error' => 'Uncorrect value'));
|
return Tools::jsonEncode(array('error' => 'Uncorrect value'));
|
||||||
$product->advanced_stock_management = (int)Tools::getValue('value');
|
$product->advanced_stock_management = (int)Tools::getValue('value');
|
||||||
$product->save();
|
$product->save();
|
||||||
if (StockAvailable::dependsOnStock($product->id) == 1 && (int)Tools::getValue('value') == 0)
|
if (StockAvailable::dependsOnStock($product->id) == 1 && (int)Tools::getValue('value') == 0)
|
||||||
StockAvailable::setProductDependsOnStock($product->id, 0);
|
StockAvailable::setProductDependsOnStock($product->id, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user