[*] BO : no payment is registered on order creation for check and bankwire payment

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11296 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2011-12-16 10:10:48 +00:00
parent d6c85b63d5
commit 6f03353f96
3 changed files with 25 additions and 29 deletions
+16 -18
View File
@@ -130,6 +130,10 @@ abstract class PaymentModuleCore extends Module
die($errorMessage);
}
$order_status = new OrderState((int)$id_order_state, (int)$order->id_lang);
if (!Validate::isLoadedObject($order_status))
throw new PrestashopException('Can\'t load Order state status');
foreach ($cart_delivery_option as $id_address => $key_carriers)
foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data)
foreach ($data['package_list'] as $id_package)
@@ -194,6 +198,13 @@ abstract class PaymentModuleCore extends Module
// Creating order
$result = $order->add();
// Register Payment only if the order status validate the order
if ($result && $order_status->logable)
{
if (!$order->addOrderPayment($amountPaid))
throw new PrestashopException('Can\'t save Order Payment');
}
$order_list[] = $order;
// Insert new Order detail list using cart for the current order
@@ -210,13 +221,6 @@ abstract class PaymentModuleCore extends Module
$order_carrier->shipping_cost_tax_incl = (float)$order->total_shipping_tax_incl;
$order_carrier->add();
}
// Register Payment
if (!$order->addOrderPayment($amountPaid))
{
$errorMessage = Tools::displayError('Can\'t save payment');
Logger::addLog($errorMessage, 4, '0000003', 'Order', intval($order->id));
die($errorMessage);
}
// Next !
foreach ($order_detail_list as $key => $order_detail)
@@ -244,8 +248,6 @@ abstract class PaymentModuleCore extends Module
//$orderDetail = new OrderDetail(null, null, $this->context);
//$orderDetail->createList($order, $cart, $id_order_state);
//$this->addPCC($order->id, $order->id_currency, $amountPaid);
// Construct order detail table for the email
$productsList = '';
$products = $cart->getProducts();
@@ -343,14 +345,10 @@ abstract class PaymentModuleCore extends Module
}
// Hook validate order
$orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang);
if (Validate::isLoadedObject($orderStatus))
{
Hook::exec('newOrder', array('cart' => $cart, 'order' => $order, 'customer' => $customer, 'currency' => $currency, 'orderStatus' => $orderStatus));
foreach ($cart->getProducts() AS $product)
if ($orderStatus->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
}
Hook::exec('newOrder', array('cart' => $cart, 'order' => $order, 'customer' => $customer, 'currency' => $currency, 'orderStatus' => $order_status));
foreach ($cart->getProducts() AS $product)
if ($order_status->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState())
{
@@ -433,7 +431,7 @@ abstract class PaymentModuleCore extends Module
$data = array_merge($data, $extraVars);
// Join PDF invoice
if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
if ((int)(Configuration::get('PS_INVOICE')) && $order_status->invoice && $order->invoice_number)
{
$fileAttachment['content'] = PDF::invoice($order, 'S');
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
+1 -1
View File
@@ -1054,7 +1054,7 @@ class OrderCore extends ObjectModel
SELECT `id_order_carrier`
FROM `'._DB_PREFIX_.'order_carrier`
WHERE `id_order` = '.(int)$order_invoice->id_order.'
AND `id_order_invoice` IS NULL');
AND (`id_order_invoice` IS NULL OR `id_order_invoice` = 0)');
$order_carrier = new OrderCarrier($id_order_carrier);
$order_carrier->id_order_invoice = (int)$order_invoice->id;
$order_carrier->update();
+8 -10
View File
@@ -57,7 +57,7 @@ INSERT INTO `PREFIX_module` (`id_module`, `name`, `active`) VALUES (1, 'homefeat
(34, 'graphvisifire', 1),(35, 'graphxmlswfcharts', 1),(36, 'graphgooglechart', 1),(37, 'graphartichow', 1),(39, 'gridhtml', 1),(40, 'statsbestcustomers', 1),
(41, 'statsorigin', 1),(42, 'pagesnotfound', 1),(43, 'sekeywords', 1),(44, 'statsproduct', 1),(45, 'statsbestproducts', 1),(46, 'statsbestcategories', 1),
(47, 'statsbestvouchers', 1),(48, 'statsbestsuppliers', 1),(49, 'statscarrier', 1),(50, 'statsnewsletter', 1),(51, 'statssearch', 1),(52, 'statscheckup', 1),(53, 'statsstock', 1),
(54, 'blockstore', 1),(55, 'statsforecast', 1),
(54, 'blockstore', 1),(55, 'statsforecast', 1),
/* new themes : modules to add */
(56, 'blocktopmenu', 1),
(57, 'blocksharefb', 1),
@@ -78,12 +78,12 @@ INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `vie
INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) (SELECT `id_module`, 1 FROM `PREFIX_module`);
/*
* rightcolumn=6, leftcolumn=7, home=8, header=9, top=14,
/*
* rightcolumn=6, leftcolumn=7, home=8, header=9, top=14,
*/
INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES
INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES
/* homefeatured */
(1, 8, 2),
(1, 9, 23),
@@ -326,8 +326,6 @@ INSERT INTO `PREFIX_order_detail_tax` (`id_order_detail`, `id_tax`, `unit_amount
(1, 1, '76.860000', '76.860000'),
(2, 1, '24.420000', '24.420000');
INSERT INTO `PREFIX_order_payment` (`id_order`, `id_currency`, `amount`, `payment_method`, `date_add`) VALUES (1, 1, '626.37', 'Chèque', NOW());
INSERT INTO `PREFIX_manufacturer` (`id_manufacturer`, `name`, `date_add`, `date_upd`, `active`) VALUES (1, 'Apple Computer, Inc', NOW(), NOW(), 1);
INSERT INTO `PREFIX_manufacturer` (`id_manufacturer`, `name`, `date_add`, `date_upd`, `active`) VALUES(2, 'Shure Incorporated', NOW(), NOW(), 1);
@@ -1670,7 +1668,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_newsletter` (
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_slide`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=UTF8;
CREATE TABLE IF NOT EXISTS `PREFIX_homeslider_slides_lang` (
`id_slide` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
@@ -1683,7 +1681,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_newsletter` (
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=UTF8;
INSERT INTO `PREFIX_configuration` (name, value)
VALUES
VALUES
("HOMESLIDER_WIDTH", "535"),
("HOMESLIDER_HEIGHT", "300"),
("HOMESLIDER_SPEED", "1300"),
@@ -1691,7 +1689,7 @@ VALUES
INSERT INTO `PREFIX_homeslider` (id_slide, id_shop) VALUES (1, 1),(2, 1), (3, 1), (4, 1), (5, 1);
INSERT INTO `PREFIX_homeslider_slides` (id_slide, position, active)
INSERT INTO `PREFIX_homeslider_slides` (id_slide, position, active)
VALUES (1, 1, 1), (2, 2, 1), (3, 3, 1), (4, 4, 1), (5, 5, 1);
INSERT INTO `PREFIX_homeslider_slides_lang` (id_slide, id_lang, title, description, legend, url, image) VALUES