Fixed: KPI access is now under employee permission in back-office

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
shazar rahman
2026-06-12 17:50:59 +05:30
parent a27e55c049
commit 653fdf3f7f
203 changed files with 9719 additions and 1593 deletions

View File

@@ -527,7 +527,10 @@ class AdminControllerCore extends Controller
29 => $this->l('Successful upgrade'),
30 => $this->l('A partial refund was successfully created.'),
31 => $this->l('The discount was successfully generated.'),
32 => $this->l('Successfully signed in to PrestaShop Addons')
32 => $this->l('Successfully signed in to PrestaShop Addons'),
33 => $this->l('The selected module(s) have been successfully enabled.'),
34 => $this->l('The selected module(s) have been successfully disabled.'),
);
if (!$this->identifier) {
@@ -554,8 +557,8 @@ class AdminControllerCore extends Controller
}
if ($this->access_query) {
if (Tools::getValue($this->identifier)) {
$this->access_query .= ' AND a.'.$this->identifier.'='.(int) Tools::getValue($this->identifier);
if (!Db::getInstance()->executeS($this->access_query)) {
$access_query = $this->access_query.' AND a.'.$this->identifier.'='.(int) Tools::getValue($this->identifier);
if (!Db::getInstance()->executeS($access_query)) {
$this->tabAccess['view'] = 0;
$this->tabAccess['add'] = 0;
$this->tabAccess['edit'] = 0;
@@ -886,7 +889,7 @@ class AdminControllerCore extends Controller
}
if (is_array($value)) {
if ($value[0] === '' && $value[1] === '') {
if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') {
$value = '';
} else {
$value = json_encode($value);
@@ -915,7 +918,7 @@ class AdminControllerCore extends Controller
}
if (is_array($value)) {
if ($value[0] === '' && $value[1] === '') {
if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') {
$value = '';
} else {
$value = json_encode($value);
@@ -1427,8 +1430,8 @@ class AdminControllerCore extends Controller
} elseif ($this->postImage($object->id) && !count($this->errors) && $this->_redirect) {
$parent_id = (int)Tools::getValue('id_parent', 1);
// Specific back redirect
if ($back = Tools::getValue('back')) {
$this->redirect_after = urldecode($back).'&conf=4';
if (($back = Tools::secureReferrer(Tools::getValue('back'))) && $back != __PS_BASE_URI__) {
$this->redirect_after=urldecode($back).'&conf=4';
}
// Specific scene feature
// @todo change stay_here submit name (not clear for redirect to scene ... )
@@ -2304,7 +2307,9 @@ class AdminControllerCore extends Controller
$this->content .= $this->renderDetails();
} elseif (!$this->ajax) {
$this->content .= $this->renderModulesList();
$this->content .= $this->renderKpis();
if ($this->tabAccess['kpi'] === 1) {
$this->content .= $this->renderKpis();
}
$this->content .= $this->renderList();
$this->content .= $this->renderOptions();
@@ -2397,7 +2402,7 @@ class AdminControllerCore extends Controller
$must_have_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST);
if (!empty($must_have_module_list) && $must_have_module_list_xml = @simplexml_load_string($must_have_module_list)) {
$must_have_module_list_array = array();
if (is_object($country_module_list_xml->module)) {
if (is_object($must_have_module_list_xml->module)) {
foreach ($must_have_module_list_xml->module as $l => $mo) {
$all_module_list[] = (string)$mo->name;
}
@@ -3033,7 +3038,8 @@ class AdminControllerCore extends Controller
$upgradeInfo = simplexml_load_string($content);
$this->context->smarty->assign(array(
'upgrade_info' => $upgradeInfo
'upgrade_info' => $upgradeInfo,
'debug_mode' => (bool) _PS_MODE_DEV_,
));
}
@@ -3838,9 +3844,10 @@ class AdminControllerCore extends Controller
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
continue;
}
/* Automatically encrypt password in MD5 */
/* Automatically hash password */
if ($key == 'passwd' && !empty($value)) {
$value = Tools::encrypt($value);
$objHash = new PasswordHashing();
$value = $objHash->passwordHash($value);
}
$object->{$key} = $value;
}
@@ -4817,4 +4824,4 @@ class AdminControllerCore extends Controller
return 0;
}
}
}
}