//MERGE branche release

This commit is contained in:
Vincent Augagneur
2013-08-26 10:59:36 +02:00
161 changed files with 2530 additions and 1173 deletions
@@ -84,7 +84,6 @@ class AdminCarrierWizardControllerCore extends AdminController
$multistore_step = array(
array(
'title' => $this->l('MultiStore'),
'desc' => $this->l('MultiStore'),
)
);
array_splice($this->wizard_steps['steps'], 1, 0, $multistore_step);
@@ -113,6 +112,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'wizard_steps' => $this->wizard_steps,
'validate_url' => $this->context->link->getAdminLink('AdminCarrierWizard'),
'carrierlist_url' => $this->context->link->getAdminLink('AdminCarriers').'&conf='.((int)Validate::isLoadedObject($carrier) ? 4 : 3),
'multistore_enable' => Shop::isFeatureActive(),
'wizard_contents' => array(
'contents' => array(
0 => $this->renderStepOne($carrier),
@@ -356,7 +356,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Maximum package height ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package height (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_height',
'required' => false,
'size' => 10,
@@ -364,7 +364,7 @@ class AdminCarrierWizardControllerCore extends AdminController
),
array(
'type' => 'text',
'label' => $this->l('Maximum package width ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package width (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_width',
'required' => false,
'size' => 10,
@@ -372,7 +372,7 @@ class AdminCarrierWizardControllerCore extends AdminController
),
array(
'type' => 'text',
'label' => $this->l('Maximum package depth ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package depth (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_depth',
'required' => false,
'size' => 10,
@@ -380,7 +380,7 @@ class AdminCarrierWizardControllerCore extends AdminController
),
array(
'type' => 'text',
'label' => $this->l('Maximum package weight ('.Configuration::get('PS_WEIGHT_UNIT').'):'),
'label' => sprintf($this->l('Maximum package weight (%s):'), Configuration::get('PS_WEIGHT_UNIT')),
'name' => 'max_weight',
'required' => false,
'size' => 10,
@@ -718,7 +718,8 @@ class AdminCarrierWizardControllerCore extends AdminController
if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none'
&& (!isset($logo['error']) || !$logo['error'])
&& preg_match('/\.(jpe?g|gif|png)$/', $logo['name'])
&& is_uploaded_file($logo['tmp_name']))
&& is_uploaded_file($logo['tmp_name'])
&& ImageManager::isRealImage($logo['tmp_name'], $logo['type']))
{
$file = $logo['tmp_name'];
do $tmp_name = uniqid().'.jpg';
@@ -884,16 +885,13 @@ class AdminCarrierWizardControllerCore extends AdminController
1 => array('name', 'delay', 'grade', 'url'),
2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'),
3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'),
4 => array(),
);
if (Shop::isFeatureActive())
{
$multistore_field = array(array('shop'));
$tmp = $step_fields;
$step_fields = array(1 => $tmp[1]) + $multistore_field;
array_shift($tmp);
foreach ($tmp as $row)
$step_field[] = $row;
array_splice($step_fields, 1, 0, $multistore_field);
}
$rules = Carrier::getValidationRules('Carrier');
+7 -51
View File
@@ -101,54 +101,6 @@ class AdminCarriersControllerCore extends AdminController
)
);
$carrier_default_sort = array(
array('value' => Carrier::SORT_BY_PRICE, 'name' => $this->l('Price')),
array('value' => Carrier::SORT_BY_POSITION, 'name' => $this->l('Position'))
);
$carrier_default_order = array(
array('value' => Carrier::SORT_BY_ASC, 'name' => $this->l('Ascending')),
array('value' => Carrier::SORT_BY_DESC, 'name' => $this->l('Descending'))
);
$this->fields_options = array(
'general' => array(
'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array(
'title' => $this->l('Default carrier:'),
'desc' => $this->l('Your shop\'s default carrier'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_carrier',
'list' => array_merge(
array(
-1 => array('id_carrier' => -1, 'name' => $this->l('Best price')),
-2 => array('id_carrier' => -2, 'name' => $this->l('Best grade'))
),
Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::ALL_CARRIERS))
),
'PS_CARRIER_DEFAULT_SORT' => array(
'title' => $this->l('Sort by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_sort
),
'PS_CARRIER_DEFAULT_ORDER' => array(
'title' => $this->l('Order by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_order
),
),
'submit' => array()
)
);
parent::__construct();
}
@@ -518,7 +470,8 @@ class AdminCarriersControllerCore extends AdminController
}
parent::postProcess();
}
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
/*
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
{
if ($this->tabAccess['edit'] === '1')
{
@@ -530,17 +483,20 @@ class AdminCarriersControllerCore extends AdminController
else
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
*/
else if (isset($_GET['isFree'.$this->table]))
{
$this->processIsFree();
}
else
{
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
/*
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|| (isset($_GET['delete'.$this->table]) && Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT')))
$this->errors[] = $this->l('Please set another carrier as default before deleting this one.');
else
{
*/
// if deletion : removes the carrier from the warehouse/carrier association
if (Tools::isSubmit('delete'.$this->table))
{
@@ -562,7 +518,7 @@ class AdminCarriersControllerCore extends AdminController
}
parent::postProcess();
Carrier::cleanPositions();
}
//}
}
}
@@ -236,7 +236,7 @@ class AdminCategoriesControllerCore extends AdminController
{
if (empty($this->display))
{
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops()) > 1)
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
$this->toolbar_btn['new-url'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'root&token='.$this->token,
'desc' => $this->l('Add new root category')
@@ -464,7 +464,8 @@ class AdminCategoriesControllerCore extends AdminController
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
// Display this field only if multistore option is enabled
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && Tools::isSubmit('add'.$this->table.'root'))
{
$this->fields_form['input'][] = array(
'type' => 'radio',
'label' => $this->l('Root Category:'),
@@ -485,6 +486,8 @@ class AdminCategoriesControllerCore extends AdminController
)
)
);
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
}
// Display this field only if multistore option is enabled AND there are several stores configured
if (Shop::isFeatureActive())
$this->fields_form['input'][] = array(
@@ -499,9 +502,6 @@ class AdminCategoriesControllerCore extends AdminController
if (in_array($input['name'], array('id_parent', 'is_root_category')))
unset($this->fields_form['input'][$k]);
if (Tools::isSubmit('add'.$this->table.'root'))
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
if (!($obj = $this->loadObject(true)))
return;
@@ -525,6 +525,8 @@ class AdminCategoriesControllerCore extends AdminController
foreach ($groups as $group)
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $category_groups_ids)));
$this->fields_value['is_root_category'] = (bool)Tools::isSubmit('add'.$this->table.'root');
return parent::renderForm();
}
@@ -555,7 +557,7 @@ class AdminCategoriesControllerCore extends AdminController
$id_parent = (int)Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent && !Tools::isSubmit('is_root_category'))
if (!$id_parent)
{
$_POST['is_root_category'] = $_POST['level_depth'] = 1;
$_POST['id_parent'] = $id_parent = (int)Configuration::get('PS_ROOT_CATEGORY');
@@ -463,6 +463,16 @@ class AdminEmployeesControllerCore extends AdminController
return parent::initContent();
}
protected function afterUpdate($object)
{
$res = parent::afterUpdate($object);
// Update cookie if needed
if (Tools::getValue('id_employee') == $this->context->employee->id && Tools::getValue('passwd') && $object->passwd != $this->context->employee->passwd)
$this->context->cookie->passwd = $this->context->employee->passwd = $object->passwd;
return $res;
}
public function ajaxProcessGetTabByIdProfile()
{
$id_profile = Tools::getValue('id_profile');
@@ -2658,6 +2658,13 @@ class AdminImportControllerCore extends AdminController
Image::clearTmpDir();
return true;
}
public function clearSmartyCache()
{
Tools::enableCache();
Tools::clearCache($this->context->smarty);
Tools::restoreCacheSettings();
}
public function postProcess()
{
@@ -2715,10 +2722,12 @@ class AdminImportControllerCore extends AdminController
{
case $this->entities[$import_type = $this->l('Categories')]:
$this->categoryImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Customers')]:
$this->customerImport();
@@ -2728,12 +2737,15 @@ class AdminImportControllerCore extends AdminController
break;
case $this->entities[$import_type = $this->l('Combinations')]:
$this->attributeImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Manufacturers')]:
$this->manufacturerImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Suppliers')]:
$this->supplierImport();
$this->clearSmartyCache();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Orders')]:
@@ -33,9 +33,6 @@ class AdminLogsControllerCore extends AdminController
$this->lang = false;
$this->noLink = true;
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fields_list = array(
'id_log' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'employee' => array('title' => $this->l('Employee'), 'align' => 'center', 'width' => 100),
+4 -2
View File
@@ -139,7 +139,7 @@ class AdminMetaControllerCore extends AdminController
$this->url = ShopUrl::getShopUrls($this->context->shop->id)->where('main', '=', 1)->getFirst();
if ($this->url)
{
$shop_url_options['description'] = $this->l('Here you can set the URL for your shop. If you migrate your shop to a new URL, remember to change the values bellow.');
$shop_url_options['description'] = $this->l('Here you can set the URL for your shop. If you migrate your shop to a new URL, remember to change the values below.');
$shop_url_options['fields'] = array(
'domain' => array(
'title' => $this->l('Shop domain'),
@@ -363,6 +363,9 @@ class AdminMetaControllerCore extends AdminController
else if (Tools::isSubmit('submitRobots'))
$this->generateRobotsFile();
if (Tools::isSubmit('PS_ROUTE_product_rule'))
Tools::clearCache($this->context->smarty);
return parent::postProcess();
}
@@ -467,7 +470,6 @@ class AdminMetaControllerCore extends AdminController
else
Configuration::updateValue('PS_ROUTE_'.$route_id, $rule);
}
}
/**
+6 -10
View File
@@ -630,9 +630,8 @@ class AdminModulesControllerCore extends AdminController
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
else
if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
}
}
@@ -674,18 +673,18 @@ class AdminModulesControllerCore extends AdminController
// Get the return value of current method
$echo = $module->{$method}();
// After a successful install of a single module that has a configuration method, to the configuration page
if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent'))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&configure='.$module->name.'&conf=12');
}
// If the method called is "configure" (getContent method), we show the html code of configure page
if ($key == 'configure' && Module::isInstalled($module->name))
{
if (isset($module->multishop_context))
$this->multishop_context = $module->multishop_context;
$backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
$hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
$tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
@@ -768,10 +767,8 @@ class AdminModulesControllerCore extends AdminController
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
if(isset($_GET['update']))
{
if (isset($_GET['update']))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
}
public function postProcess()
@@ -779,7 +776,6 @@ class AdminModulesControllerCore extends AdminController
// Parent Post Process
parent::postProcess();
// Get the list of installed module ans prepare it for ajax call.
if (($list = Tools::getValue('installed_modules')))
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));
@@ -270,12 +270,13 @@ class AdminModulesPositionsControllerCore extends AdminController
'href' => self::$currentIndex.'&addToHook'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token,
'desc' => $this->l('Transplant a module')
);
$live_edit_params = array(
'live_edit' => true,
'ad' => $admin_dir,
'liveToken' => $this->token,
'id_employee' => (int)$this->context->employee->id
'id_employee' => (int)$this->context->employee->id,
'id_shop' => (int)$this->context->shop->id
);
$this->context->smarty->assign(array(
@@ -308,6 +309,7 @@ class AdminModulesPositionsControllerCore extends AdminController
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1)
$lang = Language::getIsoById($this->context->employee->id_lang).'/';
$url = 'http://'.Tools::getHttpHost().$dir.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
return $url;
}
+29 -4
View File
@@ -861,7 +861,7 @@ class AdminOrdersControllerCore extends AdminController
$payment_module->validateOrder(
(int)$cart->id, (int)$id_order_state,
$cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, $this->l('Manual order -- Employee:').
Tools::safeOutput(substr($employee->firstname, 0, 1).'. '.$employee->lastname), array(), null, false, $cart->secure_key
substr($employee->firstname, 0, 1).'. '.$employee->lastname, array(), null, false, $cart->secure_key
);
if ($payment_module->currentOrder)
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token);
@@ -1332,6 +1332,13 @@ class AdminOrdersControllerCore extends AdminController
// if the current stock requires a warning
if ($product['current_stock'] == 0 && $display_out_of_stock_warning)
$this->displayWarning($this->l('This product is out of stock: ').' '.$product['product_name']);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
}
// Smarty assign
@@ -1374,7 +1381,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $order->getInvoicesCollection(),
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
'payment_methods' => $payment_methods,
'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop)
'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop),
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
);
return parent::renderView();
@@ -1737,6 +1745,13 @@ class AdminOrdersControllerCore extends AdminController
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
$product['return_history'] = OrderReturn::getProductReturnDetail((int)$product['id_order_detail']);
$product['refund_history'] = OrderSlip::getProductSlipDetail((int)$product['id_order_detail']);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
// Get invoices collection
$invoice_collection = $order->getInvoicesCollection();
@@ -1757,7 +1772,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link,
'current_index' => self::$currentIndex
'current_index' => self::$currentIndex,
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
));
$this->sendChangedNotification($order);
@@ -1952,6 +1968,14 @@ class AdminOrdersControllerCore extends AdminController
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
$product['refund_history'] = OrderSlip::getProductSlipDetail($order_detail->id);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
// Get invoices collection
$invoice_collection = $order->getInvoicesCollection();
@@ -1971,7 +1995,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link,
'current_index' => self::$currentIndex
'current_index' => self::$currentIndex,
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
));
if (!$res)
+1 -1
View File
@@ -175,7 +175,7 @@ class AdminPaymentControllerCore extends AdminController
),
array('items' => Group::getGroups($this->context->language->id),
'title' => $this->l('Group restrictions'),
'desc' => $this->l('Please mark each checkbox for the currency, or currencies, in which you want the payment module(s) to be available.'),
'desc' => $this->l('Please mark each checkbox for the customer group(s), in which you want the payment module(s) to be available.'),
'name_id' => 'group',
'identifier' => 'id_group',
'icon' => 'group',
@@ -791,6 +791,13 @@ class AdminPerformanceControllerCore extends AdminController
else
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
if ((bool)Tools::getValue('empty_smarty_cache'))
{
$redirectAdmin = true;
Tools::clearSmartyCache();
}
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
{
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => ''));
+19 -20
View File
@@ -359,18 +359,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();
@@ -631,6 +630,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
@@ -669,7 +669,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;
}
}
@@ -1348,7 +1348,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
@@ -1520,7 +1520,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]);
@@ -1556,8 +1556,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]);
@@ -1646,7 +1646,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);
}
/**
@@ -2614,6 +2614,7 @@ class AdminProductsControllerCore extends AdminController
if (!ShopUrl::getMainShopDomain())
return false;
$is_rewrite_active = (bool)Configuration::get('PS_REWRITING_SETTINGS');
$preview_url = $this->context->link->getProductLink(
$product,
@@ -2625,6 +2626,7 @@ class AdminProductsControllerCore extends AdminController
0,
$is_rewrite_active
);
if (!$product->active)
{
$preview_url = $this->context->link->getProductLink(
@@ -2637,15 +2639,12 @@ class AdminProductsControllerCore extends AdminController
0,
$is_rewrite_active
);
$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;
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;
}
}
return $preview_url;
}
@@ -2996,7 +2995,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(),
+46 -3
View File
@@ -37,7 +37,17 @@ class AdminShippingControllerCore extends AdminController
foreach ($carriers as $key => $carrier)
if ($carrier['is_free'])
unset($carriers[$key]);
$carrier_default_sort = array(
array('value' => Carrier::SORT_BY_PRICE, 'name' => $this->l('Price')),
array('value' => Carrier::SORT_BY_POSITION, 'name' => $this->l('Position'))
);
$carrier_default_order = array(
array('value' => Carrier::SORT_BY_ASC, 'name' => $this->l('Ascending')),
array('value' => Carrier::SORT_BY_DESC, 'name' => $this->l('Descending'))
);
$this->fields_options = array(
'handling' => array(
'title' => $this->l('Handling'),
@@ -68,12 +78,45 @@ class AdminShippingControllerCore extends AdminController
<li>'.$this->l('Coupons are not taken into account when calculating free shipping').'</li>
</ul>',
'submit' => array()
),
'general' => array(
'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array(
'title' => $this->l('Default carrier:'),
'desc' => $this->l('Your shop\'s default carrier'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_carrier',
'list' => array_merge(
array(
-1 => array('id_carrier' => -1, 'name' => $this->l('Best price')),
-2 => array('id_carrier' => -2, 'name' => $this->l('Best grade'))
),
Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::ALL_CARRIERS))
),
'PS_CARRIER_DEFAULT_SORT' => array(
'title' => $this->l('Sort by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_sort
),
'PS_CARRIER_DEFAULT_ORDER' => array(
'title' => $this->l('Order by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_order
),
),
'submit' => array()
)
);
);
}
public function postProcess()
{
/* Shipping fees */
+1 -1
View File
@@ -386,7 +386,7 @@ class AdminShopControllerCore extends AdminController
$this->fields_form['input'][] = array(
'type' => 'select',
'label' => $this->l('Category root:'),
'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,').'&nbsp;<a href="'.$this->context->link->getAdminLink('AdminCategories').'&addcategoryroot">'.$this->l('Please click here').'</a>',
'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,').'&nbsp;<a href="'.$this->context->link->getAdminLink('AdminCategories').'&addcategoryroot" target="_blank">'.$this->l('Please click here').'</a>',
'name' => 'id_category',
'options' => array(
'query' => $categories,
@@ -1193,7 +1193,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
}
// updates receipt
if (Tools::isSubmit('submitFiltersupply_order_detail') && Tools::isSubmit('submitBulkUpdatesupply_order_detail') && Tools::isSubmit('id_supply_order'))
if (Tools::isSubmit('submitBulkUpdatesupply_order_detail') && Tools::isSubmit('id_supply_order'))
$this->postProcessUpdateReceipt();
// use template to create a supply order
@@ -1338,6 +1338,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supply_order_detail);
else // everything is valid : updates
{
// creates the history
$supplier_receipt_history = new SupplyOrderReceiptHistory();
$supplier_receipt_history->id_supply_order_detail = (int)$id_supply_order_detail;
@@ -179,6 +179,15 @@ class AdminTaxRulesGroupControllerCore extends AdminController
'stay' => true
)
);
if (Shop::isFeatureActive())
{
$this->fields_form['input'][] = array(
'type' => 'shop',
'label' => $this->l('Shop association:'),
'name' => 'checkBoxShopAsso',
);
}
if (!($obj = $this->loadObject(true)))
return;
@@ -1065,7 +1065,7 @@ class AdminTranslationsControllerCore extends AdminController
{
case 'front':
// Parsing file in Front office
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?\s*\}/U';
$regex = '/\{l\s*s=(?|\'('._PS_TRANS_PATTERN_.')\'|"('._PS_TRANS_PATTERN_.')")(\s*sprintf=.*)?(\s*js=1)?\s*\}/U';
break;
case 'back':
@@ -1075,7 +1075,7 @@ class AdminTranslationsControllerCore extends AdminController
else if ($type_file == 'specific')
$regex = '/Translate::getAdminTranslation\(\''._PS_TRANS_PATTERN_.'\'\)/U';
else
$regex = '/\{l\s*s\s*=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?(\s*slashes=1)?\s*\}/U';
$regex = '/\{l\s*s\s*=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'")(\s*sprintf=.*)?(\s*js=1)?(\s*slashes=1)?\s*\}/U';
break;
case 'errors':
@@ -1089,7 +1089,7 @@ class AdminTranslationsControllerCore extends AdminController
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
else
// In tpl file look for something that should contain mod='module_name' according to the documentation
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\").*\s+mod=\''.$module_name.'\'.*\}/U';
$regex = '/\{l\s*s=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'").*\s+mod=\''.$module_name.'\'.*\}/U';
break;
case 'pdf':
@@ -1097,7 +1097,7 @@ class AdminTranslationsControllerCore extends AdminController
if ($type_file == 'php')
$regex = '/HTMLTemplate.*::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
else
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?(\s*pdf=\'true\')?\s*\}/U';
$regex = '/\{l\s*s=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'")(\s*sprintf=.*)?(\s*js=1)?(\s*pdf=\'true\')?\s*\}/U';
break;
}