diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php index 2d9e784b3..191e6a930 100755 --- a/modules/authorizeaim/authorizeaim.php +++ b/modules/authorizeaim/authorizeaim.php @@ -201,7 +201,7 @@ class authorizeAIM extends PaymentModule public function hookHeader() { - Tools::addJS(_PS_JS_DIR_.'jquery/jquery.validate.creditcard2-1.0.1.js'); + $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.validate.creditcard2-1.0.1.js'); } /** diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index 99d36be89..47dd7eb08 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -204,6 +204,7 @@ class BankWire extends PaymentModule $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) + { $this->context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'bankwireDetails' => Tools::nl2br($this->details), @@ -212,6 +213,9 @@ class BankWire extends PaymentModule 'status' => 'ok', 'id_order' => $params['objOrder']->id )); + if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference)) + $this->context->smarty->assign('reference', $params['objOrder']->reference); + } else $this->context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index e41bbbca0..b2e6a9994 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -93,7 +93,6 @@ class BlockCart extends Module 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::BOTH_WITHOUT_SHIPPING), $currency), 'total' => Tools::displayPrice($totalToPay, $currency), - 'id_carrier' => (int)($params['cart']->id_carrier), 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false )); diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index 2baf16bee..c0329b5c6 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -87,7 +87,7 @@ class BlockCategories extends Module Configuration::updateValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', $nbrColumns); Configuration::updateValue('BLOCK_CATEG_SORT_WAY', Tools::getValue('BLOCK_CATEG_SORT_WAY')); Configuration::updateValue('BLOCK_CATEG_SORT', Tools::getValue('BLOCK_CATEG_SORT')); - + $this->_clearBlockcategoriesCache(); $output .= '
'.$this->l('Confirmation').''.$this->l('Settings updated').'
'; } @@ -121,7 +121,7 @@ class BlockCategories extends Module - - + -
 
 
-
+
+ +
-
 
-
- Addons - '.$this->l('This module has been developped by PrestaShop and can only be sold through').' addons.prestashop.com.
- '.$this->l('Please report all bugs to').' addons@prestashop.com '.$this->l('or using our').' '.$this->l('contact form').'. -
'; - } - - public function hookHeader() - { - $this->context->controller->addCSS(($this->_path).'blockcontact.css', 'all'); + '; } public function hookRightColumn() @@ -100,4 +92,4 @@ class blockcontact extends Module return $this->display(__FILE__, 'blockcontact.tpl'); } } -?> \ No newline at end of file +?> diff --git a/modules/blockcontactinfos/blockcontactinfos.php b/modules/blockcontactinfos/blockcontactinfos.php index b49a160ba..ad7ab806d 100644 --- a/modules/blockcontactinfos/blockcontactinfos.php +++ b/modules/blockcontactinfos/blockcontactinfos.php @@ -1,13 +1,13 @@ -* @copyright 2007-2010 Prestashop SA -* @version Release: $Revision: 1.4 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -78,25 +78,21 @@ class blockcontactinfos extends Module $content = '

'.$this->displayName.'

-
+

-

+

-
 
-
+
+ +
-
 
-
- Addons - '.$this->l('This module has been developped by PrestaShop and can only be sold through').' addons.prestashop.com.
- '.$this->l('Please report all bugs to').' addons@prestashop.com '.$this->l('or using our').' '.$this->l('contact form').'. -
'; + '; return $content; } diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php index eab88cace..1b8de8868 100644 --- a/modules/blockcurrencies/blockcurrencies.php +++ b/modules/blockcurrencies/blockcurrencies.php @@ -62,6 +62,7 @@ class BlockCurrencies extends Module if (!count(Currency::getCurrencies())) return ''; + // @todo remove this and use smartyTemplate $this->context->smarty->assign('blockcurrencies_sign', $this->context->currency->sign); return $this->display(__FILE__, 'blockcurrencies.tpl'); } diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php index eb037bf1a..321ebeaf3 100644 --- a/modules/blockcustomerprivacy/blockcustomerprivacy.php +++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php @@ -1,13 +1,13 @@ -* @copyright 2007-2010 Prestashop SA -* @version Release: $Revision: 1.4 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/modules/blockmyaccountfooter/blockmyaccountfooter.php b/modules/blockmyaccountfooter/blockmyaccountfooter.php index bb5d6b8f5..ed3ada0df 100644 --- a/modules/blockmyaccountfooter/blockmyaccountfooter.php +++ b/modules/blockmyaccountfooter/blockmyaccountfooter.php @@ -103,3 +103,4 @@ class blockmyaccountfooter extends Module } + diff --git a/modules/blockmyaccountfooter/index.php b/modules/blockmyaccountfooter/index.php index 4e2611d37..e69de29bb 100644 --- a/modules/blockmyaccountfooter/index.php +++ b/modules/blockmyaccountfooter/index.php @@ -1,36 +0,0 @@ - -* @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 -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/blockpermanentlinks/blockpermanentlinks.php b/modules/blockpermanentlinks/blockpermanentlinks.php index 5b1e9c9c2..8264ef098 100644 --- a/modules/blockpermanentlinks/blockpermanentlinks.php +++ b/modules/blockpermanentlinks/blockpermanentlinks.php @@ -55,7 +55,7 @@ class BlockPermanentLinks extends Module * @param array $params Parameters * @return string Content */ - function hookDisplayTop($params) + function hookTop($params) { return $this->display(__FILE__, 'blockpermanentlinks-header.tpl'); } @@ -75,13 +75,13 @@ class BlockPermanentLinks extends Module { return $this->hookLeftColumn($params); } - - function hookDisplayFooter($params) + + function hookFooter($params) { return $this->display(__FILE__, 'blockpermanentlinks-footer.tpl'); } - function hookDisplayHeader($params) + function hookHeader($params) { $this->context->controller->addCSS(($this->_path).'blockpermanentlinks.css', 'all'); } diff --git a/modules/blockreinsurance/blockreinsurance.php b/modules/blockreinsurance/blockreinsurance.php index ffdefcd58..3fcfd3b30 100644 --- a/modules/blockreinsurance/blockreinsurance.php +++ b/modules/blockreinsurance/blockreinsurance.php @@ -1,13 +1,13 @@ -* @copyright 2007-2010 Prestashop SA -* @version Release: $Revision: 1.4 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -if (!defined('_PS_VERSION_')) +if (!defined('_CAN_LOAD_FILES_')) exit; - -class Blockreinsurance extends Module + +class blockreinsurance extends Module { - protected $_html = ''; - public function __construct() { $this->name = 'blockreinsurance'; - $this->tab = 'front_office_features'; + if(version_compare(_PS_VERSION_, '1.4.0.0') >= 0) + $this->tab = 'front_office_features'; + else + $this->tab = 'Blocks'; $this->version = '1.0'; - $this->author = 'PrestaShop'; - $this->need_instance = 0; parent::__construct(); - $this->displayName = $this->l('Block reinsurance'); - $this->description = $this->l('Adds a block to display more infos to reassure your customers'); + $this->displayName = $this->l('Bloc reinsurance'); + $this->description = $this->l('Add a block to display more infos to reassure your customers'); } - + public function install() { - // Module installation - $res = parent::install(); - - // Table creation - $res &= Db::getInstance()->Execute(' - CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance` ( - `id_reinsurance` INT UNSIGNED NOT NULL, - `filename` VARCHAR(100) NOT NULL, - PRIMARY KEY (`id_reinsurance`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); - - $res &= Db::getInstance()->Execute(' - CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance_lang` ( - `id_reinsurance` INT UNSIGNED NOT NULL, - `id_lang` INT UNSIGNED NOT NULL, - `text` VARCHAR(300) NOT NULL, - PRIMARY KEY (`id_reinsurance`, `id_lang`) - ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); - - $res &= $this->registerHook('header') AND $this->example(); - - return $res; + return (parent::install() AND $this->installDB() AND Configuration::updateValue('blockreinsurance_nbblocks', 5) AND $this->registerHook('footer')); } - + + public function installDB() + { + return Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance` ( + `id_contactinfos` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `filename` VARCHAR(100) NOT NULL, + `text` VARCHAR(300) NOT NULL, + PRIMARY KEY (`id_contactinfos`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;'); + } + public function uninstall() { - // Drop table - $res = Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance`'); - $res &= Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance_lang`'); - - // Uninstall module - $res &= parent::uninstall(); - - return $res; + //Delete configuration + return (Configuration::deleteByName('blockreinsurance_nbblocks') AND $this->uninstallDB() AND parent::uninstall()); } - - private function example() + public function uninstallDB() { - $res = Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."reinsurance` VALUES - (1, '10299ef6635307f2b4da1e04471ec981.jpg'), - (2, 'd02eaac9390f84f26fe9c5cae966a8f7.jpg'), - (3, 'b889e72091b006fd444f63e5de030604.jpg'), - (4, 'a215cb7a215c6976be8b2b80f02765b0.jpg'), - (5, '0f9d7fd7d13cfb5672ac7830be60d6a8.jpg');"); - $res &= Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."reinsurance_lang` VALUES - (1, 1, 'Money-back guarantee'), - (1, 2, 'SATISFAIT OU REMBOURSE'), - (1, 3, 'Money-back guarantee'), - (1, 4, 'Money-back guarantee'), - (1, 5, 'Money-back guarantee'), - (2, 1, 'Satisfied or refunded'), - (2, 2, 'ECHANGE EN MAGASIN'), - (2, 3, 'Satisfied or refunded'), - (2, 4, 'Satisfied or refunded'), - (2, 5, 'Satisfied or refunded'), - (3, 1, 'Shipped and paid'), - (3, 2, 'PAIEMENT A L''EXPEDITION'), - (3, 3, 'Shipped and paid'), - (3, 4, 'Shipped and paid'), - (3, 5, 'Shipped and paid'), - (4, 1, 'Free delivery'), - (4, 2, 'LIVRAISON GRATUITE'), - (4, 3, 'Free delivery'), - (4, 4, 'Free delivery'), - (4, 5, 'Free delivery'), - (5, 1, 'Secure payment'), - (5, 2, 'PAIEMENT 100% SECURISE'), - (5, 3, 'Secure payment'), - (5, 4, 'Secure payment'), - (5, 5, 'Secure payment');"); - return $res; + return Db::getInstance()->execute(' + DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance`'); } + + public function addToDB() + { + if(isset($_POST['nbblocks'])) + { + for($i = 1; $i <= (int)$_POST['nbblocks']; $i++) + { + $filename = explode('.', $_FILES['info'.$i.'_file']['name']); + if (isset($_FILES['info'.$i.'_file']) AND isset($_FILES['info'.$i.'_file']['tmp_name']) AND !empty($_FILES['info'.$i.'_file']['tmp_name'])) + { + if ($error = checkImage($_FILES['info'.$i.'_file'])) + return false; + elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['info'.$i.'_file']['tmp_name'], $tmpName)) + return false; + elseif (!imageResize($tmpName, dirname(__FILE__).'/img/'.$filename[0].'.jpg')) + return false; + unlink($tmpName); + } + Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'reinsurance` (`filename`,`text`) + VALUES ("'.((isset($filename[0]) AND $filename[0] != '') ? pSQL($filename[0]) : ''). + '", "'.((isset($_POST['info'.$i.'_text']) AND $_POST['info'.$i.'_text'] != '') ? pSQL($_POST['info'.$i.'_text']) : '').'")'); + } + return true; + } else + return false; + } + + public function removeFromDB() + { + $dir = opendir(dirname(__FILE__).'/img'); + while (false !== ($file = readdir($dir))) + { + $path = dirname(__FILE__).'/img/'.$file; + if ($file != ".." AND $file != "." AND !is_dir($file)) + { + unlink($path); + } + } + closedir($dir); + return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'reinsurance`'); + } + + public function getAllFromDB() + { + return Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'reinsurance`'); + } + public function getContent() { - $this->_html = '

'.$this->displayName.'.

'; - - if (Tools::isSubmit('submitBlock')) - $this->postProcess(); - $this->displayForm(); - - return $this->_html; - } - - protected function displayForm() - { - $languages = Language::getLanguages(false); - $default_language = Configuration::get('PS_LANG_DEFAULT'); - $div_id_language = 'block_1_language¤block_2_language¤block_3_language¤block_4_language¤block_5_language'; - - $data = $this->getAllReinsurances(); - $reinssuarances = array(); - foreach ($data as $row) - $reinssuarances[$row['id_reinsurance']][$row['id_lang']] = $row; - - $this->_html .= ' - -
-
- '.$this->l('Block configuration').' - '; - - for ($i = 1; $i != 6; $i++) - { - $this->_html .= ' -

Block '.$i.'

- '; - if ($i == 1) - $this->_html .= '

'.$this->l('This block is required').'

'; - - if (isset($reinssuarances[$i][$default_language]) && $reinssuarances[$i][$default_language]['filename'] != null) - $this->_html .= '
- '.$reinssuarances[$i][$default_language]['text'].' -
'; - $this->_html .= ' - -
- -
- '; - - foreach ($languages as $lang) - $this->_html .= ' -
- - -
- '; - $this->_html .= $this->displayFlags($languages, $default_language, $div_id_language, 'block_'.$i.'_language', true); - $this->_html .= ' -
- '; - if ($i != 5) - $this->_html.= '
'; - } - $this->_html .= ' -

- -

-
-
- '; - - return $this->_html; - } - - protected function postProcess() - { - $languages = Language::getLanguages(false); - $default_language = Configuration::get('PS_LANG_DEFAULT'); - $max_image_size = 2 * 1024 * 1024; // 2 Mb - - $errors = array(); - $res = 1; - for ($i = 1; $i < 6; $i++) - { - $image_name = $_FILES['images']['name'][$i]; - if ($image_name != null) - { - $new_image_name = md5($image_name).'.jpg'; - $file = array(); - $file['name'] = $_FILES['images']['name'][$i]; - $file['tmp_name'] = $_FILES['images']['tmp_name'][$i]; - $file['type'] = $_FILES['images']['type'][$i]; - $file['error'] = $_FILES['images']['error'][$i]; - $file['size'] = $_FILES['images']['size'][$i]; - if ($error = checkImage($file, $max_image_size)) - $errors[] = $error; - elseif (!move_uploaded_file($file['tmp_name'], dirname(__FILE__).'/img/'.$new_image_name)) - $errors[] = $this->l('An error occurred during the image upload.'); - - if (!sizeof($errors)) - { - // Clear old rows - $res &= $this->cleanDb($i); - - // New rows - $res &= Db::getInstance()->Execute(' - INSERT INTO `'._DB_PREFIX_.'reinsurance` (`id_reinsurance`, `filename`) - VALUES (\''.(int)$i.'\', \''.(isset($new_image_name) ? pSQL($new_image_name) : '').'\') - '); - } - } - } - - foreach ($_POST['texts'] as $key => $text) - { - $res &= $this->cleanTxt($key); - if ($text[$default_language] != null && Validate::isCleanHtml($text[$default_language])) - { - if (!sizeof($errors)) - { - foreach ($languages as $lang) - { - if ($text[$lang['id_lang']] == '' || !Validate::isCleanHtml($text[$lang['id_lang']])) - $text[$lang['id_lang']] = $text[$default_language]; - - $res &= Db::getInstance()->Execute(' - INSERT INTO `'._DB_PREFIX_.'reinsurance_lang` (`id_reinsurance`, `id_lang`, `text`) - VALUES (\''.(int)$key.'\', \''.(int)$lang['id_lang'].'\', \''.pSQL($text[$lang['id_lang']]).'\') - '); - } - - if (!$res) - $errors[] = $this->l('An error occured on save'); - } - } + // If we try to update the settings + if (isset($_POST['submitModule'])) + { + Configuration::updateValue('blockreinsurance_nbblocks', ((isset($_POST['nbblocks']) AND $_POST['nbblocks'] != '') ? (int)$_POST['nbblocks'] : '')); + if($this->removeFromDB() && $this->addToDB()) + echo '
'.$this->l('Configuration updated').'
'; else - { - if ($key == 1) - $errors[] = $this->l('The block 1 is required'); - else - // check if another language aren't empty - foreach ($text as $id_lang => $val) - if ($id_lang != $default_language) - if ($val != null) - $errors[] = $this->l('The text for the block number').' '.$key.' '.$this->l('is incorrect, the default language information is required '); - } + echo '
'.$this->l('An error occurred during the save').'
'; } - if (!sizeof($errors)) - $this->_html .= $this->displayConfirmation($this->l('Configuration updated')); - else - $this->_html .= $this->displayError(implode('
', $errors)); - } + $nb_blocks = Configuration::get('blockreinsurance_nbblocks'); + $infos = $this->getAllFromDB(); - protected function cleanDb($key) - { - $image = Db::getInstance()->ExecuteS(' - SELECT `filename` - FROM `'._DB_PREFIX_.'reinsurance` - WHERE `id_reinsurance` = '.(int)$key); + $content = ' + +

'.$this->displayName.'

+
+
+ +
 
'; + // Show by default 5 blocks maximum + for($i = 1; $i <= 5; $i++) + { + $content .= '

'.$this->l('Block number').' '.$i.'

'. + ((!empty($infos[$i-1]) && $infos[$i-1]['filename'] != '') ? '' : ''). + '
 
+

+

+

+

'; + } + $content .= '
 
+
+
+
'; - // Delete image - if (file_exists(dirname(__FILE__).'/images/'.$image)) - @unlink(dirname(__FILE__).'/images/'.$image); - - // Delete rows - return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance` WHERE `id_reinsurance` = '.(int)$key) && - Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance_lang` WHERE `id_reinsurance` = '.(int)$key); - } - - protected function cleanTxt($key) - { - // Delete rows - return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance_lang` WHERE `id_reinsurance` = '.(int)$key); - } - - protected function getAllReinsurances($id_lang = null) - { - return Db::getInstance()->ExecuteS(' - SELECT * - FROM `'._DB_PREFIX_.'reinsurance` r - LEFT JOIN `'._DB_PREFIX_.'reinsurance_lang` rl ON (r.`id_reinsurance` = rl.`id_reinsurance`) - '.($id_lang ? 'WHERE rl.`id_lang` = '.(int)$id_lang : '')); - } - - public function hookHeader() - { - $this->context->controller->addCSS(($this->_path).'style.css', 'all'); + return $content; } public function hookFooter($params) - { - global $smarty, $cookie; - - $reinssuarances = $this->getAllReinsurances($cookie->id_lang); - - if (!$nb_reinssurance = sizeof($reinssuarances)) - return; - - $smarty->assign(array( - 'nb_blocks' => $nb_reinssurance, - 'reinssurances' => $reinssuarances - )); + { + global $smarty; + $infos = $this->getAllFromDB(); + + $smarty->assign(array( + 'nbblocks' => Configuration::get('blockreinsurance_nbblocks'), + 'infos' => $infos + )); return $this->display(__FILE__, 'blockreinsurance.tpl'); } } - +?> diff --git a/modules/blockreinsurance/blockreinsurance.tpl b/modules/blockreinsurance/blockreinsurance.tpl index 165754506..663ce392a 100644 --- a/modules/blockreinsurance/blockreinsurance.tpl +++ b/modules/blockreinsurance/blockreinsurance.tpl @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} +
-
    - {foreach from=$reinssurances item=reinssurance} -
  • {if $reinssurance.filename}{$reinssurance.text}{/if} {$reinssurance.text}
  • +
      + {foreach from=$infos item=info} +
    • {$info.text} {$info.text}
    • {/foreach}
diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index bed5c987d..60c9f6939 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -54,10 +54,7 @@ class BlockSearch extends Module public function hookHeader($params) { if (Configuration::get('PS_SEARCH_AJAX')) - { - $this->context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); - $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js'); - } + $this->context->controller->addJqueryPlugin('autocomplete'); $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); } diff --git a/modules/blocksharefb/blocksharefb.php b/modules/blocksharefb/blocksharefb.php index d06e78326..caffb22a5 100644 --- a/modules/blocksharefb/blocksharefb.php +++ b/modules/blocksharefb/blocksharefb.php @@ -1,13 +1,13 @@ -* @copyright 2007-2010 Prestashop SA -* @version Release: $Revision: 1.4 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -76,4 +76,4 @@ class blocksharefb extends Module } } } -?> \ No newline at end of file +?> diff --git a/modules/blocksocial/blocksocial.php b/modules/blocksocial/blocksocial.php index be8a62d78..56c4ccf22 100644 --- a/modules/blocksocial/blocksocial.php +++ b/modules/blocksocial/blocksocial.php @@ -1,13 +1,13 @@ -* @copyright 2007-2010 Prestashop SA -* @version Release: $Revision: 1.4 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -44,7 +44,7 @@ class blocksocial extends Module public function install() { - return (parent::install() AND Configuration::updateValue('blocksocial_facebook', '') AND Configuration::updateValue('blocksocial_twitter', '') AND Configuration::updateValue('blocksocial_rss', '') AND $this->registerHook('header')); + return (parent::install() AND Configuration::updateValue('blocksocial_facebook', '') && Configuration::updateValue('blocksocial_twitter', '') && Configuration::updateValue('blocksocial_rss', '') && $this->registerHook('displayHeader') && $this->registerHook('displayFooter')); } public function uninstall() @@ -79,21 +79,15 @@ class blocksocial extends Module
 

- -
 
-
- Addons - '.$this->l('This module has been developped by PrestaShop and can only be sold through').' addons.prestashop.com.
- '.$this->l('Please report all bugs to').' addons@prestashop.com '.$this->l('or using our').' '.$this->l('contact form').'. -
'; + '; } - public function hookHeader() + public function hookDisplayHeader() { $this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all'); } - public function hookFooter() + public function hookDisplayFooter() { global $smarty; diff --git a/modules/blockspecials/blockspecials.php b/modules/blockspecials/blockspecials.php index 187ca741c..06b08c1e5 100644 --- a/modules/blockspecials/blockspecials.php +++ b/modules/blockspecials/blockspecials.php @@ -37,7 +37,7 @@ class BlockSpecials extends Module { $this->name = 'blockspecials'; $this->tab = 'pricing_promotion'; - $this->version = 0.8; + $this->version = '0.8'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -90,8 +90,8 @@ class BlockSpecials extends Module if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; - $this->context->smarty->assign(array( - 'blockspecials_special' => $special, + $this->templateAssign(array( + 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize('medium'), )); diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index 8fe5a5ab5..8ecbcf92d 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -88,7 +88,7 @@ class BlockStore extends Module return $this->displayError($this->l('an error occurred on uploading file')); else { - if (Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) + if (Configuration::hasContext('BLOCKSTORE_IMG', null, $this->context->shop->getContextType()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) @unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG')); Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']); return $this->displayConfirmation($this->l('Settings are updated')); diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php index 0a7e477e4..c4687c05d 100644 --- a/modules/blocktopmenu/blocktopmenu.php +++ b/modules/blocktopmenu/blocktopmenu.php @@ -1,4 +1,30 @@ +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7095 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + include _PS_MODULE_DIR_.'blocktopmenu/menutoplinks.class.php'; class blocktopmenu extends Module { @@ -17,10 +43,10 @@ class blocktopmenu extends Module public function install() { - if(!parent::install() || - !$this->registerHook('top') || - !Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') || - !Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '0') || + if(!parent::install() || + !$this->registerHook('top') || + !Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') || + !Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '1') || !$this->installDB()) return false; return true; @@ -28,27 +54,29 @@ class blocktopmenu extends Module public function installDb() { - Db::getInstance()->Execute(' + return (Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` ( - `id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `id_shop` INT UNSIGNED NOT NULL, `new_window` TINYINT( 1 ) NOT NULL, - `link` VARCHAR( 128 ) NOT NULL - ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'); - Db::getInstance()->Execute(' - CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` ( - `id_link` INT NOT NULL , - `id_lang` INT NOT NULL , - `label` VARCHAR( 128 ) NOT NULL , - INDEX ( `id_link` , `id_lang` ) - ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'); - return true; + `link` VARCHAR( 128 ) NOT NULL, + INDEX (`id_shop`) + ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;') AND + Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` ( + `id_link` INT NOT NULL, + `id_lang` INT NOT NULL, + `id_shop` INT NOT NULL, + `label` VARCHAR( 128 ) NOT NULL , + INDEX ( `id_link` , `id_lang`, `id_shop`) + ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')); } public function uninstall() { - if(!parent::uninstall() || - !Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') || - !Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') || + if(!parent::uninstall() || + !Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') || + !Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') || !$this->uninstallDB()) return false; return true; @@ -56,15 +84,14 @@ class blocktopmenu extends Module private function uninstallDb() { - Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'linksmenutop`'); - Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`'); + Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop`'); + Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`'); return true; } public function getContent() { global $cookie; - if(Tools::isSubmit('submitBlocktopmenu')) { if(Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items'))) @@ -81,21 +108,25 @@ class blocktopmenu extends Module } else { - MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0)); + MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int)$this->context->shop->id); $this->_html .= $this->displayConfirmation($this->l('The link has been added')); } } if(Tools::isSubmit('submitBlocktopmenuRemove')) { $id_link = Tools::getValue('id_link', 0); - MenuTopLinks::remove($id_link); + MenuTopLinks::remove($id_link, (int)$this->context->shop->id); Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_link.',', 'LNK'.$id_link), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS'))); $this->_html .= $this->displayConfirmation($this->l('The link has been removed')); } + $this->_html .= '
+
+ '.$this->l('The modifications will be applied to').' '.(Context::shop() == Shop::CONTEXT_SHOP ? $this->l('shop:').' '.$this->context->shop->name : $this->l('all shops')).'. +
'.$this->l('Settings').' -
+
@@ -149,14 +180,14 @@ class blocktopmenu extends Module // END Products // BEGIN Menu Top Links $this->_html .= ''; - $links = MenuTopLinks::gets($cookie->id_lang); + $links = MenuTopLinks::gets($cookie->id_lang, null, (int)$this->context->shop->id); foreach($links as $link) $this->_html .= ''; $this->_html .= ''; // END Menu Top Links $this->_html .= '

- << '.$this->l('Add').' + << '.$this->l('Add').' @@ -221,7 +252,7 @@ class blocktopmenu extends Module $this->_html .= '
'.$this->l('Add Menu Top Link').' - +
'; foreach ($languages as $language) @@ -247,7 +278,7 @@ class blocktopmenu extends Module


'; - + $this->_html .= '
'.$this->l('List Menu Top Link').' @@ -262,7 +293,7 @@ class blocktopmenu extends Module '; - $links = MenuTopLinks::gets($cookie->id_lang); + $links = MenuTopLinks::gets($cookie->id_lang, null, $this->context->shop->id); foreach($links as $link) { $this->_html .= ' @@ -282,108 +313,125 @@ class blocktopmenu extends Module $this->_html .= '
'; - echo $this->_html; + return $this->_html; } private function getMenuItems() { - $items = Configuration::get('MOD_BLOCKTOPMENU_ITEMS'); - $items = explode(',', $items); - return $items; + if (Context::shop() == Shop::CONTEXT_SHOP) + { + if (!Configuration::isOverridenByCurrentContext('MOD_BLOCKTOPMENU_ITEMS')) + $items_shop = Configuration::get('MOD_BLOCKTOPMENU_ITEMS'); + } + if (!isset($items_shop)) + $items_shop = ''; + + $items_shop = explode(',', $items_shop); + $items_global = Configuration::getGlobalValue('MOD_BLOCKTOPMENU_ITEMS'); + $items_global = explode(',', $items_global); + + return array('global' => $items_global, 'shop' => $items_shop); } private function makeMenuOption() { global $cookie; - foreach($this->getMenuItems() as $item) + foreach($this->getMenuItems() as $type => $items) { - $id = (int)substr($item, 3, strlen($item)); - switch(substr($item, 0, 3)) - { - case'CAT': - $this->getCategoryOption($id, $cookie->id_lang, false); - break; - case'PRD': - $product = new Product($id, true, $cookie->id_lang); - if(!is_null($product->id)) - $this->_html .= ''.PHP_EOL; - break; - case'CMS': - $cms = CMS::getLinks($cookie->id_lang, array($id)); - if(count($cms)) - $this->_html .= ''.PHP_EOL; - break; - case'MAN': - $manufacturer = new Manufacturer($id, $cookie->id_lang); - if(!is_null($manufacturer->id)) - $this->_html .= ''.PHP_EOL; - break; - case'SUP': - $supplier = new Supplier($id, $cookie->id_lang); - if(!is_null($supplier->id)) - $this->_html .= ''.PHP_EOL; - break; - case'LNK': - $link = MenuTopLinks::get($id, $cookie->id_lang); - if(count($link)) - $this->_html .= ''.PHP_EOL; - break; + foreach ($items as $item) + { + $id = (int)substr($item, 3, strlen($item)); + $disabled = ((Context::shop() == Shop::CONTEXT_SHOP && $type == 'global') ? ' disabled="disabled"': ''); + switch(substr($item, 0, 3)) + { + case'CAT': + $this->getCategoryOption($id, $cookie->id_lang, false); + break; + case'PRD': + $product = new Product($id, true, $cookie->id_lang); + if(!is_null($product->id)) + $this->_html .= ''.PHP_EOL; + break; + case'CMS': + $cms = CMS::getLinks($cookie->id_lang, array($id)); + if(count($cms)) + $this->_html .= ''.PHP_EOL; + break; + case'MAN': + $manufacturer = new Manufacturer($id, $cookie->id_lang); + if(!is_null($manufacturer->id)) + $this->_html .= ''.PHP_EOL; + break; + case'SUP': + $supplier = new Supplier($id, $cookie->id_lang); + if(!is_null($supplier->id)) + $this->_html .= ''.PHP_EOL; + break; + case'LNK': + $link = MenuTopLinks::get($id, $cookie->id_lang, (int)$this->context->shop->id); + if(count($link)) + $this->_html .= ''.PHP_EOL; + break; + } } } } private function makeMenu() { - global $cookie, $page_name; - foreach($this->getMenuItems() as $item) + global $cookie, $page_name; + foreach($this->getMenuItems() as $type => $items) { - $id = (int)substr($item, 3, strlen($item)); - switch(substr($item, 0, 3)) - { - case'CAT': - $this->getCategory($id, $cookie->id_lang); - break; - case'PRD': - $selected = ($page_name == 'product' && (Tools::getValue('id_product') == $id)) ? ' class="sfHover"' : ''; - $product = new Product($id, true, $cookie->id_lang); - if(!is_null($product->id)) - $this->_menu .= ''.$product->name.''.PHP_EOL; - break; - case'CMS': - $selected = ($page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : ''; - $cms = CMS::getLinks($cookie->id_lang, array($id)); - if(count($cms)) - $this->_menu .= ''.$cms[0]['meta_title'].''.PHP_EOL; - break; - case'MAN': - $selected = ($page_name == 'manufacturer' && (Tools::getValue('id_manufacturer') == $id)) ? ' class="sfHover"' : ''; - $manufacturer = new Manufacturer($id, $cookie->id_lang); - if(!is_null($manufacturer->id)) - { - if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) - $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false); - else - $manufacturer->link_rewrite = 0; - $link = new Link; - $this->_menu .= ''.$manufacturer->name.''.PHP_EOL; - } - break; - case'SUP': - $selected = ($page_name == 'supplier' && (Tools::getValue('id_supplier') == $id)) ? ' class="sfHover"' : ''; - $supplier = new Supplier($id, $cookie->id_lang); - if(!is_null($supplier->id)) - { - $link = new Link; - $this->_menu .= ''.$supplier->name.''.PHP_EOL; - } - break; - case'LNK': - $link = MenuTopLinks::get($id, $cookie->id_lang); - if(count($link)) - $this->_menu .= '
  • '.$link[0]['label'].'
  • '.PHP_EOL; - break; - } - } + foreach ($items as $item) + { + $id = (int)substr($item, 3, strlen($item)); + switch(substr($item, 0, 3)) + { + case'CAT': + $this->getCategory($id, $cookie->id_lang); + break; + case'PRD': + $selected = ($page_name == 'product' && (Tools::getValue('id_product') == $id)) ? ' class="sfHover"' : ''; + $product = new Product($id, true, $cookie->id_lang); + if(!is_null($product->id)) + $this->_menu .= ''.$product->name.''.PHP_EOL; + break; + case'CMS': + $selected = ($page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : ''; + $cms = CMS::getLinks($cookie->id_lang, array($id)); + if(count($cms)) + $this->_menu .= ''.$cms[0]['meta_title'].''.PHP_EOL; + break; + case'MAN': + $selected = ($page_name == 'manufacturer' && (Tools::getValue('id_manufacturer') == $id)) ? ' class="sfHover"' : ''; + $manufacturer = new Manufacturer($id, $cookie->id_lang); + if(!is_null($manufacturer->id)) + { + if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) + $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false); + else + $manufacturer->link_rewrite = 0; + $link = new Link; + $this->_menu .= ''.$manufacturer->name.''.PHP_EOL; + } + break; + case'SUP': + $selected = ($page_name == 'supplier' && (Tools::getValue('id_supplier') == $id)) ? ' class="sfHover"' : ''; + $supplier = new Supplier($id, $cookie->id_lang); + if(!is_null($supplier->id)) + { + $link = new Link; + $this->_menu .= ''.$supplier->name.''.PHP_EOL; + } + break; + case'LNK': + $link = MenuTopLinks::get($id, $cookie->id_lang, (int)$this->context->shop->id); + if(count($link)) + $this->_menu .= '
  • '.$link[0]['label'].'
  • '.PHP_EOL; + break; + } + } + } } private function getCategoryOption($id_category, $id_lang, $children = true) @@ -440,4 +488,4 @@ class blocktopmenu extends Module return $this->display(__FILE__, 'blocktopmenu.tpl'); } } -?> \ No newline at end of file +?> diff --git a/modules/blocktopmenu/index.php b/modules/blocktopmenu/index.php index 4a2aa31b2..56129df6a 100644 --- a/modules/blocktopmenu/index.php +++ b/modules/blocktopmenu/index.php @@ -1,4 +1,29 @@ +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7095 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); @@ -9,4 +34,4 @@ header("Pragma: no-cache"); header("Location: ../"); exit; -?> \ No newline at end of file +?> diff --git a/modules/blocktopmenu/menutoplinks.class.php b/modules/blocktopmenu/menutoplinks.class.php index d0727e695..8de71b1f1 100644 --- a/modules/blocktopmenu/menutoplinks.class.php +++ b/modules/blocktopmenu/menutoplinks.class.php @@ -1,22 +1,50 @@ +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7095 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + class MenuTopLinks { - public static function gets($id_lang, $id_link = null) + public static function gets($id_lang, $id_link = null, $id_shop) { - return Db::getInstance()->ExecuteS(' + return Db::getInstance()->executeS(' SELECT l.id_link, l.new_window, l.link, ll.label FROM '._DB_PREFIX_.'linksmenutop l - LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_link = ll.id_link AND ll.id_lang = "'.$id_lang.'") - '.((!is_null($id_link)) ? 'WHERE l.id_link = "'.$id_link.'"' : '').' + LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_link = ll.id_link AND ll.id_lang = '.(int)$id_lang.' AND ll.id_shop='.(int)$id_shop.') + WHERE 1 + '.((!is_null($id_link)) ? ' AND l.id_link = "'.(int)$id_link.'"' : '').' + AND l.id_shop IN (0, '.(int)$id_shop.') '); } - public static function get($id_link, $id_lang) + public static function get($id_link, $id_lang, $id_shop) { - return self::gets($id_lang, $id_link); + return self::gets($id_lang, $id_link, $id_shop); } - public static function add($link, $label, $newWindow = 0) + public static function add($link, $label, $newWindow = 0, $id_shop) { if(!is_array($label)) return false; @@ -25,7 +53,8 @@ class MenuTopLinks _DB_PREFIX_.'linksmenutop', array( 'new_window'=>(int)$newWindow, - 'link'=>$link + 'link'=>pSQL($link), + 'id_shop' => (int)$id_shop ), 'INSERT' ); @@ -35,19 +64,20 @@ class MenuTopLinks Db::getInstance()->autoExecute( _DB_PREFIX_.'linksmenutop_lang', array( - 'id_link'=>$id_link, - 'id_lang'=>$id_lang, - 'label'=>$label + 'id_link'=>(int)$id_link, + 'id_lang'=>(int)$id_lang, + 'id_shop'=>(int)$id_shop, + 'label'=>pSQL($label) ), 'INSERT' ); } } - public static function remove($id_link) + public static function remove($id_link, $id_shop) { - Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', "id_link = '{$id_link}'"); - Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', "id_link = '{$id_link}'"); + Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', 'id_link = '.(int)$id_link.' AND id_shop = '.(int)$id_shop); + Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', 'id_link = '.(int)$id_link); } } -?> \ No newline at end of file +?> diff --git a/modules/cashondelivery/validation.php b/modules/cashondelivery/validation.php index fa0b68c7c..5066d3340 100644 --- a/modules/cashondelivery/validation.php +++ b/modules/cashondelivery/validation.php @@ -1,6 +1,6 @@ id_customer); if (!Validate::isLoadedObject($customer)) @@ -60,7 +60,7 @@ if (Tools::getValue('confirm')) } else { - /* or ask for confirmation */ + /* or ask for confirmation */ $smarty->assign(array( 'total' => $cart->getOrderTotal(true, Cart::BOTH), 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/cashondelivery/' @@ -68,7 +68,7 @@ else $smarty->assign('this_path', __PS_BASE_URI__.'modules/cashondelivery/'); $template = 'validation.tpl'; - echo Module::display('cashondelivery', $template); + echo $cashOnDelivery->display('cashondelivery', $template); } include(dirname(__FILE__).'/../../footer.php'); diff --git a/modules/cashticket/PrepaidServices.php b/modules/cashticket/PrepaidServices.php index 389855808..e409cdd29 100644 --- a/modules/cashticket/PrepaidServices.php +++ b/modules/cashticket/PrepaidServices.php @@ -540,7 +540,7 @@ abstract class PrepaidServices extends PaymentModule } if (!empty($params)) - $dataSync = ''; + $dataSync = ''; return $this->displayConfirmation($this->getL('settings_updated').$dataSync); } diff --git a/modules/cashticket/cashticket.php b/modules/cashticket/cashticket.php index 475c84708..0af6c588a 100644 --- a/modules/cashticket/cashticket.php +++ b/modules/cashticket/cashticket.php @@ -49,9 +49,9 @@ class CashTicket extends PrepaidServices protected $certificat_dir; - protected $register_url = array('en' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/uk', - 'fr' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/fr', - 'es' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/es'); + protected $register_url = array('en' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/uk', + 'fr' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/fr', + 'es' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/es'); public function __construct() { diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php index 066752fe3..11ad59444 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -173,6 +173,7 @@ class Cheque extends PaymentModule $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) + { $this->context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'chequeName' => $this->chequeName, @@ -180,6 +181,9 @@ class Cheque extends PaymentModule 'status' => 'ok', 'id_order' => $params['objOrder']->id )); + if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference)) + $this->context->smarty->assign('reference', $params['objOrder']->reference); + } else $this->context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); diff --git a/modules/criteo/criteo.php b/modules/criteo/criteo.php index 441da44f5..173271a54 100755 --- a/modules/criteo/criteo.php +++ b/modules/criteo/criteo.php @@ -84,7 +84,7 @@ class Criteo extends Module { return '
    - '.($this->_postProcess() ? $this->displayConfirmation($this->l('Settings are updated').'') : '').' + '.($this->_postProcess() ? $this->displayConfirmation($this->l('Settings are updated').'') : '').' '.$this->l('Criteo Export').'
    diff --git a/modules/dejala/dejala.php b/modules/dejala/dejala.php index 65aa12fbc..c8cddda02 100644 --- a/modules/dejala/dejala.php +++ b/modules/dejala/dejala.php @@ -422,7 +422,7 @@ class Dejala extends CarrierModule $method = Tools::getValue('method'); $output .= '
    - '.$this->l('Settings updated').(($method == 'signin' OR $method == 'register' OR $method == 'golive') ? '' : '').' + '.$this->l('Settings updated').(($method == 'signin' OR $method == 'register' OR $method == 'golive') ? '' : '').'
    '; } } diff --git a/modules/dibs/dibs.php b/modules/dibs/dibs.php index 5d72fcb48..0d05f2c1b 100644 --- a/modules/dibs/dibs.php +++ b/modules/dibs/dibs.php @@ -182,7 +182,7 @@ class dibs extends PaymentModule $data_sync = ''; if(self::$ID_MERCHANT !== '' AND self::$TESTING !== 1 AND self::$MORE_SETTINGS['k1'] !== '' AND self::$MORE_SETTINGS['k2'] !== '') - $data_sync = ''; + $data_sync = ''; echo '
    '.$this->l('Configuration updated').$data_sync.'
    '; } diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index 40b970606..44e569097 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -598,7 +598,7 @@ class Ebay extends Module // Displaying Information from Prestashop $stream_context = @stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2))); - $prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); + $prestashopContent = @file_get_contents('http://api.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); if (!Validate::isCleanHtml($prestashopContent)) $prestashopContent = ''; diff --git a/modules/envoimoinscher/envoimoinscher.php b/modules/envoimoinscher/envoimoinscher.php index b3f74c468..7a1790069 100755 --- a/modules/envoimoinscher/envoimoinscher.php +++ b/modules/envoimoinscher/envoimoinscher.php @@ -494,7 +494,7 @@ class Envoimoinscher extends Module AND Configuration::updateValue('EMC_DELIVERY_STATE', Tools::getValue('EMC_DELIVERY_STATE'))) { $dataSync = (($emc_login = Configuration::get('EMC_LOGIN')) - ? '' : ''); + ? '' : ''); $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); } else diff --git a/modules/favoriteproducts/FavoriteProduct.php b/modules/favoriteproducts/FavoriteProduct.php index 1005ab48f..f1f4e9cf1 100644 --- a/modules/favoriteproducts/FavoriteProduct.php +++ b/modules/favoriteproducts/FavoriteProduct.php @@ -4,10 +4,10 @@ * * NOTICE OF LICENSE * -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 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 +* http://opensource.org/licenses/afl-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. @@ -21,7 +21,7 @@ * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -112,4 +112,4 @@ class FavoriteProduct extends ObjectModel AND `id_product` = '.(int)($id_product).' AND `id_shop` = '.(int)($shop->getID())); } -} \ No newline at end of file +} diff --git a/modules/favoriteproducts/favoriteproducts-account.php b/modules/favoriteproducts/favoriteproducts-account.php index 9dff31435..432f53cd9 100644 --- a/modules/favoriteproducts/favoriteproducts-account.php +++ b/modules/favoriteproducts/favoriteproducts-account.php @@ -1,6 +1,6 @@ customer->isLogged()) Tools::redirect('authentication.php?back=modules/favoriteproducts/favoriteproducts.php'); - + include(dirname(__FILE__).'/../../header.php'); if ((int)Context::getContext()->customer->id) -{ +{ $smarty->assign('favoriteProducts', FavoriteProduct::getFavoriteProducts((int)Context::getContext()->customer->id, (int)Context::getContext()->language->id)); - echo Module::display(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl'); + $favoriteproducts = new FavoriteProducts(); + echo $favoriteproducts->display(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl'); } include(dirname(__FILE__).'/../../footer.php'); diff --git a/modules/favoriteproducts/favoriteproducts.php b/modules/favoriteproducts/favoriteproducts.php index d1c81e271..7402346e3 100644 --- a/modules/favoriteproducts/favoriteproducts.php +++ b/modules/favoriteproducts/favoriteproducts.php @@ -48,7 +48,6 @@ class FavoriteProducts extends Module { if (!parent::install() OR !$this->registerHook('myAccountBlock') - OR !$this->registerHook('customerAccount') OR !$this->registerHook('extraLeft') OR !$this->registerHook('header')) return false; diff --git a/modules/fianetfraud/fianetfraud.php b/modules/fianetfraud/fianetfraud.php index 4eeacf960..586a645fd 100644 --- a/modules/fianetfraud/fianetfraud.php +++ b/modules/fianetfraud/fianetfraud.php @@ -194,7 +194,7 @@ class Fianetfraud extends Module if (!$error) { $dataSync = ((($site_id = Configuration::get('SAC_SITEID')) AND Configuration::get('SAC_PRODUCTION')) - ? '' + ? '' : '' ); $this->_html .= '
    '.$this->l('Settings are updated').$dataSync.'
    '; diff --git a/modules/fianetsceau/fianetsceau.php b/modules/fianetsceau/fianetsceau.php index 9a839c66e..ad69abba2 100644 --- a/modules/fianetsceau/fianetsceau.php +++ b/modules/fianetsceau/fianetsceau.php @@ -81,7 +81,7 @@ class FianetSceau extends Module Configuration::updateValue('FIANET_SCEAU_PRIVATEKEY', Tools::getValue('FIANET_SCEAU_PRIVATEKEY')); if ((int)Tools::getValue('fia_net_mode')) - $dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '' : 'toto'); + $dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '' : 'toto'); else $dataSync = ''; return $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); } diff --git a/modules/hipay/hipay.php b/modules/hipay/hipay.php index 8be233509..02f2b267c 100644 --- a/modules/hipay/hipay.php +++ b/modules/hipay/hipay.php @@ -385,7 +385,7 @@ class Hipay extends PaymentModule } $i = 1; - $dataSync = 'http://www.prestashop.com/modules/hipay.png?mode='.($this->prod ? 'prod' : 'test'); + $dataSync = 'http://api.prestashop.com/modules/hipay.png?mode='.($this->prod ? 'prod' : 'test'); foreach ($accounts as $account => $null) $dataSync .= '&account'.($i++).'='.urlencode($account); @@ -612,7 +612,7 @@ class Hipay extends PaymentModule if (!is_array($this->arrayCategories)) { $this->arrayCategories = array(); - if ($xml = simplexml_load_string(file_get_contents('https://www.prestashop.com/partner/hipay/ws.php?site='.$hipaySiteId.'&accountId='.$hipayAccountId.($prod ? '&prod' : '')))) + if ($xml = simplexml_load_string(file_get_contents('https://api.prestashop.com/partner/hipay/ws.php?site='.$hipaySiteId.'&accountId='.$hipayAccountId.($prod ? '&prod' : '')))) { foreach ($xml->children() as $categoriesList) foreach ($categoriesList->children() as $category) diff --git a/modules/homefeatured/homefeatured.php b/modules/homefeatured/homefeatured.php index 9f6e06dea..9146b0897 100644 --- a/modules/homefeatured/homefeatured.php +++ b/modules/homefeatured/homefeatured.php @@ -90,12 +90,7 @@ class HomeFeatured extends Module return $output; } - public function hookDisplayHeader($params) - { - $this->context->controller->addCss($this->_path.'homefeatured.css'); - } - - public function hookDisplayHome($params) + function hookHome($params) { $category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); diff --git a/modules/homeslider/HomeSlide.php b/modules/homeslider/HomeSlide.php index 532c6dd61..a6451fec1 100644 --- a/modules/homeslider/HomeSlide.php +++ b/modules/homeslider/HomeSlide.php @@ -4,10 +4,10 @@ * * NOTICE OF LICENSE * -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 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 +* http://opensource.org/licenses/afl-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. @@ -21,7 +21,7 @@ * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -84,17 +84,17 @@ class HomeSlide extends ObjectModel )); } - public function __construct($id_slide = NULL, $id_lang = NULL, $id_shop = NULL, Context $context = NULL) + public function __construct($id_slide = null, $id_lang = null, $id_shop = null, Context $context = null) { parent::__construct($id_slide, $id_lang, $id_shop); } - public function add($autodate = true, $nullValues = false) + public function add($autodate = true, $null_values = false) { $context = Context::getContext(); $id_shop = $context->shop->getID(); - $res = parent::add($autodate, $nullValues); + $res = parent::add($autodate, $null_values); $res &= Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'homeslider` (`id_shop`, `id_slide`) VALUES('.(int)$id_shop.', '.(int)$this->id.')' @@ -155,4 +155,4 @@ class HomeSlide extends ObjectModel } return true; } -} \ No newline at end of file +} diff --git a/modules/homeslider/ajax_homeslider.php b/modules/homeslider/ajax_homeslider.php index 5d3470318..9e39f82bd 100644 --- a/modules/homeslider/ajax_homeslider.php +++ b/modules/homeslider/ajax_homeslider.php @@ -4,10 +4,10 @@ * * NOTICE OF LICENSE * -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 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 +* http://opensource.org/licenses/afl-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. @@ -21,7 +21,7 @@ * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include_once('../../config/config.inc.php'); diff --git a/modules/homeslider/homeslider.php b/modules/homeslider/homeslider.php index e425d04bb..36ae4b757 100644 --- a/modules/homeslider/homeslider.php +++ b/modules/homeslider/homeslider.php @@ -4,10 +4,10 @@ * * NOTICE OF LICENSE * -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 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 +* http://opensource.org/licenses/afl-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. @@ -21,10 +21,15 @@ * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ +/** + * @since 1.5.0 + * @version 1.1 (2011-11-23) + */ + if (!defined('_PS_VERSION_')) exit; @@ -38,7 +43,7 @@ class HomeSlider extends Module { $this->name = 'homeslider'; $this->tab = 'front_office_features'; - $this->version = '1.0'; + $this->version = '1.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->secure_key = Tools::encrypt($this->name); @@ -164,7 +169,7 @@ class HomeSlider extends Module
    '.$this->l('Slider configuration').''; /* Begin form */ - $this->_html .= ''; + $this->_html .= ''; /* Height field */ $this->_html .= ' @@ -213,7 +218,7 @@ class HomeSlider extends Module /* Display notice if there are no slides yet */ if (!$slides) - $this->_html .= '

    '.$this->l("You did not add any slides yet.").'

    '; + $this->_html .= '

    '.$this->l('You did not add any slides yet.').'

    '; else /* Display slides */ { $this->_html .= ' @@ -255,7 +260,7 @@ class HomeSlider extends Module $this->_html = ''; /* Form */ - $this->_html .= ''; + $this->_html .= ''; /* Fieldset Upload */ $this->_html .= ' @@ -465,7 +470,10 @@ class HomeSlider extends Module else if (Tools::isSubmit('changeStatus') && Tools::isSubmit('id_slide')) { $slide = new HomeSlide((int)Tools::getValue('id_slide')); - $slide->active = (int)($slide->active == 0 ? 1 : 0); + if ($slide->active == 0) + $slide->active = 1; + else + $slide->active = 0; $res = $slide->update(); $this->_html = ($res ? $this->displayConfirmation($this->l('Configuration updated')) : $this->displayErro($this->l('Configuration could not be updated'))); } @@ -502,16 +510,19 @@ class HomeSlider extends Module if (Tools::getValue('description_'.$language['id_lang']) != '') $slide->description[$language['id_lang']] = pSQL(Tools::getValue('description_'.$language['id_lang'])); /* Uploads image and sets slide */ - if (isset($_FILES['image_'.$language['id_lang']]) && isset($_FILES['image_'.$language['id_lang']]['tmp_name']) && !empty($_FILES['image_'.$language['id_lang']]['tmp_name'])) + if (isset($_FILES['image_'.$language['id_lang']]) && + isset($_FILES['image_'.$language['id_lang']]['tmp_name']) && + !empty($_FILES['image_'.$language['id_lang']]['tmp_name'])) { + $temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS'); if ($error = checkImage($_FILES['image_'.$language['id_lang']])) $errors .= $error; - else if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $tmpName)) + else if (!$temp_name || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $temp_name)) return false; - else if (!imageResize($tmpName, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg')) + else if (!imageResize($temp_name, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg')) $errors .= $this->displayError($this->l('An error occurred during the image upload.')); - if (isset($tmpName)) - unlink($tmpName); + if (isset($temp_name)) + unlink($temp_name); $slide->image[$language['id_lang']] = pSQL(Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name']).'.jpg'); } if (Tools::getValue('image_old_'.$language['id_lang']) != '') @@ -568,7 +579,7 @@ class HomeSlider extends Module { if (!$this->getSlides(true)) return; - $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js'); + $this->context->controller->addJqueryUI('ui.sortable'); $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js'); $this->context->controller->addCSS($this->_path.'bx_styles.css'); $this->context->controller->addJS($this->_path.'js/homeslider.js'); @@ -576,6 +587,9 @@ class HomeSlider extends Module public function hookBackOfficeTop() { + if (Tools::getValue('controller') != 'AdminModules' && Tools::getValue('configure') != $this->name) + return; + /* Style & js for fieldset 'slides configuration' */ $html = ' - + '; return $html; } @@ -311,8 +334,9 @@ class TntCarrier extends CarrierModule private function _displayFormAccount() { global $smarty; - $var = array('login' => Tools::getValue('tnt_carrier_login', Configuration::get('TNT_CARRIER_LOGIN')), 'password' => Tools::getValue('tnt_carrier_password', Configuration::get('TNT_CARRIER_PASSWORD')), - 'account' => Tools::getValue('tnt_carrier_number_account', Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'))); + $var = array('login' => htmlentities(Tools::getValue('tnt_carrier_login', Configuration::get('TNT_CARRIER_LOGIN'))), + 'password' => htmlentities(Tools::getValue('tnt_carrier_password', Configuration::get('TNT_CARRIER_PASSWORD'))), + 'account' => htmlentities(Tools::getValue('tnt_carrier_number_account', Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT')))); $smarty->assign('varAccount', $var); return $this->display( __FILE__, 'tpl/accountForm.tpl' ); } @@ -348,13 +372,13 @@ class TntCarrier extends CarrierModule foreach ($serviceList as $k => $v) { $serviceList[$k]['optionId'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_ID'); - $serviceList[$k]['optionOvercost'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST'); + $serviceList[$k]['optionOvercost'] = (Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST') ? Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST') : '0'); } $var = array('serviceList' => $serviceList, - 'action' => Tools::getValue('action'), - 'section' => Tools::getValue('section'), - 'form' => $this->_displayFormService(Tools::getValue('service'))); + 'action' => htmlentities(Tools::getValue('action')), + 'section' => htmlentities(Tools::getValue('section')), + 'form' => $this->_displayFormService(htmlentities(Tools::getValue('service')))); $smarty->assign('varService', $var); return $this->display( __FILE__, 'tpl/service.tpl' ); } @@ -364,35 +388,35 @@ class TntCarrier extends CarrierModule if (Tools::getValue('action') == 'del' && Tools::getValue($cat) != '') { $id = Tools::getValue($cat); - Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = '.(int)$id.''); + Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'` WHERE `id_'.bqSQL($cat).'` = '.(int)$id.''); } $html = ' - - add '.$this->l('New weight option').'

    + + add '.$this->l('Add additional charges depending on the package weight').'

    '; - $List = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` ORDER BY `id_'.$cat.'`'); + $List = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'` ORDER BY `id_'.bqSQL($cat).'`'); $irow = 0; foreach ($List as $v) { $html .= ' - + '; } $html .= '
    '.$this->l('ID').''.$this->l('Weight Min').''.$this->l('Weight Max').''.$this->l('Additionnal charge (Euros)').'
    '.$v['id_'.$cat.''].' '.$v[''.$cat.'_min'].''.$v[''.$cat.'_max'].''.((float)$v[''.$cat.'_max'] == 0 ? '∞' : $v[''.$cat.'_max']).' '.$v['additionnal_charges'].' - + edit - + delete

    -
    '.((Tools::getValue('action') == 'edit' || Tools::getValue('action') == 'new') && Tools::getValue('section') == $cat ? $this->_displayFormInfo($cat, Tools::getValue($cat)) : '').'
    +
    '.((Tools::getValue('action') == 'edit' || Tools::getValue('action') == 'new') && Tools::getValue('section') == $cat ? $this->_displayFormInfo(htmlentities($cat), htmlentities(Tools::getValue($cat))) : '').'
    '; return $html; @@ -404,11 +428,11 @@ class TntCarrier extends CarrierModule $var = array( 'country' => $country, - 'overcost' => Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST'), - 'action' => Tools::getValue('action'), - 'section' => Tools::getValue('section'), - 'getCountry' => Tools::getValue('country'), - 'form' => (Tools::getValue('country') != '' ? $this->_displayFormCountry(Tools::getValue('country')) : '') + 'overcost' => (Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST') ? Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST') : '0'), + 'action' => htmlentities(Tools::getValue('action')), + 'section' => htmlentities(Tools::getValue('section')), + 'getCountry' => htmlentities(Tools::getValue('country')), + 'form' => (Tools::getValue('country') != '' ? $this->_displayFormCountry(htmlentities(Tools::getValue('country'))) : '') ); $smarty->assign('varCountry', $var); return $this->display( __FILE__, 'tpl/country.tpl' ); @@ -437,7 +461,7 @@ class TntCarrier extends CarrierModule $display = $service[0]['deleted']; } } - $var = array('id' => $id,'name' => $name, 'description' => $description, 'code' => $code, 'charge' => $charge, 'display' => $display); + $var = array('id' => $id, 'name' => $name, 'description' => $description, 'code' => $code, 'charge' => $charge, 'display' => $display); $smarty->assign('varServiceForm', $var); return $this->display( __FILE__, 'tpl/serviceForm.tpl' ); } @@ -452,22 +476,22 @@ class TntCarrier extends CarrierModule { $info = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = "'.$id.'"'); $info_min = $info[0][$cat.'_min']; - $info_max = $info[0][$cat.'_max']; + $info_max = ((float)$info[0][$cat.'_max'] == 0 ? '': $info[0][$cat.'_max']); $charge = $info[0]['additionnal_charges']; } $html = ' - - '.($id != null ? '' : '').' + + '.($id != null ? '' : '').' - + - +
    '.$this->l('Weight min').''.$this->l('Weight max').''.$this->l('Additionnal charge').''.$this->l('Weight min').''.$this->l('Weight max (can be empty)').''.$this->l('Additionnal charge').'
    '; @@ -511,7 +535,7 @@ class TntCarrier extends CarrierModule $password = Tools::getValue('tnt_carrier_password'); $number = Tools::getValue('tnt_carrier_number_account'); if (!$login || !$password || !$number) - $this->_postErrors[] = $this->l("All the fields are required"); + $this->_postErrors[] = $this->l('All the fields are required'); Configuration::updateValue('TNT_CARRIER_LOGIN', $login); Configuration::updateValue('TNT_CARRIER_PASSWORD', $password); Configuration::updateValue('TNT_CARRIER_NUMBER_ACCOUNT', $number); @@ -519,7 +543,7 @@ class TntCarrier extends CarrierModule private function _postValidationShipping() { - $collect = $email = Tools::getValue('tnt_carrier_shipping_collect'); + $collect = '1';//Tools::getValue('tnt_carrier_shipping_collect'); $company = Tools::getValue('tnt_carrier_shipping_company'); $pex = Tools::getValue('tnt_carrier_shipping_pex'); $lname = Tools::getValue('tnt_carrier_shipping_last_name'); @@ -535,23 +559,25 @@ class TntCarrier extends CarrierModule $print = Tools::getValue('tnt_carrier_print_sticker'); if (!$collect && $pex == '') - $this->_postErrors[] = $this->l("The pex code is missing"); + $this->_postErrors[] = $this->l('The pex code is missing'); if ($collect && $company == '') - $this->_postErrors[] = $this->l("Your company name is missing"); + $this->_postErrors[] = $this->l('Company name is missing'); if ($collect && !$lname) - $this->_postErrors[] = $this->l("Your last name is missing"); + $this->_postErrors[] = $this->l('Contact last name is missing'); if ($collect && !$fname) - $this->_postErrors[] = $this->l("Your first name is missing"); + $this->_postErrors[] = $this->l('Contact first name is missing'); if (!$address1) - $this->_postErrors[] = $this->l("Your address is missing"); + $this->_postErrors[] = $this->l('Address is missing'); + if (isset($address2) && strlen($address2) >= 32) + $this->_postErrors[] = $this->l('Address line 2 must be under 32 characters'); if (!$postal_code) - $this->_postErrors[] = $this->l("Your zip code is missing"); + $this->_postErrors[] = $this->l('Postal code is missing'); if (!$email) - $this->_postErrors[] = $this->l("Your email address is missing"); + $this->_postErrors[] = $this->l('Contact email address is missing'); if (!$phone) - $this->_postErrors[] = $this->l("Your phone number is missing"); + $this->_postErrors[] = $this->l('Contact phone number is missing'); if ($collect && $closing == '') - $this->_postErrors[] = $this->l("Your closing time is missing"); + $this->_postErrors[] = $this->l('Company closing time is missing'); Configuration::updateValue('TNT_CARRIER_SHIPPING_COLLECT', $collect); Configuration::updateValue('TNT_CARRIER_SHIPPING_COMPANY', $company); @@ -624,12 +650,12 @@ class TntCarrier extends CarrierModule Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_option', array('id_carrier' => (int)($id_carrier), - 'option' => $code, + 'option' => pSQL($code), 'additionnal_charges' => (float)($charge)),'INSERT'); - Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id_carrier)); - Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); - $this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); - $this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id_carrier); + Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_ID', (int)($id_carrier)); + Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_OVERCOST', (float)($charge)); + $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_OVERCOST'] = (float)($charge); + $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_ID'] = (float)($id_carrier); $this->_html .= $this->displayConfirmation($this->l('Service updated')); } } @@ -656,13 +682,13 @@ class TntCarrier extends CarrierModule if (!$this->_postErrors) { - Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `name` = "'.$name.'", `deleted` = "'.(int)($display).'" WHERE `id_carrier` = '.(int)($id).''); - Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier_lang` SET `delay` = "'.$description.'" WHERE `id_carrier` = '.(int)($id).''); - Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_option` SET `option` = "'.$code.'" WHERE `id_carrier` = '.(int)($id).''); - Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); - Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id)); - $this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); - $this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `name` = "'.pSQL($name).'", `deleted` = "'.(int)($display).'" WHERE `id_carrier` = '.(int)($id).''); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier_lang` SET `delay` = "'.pSQL($description).'" WHERE `id_carrier` = '.(int)($id).''); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_option` SET `option` = "'.pSQL($code).'" WHERE `id_carrier` = '.(int)($id).''); + Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_OVERCOST', (float)($charge)); + Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_ID', (int)($id)); + $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_OVERCOST'] = (float)($charge); + $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_ID'] = (float)($id); $this->_html .= $this->displayConfirmation($this->l('Service updated')); } } @@ -672,10 +698,10 @@ class TntCarrier extends CarrierModule $info_min = Tools::getValue('tnt_carrier_'.$cat.'_min'); $info_max = Tools::getValue('tnt_carrier_'.$cat.'_max'); $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); - Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_'.$cat.'', + Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'', array( - ''.$cat.'_min' => (float)($info_min), - ''.$cat.'_max' => (float)($info_max), + ''.pSQL($cat).'_min' => (float)($info_min), + ''.pSQL($cat).'_max' => (float)($info_max), 'additionnal_charges' => (float)($charge)),'INSERT'); $this->_html .= $this->displayConfirmation($this->l('Service updated')); } @@ -688,10 +714,10 @@ class TntCarrier extends CarrierModule $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` - SET `'.$cat.'_min` = "'.(float)($info_min).'", - `'.$cat.'_max` = "'.(float)($info_max).'", + SET `'.bqSQL($cat).'_min` = "'.(float)($info_min).'", + `'.bqSQL($cat).'_max` = "'.(float)($info_max).'", `additionnal_charges` = "'.(float)$charge.'" - WHERE `id_'.$cat.'` = '.(int)($id).''); + WHERE `id_'.bqSQL($cat).'` = '.(int)($id).''); $this->_html .= $this->displayConfirmation($this->l('Service updated')); } @@ -704,6 +730,11 @@ class TntCarrier extends CarrierModule Configuration::updateValue('TNT_CARRIER_'.strtoupper($country).'_OVERCOST', $overcost); } + public function get_followup($shipping_number) + { + return false; + } + /* ** Hook update carrier ** @@ -712,7 +743,7 @@ class TntCarrier extends CarrierModule { global $smarty; $id_cart = $params['cart']->id; - $smarty->assign('id_cart', $id_cart); + $smarty->assign('id_cart', (int)$id_cart); return $this->display( __FILE__, 'tpl/relaisColis.tpl' ); } @@ -823,6 +854,7 @@ class TntCarrier extends CarrierModule $erreur = null; $follow = array(); $carrierName = Db::getInstance()->ExecuteS('SELECT external_module_name FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = "'.(int)($id_carrier).'"'); + if ($carrierName != null && $carrierName[0]['external_module_name'] == $this->_moduleName && $shipping_number != '') { $pack = new PackageTnt($params['order']->id); @@ -834,6 +866,10 @@ class TntCarrier extends CarrierModule public function hookupdateCarrier($params) { + $option = Db::getInstance()->ExecuteS('SELECT option + FROM `'._DB_PREFIX_.'tnt_carrier_option` + WHERE id_carrier = "'.(int)$params['id_carrier'].'"'); + Configuration::updateValue('TNT_CARRIER_'.$option[0]['option'].'_ID', (int)($params['carrier']->id)); } /* @@ -849,6 +885,8 @@ class TntCarrier extends CarrierModule public function getOrderShippingCost($params, $shipping_cost) { + if (!Tools::getValue('step')) + return false; if ((int)(Tools::getValue('step')) > 2) serviceCache::deleteServices($params->id); $product = $params->getProducts(); @@ -857,6 +895,7 @@ class TntCarrier extends CarrierModule $id_customer = $params->id_customer; $date_exp = $params->date_upd; $id_adress_delivery = $params->id_address_delivery; + $info = Db::getInstance()->ExecuteS('SELECT postcode, city, company FROM `'._DB_PREFIX_.'address` WHERE `id_address` = "'.(int)($id_adress_delivery).'"'); foreach($product as $k => $v) $weight += (float)($v['weight']); @@ -867,7 +906,6 @@ class TntCarrier extends CarrierModule return false; if (!Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY')) return false; - $info = Db::getInstance()->ExecuteS('SELECT postcode, city, company FROM `'._DB_PREFIX_.'address` WHERE `id_address` = "'.(int)($id_adress_delivery).'"'); $serviceCache = new serviceCache($params->id, $info[0]['postcode']); if (!$serviceCache->getFaisabilityAtThisTime()) @@ -902,18 +940,13 @@ class TntCarrier extends CarrierModule $priceCarrier = Configuration::get('TNT_CARRIER_'.$v['code'].'_OVERCOST'); } } - if (!isset($priceCarrier)) + if (!isset($priceCarrier)) { - if (isset($params->id_carrier) && (int)($params->id_carrier) > 0) - { - if ($option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($params->id_carrier).'"')) - $priceCarrier = Configuration::get('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST'); - } - else - $priceCarrier = 0; + if ($option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($this->id_carrier).'"')) + $priceCarrier = Configuration::get('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST'); } - - $weightLimit = Db::getInstance()->ExecuteS('SELECT additionnal_charges FROM `'._DB_PREFIX_.'tnt_carrier_weight` WHERE `weight_min` < "'.(float)($weight).'" AND `weight_max` > "'.(float)($weight).'"'); + $zero = 0; + $weightLimit = Db::getInstance()->ExecuteS('SELECT additionnal_charges FROM `'._DB_PREFIX_.'tnt_carrier_weight` WHERE `weight_min` < "'.(float)($weight).'" AND (`weight_max` > "'.(float)($weight).'" OR `weight_max` = "'.(float)$zero.'")'); $currency = Db::getInstance()->ExecuteS('SELECT conversion_rate FROM `'._DB_PREFIX_.'currency` WHERE `id_currency` = "'.(int)($params->id_currency).'"'); if ($weightLimit != null) $add += (float)($weightLimit[0]['additionnal_charges']); @@ -942,4 +975,4 @@ class TntCarrier extends CarrierModule $new = array("ST", " "); return (str_replace($old, $new, $city)); } -} \ No newline at end of file +} diff --git a/modules/treepodia/treepodia.php b/modules/treepodia/treepodia.php index 35d306ec4..f9c183b1e 100644 --- a/modules/treepodia/treepodia.php +++ b/modules/treepodia/treepodia.php @@ -705,7 +705,7 @@ XML; $this->registerHook('productFooter'); } - $dataSync = ''; + $dataSync = ''; return $this->displayConfirmation($this->l('Settings updated').$dataSync); } diff --git a/modules/vatnumber/VATNumberTaxManager.php b/modules/vatnumber/VATNumberTaxManager.php index 7edd50685..7a088c506 100755 --- a/modules/vatnumber/VATNumberTaxManager.php +++ b/modules/vatnumber/VATNumberTaxManager.php @@ -4,10 +4,10 @@ * * NOTICE OF LICENSE * -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 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 +* http://opensource.org/licenses/afl-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. @@ -21,7 +21,7 @@ * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/modules/vatnumber/vatnumber.php b/modules/vatnumber/vatnumber.php index 21ba5e97d..303fb5fb6 100755 --- a/modules/vatnumber/vatnumber.php +++ b/modules/vatnumber/vatnumber.php @@ -34,13 +34,17 @@ class VatNumber extends TaxManagerModule { $this->name = 'vatnumber'; $this->tab = 'billing_invoicing'; - $this->version = 1.0; + $this->version = 1.2; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->tax_manager_class = 'VATNumberTaxManager'; parent::__construct(); + $id_country = (int)Configuration::get('VATNUMBER_COUNTRY'); + + if ($id_country == 0) + $this->warning = $this->l('No default country set.'); $this->displayName = $this->l('European VAT number'); $this->description = $this->l('Enable entering of the VAT intra-community number when creating the address (You must fill in the company field to allow keyboarding VAT number)');