From cba5631db0f33eba40b1a35fc414f1b2d96edcfe Mon Sep 17 00:00:00 2001 From: rMalie Date: Wed, 17 Aug 2011 08:15:38 +0000 Subject: [PATCH] // Merge -> revision 8076 --- admin-dev/tabs/AdminAddresses.php | 3 +-- admin-dev/tabs/AdminCategories.php | 2 +- admin-dev/tabs/AdminProducts.php | 15 +++++++++----- modules/authorizeaim/authorizeaim.php | 9 ++++++++- modules/authorizeaim/config.xml | 2 +- modules/birthdaypresent/birthdaypresent.php | 1 + modules/blockcms/blockcms.php | 2 +- modules/cashticket/cashticket.php | 9 ++++++++- modules/cashticket/config.xml | 2 +- modules/ebay/eBayRequest.php | 4 ++++ modules/ebay/ebay.php | 12 +++++++++-- modules/gcheckout/config.xml | 2 +- modules/gcheckout/gcheckout.php | 9 ++++++++- modules/mondialrelay/mondialrelay.tpl | 16 +++++++-------- modules/ogone/config.xml | 2 +- modules/ogone/ogone.php | 9 ++++++++- modules/paypal/config.xml | 2 +- modules/paypal/paypal.php | 22 +++++++++++---------- modules/paysafecard/config.xml | 2 +- modules/paysafecard/paysafecard.php | 9 ++++++++- modules/uspscarrier/uspscarrier.php | 10 +++++----- themes/prestashop/errors.tpl | 2 +- 22 files changed, 100 insertions(+), 46 deletions(-) diff --git a/admin-dev/tabs/AdminAddresses.php b/admin-dev/tabs/AdminAddresses.php index 9dfea8271..0489f0579 100644 --- a/admin-dev/tabs/AdminAddresses.php +++ b/admin-dev/tabs/AdminAddresses.php @@ -75,8 +75,7 @@ class AdminAddresses extends AdminTab { if (Validate::isEmail(Tools::getValue('email'))) { - $customer = new Customer; - $customer = $customer->getByemail(Tools::getValue('email')); + $customer = new Customer(Tools::getValue('id_customer')); if (Validate::isLoadedObject($customer)) $_POST['id_customer'] = $customer->id; else diff --git a/admin-dev/tabs/AdminCategories.php b/admin-dev/tabs/AdminCategories.php index 4f5e8d55d..2152741a7 100644 --- a/admin-dev/tabs/AdminCategories.php +++ b/admin-dev/tabs/AdminCategories.php @@ -222,7 +222,7 @@ class AdminCategories extends AdminTab 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All') ); - echo Helper::renderAdminCategorieTree($trads, array(isset($obj->id_parent) ? $obj->id_parent : 1), 'id_parent', true); + echo Helper::renderAdminCategorieTree($trads, array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1)), 'id_parent', true); echo '
'; diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index 67ce7f3cf..2a26699e2 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -1583,12 +1583,17 @@ class AdminProducts extends AdminTab { echo ' if (toload[id]) { toload[id] = false; - $.post( - "'.dirname(self::$currentIndex).'/ajax.php", { + + $.ajax({ + url: "'.dirname(self::$currentIndex).'/ajax.php", + data: { ajaxProductTab: id, id_product: '.$obj->id.', token: \''.Tools::getValue('token').'\', - id_category: '.(int)(Tools::getValue('id_category')).'}, - function(rep) { + id_category: '.(int)(Tools::getValue('id_category')).' + }, + cache: false, + type: \'POST\', + success: function(rep) { $("#step" + id).html(rep);var languages = new Array(); if (id == 3) populate_attrs(); @@ -1607,7 +1612,7 @@ class AdminProducts extends AdminTab }); } } - ) + }) }'; } echo ' } diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php index d61930fca..767f9428c 100755 --- a/modules/authorizeaim/authorizeaim.php +++ b/modules/authorizeaim/authorizeaim.php @@ -34,7 +34,7 @@ class authorizeAIM extends PaymentModule { $this->name = 'authorizeaim'; $this->tab = 'payments_gateways'; - $this->version = '1.1'; + $this->version = '1.2'; $this->author = 'PrestaShop'; $this->limited_countries = array('us'); $this->need_instance = 0; @@ -43,6 +43,13 @@ class authorizeAIM extends PaymentModule $this->displayName = 'Authorize.net AIM (Advanced Integration Method)'; $this->description = $this->l('Receive payment with Authorize.net'); + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); } public function install() diff --git a/modules/authorizeaim/config.xml b/modules/authorizeaim/config.xml index 39d2b2bbc..7280f071b 100755 --- a/modules/authorizeaim/config.xml +++ b/modules/authorizeaim/config.xml @@ -2,7 +2,7 @@ authorizeaim - + diff --git a/modules/birthdaypresent/birthdaypresent.php b/modules/birthdaypresent/birthdaypresent.php index 2988da372..a790adb54 100644 --- a/modules/birthdaypresent/birthdaypresent.php +++ b/modules/birthdaypresent/birthdaypresent.php @@ -128,6 +128,7 @@ class BirthdayPresent extends Module $voucher->name = 'BIRTHDAY-'.(int)($voucher->id_customer).'-'.date('Y'); $voucher->description[(int)(Configuration::get('PS_LANG_DEFAULT'))] = $this->l('Your birthday present !'); $voucher->value = Configuration::get('BIRTHDAY_DISCOUNT_VALUE'); + $voucher->id_currency = Configuration::get('PS_CURRENCY_DEFAULT'); $voucher->quantity = 1; $voucher->quantity_per_user = 1; $voucher->cumulable = 1; diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index 388a306d8..71234cd07 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -685,7 +685,7 @@ class BlockCms extends Module $footer .= $box.'|'; Configuration::updateValue('FOOTER_CMS', rtrim($footer, '|')); Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', Tools::getValue('footer_active')); - Configuration::updateValue('FOOTER_POWEREDBY', (Tools::getValue('footer_poweredby_active') == 1 ? 1 : 0)); + Configuration::updateValue('FOOTER_POWEREDBY', (Tools::getValue('footer_poweredby_active') == 'on' ? 1 : 0)); $this->_html = $this->displayConfirmation($this->l('Footer\'s CMS updated')); } diff --git a/modules/cashticket/cashticket.php b/modules/cashticket/cashticket.php index d403ac0bc..b00591e7f 100644 --- a/modules/cashticket/cashticket.php +++ b/modules/cashticket/cashticket.php @@ -57,7 +57,7 @@ class CashTicket extends PrepaidServices { $this->name = 'cashticket'; $this->tab = 'payments_gateways'; - $this->version = 1.2; + $this->version = '1.3'; $this->module_dir = dirname(__FILE__); $this->certificat_dir = dirname(__FILE__).'/keyring/'; $this->need_instance = 0; @@ -66,6 +66,13 @@ class CashTicket extends PrepaidServices $this->displayName = $this->l('CashTicket'); $this->description = $this->l('Accepts payments by CashTicket'); + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); } diff --git a/modules/cashticket/config.xml b/modules/cashticket/config.xml index 6c3c20538..4f31b4bf3 100755 --- a/modules/cashticket/config.xml +++ b/modules/cashticket/config.xml @@ -2,7 +2,7 @@ cashticket - + diff --git a/modules/ebay/eBayRequest.php b/modules/ebay/eBayRequest.php index eab2ec0ce..318ace257 100755 --- a/modules/ebay/eBayRequest.php +++ b/modules/ebay/eBayRequest.php @@ -389,6 +389,7 @@ class eBayRequest $requestXml .= ' '.$datas['categoryId'].''."\n"; $requestXml .= ' '."\n"; $requestXml .= ' 1000'."\n"; + if (!isset($datas['noPriceUpdate'])) $requestXml .= ' '.$datas['price'].''."\n"; $requestXml .= ' true'."\n"; $requestXml .= ' FR'."\n"; @@ -505,6 +506,7 @@ class eBayRequest $requestXml .= ' '.$datas['itemID'].''."\n"; $requestXml .= ' prestashop-'.$datas['id_product'].''; $requestXml .= ' '.$datas['quantity'].''."\n"; + if (!isset($datas['noPriceUpdate'])) $requestXml .= ' '.$datas['price'].''."\n"; if (Configuration::get('EBAY_SYNC_OPTION_RESYNC') != 1) { @@ -734,6 +736,7 @@ class eBayRequest { $requestXml .= ' '."\n"; $requestXml .= ' prestashop-'.$key.''."\n"; + if (!isset($datas['noPriceUpdate'])) $requestXml .= ' '.$variation['price'].''."\n"; $requestXml .= ' '.$variation['quantity'].''."\n"; $requestXml .= ' '."\n"; @@ -900,6 +903,7 @@ class eBayRequest { $requestXml .= ' '."\n"; $requestXml .= ' prestashop-'.$key.''."\n"; + if (!isset($datas['noPriceUpdate'])) $requestXml .= ' '.$variation['price'].''."\n"; $requestXml .= ' '.$variation['quantity'].''."\n"; $requestXml .= ' '."\n"; diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index aeccb8fc5..5e90a8460 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -269,6 +269,8 @@ class Ebay extends Module { // Retrieve product list for eBay (which have matched categories) AND Send each product on eBay $productsList = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE '.$sql.' AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)'); + foreach ($productList as $k => $v) + $productList[$k]['noPriceUpdate'] = 1; if ($productsList) $this->_syncProducts($productsList); } @@ -276,6 +278,8 @@ class Ebay extends Module { // Select the sync Categories and Retrieve product list for eBay (which have matched and sync categories) AND Send each product on eBay $productsList = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE '.$sql.' AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)'); + foreach ($productList as $k => $v) + $productList[$k]['noPriceUpdate'] = 1; if ($productsList) $this->_syncProducts($productsList); } @@ -1319,10 +1323,10 @@ class Ebay extends Module @set_time_limit(3600); // Run the products list - foreach ($productsList as $product) + foreach ($productsList as $p) { // Product instanciation - $product = new Product((int)$product['id_product'], true, $this->id_lang); + $product = new Product((int)$p['id_product'], true, $this->id_lang); if (Validate::isLoadedObject($product) && $product->id_category_default > 0) { // Load default category matched in cache @@ -1408,6 +1412,10 @@ class Ebay extends Module 'picturesLarge' => $picturesLarge, ); + // Price Update + if (isset($p['noPriceUpdate'])) + $datas['noPriceUpdate'] = $p['noPriceUpdate']; + // Save percent and price discount if ($categoryDefaultCache[$product->id_category_default]['percent'] < 0) { diff --git a/modules/gcheckout/config.xml b/modules/gcheckout/config.xml index e9e6991de..0d616f9e8 100755 --- a/modules/gcheckout/config.xml +++ b/modules/gcheckout/config.xml @@ -2,7 +2,7 @@ gcheckout - + diff --git a/modules/gcheckout/gcheckout.php b/modules/gcheckout/gcheckout.php index 16fe8fb1f..c1887332b 100644 --- a/modules/gcheckout/gcheckout.php +++ b/modules/gcheckout/gcheckout.php @@ -34,7 +34,7 @@ class GCheckout extends PaymentModule { $this->name = 'gcheckout'; $this->tab = 'payments_gateways'; - $this->version = 1.1; + $this->version = '1.2'; $this->author = 'PrestaShop'; $this->currencies = true; @@ -47,6 +47,13 @@ class GCheckout extends PaymentModule if (!sizeof(Currency::checkPaymentCurrencies($this->id))) $this->warning = $this->l('No currency set for this module'); + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); } public function install() diff --git a/modules/mondialrelay/mondialrelay.tpl b/modules/mondialrelay/mondialrelay.tpl index ec367f369..d6bcf78a1 100755 --- a/modules/mondialrelay/mondialrelay.tpl +++ b/modules/mondialrelay/mondialrelay.tpl @@ -44,26 +44,26 @@ diff --git a/modules/ogone/config.xml b/modules/ogone/config.xml index df43fb124..5acbfc5f6 100755 --- a/modules/ogone/config.xml +++ b/modules/ogone/config.xml @@ -2,7 +2,7 @@ ogone - + diff --git a/modules/ogone/ogone.php b/modules/ogone/ogone.php index 764301afe..45abc5469 100644 --- a/modules/ogone/ogone.php +++ b/modules/ogone/ogone.php @@ -36,12 +36,19 @@ class Ogone extends PaymentModule { $this->name = 'ogone'; $this->tab = 'payments_gateways'; - $this->version = '2.0'; + $this->version = '2.1'; parent::__construct(); $this->displayName = 'Ogone'; $this->description = ''; + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); } public function install() diff --git a/modules/paypal/config.xml b/modules/paypal/config.xml index 256aa8a8f..6eea0c3ae 100755 --- a/modules/paypal/config.xml +++ b/modules/paypal/config.xml @@ -2,7 +2,7 @@ paypal - + diff --git a/modules/paypal/paypal.php b/modules/paypal/paypal.php index e7bae5a40..94d273caf 100644 --- a/modules/paypal/paypal.php +++ b/modules/paypal/paypal.php @@ -40,7 +40,7 @@ class PayPal extends PaymentModule { $this->name = 'paypal'; $this->tab = 'payments_gateways'; - $this->version = '2.7'; + $this->version = '2.8'; $this->currencies = true; $this->currencies_mode = 'radio'; @@ -352,7 +352,7 @@ class PayPal extends PaymentModule $products = $order->getProducts(); $amt = $products[(int)($order_detail->id)]['product_price_wt'] * (int)($_POST['cancelQuantity'][(int)($order_detail->id)]); - $response = $this->_makeRefund($id_transaction, (float)($amt)); + $response = $this->_makeRefund($id_transaction, $order->id, (float)($amt)); $message = $this->l('Cancel products result:').'
'; foreach ($response AS $k => $value) $message .= $k.': '.$value.'
'; @@ -975,7 +975,7 @@ class PayPal extends PaymentModule WHERE `id_order` = '.(int)$id_order); } - private function _makeRefund($id_transaction, $amt = false) + private function _makeRefund($id_transaction, $id_order, $amt = false) { include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php'); @@ -991,7 +991,8 @@ class PayPal extends PaymentModule $isoCurrency = Db::getInstance()->getValue(' SELECT `iso_code` FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'currency` c ON (o.`id_currency` = c.`id_currency`)'); + LEFT JOIN `'._DB_PREFIX_.'currency` c ON (o.`id_currency` = c.`id_currency`) + WHERE o.`id_order` = '.(int)$id_order); $request = '&TRANSACTIONID='.urlencode($id_transaction).'&REFUNDTYPE=Partial&AMT='.(float)($amt).'&CURRENCYCODE='.urlencode(strtoupper($isoCurrency)); } $paypalLib = new PaypalLib(); @@ -1028,17 +1029,18 @@ class PayPal extends PaymentModule if (!Validate::isLoadedObject($order)) return false; $products = $order->getProducts(); + // Amount for refund $amt = 0.00; foreach ($products AS $product) - if ($product['product_quantity_refunded'] == 0) - $amt += (float)($product['total_price']); - $amt += (float)($order->total_shipping); + $amt += (float)($product['total_price']) * ($product['product_quantity'] - $product['product_quantity_refunded']); + $amt += (float)($order->total_shipping) + (float)($order->total_wrapping) - (float)($order->total_discounts); + // check if total or partial - if ($order->total_products_wt == $amt) - $response = $this->_makeRefund($id_transaction); + if ($this->PayPalRound($order->total_paid_real) == $this->PayPalRound($amt)) + $response = $this->_makeRefund($id_transaction, $id_order); else - $response = $this->_makeRefund($id_transaction, (float)($amt)); + $response = $this->_makeRefund($id_transaction, $id_order, (float)($amt)); $message = $this->l('Refund operation result:').'
'; foreach ($response AS $k => $value) $message .= $k.': '.$value.'
'; diff --git a/modules/paysafecard/config.xml b/modules/paysafecard/config.xml index 47ab4c356..8a21d6583 100755 --- a/modules/paysafecard/config.xml +++ b/modules/paysafecard/config.xml @@ -2,7 +2,7 @@ paysafecard - + diff --git a/modules/paysafecard/paysafecard.php b/modules/paysafecard/paysafecard.php index 0f5075bf7..7d135459c 100644 --- a/modules/paysafecard/paysafecard.php +++ b/modules/paysafecard/paysafecard.php @@ -58,7 +58,7 @@ class PaysafeCard extends PSCPrepaidServices { $this->name = 'paysafecard'; $this->tab = 'payments_gateways'; - $this->version = 1.2; + $this->version = '1.3'; $this->module_dir = dirname(__FILE__); $this->certificat_dir = dirname(__FILE__).'/keyring/'; $this->need_instance = 0; @@ -67,6 +67,13 @@ class PaysafeCard extends PSCPrepaidServices $this->displayName = $this->l('PaysafeCard'); $this->description = $this->l('Accepts payments by PaysafeCard.'); + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); } public function getL($key) diff --git a/modules/uspscarrier/uspscarrier.php b/modules/uspscarrier/uspscarrier.php index 24690e571..a11e39bbb 100644 --- a/modules/uspscarrier/uspscarrier.php +++ b/modules/uspscarrier/uspscarrier.php @@ -57,7 +57,7 @@ class UspsCarrier extends CarrierModule parent::__construct (); - $this->displayName = $this->l('USPS Carrier'); + $this->displayName = $this->l('U.S.P.S Rate Calulator'); $this->description = $this->l('Offer your customers, different delivery methods with USPS'); if (self::isInstalled($this->name)) @@ -71,7 +71,7 @@ class UspsCarrier extends CarrierModule if (!Configuration::get($keyConfiguration) && !empty($name)) $warning[] = '\''.$name.'\' '; - // Check calcul mode + // Check calculation mode if (!Configuration::get('USPS_CARRIER_CALCUL_MODE')) Configuration::updateValue('USPS_CARRIER_CALCUL_MODE', 'split'); @@ -134,7 +134,7 @@ class UspsCarrier extends CarrierModule 'TRUE' => $this->l('True') ); - // Loading calcul mode list + // Loading calculation mode list $this->_calculModeList = array( 'onepackage' => $this->l('All items in one package'), 'split' => $this->l('Split one item per package') @@ -549,14 +549,14 @@ class UspsCarrier extends CarrierModule $html .= '

' . $this->l('Select if it is machinable or not by default.') . '

- +
-

' . $this->l('Using the calcul mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specifics configurations for categories or product won\'t be used.') . '

+

' . $this->l('Using the calculation mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specifics configurations for categories or product won\'t be used.') . '

'; diff --git a/themes/prestashop/errors.tpl b/themes/prestashop/errors.tpl index 3ed72fc65..db9cbfd60 100644 --- a/themes/prestashop/errors.tpl +++ b/themes/prestashop/errors.tpl @@ -32,7 +32,7 @@
  • {$error}
  • {/foreach} - {if isset($smarty.server.HTTP_REFERER) && !strstr($request_uri, 'authentication') && preg_replace('#^http://[^/]+/#', '/', $smarty.server.HTTP_REFERER) != $request_uri} + {if isset($smarty.server.HTTP_REFERER) && !strstr($request_uri, 'authentication') && preg_replace('#^https?://[^/]+/#', '/', $smarty.server.HTTP_REFERER) != $request_uri}

    « {l s='Back'}

    {/if}