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

Conflicts:
	admin-dev/themes/default/css/admin.css
	admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl
	admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/home/content.tpl
	admin-dev/themes/default/template/controllers/localization/content.tpl
	admin-dev/themes/default/template/controllers/orders/_customized_data.tpl
	admin-dev/themes/default/template/controllers/orders/_new_product.tpl
	admin-dev/themes/default/template/controllers/orders/_product_line.tpl
	admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl
	admin-dev/themes/default/template/controllers/tax_rules/helpers/list/list_header.tpl
	admin-dev/themes/default/template/footer.tpl
	controllers/admin/AdminCarrierWizardController.php
	controllers/admin/AdminCarriersController.php
	controllers/admin/AdminCmsController.php
	controllers/admin/AdminLocalizationController.php
	controllers/admin/AdminManufacturersController.php
	controllers/admin/AdminSuppliersController.php
	css/admin.css
	js/admin-products.js
	js/admin_carrier_wizard.js
	translations/fr.gzip
This commit is contained in:
Kevin Granger
2013-09-13 11:41:14 +02:00
247 changed files with 7965 additions and 4936 deletions
+32 -79
View File
@@ -357,18 +357,17 @@ class AdminProductsControllerCore extends AdminController
$result = parent::loadObject($opt);
if ($result && Validate::isLoadedObject($this->object))
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !$this->object->isAssociatedToShop())
if (Shop::getContext() == Shop::CONTEXT_SHOP && Shop::isFeatureActive() && !$this->object->isAssociatedToShop())
{
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
$def = ObjectModel::getDefinition($this->object);
foreach ($def['fields'] as $field_name => $row)
{
$fields_array = array();
if(is_array($default_product->$field_name))
foreach ($fields_array as $key => $fields_name)
$this->object->$field_name[$key] = ObjectModel::formatValue($fields_name, $def['fields'][$field_name]['type']);
if (is_array($default_product->$field_name))
foreach ($default_product->$field_name as $key => $value)
$this->object->{$field_name}[$key] = ObjectModel::formatValue($value, $def['fields'][$field_name]['type']);
else
$this->object->$field_name = ObjectModel::formatValue($this->object->$field_name, $def['fields'][$field_name]['type']);
$this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
}
}
$this->object->loadStockData();
@@ -629,6 +628,7 @@ class AdminProductsControllerCore extends AdminController
{
$id_category = (int)Tools::getValue('id_category');
$category_url = empty($id_category) ? '' : '&id_category='.(int)$id_category;
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url;
}
else
@@ -667,7 +667,7 @@ class AdminProductsControllerCore extends AdminController
{
$productId = (int)Tools::getValue('id_product');
@unlink(_PS_TMP_IMG_DIR_.'product_'.$productId.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$productId.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$productId.'_'.$this->context->shop->id.'.jpg');
$this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&action=Images&addproduct'.'&token='.$this->token;
}
}
@@ -861,6 +861,12 @@ class AdminProductsControllerCore extends AdminController
{
$combination = new Combination((int)$id_product_attribute);
$combination->setAttributes(Tools::getValue('attribute_combination_list'));
// images could be deleted before
$id_images = Tools::getValue('id_image_attr');
if (!empty($id_images))
$combination->setImages($id_images);
$product->checkDefaultAttributes();
if (Tools::getValue('attribute_default'))
{
@@ -1346,7 +1352,7 @@ class AdminProductsControllerCore extends AdminController
'shops' => $json_shops,
);
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$obj->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$obj->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$obj->id_product.'_'.$this->context->shop->id.'.jpg');
die(Tools::jsonEncode($json));
}
else
@@ -1518,7 +1524,7 @@ class AdminProductsControllerCore extends AdminController
$img->cover = 1;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$img->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$img->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$img->id_product.'_'.$this->context->shop->id.'.jpg');
if ($img->update())
$this->jsonConfirmation($this->_conf[26]);
@@ -1554,8 +1560,8 @@ class AdminProductsControllerCore extends AdminController
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$image->id_product.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_'.$image->id_product.'.jpg');
if (file_exists(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'.jpg');
if (file_exists(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'_'.$this->context->shop->id.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'_'.$this->context->shop->id.'.jpg');
if ($res)
$this->jsonConfirmation($this->_conf[7]);
@@ -1644,7 +1650,7 @@ class AdminProductsControllerCore extends AdminController
if (count($this->errors))
return false;
@unlink(_PS_TMP_IMG_DIR_.'product_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$product->id.'_'.$this->context->shop->id.'.jpg');
return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : false);
}
/**
@@ -1728,27 +1734,7 @@ class AdminProductsControllerCore extends AdminController
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($this->object, 'id'),
$this->getFieldValue($this->object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($this->object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$this->object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= '&adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
$this->redirect_after = $this->getPreviewUrl($this->object);
// Save and stay on same form
if ($this->display == 'edit')
@@ -1893,30 +1879,7 @@ class AdminProductsControllerCore extends AdminController
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($object, 'id'),
$this->getFieldValue($object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
if (strpos($preview_url, '?') === false)
$preview_url .= '?';
else
$preview_url .= '&';
$preview_url .= 'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
$this->redirect_after = $this->getPreviewUrl($object);
else
{
// Save and stay on same form
@@ -2621,40 +2584,30 @@ class AdminProductsControllerCore extends AdminController
public function getPreviewUrl(Product $product)
{
$id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, Context::getContext()->shop->id);
if (!ShopUrl::getMainShopDomain())
return false;
$is_rewrite_active = (bool)Configuration::get('PS_REWRITING_SETTINGS');
$preview_url = $this->context->link->getProductLink(
$product,
$this->getFieldValue($product, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($product->id_category_default, $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
$id_lang,
(int)Context::getContext()->shop->id,
0,
$is_rewrite_active
);
if (!$product->active)
{
$preview_url = $this->context->link->getProductLink(
$product,
$this->getFieldValue($product, 'link_rewrite', $this->default_form_language),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
$is_rewrite_active
);
if (!$product->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= $product->active ? '' : '&adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= ((strpos($preview_url, '?') === false) ? '?' : '&').'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
return $preview_url;
}
@@ -3012,7 +2965,7 @@ class AdminProductsControllerCore extends AdminController
$data->assign(array(
'link' => $this->context->link,
'currency' => $currency = $this->context->currency,
'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true, true),
'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true),
'taxesRatesByGroup' => TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id),
'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),