Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
vAugagneur
2013-02-15 11:33:06 +01:00
61 changed files with 2397 additions and 1952 deletions
+10 -13
View File
@@ -44,6 +44,8 @@ class AdminAddressesControllerCore extends AdminController
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->allow_export = true;
if (!Tools::getValue('realedit'))
$this->deleted = true;
@@ -61,8 +63,15 @@ class AdminAddressesControllerCore extends AdminController
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
parent::__construct();
$this->_select = 'cl.`name` as country';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'customer` c ON a.id_customer = c.id_customer
';
$this->_where = 'AND a.id_customer != 0 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
}
public function initToolbar()
{
parent::initToolbar();
@@ -71,18 +80,6 @@ class AdminAddressesControllerCore extends AdminController
'desc' => $this->l('Import')
);
}
public function renderList()
{
$this->_select = 'cl.`name` as country';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'customer` c ON a.id_customer = c.id_customer
';
$this->_where = 'AND a.id_customer != 0 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
return parent::renderList();
}
public function renderForm()
{
@@ -35,6 +35,7 @@ class AdminCartsControllerCore extends AdminController
$this->addRowAction('view');
$this->addRowAction('delete');
$this->allow_export = true;
$this->_select = 'CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, o.id_order, IF(co.id_guest, 1, 0) id_guest';
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
@@ -45,6 +45,7 @@ class AdminCategoriesControllerCore extends AdminController
$this->lang = true;
$this->deleted = false;
$this->explicitSelect = true;
$this->allow_export = true;
$this->context = Context::getContext();
@@ -42,6 +42,8 @@ class AdminCustomersControllerCore extends AdminController
$this->deleted = true;
$this->explicitSelect = true;
$this->allow_export = true;
$this->addRowAction('edit');
$this->addRowAction('view');
$this->addRowAction('delete');
@@ -35,6 +35,7 @@ class AdminManufacturersControllerCore extends AdminController
$this->className = 'Manufacturer';
$this->lang = false;
$this->deleted = false;
$this->allow_export = true;
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
@@ -64,6 +64,13 @@ class AdminMetaControllerCore extends AdminController
'type' => 'rewriting_settings',
'mod_rewrite' => $mod_rewrite
),
'PS_ALLOW_ACCENTED_CHARS_URL' => array(
'title' => $this->l('Accented URL'),
'desc' => $this->l('Enable if you want to allow accented characters in your friendly URLs.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_CANONICAL_REDIRECT' => array(
'title' => $this->l('Automatically redirect to the canonical URL.'),
'desc' => $this->l('Recommended, but your theme must be compliant.'),
+7 -1
View File
@@ -1072,6 +1072,12 @@ class AdminModulesControllerCore extends AdminController
unset($object);
}
// Don't display categories without modules
$cleaned_list = array();
foreach ($this->list_modules_categories as $k => $list)
if ($list['nb'] > 0)
$cleaned_list[$k] = $list;
// Actually used for the report of the upgraded errors
if (count($module_errors))
{
@@ -1109,7 +1115,7 @@ class AdminModulesControllerCore extends AdminController
$tpl_vars['nb_modules_uninstalled'] = $tpl_vars['nb_modules'] - $tpl_vars['nb_modules_installed'];
$tpl_vars['nb_modules_activated'] = $this->nb_modules_activated;
$tpl_vars['nb_modules_unactivated'] = $tpl_vars['nb_modules_installed'] - $tpl_vars['nb_modules_activated'];
$tpl_vars['list_modules_categories'] = $this->list_modules_categories;
$tpl_vars['list_modules_categories'] = $cleaned_list;
$tpl_vars['list_modules_authors'] = $this->modules_authors;
$tpl_vars['check_url_fopen'] = (ini_get('allow_url_fopen') ? 'ok' : 'ko');
+1 -1
View File
@@ -35,7 +35,7 @@ class AdminOrdersControllerCore extends AdminController
$this->lang = false;
$this->addRowAction('view');
$this->explicitSelect = true;
$this->allow_export = true;
$this->deleted = false;
$this->context = Context::getContext();
+25 -9
View File
@@ -53,6 +53,8 @@ class AdminProductsControllerCore extends AdminController
protected $position_identifier = 'id_product';
protected $submitted_tabs;
protected $id_current_category;
public function __construct()
{
@@ -71,6 +73,7 @@ class AdminProductsControllerCore extends AdminController
$this->_defaultOrderBy = 'position';
$this->max_file_size = (int)(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
$this->allow_export = true;
// @since 1.5 : translations for tabs
$this->available_tabs_lang = array (
@@ -121,17 +124,28 @@ class AdminProductsControllerCore extends AdminController
$this->available_tabs_lang['Module'.ucfirst($m['module'])] = Module::getModuleName($m['module']);
}
if (Tools::getValue('reset_filter_category'))
$this->context->cookie->id_category_products_filter = false;
/* Join categories table */
if ($id_category = (int)Tools::getValue('productFilter_cl!name'))
{
$this->_category = new Category((int)$id_category);
$_POST['productFilter_cl!name'] = $this->_category->name[$this->context->language->id];
}
elseif ($id_category = Tools::getvalue('id_category'))
$this->_category = new Category((int)$id_category);
else
$this->_category = new Category();
{
if ($id_category = (int)Tools::getValue('id_category'))
{
$this->id_current_category = $id_category;
$this->context->cookie->id_category_products_filter = $id_category;
}
elseif ($id_category = $this->context->cookie->id_category_products_filter)
$this->id_current_category = $id_category;
if ($this->id_current_category)
$this->_category = new Category((int)$this->id_current_category);
else
$this->_category = new Category();
}
$join_category = false;
if (Validate::isLoadedObject($this->_category) && empty($this->_filter))
@@ -241,7 +255,8 @@ class AdminProductsControllerCore extends AdminController
'type' => 'bool',
'orderby' => false
);
if ((int)Tools::getValue('id_category'))
if ((int)$this->id_current_category)
$this->fields_list['position'] = array(
'title' => $this->l('Position'),
'width' => 70,
@@ -2126,8 +2141,8 @@ class AdminProductsControllerCore extends AdminController
}
else
{
if ($id_category = (int)Tools::getValue('id_category'))
self::$currentIndex .= '&id_category='.(int)$id_category;
if ($id_category = (int)$this->id_current_category)
self::$currentIndex .= '&id_category='.(int)$this->id_current_category;
// If products from all categories are displayed, we don't want to use sorting by position
if (!$id_category)
@@ -2139,8 +2154,9 @@ class AdminProductsControllerCore extends AdminController
unset($this->context->cookie->{$this->table.'Orderway'});
}
}
$id_category = (int)Tools::getValue('id_category', 1);
$this->tpl_list_vars['is_category_filter'] = Tools::getValue('id_category') ? true : false;
if (!$id_category)
$id_category = 1;
$this->tpl_list_vars['is_category_filter'] = (bool)$this->id_current_category;
// Generate category selection tree
$helper = new Helper();
@@ -34,6 +34,8 @@ class AdminSuppliersControllerCore extends AdminController
$this->addRowAction('view');
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->allow_export = true;
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->_select = 'COUNT(DISTINCT ps.`id_product`) AS products';
+2 -11
View File
@@ -340,19 +340,10 @@ class OrderControllerCore extends ParentOrderController
parent::_assignCarrier();
// Assign wrapping and TOS
$this->_assignWrappingAndTOS();
// If a rule offer free-shipping, force hidding shipping prices
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule)
if ($rule['free_shipping'])
{
$free_shipping = true;
break;
}
$this->context->smarty->assign(
array(
'free_shipping' => $free_shipping,
'free_shipping' => false, // Deprecated since a cart rule can be applied the specific carriers only
'is_guest' => (isset($this->context->customer->is_guest) ? $this->context->customer->is_guest : 0)
));
}
+1 -10
View File
@@ -480,15 +480,6 @@ class OrderOpcControllerCore extends ParentOrderController
else
$link_conditions .= '&content_only=1';
// If a rule offer free-shipping, force hidding shipping prices
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule)
if ($rule['free_shipping'])
{
$free_shipping = true;
break;
}
$carriers = $this->context->cart->simulateCarriersOutput();
$delivery_option = $this->context->cart->getDeliveryOption(null, false, false);
@@ -496,7 +487,7 @@ class OrderOpcControllerCore extends ParentOrderController
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
$vars = array(
'free_shipping' => $free_shipping,
'free_shipping' => false, // Deprecated since a cart rule can be applied the specific carriers only
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
'giftAllowed' => (int)(Configuration::get('PS_GIFT_WRAPPING')),
@@ -37,6 +37,16 @@ class PageNotFoundControllerCore extends FrontController
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
if (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('png', 'jpg', 'gif')))
{
header('Content-Type: image/gif');
readfile(_PS_IMG_DIR_.'img/404.gif');
exit;
}
elseif (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('.js', 'css')))
exit;
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'404.tpl');
+20 -19
View File
@@ -87,19 +87,11 @@ class ProductControllerCore extends FrontController
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
$this->errors[] = Tools::displayError('Product not found');
}
else
$this->canonicalRedirection();
if (!Validate::isLoadedObject($this->product))
$this->errors[] = Tools::displayError('Product not found');
else
{
if (Pack::isPack((int)$this->product->id) && !Pack::isInStock((int)$this->product->id))
$this->product->quantity = 0;
$this->product->description = $this->transformDescriptionWithImg($this->product->description);
$this->canonicalRedirection();
/*
* If the product is associated to the shop
* and is active or not active but preview mode (need token + file_exists)
@@ -181,11 +173,14 @@ class ProductControllerCore extends FrontController
if (!$this->errors)
{
if (Pack::isPack((int)$this->product->id) && !Pack::isInStock((int)$this->product->id))
$this->product->quantity = 0;
$this->product->description = $this->transformDescriptionWithImg($this->product->description);
// Assign to the template the id of the virtual product. "0" if the product is not downloadable.
$this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int)$this->product->id));
// Product pictures management
require_once('images.inc.php');
$this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
if (Tools::isSubmit('submitCustomizedDatas'))
@@ -204,15 +199,21 @@ class ProductControllerCore extends FrontController
else if (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture')))
$this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
$files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
$pictures = array();
foreach ($files as $file)
$pictures['pictures_'.$this->product->id.'_'.$file['index']] = $file['value'];
$texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
$text_fields = array();
foreach ($texts as $text_field)
$text_fields['textFields_'.$this->product->id.'_'.$text_field['index']] = str_replace('<br />', "\n", $text_field['value']);
if ($this->product->customizable)
{
$files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
foreach ($files as $file)
$pictures['pictures_'.$this->product->id.'_'.$file['index']] = $file['value'];
$texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
foreach ($texts as $text_field)
$text_fields['textFields_'.$this->product->id.'_'.$text_field['index']] = str_replace('<br />', "\n", $text_field['value']);
}
$this->context->smarty->assign(array(
'pictures' => $pictures,
'textFields' => $text_fields));