Merge branch 'release' into development

This commit is contained in:
Francois Gaillard
2013-03-07 18:11:34 +01:00
23 changed files with 162 additions and 81 deletions
+8 -8
View File
@@ -68,7 +68,14 @@ class AdminCmsControllerCore extends AdminController
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(
'href' => '#',
'desc' => $this->l('Save and preview')
@@ -79,14 +86,7 @@ class AdminCmsControllerCore extends AdminController
'desc' => $this->l('Save and stay'),
);
$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);
$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();
}
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()
*/
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'))
$this->errors[] = $this->l('You cannot delete the default currency');
else if ($object->delete())
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
else
$this->errors[] = Tools::displayError('An error occurred during deletion.');
foreach ($this->boxes as $id_currency)
{
$object = new Currency((int)$id_currency);
if (!$this->checkDeletion($object))
return false;
}
}
else
$this->errors[] = Tools::displayError('An error occurred while deleting object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return parent::processBulkDelete();
}
/**
@@ -263,19 +302,25 @@ class AdminCurrenciesControllerCore extends AdminController
*/
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'))
$this->errors[] = $this->l('You cannot disable the default currency');
else if ($object->toggleStatus())
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category =
(int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
else
$this->errors[] = Tools::displayError('An error occurred while updating status.');
foreach ($this->boxes as $id_currency)
{
$object = new Currency((int)$id_currency);
if (!$this->checkDisableStatus($object))
return false;
}
}
else
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return parent::processBulkDisableSelection();
}
/**
+1 -1
View File
@@ -218,7 +218,7 @@ class AdminEmailsControllerCore extends AdminController
$smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp');
$smtpServer = Tools::getValue('smtpSrv');
$content = urldecode(Tools::getValue('testMsg'));
$content = utf8_encode(html_entity_decode($content));
$content = html_entity_decode($content);
$subject = urldecode(Tools::getValue('testSubject'));
$type = 'text/html';
$to = Tools::getValue('testEmail');
+9 -5
View File
@@ -169,7 +169,7 @@ class AdminHomeControllerCore extends AdminController
return;
$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->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">'.
@@ -542,8 +542,12 @@ class AdminHomeControllerCore extends AdminController
{
// Cache the logo
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
$display = 0;
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;
$lastname = $employee->lastname;
$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);
}
@@ -632,7 +636,7 @@ class AdminHomeControllerCore extends AdminController
$isoUser = Context::getContext()->language->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)
return ''; // NOK
@@ -2876,13 +2876,16 @@ class AdminProductsControllerCore extends AdminController
'countries' => $countries,
'groups' => $groups,
'combinations' => $combinations,
'product' => $product,
'multi_shop' => Shop::isFeatureActive(),
'link' => new Link()
));
}
else
{
$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
$data->assign(array(
@@ -2893,7 +2896,6 @@ class AdminProductsControllerCore extends AdminController
'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),
'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'),
'ecotax_tax_excl' => 0
));
$product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context);