diff --git a/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl b/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl index 4bbace5b9..73147573b 100644 --- a/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl +++ b/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl @@ -72,7 +72,8 @@ {$module->optionsHtml} Valider {else} - {l s='Install'} + + {l s='Install'} {/if} diff --git a/admin-dev/themes/default/template/controllers/orders/_shipping.tpl b/admin-dev/themes/default/template/controllers/orders/_shipping.tpl index 7dd842ac3..ca22c24c1 100644 --- a/admin-dev/themes/default/template/controllers/orders/_shipping.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_shipping.tpl @@ -45,7 +45,7 @@ {dateFormat date=$line.date_add full=true} {$line.type} - {$line.state_name} + {$line.carrier_name} {$line.weight|string_format:"%.3f"} {Configuration::get('PS_WEIGHT_UNIT')} {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC} diff --git a/classes/Feature.php b/classes/Feature.php index 83b49bb57..fbf6af072 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -312,16 +312,16 @@ class FeatureCore extends ObjectModel */ public static function cleanPositions() { - $return = true; - $sql = ' - UPDATE `'._DB_PREFIX_.'feature` f LEFT JOIN - (SELECT @i := @i +1 AS rank, id_feature, position - FROM `'._DB_PREFIX_.'feature` JOIN (SELECT @i :=1) dummy - ORDER by position) AS f2 - USING(id_feature) - SET f.position = f2.rank-1'; - $return = Db::getInstance()->executeS($sql); - return $return; + return Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'feature` f + LEFT JOIN ( + SELECT @i := @i +1 AS rank, id_feature, position + FROM `'._DB_PREFIX_.'feature` + JOIN (SELECT @i :=1) dummy + ORDER by position + ) AS f2 + USING (id_feature) + SET f.position = f2.rank - 1'); } /** diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 444d1dfdb..27b09c547 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -859,6 +859,8 @@ abstract class ObjectModelCore $values = $this->$field; if (!is_array($values)) $values = array($this->id_lang => $values); + if (!isset($values[Configuration::get('PS_LANG_DEFAULT')])) + $values[Configuration::get('PS_LANG_DEFAULT')] = ''; foreach ($values as $id_lang => $value) { diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 13e0aa09a..f797cb5c8 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1514,6 +1514,7 @@ class AdminControllerCore extends Controller public function renderModulesList() { + if ($this->getModulesList($this->filter_modules_list)) { $helper = new Helper(); @@ -2214,7 +2215,18 @@ class AdminControllerCore extends Controller $this->modules_list = array(); foreach($all_modules as $module) { - if (in_array($module->name, $filter_modules_list)) + $perm = true; + if ($module->id) + $perm &= Module::getPermissionStatic($module->id, 'configure'); + else + { + $id_admin_module = Tab::getIdFromClassName('AdminModules'); + $access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module); + if (!$access['edit']) + $perm &= false; + } + + if (in_array($module->name, $filter_modules_list) && $perm) { $this->fillModuleData($module, 'select'); $this->modules_list[] = $module; diff --git a/classes/order/Order.php b/classes/order/Order.php index 11cc76562..36c2b45af 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1510,11 +1510,12 @@ class OrderCore extends ObjectModel /** * @return array return all shipping method for the current order + * state_name sql var is now deprecated - use order_state_name for the state name and carrier_name for the carrier_name */ public function getShipping() { return Db::getInstance()->executeS(' - SELECT DISTINCT oc.`id_order_invoice`, oc.`weight`, oc.`shipping_cost_tax_excl`, oc.`shipping_cost_tax_incl`, c.`url`, oc.`id_carrier`, c.`name` as `state_name`, oc.`date_add`, "Delivery" as `type`, "true" as `can_edit`, oc.`tracking_number`, oc.`id_order_carrier` + SELECT DISTINCT oc.`id_order_invoice`, oc.`weight`, oc.`shipping_cost_tax_excl`, oc.`shipping_cost_tax_incl`, c.`url`, oc.`id_carrier`, c.`name` as `carrier_name`, oc.`date_add`, "Delivery" as `type`, "true" as `can_edit`, oc.`tracking_number`, oc.`id_order_carrier`, osl.`name` as order_state_name, c.`name` as state_name FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (o.`id_order` = oh.`id_order`) @@ -1524,7 +1525,8 @@ class OrderCore extends ObjectModel ON (oc.`id_carrier` = c.`id_carrier`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (oh.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)Context::getContext()->language->id.') - WHERE oc.`id_order` = '.(int)$this->id); + WHERE o.`id_order` = '.(int)$this->id.' + GROUP BY c.id_carrier'); } diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index f8eb332fc..9add527b1 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -645,7 +645,7 @@ class AdminImportControllerCore extends AdminController do $uniqid_path = _PS_UPLOAD_DIR_.uniqid(); while (file_exists($uniqid_path)); file_put_contents($uniqid_path, $field); $tab = ''; - if(!empty($uniqid_path)) + if (!empty($uniqid_path)) { $fd = fopen($uniqid_path, 'r'); $tab = fgetcsv($fd, MAX_LINE_SIZE, $separator); diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index ec5e2c42f..dcb8e6cb3 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -250,11 +250,25 @@ class AdminModulesControllerCore extends AdminController { if (in_array($module->name, $tab_modules_list)) { - $this->fillModuleData($module, 'select', $back); + $perm = true; if ($module->id) - $modules_list['installed'][] = $module; + $perm &= Module::getPermissionStatic($module->id, 'configure'); else - $modules_list['not_installed'][] = $module; + { + $id_admin_module = Tab::getIdFromClassName('AdminModules'); + $access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module); + if (!$access['edit']) + $perm &= false; + } + if ($perm) + { + $this->fillModuleData($module, 'select', $back); + if ($module->id) + $modules_list['installed'][] = $module; + else + $modules_list['not_installed'][] = $module; + + } } } } @@ -781,7 +795,7 @@ class AdminModulesControllerCore extends AdminController // Call appropriate module callback if (!isset($ppmReturn)) $this->postProcessCallback(); - + if ($back = Tools::getValue('back')) Tools::redirectAdmin($back); } diff --git a/themes/default/mobile/order-detail.tpl b/themes/default/mobile/order-detail.tpl index d2a513e03..c341b7461 100644 --- a/themes/default/mobile/order-detail.tpl +++ b/themes/default/mobile/order-detail.tpl @@ -203,7 +203,7 @@