Merge branch 'release' into development

This commit is contained in:
François Gaillard committed 2013-03-07 18:11:34 +01:00
commit 8e357caaa1
23 files changed
+162 -81

No files matched your search

@@ -39,13 +39,13 @@
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if} {if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
name="latitude" name="latitude"
id="latitude" id="latitude"
value="{$fields_value[$input.name]|htmlentities}" /> / value="{$fields_value[$input.name]|escape:'htmlall'}" /> /
<input type="text" <input type="text"
{if isset($input.size)}size="{$input.size}"{/if} {if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if} {if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
name="longitude" name="longitude"
id="longitude" id="longitude"
value="{$fields_value['longitude']|htmlentities}" /> value="{$fields_value['longitude']|escape:'htmlall'}" />
{else} {else}
{$smarty.block.parent} {$smarty.block.parent}
{/if} {/if}
@@ -82,7 +82,7 @@
{foreach $fields_value.days as $k => $value} {foreach $fields_value.days as $k => $value}
<tr style="color: #7F7F7F; font-size: 0.85em;"> <tr style="color: #7F7F7F; font-size: 0.85em;">
<td>{$value}</td> <td>{$value}</td>
<td><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|htmlentities}{/if}" /><br /></td> <td><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|escape:'htmlall'}{/if}" /><br /></td>
</tr> </tr>
{/foreach} {/foreach}
</table> </table>
+3 -1
View File
@@ -131,6 +131,7 @@ class Autoload
if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename))) if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename)))
{ {
header('HTTP/1.1 503 temporarily overloaded'); header('HTTP/1.1 503 temporarily overloaded');
// Cannot use PrestaShopException in this context
die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.'); die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.');
} }
else else
@@ -154,7 +155,8 @@ class Autoload
if (!$integrity_is_ok) if (!$integrity_is_ok)
{ {
file_put_contents($filename, '<?php return array(); ?>'); file_put_contents($filename, '<?php return array(); ?>');
throw new PrestaShopException('Your file '.$filename.' is corrupted. Please remove this file, a new one will be regenerated automatically'); // Cannot use PrestaShopException in this context
die('Your file '.$filename.' is corrupted. Please remove this file, a new one will be regenerated automatically');
} }
} }
+1 -1
View File
@@ -292,7 +292,7 @@ class CartCore extends ObjectModel
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice') if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice')
$address_id = (int)$cart->id_address_invoice; $address_id = (int)$cart->id_address_invoice;
else else
$address_id = (int)$product->id_address_delivery; // Get delivery address of the product from the cart $address_id = (int)$product['id_address_delivery']; // Get delivery address of the product from the cart
if (!Address::addressExists($address_id)) if (!Address::addressExists($address_id))
$address_id = null; $address_id = null;
+11 -11
View File
@@ -65,7 +65,7 @@ class MailCore
'PS_MAIL_SMTP_PORT', 'PS_MAIL_SMTP_PORT',
'PS_MAIL_METHOD', 'PS_MAIL_METHOD',
'PS_MAIL_TYPE' 'PS_MAIL_TYPE'
)); ), null, null, $id_shop);
// Returns immediatly if emails are deactivated // Returns immediatly if emails are deactivated
if ($configuration['PS_MAIL_METHOD'] == 3) if ($configuration['PS_MAIL_METHOD'] == 3)
@@ -183,7 +183,7 @@ class MailCore
if (!$connection) if (!$connection)
return false; return false;
$swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN')); $swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN', null, null, $id_shop));
/* Get templates content */ /* Get templates content */
$iso = Language::getIsoById((int)$id_lang); $iso = Language::getIsoById((int)$id_lang);
if (!$iso) if (!$iso)
@@ -197,13 +197,13 @@ class MailCore
$override_mail = false; $override_mail = false;
// get templatePath // get templatePath
if (preg_match('#'.__PS_BASE_URI__.'modules/#', $template_path) && preg_match('#modules/([a-z0-9_-]+)/#ui', $template_path, $res)) if (preg_match('#'.__PS_BASE_URI__.'modules/#', str_replace(DIRECTORY_SEPARATOR, '/', $template_path)) && preg_match('#modules/([a-z0-9_-]+)/#ui', str_replace(DIRECTORY_SEPARATOR, '/',$template_path), $res))
$module_name = $res[1]; $module_name = $res[1];
if ($module_name !== false && (file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.txt') || if ($module_name !== false && (file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.txt') ||
file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.html'))) file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.html')))
$template_path = $theme_path.'modules/'.$module_name.'/mails/'; $template_path = $theme_path.'modules/'.$module_name.'/mails/';
else if (file_exists($theme_path.'mails/'.$template.'.txt') || file_exists($theme_path.'mails/'.$template.'.html')) elseif (file_exists($theme_path.'mails/'.$template.'.txt') || file_exists($theme_path.'mails/'.$template.'.html'))
{ {
$template_path = $theme_path.'mails/'; $template_path = $theme_path.'mails/';
$override_mail = true; $override_mail = true;
@@ -229,19 +229,19 @@ class MailCore
include_once(_PS_MAIL_DIR_.$iso.'/lang.php'); include_once(_PS_MAIL_DIR_.$iso.'/lang.php');
/* Create mail and attach differents parts */ /* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '.$subject); $message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
/* Set Message-ID - getmypid() is blocked on some hosting */ /* Set Message-ID - getmypid() is blocked on some hosting */
$message->setId(Mail::generateId()); $message->setId(Mail::generateId());
$message->headers->setEncoding('Q'); $message->headers->setEncoding('Q');
if (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))) if (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $id_shop)))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'); $logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $id_shop);
else else
{ {
if (file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO'))) if (file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop)))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO'); $logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop);
else else
$template_vars['{shop_logo}'] = ''; $template_vars['{shop_logo}'] = '';
} }
@@ -250,12 +250,12 @@ class MailCore
if (isset($logo)) if (isset($logo))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo))); $template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo)));
$template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME')); $template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME', null, null, $id_shop));
$template_vars['{shop_url}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'index.php'; $template_vars['{shop_url}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'index.php';
$template_vars['{my_account_url}'] = Context::getContext()->link->getPageLink('my-account', true, Context::getContext()->language->id); $template_vars['{my_account_url}'] = Context::getContext()->link->getPageLink('my-account', true, Context::getContext()->language->id);
$template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, Context::getContext()->language->id); $template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, Context::getContext()->language->id);
$template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, Context::getContext()->language->id); $template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, Context::getContext()->language->id);
$template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR')); $template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR', null, null, $id_shop));
$swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $template_vars)), 'decorator'); $swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $template_vars)), 'decorator');
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT) if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT)
$message->attach(new Swift_Message_Part($template_txt, 'text/plain', '8bit', 'utf-8')); $message->attach(new Swift_Message_Part($template_txt, 'text/plain', '8bit', 'utf-8'));
+1 -1
View File
@@ -148,7 +148,7 @@ class NotificationCore
return Db::getInstance()->execute(' return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'employee` UPDATE `'._DB_PREFIX_.'employee`
SET `id_last_'.bqSQL($type).'` = ( SET `id_last_'.bqSQL($type).'` = (
SELECT MAX(`id_'.$type.'`) SELECT IFNULL(MAX(`id_'.$type.'`), 0)
FROM `'._DB_PREFIX_.(($type == 'order') ? bqSQL($type).'s' : bqSQL($type)).'` FROM `'._DB_PREFIX_.(($type == 'order') ? bqSQL($type).'s' : bqSQL($type)).'`
) )
WHERE `id_employee` = '.(int)$cookie->id_employee); WHERE `id_employee` = '.(int)$cookie->id_employee);
+20 -1
View File
@@ -4737,7 +4737,8 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la
ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.') ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\' WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\'
AND pa.`id_product` = '.(int)$id_product); AND pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute);
if (!empty($nb_custom_values)) if (!empty($nb_custom_values))
{ {
@@ -4780,6 +4781,7 @@ class ProductCore extends ObjectModel
ON (pac.`id_product_attribute` = pa.`id_product_attribute`) ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').' '.Shop::addSqlAssociation('product_attribute', 'pa').'
WHERE pa.`id_product` = '.(int)$id_product.' WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.id_product_attribute = '.(int)$id_product_attribute.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')'); AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
$result = array_merge($values_not_custom, $result); $result = array_merge($values_not_custom, $result);
} }
@@ -5213,6 +5215,23 @@ class ProductCore extends ObjectModel
); );
} }
public static function getIdTaxRulesGroupMostUsed()
{
return Db::getInstance()->getValue('
SELECT id_tax_rules_group
FROM (
SELECT COUNT(*) n, product_shop.id_tax_rules_group
FROM '._DB_PREFIX_.'product p
'.Shop::addSqlAssociation('product', 'p').'
JOIN '._DB_PREFIX_.'tax_rules_group trg ON (product_shop.id_tax_rules_group = trg.id_tax_rules_group)
WHERE trg.active = 1
GROUP BY product_shop.id_tax_rules_group
ORDER BY n DESC
LIMIT 1
) most_used'
);
}
/** /**
* For a given ean13 reference, returns the corresponding id * For a given ean13 reference, returns the corresponding id
* *
+3 -3
View File
@@ -1201,11 +1201,11 @@ class AdminControllerCore extends Controller
$this->context->smarty->assign('conf', $this->_conf[(int)$conf]); $this->context->smarty->assign('conf', $this->_conf[(int)$conf]);
$notifications_type = array('errors', 'warnings', 'informations', 'confirmations'); $notifications_type = array('errors', 'warnings', 'informations', 'confirmations');
foreach($notifications_type as $type) foreach($notifications_type as $type)
if ($this->json) if ($this->json)
$this->context->smarty->assign($type, Tools::jsonEncode($this->$type)); $this->context->smarty->assign($type, Tools::jsonEncode(array_unique($this->$type)));
else else
$this->context->smarty->assign($type, $this->$type); $this->context->smarty->assign($type, array_unique($this->$type));
if ($this->json) if ($this->json)
$this->context->smarty->assign('page', Tools::jsonEncode($page)); $this->context->smarty->assign('page', Tools::jsonEncode($page));
+1
View File
@@ -330,6 +330,7 @@ class FrontControllerCore extends Controller
'shop_name' => Configuration::get('PS_SHOP_NAME'), 'shop_name' => Configuration::get('PS_SHOP_NAME'),
'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'), 'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
'use_taxes' => (int)Configuration::get('PS_TAX'), 'use_taxes' => (int)Configuration::get('PS_TAX'),
'show_taxes' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && (int)Configuration::get('PS_TAX')),
'display_tax_label' => (bool)$display_tax_label, 'display_tax_label' => (bool)$display_tax_label,
'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'), 'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'), 'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
+1 -6
View File
@@ -51,12 +51,7 @@ class PrestaShopExceptionCore extends Exception
</style>'; </style>';
echo '<div id="psException">'; echo '<div id="psException">';
echo '<h2>['.get_class($this).']</h2>'; echo '<h2>['.get_class($this).']</h2>';
printf( echo $this->getExentedMessage();
'<p><b>%s</b><br /><i>at line </i><b>%d</b><i> in file </i><b>%s</b></p>',
Tools::safeOutput($this->getMessage()),
$this->getLine(),
ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $this->getFile()), '/')
);
$this->displayFileDebug($this->getFile(), $this->getLine()); $this->displayFileDebug($this->getFile(), $this->getLine());
+1 -1
View File
@@ -54,7 +54,7 @@ class PDFCore
public function render($display = true) public function render($display = true)
{ {
$render = false; $render = false;
$this->pdf_renderer->setFontForLang('fr'); $this->pdf_renderer->setFontForLang(Context::getContext()->language->iso_code);
foreach ($this->objects as $object) foreach ($this->objects as $object)
{ {
$template = $this->getTemplateObject($object); $template = $this->getTemplateObject($object);
+4 -3
View File
@@ -39,7 +39,7 @@ class PDFGeneratorCore extends TCPDF
public $content; public $content;
public $font; public $font;
public $font_by_lang = array('jp' => 'cid0jp'); public $font_by_lang = array('ja' => 'cid0jp', 'ru' => 'freeserif', 'el' => 'freeserif', 'vn' => 'dejavusans', 'pl' => 'dejavusans');
public function __construct($use_cache = false) public function __construct($use_cache = false)
@@ -93,11 +93,12 @@ class PDFGeneratorCore extends TCPDF
public function setFontForLang($iso_lang) public function setFontForLang($iso_lang)
{ {
$this->font = PDFGenerator::DEFAULT_FONT; $this->font = PDFGenerator::DEFAULT_FONT;
$this->setHeaderFont(array(PDFGenerator::DEFAULT_FONT, '', PDF_FONT_SIZE_MAIN));
$this->setFooterFont(array(PDFGenerator::DEFAULT_FONT, '', PDF_FONT_SIZE_MAIN));
if (array_key_exists($iso_lang, $this->font_by_lang)) if (array_key_exists($iso_lang, $this->font_by_lang))
$this->font = $this->font_by_lang[$iso_lang]; $this->font = $this->font_by_lang[$iso_lang];
$this->setHeaderFont(array($this->font, '', PDF_FONT_SIZE_MAIN));
$this->setFooterFont(array($this->font, '', PDF_FONT_SIZE_MAIN));
$this->setFont($this->font); $this->setFont($this->font);
} }
+4 -1
View File
@@ -943,7 +943,10 @@ class ShopCore extends ObjectModel
public static function addSqlRestrictionOnLang($alias = null, $id_shop = null) public static function addSqlRestrictionOnLang($alias = null, $id_shop = null)
{ {
if (is_null($id_shop)) if (is_null($id_shop))
$id_shop = Shop::getContextShopID(); $id_shop = (int)Context::getContext()->shop->id;
if (!$id_shop)
$id_shop = (int)Configuration::get('PS_SHOP_DEFAULT');
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$id_shop.' '; return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$id_shop.' ';
} }
+9 -7
View File
@@ -141,13 +141,6 @@ else
$context->cookie = $cookie; $context->cookie = $cookie;
/* if the language stored in the cookie is not available language, use default language */
if (isset($cookie->id_lang) && $cookie->id_lang)
$language = new Language($cookie->id_lang);
if (!isset($language) || !Validate::isLoadedObject($language))
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
$context->language = $language;
/* Create employee if in BO, customer else */ /* Create employee if in BO, customer else */
if (defined('_PS_ADMIN_DIR_')) if (defined('_PS_ADMIN_DIR_'))
{ {
@@ -158,10 +151,19 @@ if (defined('_PS_ADMIN_DIR_'))
if ($employee->id_profile != _PS_ADMIN_PROFILE_) if ($employee->id_profile != _PS_ADMIN_PROFILE_)
Shop::cacheShops(true); Shop::cacheShops(true);
$language = new Language($employee->id_lang);
$context->language = $language;
$cookie->id_lang = (int)$employee->id_lang; $cookie->id_lang = (int)$employee->id_lang;
} }
else else
{ {
/* if the language stored in the cookie is not available language, use default language */
if (isset($cookie->id_lang) && $cookie->id_lang)
$language = new Language($cookie->id_lang);
if (!isset($language) || !Validate::isLoadedObject($language))
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
$context->language = $language;
if (isset($cookie->id_customer) && (int)$cookie->id_customer) if (isset($cookie->id_customer) && (int)$cookie->id_customer)
{ {
$customer = new Customer($cookie->id_customer); $customer = new Customer($cookie->id_customer);
+8 -8
View File
@@ -68,7 +68,14 @@ class AdminCmsControllerCore extends AdminController
public function renderForm() public function renderForm()
{ {
if (!$this->loadObject(true))
return;
if (Validate::isLoadedObject($this->object))
$this->display = 'edit';
else
$this->display = 'add';
$this->toolbar_btn['save-and-preview'] = array( $this->toolbar_btn['save-and-preview'] = array(
'href' => '#', 'href' => '#',
'desc' => $this->l('Save and preview') 'desc' => $this->l('Save and preview')
@@ -79,14 +86,7 @@ class AdminCmsControllerCore extends AdminController
'desc' => $this->l('Save and stay'), 'desc' => $this->l('Save and stay'),
); );
$this->initToolbar(); $this->initToolbar();
if (!$this->loadObject(true))
return;
if (Validate::isLoadedObject($this->object))
$this->display = 'edit';
else
$this->display = 'add';
$categories = CMSCategory::getCategories($this->context->language->id, false); $categories = CMSCategory::getCategories($this->context->language->id, false);
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1); $html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
+66 -21
View File
@@ -239,23 +239,62 @@ class AdminCurrenciesControllerCore extends AdminController
return parent::renderForm(); return parent::renderForm();
} }
protected function checkDeletion($object)
{
if (Validate::isLoadedObject($object))
{
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot delete the default currency');
else
return true;
}
else
$this->errors[] = Tools::displayError('An error occurred while deleting object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return false;
}
protected function checkDisableStatus($object)
{
if (Validate::isLoadedObject($object))
{
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot disable the default currency');
else
return true;
}
else
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return false;
}
/** /**
* @see AdminController::processDelete() * @see AdminController::processDelete()
*/ */
public function processDelete() public function processDelete()
{ {
if (Validate::isLoadedObject($object = $this->loadObject())) $object = $this->loadObject();
if (!$this->checkDeletion($object))
return false;
return parent::processDelete();
}
protected function processBulkDelete()
{
if (is_array($this->boxes) && !empty($this->boxes))
{ {
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT')) foreach ($this->boxes as $id_currency)
$this->errors[] = $this->l('You cannot delete the default currency'); {
else if ($object->delete()) $object = new Currency((int)$id_currency);
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token); if (!$this->checkDeletion($object))
else return false;
$this->errors[] = Tools::displayError('An error occurred during deletion.'); }
} }
else
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' return parent::processBulkDelete();
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
} }
/** /**
@@ -263,19 +302,25 @@ class AdminCurrenciesControllerCore extends AdminController
*/ */
public function processStatus() public function processStatus()
{ {
if (Validate::isLoadedObject($object = $this->loadObject())) $object = $this->loadObject();
if (!$this->checkDisableStatus($object))
return false;
return parent::processStatus();
}
protected function processBulkDisableSelection()
{
if (is_array($this->boxes) && !empty($this->boxes))
{ {
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT')) foreach ($this->boxes as $id_currency)
$this->errors[] = $this->l('You cannot disable the default currency'); {
else if ($object->toggleStatus()) $object = new Currency((int)$id_currency);
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category = if (!$this->checkDisableStatus($object))
(int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token); return false;
else }
$this->errors[] = Tools::displayError('An error occurred while updating status.');
} }
else return parent::processBulkDisableSelection();
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
} }
/** /**
+1 -1
View File
@@ -218,7 +218,7 @@ class AdminEmailsControllerCore extends AdminController
$smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp'); $smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp');
$smtpServer = Tools::getValue('smtpSrv'); $smtpServer = Tools::getValue('smtpSrv');
$content = urldecode(Tools::getValue('testMsg')); $content = urldecode(Tools::getValue('testMsg'));
$content = utf8_encode(html_entity_decode($content)); $content = html_entity_decode($content);
$subject = urldecode(Tools::getValue('testSubject')); $subject = urldecode(Tools::getValue('testSubject'));
$type = 'text/html'; $type = 'text/html';
$to = Tools::getValue('testEmail'); $to = Tools::getValue('testEmail');
+9 -5
View File
@@ -169,7 +169,7 @@ class AdminHomeControllerCore extends AdminController
return; return;
$shop = Context::getContext()->shop; $shop = Context::getContext()->shop;
if ($_SERVER['HTTP_HOST'] != $shop->domain && $_SERVER['HTTP_HOST'] != $shop->domain_ssl) if ($_SERVER['HTTP_HOST'] != $shop->domain && $_SERVER['HTTP_HOST'] != $shop->domain_ssl && Tools::getValue('ajax') == false)
$this->displayWarning($this->l('You are currently connected under the following domain name:').' <span style="color: #CC0000;">'.$_SERVER['HTTP_HOST'].'</span><br />'. $this->displayWarning($this->l('You are currently connected under the following domain name:').' <span style="color: #CC0000;">'.$_SERVER['HTTP_HOST'].'</span><br />'.
$this->l('This is different from the main shop domain name set in the "Multistore" page under the "Advanced Parameters" menu:').' <span style="color: #CC0000;">'.$shop->domain.'</span><br /> $this->l('This is different from the main shop domain name set in the "Multistore" page under the "Advanced Parameters" menu:').' <span style="color: #CC0000;">'.$shop->domain.'</span><br />
<a href="index.php?controller=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#conf_id_domain">'. <a href="index.php?controller=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#conf_id_domain">'.
@@ -542,8 +542,12 @@ class AdminHomeControllerCore extends AdminController
{ {
// Cache the logo // Cache the logo
if (!file_exists('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png')) if (!file_exists('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png'))
@copy(htmlentities((string)$partner->logo), '../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png'); {
$logo = @Tools::file_get_contents(htmlentities((string)$partner->logo));
if (sizeof($logo) > 0)
file_put_contents('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png', $logo);
}
// Check if module is not already installed and configured // Check if module is not already installed and configured
$display = 0; $display = 0;
if (file_exists('../config/xml/default_country_modules_list.xml') && filesize('../config/xml/default_country_modules_list.xml') > 10) if (file_exists('../config/xml/default_country_modules_list.xml') && filesize('../config/xml/default_country_modules_list.xml') > 10)
@@ -619,7 +623,7 @@ class AdminHomeControllerCore extends AdminController
$firstname = $employee->firstname; $firstname = $employee->firstname;
$lastname = $employee->lastname; $lastname = $employee->lastname;
$email = $employee->email; $email = $employee->email;
$return = @file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home'); $return = @Tools::file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home');
die($return); die($return);
} }
@@ -632,7 +636,7 @@ class AdminHomeControllerCore extends AdminController
$isoUser = Context::getContext()->language->iso_code; $isoUser = Context::getContext()->language->iso_code;
$isoCountry = Context::getContext()->country->iso_code; $isoCountry = Context::getContext()->country->iso_code;
$content = @file_get_contents($protocol.'://api.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&ps_version='.urlencode(_PS_VERSION_), false, $stream_context); $content = @Tools::file_get_contents($protocol.'://api.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&ps_version='.urlencode(_PS_VERSION_), false, $stream_context);
if (!$content) if (!$content)
return ''; // NOK return ''; // NOK
@@ -2876,13 +2876,16 @@ class AdminProductsControllerCore extends AdminController
'countries' => $countries, 'countries' => $countries,
'groups' => $groups, 'groups' => $groups,
'combinations' => $combinations, 'combinations' => $combinations,
'product' => $product,
'multi_shop' => Shop::isFeatureActive(), 'multi_shop' => Shop::isFeatureActive(),
'link' => new Link() 'link' => new Link()
)); ));
} }
else else
{
$this->displayWarning($this->l('You must save this product before adding specific pricing')); $this->displayWarning($this->l('You must save this product before adding specific pricing'));
$product->id_tax_rules_group = (int)Product::getIdTaxRulesGroupMostUsed();
$data->assign('ecotax_tax_excl', 0);
}
// prices part // prices part
$data->assign(array( $data->assign(array(
@@ -2893,7 +2896,6 @@ class AdminProductsControllerCore extends AdminController
'ecotaxTaxRate' => Tax::getProductEcotaxRate(), 'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(), 'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),
'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'), 'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'),
'ecotax_tax_excl' => 0
)); ));
$product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context); $product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context);
+3 -3
View File
@@ -320,7 +320,7 @@ class ProductControllerCore extends FrontController
$product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false); $product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false);
$address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax), 'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax, $ecotax_tax_amount),
'ecotax_tax_inc' => $ecotax_tax_amount, 'ecotax_tax_inc' => $ecotax_tax_amount,
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
'ecotaxTax_rate' => $ecotax_rate, 'ecotaxTax_rate' => $ecotax_rate,
@@ -590,14 +590,14 @@ class ProductControllerCore extends FrontController
$this->context->smarty->assign('customizationFormTarget', $customization_form_target); $this->context->smarty->assign('customizationFormTarget', $customization_form_target);
} }
protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate) protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate, $ecotax_amount)
{ {
foreach ($specific_prices as $key => &$row) foreach ($specific_prices as $key => &$row)
{ {
$row['quantity'] = &$row['from_quantity']; $row['quantity'] = &$row['from_quantity'];
if ($row['price'] >= 0) // The price may be directly set if ($row['price'] >= 0) // The price may be directly set
{ {
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)); $cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)) + (float)$ecotax_amount;
if ($row['reduction_type'] == 'amount') if ($row['reduction_type'] == 'amount')
$cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100)); $cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100));
else else
+1
View File
@@ -741,6 +741,7 @@ function showErrorMessage(msg, delay)
$(document).ready(function() $(document).ready(function()
{ {
$('select.chosen').each(function(k, item){ $('select.chosen').each(function(k, item){
$(item).val($(this).find('option[selected=selected]').val());
$(item).chosen(); $(item).chosen();
if ($(item).hasClass('no-search')) if ($(item).hasClass('no-search'))
$(item).next().find('.chzn-search').hide(); $(item).next().find('.chzn-search').hide();
+1 -1
View File
@@ -588,7 +588,7 @@ function updateCartSummary(json)
current_price = formatCurrency(product_list[i].price_wt, currencyFormat, currencySign, currencyBlank); current_price = formatCurrency(product_list[i].price_wt, currencyFormat, currencySign, currencyBlank);
if (reduction && typeof(initial_price) !== 'undefined') if (reduction && typeof(initial_price) !== 'undefined')
{ {
if (initial_price !== '' && initial_price > current_price) if (initial_price !== '' && product_list[i].price_without_quantity_discount > product_list[i].price)
initial_price_text = '<span style="text-decoration:line-through;">'+initial_price+'</span><br />'; initial_price_text = '<span style="text-decoration:line-through;">'+initial_price+'</span><br />';
} }
+1 -1
View File
@@ -166,7 +166,7 @@
{displayPrice price=$total_discounts_negative} {displayPrice price=$total_discounts_negative}
</td> </td>
</tr> </tr>
{if $use_taxes} {if $use_taxes && $show_taxes}
<tr class="cart_total_price"> <tr class="cart_total_price">
<td colspan="5">{l s='Total (tax excl.):'}</td> <td colspan="5">{l s='Total (tax excl.):'}</td>
<td colspan="2" class="price" id="total_price_without_tax">{displayPrice price=$total_price_without_tax}</td> <td colspan="2" class="price" id="total_price_without_tax">{displayPrice price=$total_price_without_tax}</td>
+6
View File
@@ -0,0 +1,6 @@
<?php
// unicode to cid conversion table is from
// ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/
// cid2code.txt in aj16.tar.Z
$cidinfo['uni2cid'] = array(160=>1,32=>1,33=>2,34=>3,35=>4,36=>5,37=>6,38=>7,39=>8,40=>9,41=>10,42=>11,43=>12,44=>13,8209=>14,45=>14,46=>15,47=>16,48=>17,49=>18,50=>19,51=>20,52=>21,53=>22,54=>23,55=>24,56=>25,57=>26,58=>27,59=>28,60=>29,61=>30,62=>31,63=>32,64=>33,65=>34,66=>35,67=>36,68=>37,69=>38,70=>39,71=>40,72=>41,73=>42,74=>43,75=>44,76=>45,77=>46,78=>47,79=>48,80=>49,81=>50,82=>51,83=>52,84=>53,85=>54,86=>55,87=>56,88=>57,89=>58,90=>59,91=>60,165=>61,93=>62,94=>63,818=>64,95=>64,768=>65,96=>65,97=>66,98=>67,99=>68,100=>69,101=>70,102=>71,103=>72,104=>73,105=>74,106=>75,107=>76,108=>77,109=>78,110=>79,111=>80,112=>81,113=>82,114=>83,115=>84,116=>85,117=>86,118=>87,119=>88,120=>89,121=>90,122=>91,123=>92,166=>93,125=>94,732=>95,771=>95,700=>96,8217=>96,92=>97,699=>98,8216=>98,124=>99,126=>100,8764=>100,161=>101,162=>102,163=>103,8260=>104,402=>105,164=>107,8220=>108,171=>109,8249=>110,8250=>111,64257=>112,64258=>113,8210=>114,8211=>114,183=>117,8729=>117,8226=>119,8218=>120,8222=>121,8221=>122,187=>123,191=>126,769=>127,710=>128,770=>128,175=>129,772=>129,774=>130,775=>131,776=>132,730=>133,778=>133,184=>134,807=>134,779=>135,808=>136,780=>137,822=>138,8212=>138,198=>139,170=>140,321=>141,216=>142,338=>143,186=>144,230=>145,305=>146,322=>147,248=>148,339=>149,223=>150,173=>151,169=>152,172=>153,174=>154,178=>157,179=>158,181=>159,185=>160,188=>161,189=>162,190=>163,192=>164,193=>165,194=>166,195=>167,196=>168,197=>169,199=>170,200=>171,201=>172,202=>173,203=>174,204=>175,205=>176,206=>177,207=>178,208=>179,209=>180,210=>181,211=>182,212=>183,213=>184,214=>185,217=>187,218=>188,219=>189,220=>190,221=>191,222=>192,224=>193,225=>194,226=>195,227=>196,228=>197,229=>198,231=>199,232=>200,233=>201,234=>202,235=>203,236=>204,237=>205,238=>206,239=>207,240=>208,241=>209,242=>210,243=>211,244=>212,245=>213,246=>214,249=>216,250=>217,251=>218,252=>219,253=>220,254=>221,255=>222,352=>223,376=>224,381=>225,773=>226,8254=>226,353=>227,8482=>228,382=>229,8194=>231,65512=>323,65377=>327,65378=>328,65379=>329,65380=>330,65381=>331,65382=>332,65383=>333,65384=>334,65385=>335,65386=>336,65387=>337,65388=>338,65389=>339,65390=>340,65391=>341,65392=>342,65393=>343,65394=>344,65395=>345,65396=>346,65397=>347,65398=>348,65399=>349,65400=>350,65401=>351,65402=>352,65403=>353,65404=>354,65405=>355,65406=>356,65407=>357,65408=>358,65409=>359,65410=>360,65411=>361,65412=>362,65413=>363,65414=>364,65415=>365,65416=>366,65417=>367,65418=>368,65419=>369,65420=>370,65421=>371,65422=>372,65423=>373,65424=>374,65425=>375,65426=>376,65427=>377,65428=>378,65429=>379,65430=>380,65431=>381,65432=>382,65433=>383,65434=>384,65435=>385,65436=>386,65437=>387,65438=>388,65439=>389,8195=>633,12288=>633,12289=>634,12290=>635,65292=>636,65294=>637,12539=>638,65306=>639,65307=>640,65311=>641,65281=>642,12443=>643,12444=>644,180=>645,65344=>646,168=>647,65342=>648,65507=>649,65343=>650,12541=>651,12542=>652,12445=>653,12446=>654,12291=>655,20189=>656,12293=>657,12294=>658,12295=>659,12540=>660,8213=>661,8208=>662,65295=>663,65340=>664,12316=>665,65374=>665,8214=>666,65372=>667,8230=>668,8229=>669,65288=>674,65289=>675,12308=>676,12309=>677,65339=>678,65341=>679,65371=>680,65373=>681,12296=>682,12297=>683,12298=>684,12299=>685,12300=>686,12301=>687,12302=>688,12303=>689,12304=>690,12305=>691,65291=>692,8722=>693,65293=>693,177=>694,215=>695,247=>696,65309=>697,8800=>698,65308=>699,65310=>700,8806=>701,8807=>702,8734=>703,8756=>704,9794=>705,9792=>706,176=>707,8242=>708,8243=>709,8451=>710,65509=>711,65284=>712,65504=>713,65505=>714,65285=>715,65283=>716,65286=>717,65290=>718,65312=>719,167=>720,9734=>721,9733=>722,9675=>723,9679=>724,9678=>725,9671=>726,9670=>727,9633=>728,9632=>729,9651=>730,9650=>731,9661=>732,9660=>733,8251=>734,12306=>735,8594=>736,8592=>737,8593=>738,8595=>739,12307=>740,8712=>741,8715=>742,8838=>743,8839=>744,8834=>745,8835=>746,8746=>747,8745=>748,8743=>749,8744=>750,65506=>751,8658=>752,8660=>753,8704=>754,8707=>755,8736=>756,8869=>757,8978=>758,8706=>759,8711=>760,8801=>761,8786=>762,8810=>763,8811=>764,8730=>765,8765=>766,8733=>767,8757=>768,8747=>769,8748=>770,8491=>771,8240=>772,9839=>773,9837=>774,9834=>775,8224=>776,8225=>777,182=>778,9711=>779,65296=>780,65297=>781,65298=>782,65299=>783,65300=>784,65301=>785,65302=>786,65303=>787,65304=>788,65305=>789,65313=>790,65314=>791,65315=>792,65316=>793,65317=>794,65318=>795,65319=>796,65320=>797,65321=>798,65322=>799,65323=>800,65324=>801,65325=>802,65326=>803,65327=>804,65328=>805,65329=>806,65330=>807,65331=>808,65332=>809,65333=>810,65334=>811,65335=>812,65336=>813,65337=>814,65338=>815,65345=>816,65346=>817,65347=>818,65348=>819,65349=>820,65350=>821,65351=>822,65352=>823,65353=>824,65354=>825,65355=>826,65356=>827,65357=>828,65358=>829,65359=>830,65360=>831,65361=>832,65362=>833,65363=>834,65364=>835,65365=>836,65366=>837,65367=>838,65368=>839,65369=>840,65370=>841,12353=>842,12354=>843,12355=>844,12356=>845,12357=>846,12358=>847,12359=>848,12360=>849,12361=>850,12362Line truncated
// --- EOF ---