[+] BO : you can now set detailed permissions for each module in the back end
This commit is contained in:
@@ -40,11 +40,10 @@ if (empty($tab) and !sizeof($_POST))
|
||||
$_POST['tab'] = 'AdminHome';
|
||||
$_POST['token'] = Tools::getAdminTokenLite($tab);
|
||||
}
|
||||
if ($id_tab = checkingTab($tab))
|
||||
if ($adminObj = checkingTab($tab))
|
||||
{
|
||||
$isoUser = Language::getIsoById(intval($cookie->id_lang));
|
||||
|
||||
|
||||
if (Validate::isLoadedObject($adminObj))
|
||||
{
|
||||
$adminObj->ajax = true;
|
||||
|
||||
+125
-14
@@ -68,14 +68,14 @@ class AdminAccess extends AdminTab
|
||||
$currentProfile = (int)($this->getCurrentProfileId());
|
||||
$tabs = Tab::getTabs($this->context->language->id);
|
||||
$profiles = Profile::getProfiles($this->context->language->id);
|
||||
$accesses = Profile::getProfileAccesses($this->context->language->id);
|
||||
$accesses = Profile::getProfileAccesses($this->context->employee->id_profile);
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
setLang(Array(\''.$this->l('Profile updated').'\', \''.$this->l('Request failed!').'\', \''.$this->l('Update in progress. Please wait.').'\', \''.$this->l('Server connection failed!').'\'));
|
||||
</script>
|
||||
<div id="ajax_confirmation"></div>
|
||||
<table class="table" cellspacing="0">
|
||||
<table class="table float" cellspacing="0">
|
||||
<tr>
|
||||
<th '.($currentProfile == (int)_PS_ADMIN_PROFILE_ ? 'colspan="6"' : '').'>
|
||||
<select name="profile" onchange="redirect(\''.Tools::getHttpHost(true, true).self::$currentIndex.'&token='.$this->token.'&profile=\'+this.options[this.selectedIndex].value)">';
|
||||
@@ -87,17 +87,36 @@ class AdminAccess extends AdminTab
|
||||
foreach ($tabs AS $tab)
|
||||
if ($tab['id_tab'] > $tabsize)
|
||||
$tabsize = $tab['id_tab'];
|
||||
echo '
|
||||
</select>
|
||||
echo ' </select>
|
||||
</th>';
|
||||
|
||||
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
|
||||
echo '
|
||||
<th class="center">'.$this->l('View').'<br /><input type="checkbox" name="1" id="viewall" onclick="ajax_power(this, \'view\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Add').'<br /><input type="checkbox" name="1" id="addall" onclick="ajax_power(this, \'add\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Edit').'<br /><input type="checkbox" name="1" id="editall" onclick="ajax_power(this, \'edit\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Delete').'<br /><input type="checkbox" name="1" id="deleteall" onclick="ajax_power(this, \'delete\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('All').'<br /><input type="checkbox" name="1" id="allall" onclick="ajax_power(this, \'all\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="viewall"
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'view\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')"' : 'disabled="disabled"').' />
|
||||
'.$this->l('View').'
|
||||
</th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="addall"
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'add\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')"' : 'disabled="disabled"').' />
|
||||
'.$this->l('Add').'
|
||||
</th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="editall"
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'edit\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')"' : 'disabled="disabled"').' />
|
||||
'.$this->l('Edit').'
|
||||
</th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="deleteall"
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'delete\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')"' : 'disabled="disabled"').' />
|
||||
'.$this->l('Delete').'
|
||||
</th>
|
||||
<th class="center">
|
||||
<input type="checkbox" name="1" id="allall"
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'all\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')"' : 'disabled="disabled"').' />
|
||||
'.$this->l('All').'
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
if (!sizeof($tabs))
|
||||
@@ -114,6 +133,10 @@ class AdminAccess extends AdminTab
|
||||
$this->printTabAccess($currentProfile, $child, $accesses[$child['id_tab']], true, $tabsize, sizeof($tabs));
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
|
||||
$this->displayModuleAccesses($currentProfile);
|
||||
echo '<div class="clear"> </div>';
|
||||
}
|
||||
|
||||
private function printTabAccess($currentProfile, $tab, $access, $is_child, $tabsize, $tabnumber)
|
||||
@@ -123,14 +146,102 @@ class AdminAccess extends AdminTab
|
||||
echo '<tr><td'.($is_child ? '' : ' class="bold"').'>'.($is_child ? ' » ' : '').$tab['name'].'</td>';
|
||||
foreach ($perms as $perm)
|
||||
{
|
||||
if($this->tabAccess['edit'] == 1)
|
||||
echo '<td class="center"><input type="checkbox" name="1" id=\''.$perm.(int)($access['id_tab']).'\' class=\''.$perm.' '.(int)($access['id_tab']).'\' onclick="ajax_power(this, \''.$perm.'\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').'/></td>';
|
||||
if ($this->tabAccess['edit'] == 1)
|
||||
echo '<td><input type="checkbox" name="1" id=\''.$perm.(int)($access['id_tab']).'\' class=\''.$perm.' '.(int)($access['id_tab']).'\' onclick="ajax_power(this, \''.$perm.'\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').'/></td>';
|
||||
else
|
||||
echo '<td class="center"><input type="checkbox" name="1" disabled="disabled" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').' /></td>';
|
||||
echo '<td><input type="checkbox" name="1" disabled="disabled" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').' /></td>';
|
||||
$result_accesses += $access[$perm];
|
||||
}
|
||||
echo '<td class="center"><input type="checkbox" name="1" id=\'all'.(int)($access['id_tab']).'\' class=\'all '.(int)($access['id_tab']).'\' onclick="ajax_power(this, \'all\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')" '.($result_accesses == 4 ? 'checked="checked"' : '').'/></td></tr>';
|
||||
|
||||
echo '<td>
|
||||
<input type="checkbox" name="1" id=\'all'.(int)($access['id_tab']).'\' class=\'all '.(int)($access['id_tab']).'\'
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="ajax_power(this, \'all\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')"' : 'disabled="disabled"').'
|
||||
'.($result_accesses == 4 ? 'checked="checked"' : '').'
|
||||
/>
|
||||
</td></tr>';
|
||||
}
|
||||
|
||||
public function ajaxProcess()
|
||||
{
|
||||
if (Tools::isSubmit('changeModuleAccess'))
|
||||
{
|
||||
if ($action = Tools::getValue('action') AND $variable = Tools::getValue('variable') AND $id_module = (int)Tools::getValue('id_module') AND $id_profile = (int)Tools::getValue('id_profile') AND $this->tabAccess['edit'] == 1)
|
||||
{
|
||||
if (!in_array($variable, array('view', 'configure')))
|
||||
die (Tools::displayErrors('unknown variable'));
|
||||
$action = ($action == 'true' ? 1 : 0);
|
||||
if ($id_module == -1)
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($variable).'` = '.(int)$action.' WHERE `id_profile` = '.(int)$id_profile);
|
||||
else
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($variable).'` = '.(int)$action.' WHERE `id_module` = '.(int)$id_module.' AND `id_profile` = '.(int)$id_profile);
|
||||
die ('ok');
|
||||
}
|
||||
die ('inconsistent data');
|
||||
}
|
||||
}
|
||||
|
||||
private function displayModuleAccesses($currentProfile)
|
||||
{
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function changeModuleAccess(checkbox, id_module, variable)
|
||||
{
|
||||
getE(\'ajax_confirmation\').innerHTML = \'<span class="bold">\'+lang[2]+\'</span>\';
|
||||
$.post(
|
||||
\'ajax-tab.php?tab=AdminAccess&token='.Tools::getAdminTokenLite('AdminAccess').'&changeModuleAccess\',
|
||||
{id_profile:'.(int)$currentProfile.',id_module:id_module,action:checkbox.checked,variable:variable},
|
||||
function(r) {
|
||||
if (r != \'ok\')
|
||||
getE(\'ajax_confirmation\').innerHTML = \'<span class="bold">'.addslashes(Tools::displayError('An error occurred:')).' \'+lang[1]+\'</span>\';
|
||||
else
|
||||
{
|
||||
getE(\'ajax_confirmation\').innerHTML = \'<span class="bold">\'+lang[0]+\'</span>\';
|
||||
if (id_module == -1)
|
||||
$(\'.ajax-ma-\'+variable).each(function(key, value) {
|
||||
value.checked = checkbox.checked;
|
||||
});
|
||||
else if (!checkbox.checked)
|
||||
$(\'#ajax-ma-\'+variable+\'-master\').each(function(key, value) {
|
||||
value.checked = checkbox.checked;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<table class="table float" cellspacing="0" style="margin-left:20px">
|
||||
<tr>
|
||||
<th>'.$this->l('Modules').'</th>
|
||||
<th class="center"><input type="checkbox" id="ajax-ma-view-master" '.($this->tabAccess['edit'] == 1 ? 'onclick="changeModuleAccess(this, -1, \'view\');"' : 'disabled="disabled"').' /> '.$this->l('View').'</th>
|
||||
<th class="center"><input type="checkbox" id="ajax-ma-configure-master" '.($this->tabAccess['edit'] == 1 ? 'onclick="changeModuleAccess(this, -1, \'configure\');"' : 'disabled="disabled"').' /> '.$this->l('Configure').'</th>
|
||||
</tr>';
|
||||
|
||||
$modules = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT ma.id_module, m.name, ma.`view`, ma.`configure`
|
||||
FROM '._DB_PREFIX_.'module_access ma
|
||||
LEFT JOIN '._DB_PREFIX_.'module m ON ma.id_module = m.id_module
|
||||
WHERE id_profile = '.(int)$currentProfile.'
|
||||
ORDER BY m.name');
|
||||
if (!sizeof($modules))
|
||||
echo '<tr><td colspan="2">'.$this->l('No modules installed').'</td></tr>';
|
||||
else
|
||||
foreach ($modules AS $module)
|
||||
echo '<tr>
|
||||
<td>» '.$module['name'].'</td>
|
||||
<td>
|
||||
<input type="checkbox" class="ajax-ma-view"
|
||||
'.((int)$module['view'] == 1 ? 'checked="checked"' : '').'
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="changeModuleAccess(this, '.(int)$module['id_module'].', \'view\');"' : 'disabled="disabled"').'
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" class="ajax-ma-configure"
|
||||
'.((int)$module['configure'] == 1 ? 'checked="checked"' : '').'
|
||||
'.($this->tabAccess['edit'] == 1 ? 'onclick="changeModuleAccess(this, '.(int)$module['id_module'].', \'configure\');"' : 'disabled="disabled"').'
|
||||
/>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
echo '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+126
-63
@@ -46,21 +46,24 @@ class AdminModules extends AdminTab
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct ();
|
||||
parent::__construct();
|
||||
|
||||
$this->_moduleCacheFile = _PS_ROOT_DIR_.'/config/modules_list.xml';
|
||||
|
||||
//refresh modules_list.xml every week
|
||||
// refresh modules_list.xml every week
|
||||
if (!$this->isFresh())
|
||||
$this->refresh();
|
||||
|
||||
$this->listTabModules = array('administration' => $this->l('Administration'), 'advertising_marketing' => $this->l('Advertising & Marketing'),
|
||||
'analytics_stats' => $this->l('Analytics & Stats'), 'billing_invoicing' => $this->l('Billing & Invoicing'), 'checkout' => $this->l('Checkout'),
|
||||
'content_management' => $this->l('Content Management'), 'export' => $this->l('Export'), 'front_office_features' => $this->l('Front Office Features'),
|
||||
'i18n_localization' => $this->l('I18n & Localization'), 'merchandizing' => $this->l('Merchandizing'), 'migration_tools' => $this->l('Migration Tools'),
|
||||
'payments_gateways' => $this->l('Payments & Gateways'), 'payment_security' => $this->l('Payment Security'), 'pricing_promotion' => $this->l('Pricing & Promotion'),
|
||||
'quick_bulk_update' => $this->l('Quick / Bulk update'), 'search_filter' => $this->l('Search & Filter'), 'seo' => $this->l('SEO'), 'shipping_logistics' => $this->l('Shipping & Logistics'),
|
||||
'slideshows' => $this->l('Slideshows'), 'smart_shopping' => $this->l('Smart Shopping'), 'market_place' => $this->l('Market Place'), 'social_networks' => $this->l('Social Networks'), 'others'=> $this->l('Other Modules'));
|
||||
$this->listTabModules = array(
|
||||
'administration' => $this->l('Administration'), 'advertising_marketing' => $this->l('Advertising & Marketing'),
|
||||
'analytics_stats' => $this->l('Analytics & Stats'), 'billing_invoicing' => $this->l('Billing & Invoicing'), 'checkout' => $this->l('Checkout'),
|
||||
'content_management' => $this->l('Content Management'), 'export' => $this->l('Export'), 'front_office_features' => $this->l('Front Office Features'),
|
||||
'i18n_localization' => $this->l('I18n & Localization'), 'merchandizing' => $this->l('Merchandizing'), 'migration_tools' => $this->l('Migration Tools'),
|
||||
'payments_gateways' => $this->l('Payments & Gateways'), 'payment_security' => $this->l('Payment Security'), 'pricing_promotion' => $this->l('Pricing & Promotion'),
|
||||
'quick_bulk_update' => $this->l('Quick / Bulk update'), 'search_filter' => $this->l('Search & Filter'), 'seo' => $this->l('SEO'), 'shipping_logistics' => $this->l('Shipping & Logistics'),
|
||||
'slideshows' => $this->l('Slideshows'), 'smart_shopping' => $this->l('Smart Shopping'), 'market_place' => $this->l('Market Place'), 'social_networks' => $this->l('Social Networks'),
|
||||
'others'=> $this->l('Other Modules')
|
||||
);
|
||||
|
||||
$xmlModules = @simplexml_load_file($this->_moduleCacheFile);
|
||||
|
||||
@@ -68,25 +71,25 @@ class AdminModules extends AdminTab
|
||||
if ($xmlModule->attributes() == 'native')
|
||||
foreach($xmlModule->children() as $module)
|
||||
foreach($module->attributes() as $key => $value)
|
||||
if ($key == 'name')
|
||||
$this->listNativeModules[] = (string)$value;
|
||||
if ($key == 'name')
|
||||
$this->listNativeModules[] = (string)$value;
|
||||
if ($xmlModule->attributes() == 'partner')
|
||||
foreach($xmlModule->children() as $module)
|
||||
foreach($module->attributes() as $key => $value)
|
||||
if ($key == 'name')
|
||||
$this->listPartnerModules[] = (string)$value;
|
||||
if ($key == 'name')
|
||||
$this->listPartnerModules[] = (string)$value;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
$id_employee = (int)$this->context->employee->id;
|
||||
$filter_conf = Configuration::getMultiple(array(
|
||||
'PS_SHOW_TYPE_MODULES_'.$id_employee,
|
||||
'PS_SHOW_COUNTRY_MODULES_'.$id_employee,
|
||||
'PS_SHOW_INSTALLED_MODULES_'.$id_employee,
|
||||
'PS_SHOW_ENABLED_MODULES_'.$id_employee
|
||||
));
|
||||
//reset filtre
|
||||
'PS_SHOW_TYPE_MODULES_'.$id_employee,
|
||||
'PS_SHOW_COUNTRY_MODULES_'.$id_employee,
|
||||
'PS_SHOW_INSTALLED_MODULES_'.$id_employee,
|
||||
'PS_SHOW_ENABLED_MODULES_'.$id_employee
|
||||
));
|
||||
|
||||
if (Tools::isSubmit('desactive') && isset($filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee] != 'enabledDisabled')
|
||||
$this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee], 'disabled');
|
||||
|
||||
@@ -99,7 +102,6 @@ class AdminModules extends AdminTab
|
||||
if (Tools::isSubmit('install') && isset($filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee] != 'installedUninstalled')
|
||||
$this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], 'installed', $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]);
|
||||
|
||||
|
||||
if (Tools::isSubmit('filterModules'))
|
||||
{
|
||||
$this->setFilterModules(Tools::getValue('module_type'), Tools::getValue('country_module_value'), Tools::getValue('module_install'), Tools::getValue('module_status'));
|
||||
@@ -110,6 +112,7 @@ class AdminModules extends AdminTab
|
||||
$this->resetFilterModules();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('active'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -117,9 +120,15 @@ class AdminModules extends AdminTab
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
$module->enable();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
} else
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
$module->enable();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
} else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
@@ -131,9 +140,15 @@ class AdminModules extends AdminTab
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
$module->disable();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
} else
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
$module->disable();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
} else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
@@ -145,15 +160,20 @@ class AdminModules extends AdminTab
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
if ($module->uninstall())
|
||||
if ($module->install())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot install module');
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot uninstall module');
|
||||
|
||||
} else
|
||||
{
|
||||
if ($module->uninstall())
|
||||
if ($module->install())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot install module');
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot uninstall module');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
} else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
@@ -200,11 +220,16 @@ class AdminModules extends AdminTab
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
if (Tools::getValue('enable'))
|
||||
$module->enable();
|
||||
if (!$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
$module->disable();
|
||||
Tools::redirectAdmin($this->getCurrentUrl('enable'));
|
||||
{
|
||||
if (Tools::getValue('enable'))
|
||||
$module->enable();
|
||||
else
|
||||
$module->disable();
|
||||
Tools::redirectAdmin($this->getCurrentUrl('enable'));
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Cannot load module object');
|
||||
@@ -219,11 +244,16 @@ class AdminModules extends AdminTab
|
||||
{
|
||||
if (Tools::getValue('module_name') != '')
|
||||
{
|
||||
$moduleDir = _PS_MODULE_DIR_.str_replace(array('.', '/', '\\'), array('', '', ''), Tools::getValue('module_name'));
|
||||
$this->recursiveDeleteOnDisk($moduleDir);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=22&token='.$this->token.'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name'));
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module) AND !$module->getPermission('configure'))
|
||||
$this->_errors[] = Tools::displayError('You do not have the permission to use this module');
|
||||
else
|
||||
{
|
||||
$moduleDir = _PS_MODULE_DIR_.str_replace(array('.', '/', '\\'), array('', '', ''), Tools::getValue('module_name'));
|
||||
$this->recursiveDeleteOnDisk($moduleDir);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=22&token='.$this->token.'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name'));
|
||||
}
|
||||
}
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
@@ -247,15 +277,15 @@ class AdminModules extends AdminTab
|
||||
if (!($module = Module::getInstanceByName(urldecode($name))))
|
||||
$this->_errors[] = $this->l('module not found');
|
||||
elseif ($key == 'install' AND $this->tabAccess['add'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
elseif ($key == 'uninstall' AND $this->tabAccess['delete'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
elseif ($key == 'configure' AND $this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to install a module.');
|
||||
elseif ($key == 'uninstall' AND ($this->tabAccess['delete'] !== '1' OR !$module->getPermission('configure')))
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete this module.');
|
||||
elseif ($key == 'configure' AND ($this->tabAccess['edit'] !== '1' OR !$module->getPermission('configure')))
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to configure this module.');
|
||||
elseif ($key == 'install' AND Module::isInstalled($module->name))
|
||||
$this->_errors[] = Tools::displayError('This module is already installed : ').$module->name;
|
||||
$this->_errors[] = Tools::displayError('This module is already installed:').' '.$module->name;
|
||||
elseif ($key == 'uninstall' AND !Module::isInstalled($module->name))
|
||||
$this->_errors[] = Tools::displayError('This module is already uninstalled : ').$module->name;
|
||||
$this->_errors[] = Tools::displayError('This module is already uninstalled:').' '.$module->name;
|
||||
else
|
||||
{
|
||||
if (((method_exists($module, $method) && ($echo = $module->{$method}())) || ($echo = ' ')) AND $key == 'configure' AND Module::isInstalled($module->name))
|
||||
@@ -311,12 +341,11 @@ class AdminModules extends AdminTab
|
||||
}
|
||||
if (sizeof($module_errors))
|
||||
{
|
||||
$htmlError = '';
|
||||
|
||||
$htmlError = '<ul>';
|
||||
foreach ($module_errors AS $module_error)
|
||||
$htmlError .= '<li>'.$module_error.'</li>';
|
||||
$htmlError .= '</ul>';
|
||||
$this->_errors[] = Tools::displayError('The following module(s) were not installed successfully:'.$htmlError);
|
||||
$this->_errors[] = Tools::displayError('The following module(s) were not installed successfully:').$htmlError;
|
||||
}
|
||||
}
|
||||
if ($return)
|
||||
@@ -330,9 +359,9 @@ class AdminModules extends AdminTab
|
||||
if (substr($file, -4) == '.zip')
|
||||
{
|
||||
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
|
||||
$this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||
}
|
||||
else
|
||||
{
|
||||
$archive = new Archive_Tar($file);
|
||||
if ($archive->extract(_PS_MODULE_DIR_))
|
||||
@@ -505,22 +534,37 @@ class AdminModules extends AdminTab
|
||||
</script>';
|
||||
}
|
||||
|
||||
//filter module list
|
||||
foreach($modules as $key => $module)
|
||||
// Filter module list
|
||||
foreach ($modules as $key => $module)
|
||||
{
|
||||
if ($module->id AND !Module::getPermissionStatic($module->id, 'view') AND !Module::getPermissionStatic($module->id, 'configure'))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($showTypeModules)
|
||||
{
|
||||
case 'nativeModules':
|
||||
if (!in_array($module->name, $this->listNativeModules))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'partnerModules':
|
||||
if (!in_array($module->name, $this->listPartnerModules))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'otherModules':
|
||||
if (in_array($module->name, $this->listPartnerModules) OR in_array($module->name, $this->listNativeModules))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (strpos($showTypeModules, 'authorModules[') !== false)
|
||||
@@ -528,7 +572,10 @@ class AdminModules extends AdminTab
|
||||
$author_selected = $this->_getSubmitedModuleAuthor($showTypeModules);
|
||||
$modulesAuthors[$author_selected] = 'selected'; // setting selected author in authors set
|
||||
if (empty($module->author) || $module->author != $author_selected)
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -539,11 +586,17 @@ class AdminModules extends AdminTab
|
||||
{
|
||||
case 'installed':
|
||||
if (!$module->id)
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'unistalled':
|
||||
if ($module->id)
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -551,21 +604,31 @@ class AdminModules extends AdminTab
|
||||
{
|
||||
case 'enabled':
|
||||
if (!$module->active)
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 'disabled':
|
||||
if ($module->active)
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($showCountryModules)
|
||||
if (isset($module->limited_countries) AND !empty($module->limited_countries) AND ((is_array($module->limited_countries) AND sizeof($module->limited_countries) AND !in_array(strtolower($isoCountryDefault), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($isoCountryDefault) != strval($module->limited_countries))))
|
||||
unset($modules[$key]);
|
||||
if ($showCountryModules AND (isset($module->limited_countries) AND !empty($module->limited_countries) AND ((is_array($module->limited_countries) AND sizeof($module->limited_countries) AND !in_array(strtolower($isoCountryDefault), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($isoCountryDefault) != strval($module->limited_countries)))))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($filterName))
|
||||
if (stristr($module->name, $filterName) === false AND stristr($module->displayName, $filterName) === false AND stristr($module->description, $filterName) === false)
|
||||
unset($modules[$key]);
|
||||
if (!empty($filterName) AND (stristr($module->name, $filterName) === false AND stristr($module->displayName, $filterName) === false AND stristr($module->description, $filterName) === false))
|
||||
{
|
||||
unset($modules[$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($modules as $module)
|
||||
|
||||
+48
-1
@@ -85,6 +85,8 @@ abstract class ModuleCore
|
||||
protected static $_generateConfigXmlMode = false;
|
||||
|
||||
protected static $l_cache = array();
|
||||
|
||||
protected static $cache_permissions = array();
|
||||
|
||||
/**
|
||||
* @var array used by AdminTab to determine which lang file to use (admin.php or module lang file)
|
||||
@@ -163,6 +165,23 @@ abstract class ModuleCore
|
||||
$this->id = Db::getInstance()->Insert_ID();
|
||||
|
||||
$this->enable(true);
|
||||
|
||||
// Permissions management
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||
SELECT id_profile, '.(int)$this->id.', 1, 1
|
||||
FROM '._DB_PREFIX_.'access a
|
||||
WHERE id_tab = (SELECT `id_tab` FROM '._DB_PREFIX_.'tab WHERE class_name = \'AdminModules\' LIMIT 1)
|
||||
AND a.`view` = 1
|
||||
)');
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||
SELECT id_profile, '.(int)$this->id.', 1, 0
|
||||
FROM '._DB_PREFIX_.'access a
|
||||
WHERE id_tab = (SELECT `id_tab` FROM '._DB_PREFIX_.'tab WHERE class_name = \'AdminModules\' LIMIT 1)
|
||||
AND a.`view` = 0
|
||||
)');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,10 +208,12 @@ abstract class ModuleCore
|
||||
$this->cleanPositions($row['id_hook']);
|
||||
}
|
||||
$this->disable(true);
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_module` = '.(int)$this->id);
|
||||
|
||||
return Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'module`
|
||||
WHERE `id_module` = '.(int)($this->id));
|
||||
WHERE `id_module` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,6 +787,8 @@ abstract class ModuleCore
|
||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||
if (in_array(Dispatcher::getInstance()->getController(), $exceptions))
|
||||
continue;
|
||||
if (isset($context->employee) AND !$moduleInstance->getPermission('view', $context->employee))
|
||||
continue;
|
||||
|
||||
if (is_callable(array($moduleInstance, 'hook'.$hook_name)))
|
||||
{
|
||||
@@ -1164,5 +1187,29 @@ abstract class ModuleCore
|
||||
{
|
||||
return is_callable(array($this, 'hook'.ucfirst($hook_name)));
|
||||
}
|
||||
|
||||
public function getPermission($variable, $employee = null)
|
||||
{
|
||||
return self::getPermissionStatic($this->id, $variable, $employee);
|
||||
}
|
||||
|
||||
public function getPermissionStatic($id_module, $variable, $employee = null)
|
||||
{
|
||||
if (!in_array($variable, array('view', 'configure')))
|
||||
return false;
|
||||
if (!$employee)
|
||||
$employee = $this->context->employee;
|
||||
if (!isset($cache_permissions[$employee->id_profile]))
|
||||
{
|
||||
$cache_permissions[$employee->id_profile] = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_module, `view`, `configure` FROM '._DB_PREFIX_.'module_access WHERE id_profile = '.(int)$employee->id_profile);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
||||
$cache_permissions[$employee->id_profile][$row['id_module']]['configure'] = $row['configure'];
|
||||
}
|
||||
}
|
||||
return (bool)$cache_permissions[$employee->id_profile][$id_module][$variable];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -80,22 +80,28 @@ class ProfileCore extends ObjectModel
|
||||
SELECT `name`
|
||||
FROM `'._DB_PREFIX_.'profile` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (p.`id_profile` = pl.`id_profile`)
|
||||
WHERE p.`id_profile` = '.(int)($id_profile).'
|
||||
AND pl.`id_lang` = '.(int)($id_lang));
|
||||
WHERE p.`id_profile` = '.(int)$id_profile.'
|
||||
AND pl.`id_lang` = '.(int)$id_lang);
|
||||
}
|
||||
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
if (parent::add($autodate, true))
|
||||
return Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)($this->id).', id_tab, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)');
|
||||
return (
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)$this->id.', id_tab, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)')
|
||||
&& Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'module_access (`id_profile`, `id_module`, `configure`, `view`) (SELECT '.(int)$this->id.', id_module, 0, 1 FROM '._DB_PREFIX_.'module)')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (parent::delete())
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'access` WHERE `id_profile` = '.(int)($this->id));
|
||||
return (
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'access` WHERE `id_profile` = '.(int)$this->id)
|
||||
&& Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_profile` = '.(int)$this->id)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -117,7 +123,7 @@ class ProfileCore extends ObjectModel
|
||||
WHERE `id_profile` = '.(int)$id_profile);
|
||||
|
||||
self::$_cache_accesses[$id_profile] = array();
|
||||
foreach($result AS $row)
|
||||
foreach ($result AS $row)
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile][$row['id_tab']]))
|
||||
self::$_cache_accesses[$id_profile][$row['id_tab']] = array();
|
||||
|
||||
@@ -862,6 +862,14 @@ CREATE TABLE `PREFIX_module` (
|
||||
KEY `name` (`name`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_module_access` (
|
||||
`id_profile` int(10) unsigned NOT NULL,
|
||||
`id_module` int(10) unsigned NOT NULL,
|
||||
`view` tinyint(1) NOT NULL,
|
||||
`configure` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id_profile`,`id_module`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_module_country` (
|
||||
`id_module` int(10) unsigned NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
|
||||
@@ -59,8 +59,9 @@ INSERT INTO `PREFIX_module` (`id_module`, `name`, `active`) VALUES (1, 'homefeat
|
||||
(47, 'statsbestvouchers', 1),(48, 'statsbestsuppliers', 1),(49, 'statscarrier', 1),(50, 'statsnewsletter', 1),(51, 'statssearch', 1),(52, 'statscheckup', 1),(53, 'statsstock', 1),
|
||||
(54, 'blockstore', 1),(55, 'statsforecast', 1);
|
||||
|
||||
INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) (SELECT `id_module`, 1 FROM `PREFIX_module`);
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 1, id_module, 1, 1 FROM PREFIX_module);
|
||||
|
||||
INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) (SELECT `id_module`, 1 FROM `PREFIX_module`);
|
||||
|
||||
INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES
|
||||
('myAccountBlock', 'My account block', 'Display extra informations inside the "my account" block', 1);
|
||||
@@ -1107,6 +1108,10 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(4, 91, 0, 0, 0, 0),
|
||||
(4, 92, 0, 0, 0, 0);
|
||||
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module);
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 4, id_module, 0, 1 FROM PREFIX_module);
|
||||
|
||||
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (2),(3),(4);
|
||||
INSERT INTO `PREFIX_profile_lang` (`id_lang`, `id_profile`, `name`) VALUES
|
||||
(1, 2, 'Logistician'),(2, 2, 'Logisticien'),(3, 2, 'Logistician'),(4, 2, 'Logistiker'),(5, 2, 'Logista'),
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
SET NAMES 'utf8';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_module_access` (
|
||||
`id_profile` int(10) unsigned NOT NULL,
|
||||
`id_module` int(10) unsigned NOT NULL,
|
||||
`view` tinyint(1) NOT NULL,
|
||||
`configure` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id_profile`,`id_module`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (
|
||||
SELECT id_profile, id_module, 0, 1
|
||||
FROM PREFIX_access a, PREFIX_module m
|
||||
WHERE id_tab = (SELECT `id_tab` FROM PREFIX_tab WHERE class_name = 'AdminModules' LIMIT 1)
|
||||
AND a.`view` = 0
|
||||
);
|
||||
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (
|
||||
SELECT id_profile, id_module, 1, 1
|
||||
FROM PREFIX_access a, PREFIX_module m
|
||||
WHERE id_tab = (SELECT `id_tab` FROM PREFIX_tab WHERE class_name = 'AdminModules' LIMIT 1)
|
||||
AND a.`view` = 1
|
||||
);
|
||||
@@ -67,7 +67,8 @@ class VatNumber extends Module
|
||||
|
||||
public static function getPrefixIntracomVAT()
|
||||
{
|
||||
$intracom_array = array('AT'=>'AT', //Austria
|
||||
$intracom_array = array(
|
||||
'AT'=>'AT', //Austria
|
||||
'BE'=>'BE', //Belgium
|
||||
'DK'=>'DK', //Denmark
|
||||
'FI'=>'FI', //Finland
|
||||
@@ -148,16 +149,17 @@ class VatNumber extends Module
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$echo = '';
|
||||
|
||||
if (Tools::isSubmit('submitVatNumber'))
|
||||
{
|
||||
if (Tools::getValue('vatnumber_country'))
|
||||
if (Configuration::updateValue('VATNUMBER_COUNTRY', (int)(Tools::getValue('vatnumber_country'))))
|
||||
echo $this->displayConfirmation($this->l('Your country has been updated.'));
|
||||
if (Configuration::updateValue('VATNUMBER_COUNTRY', (int)(Tools::getValue('vatnumber_country'))))
|
||||
$echo .= $this->displayConfirmation($this->l('Your country has been updated.'));
|
||||
$check = (int)Tools::getValue('vatnumber_checking');
|
||||
if(Configuration::get('VATNUMBER_CHECKING') != $check AND Configuration::updateValue('VATNUMBER_CHECKING', $check))
|
||||
echo ($check ? $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now enabled.')) : $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now disabled.')));
|
||||
if (Configuration::get('VATNUMBER_CHECKING') != $check AND Configuration::updateValue('VATNUMBER_CHECKING', $check))
|
||||
$echo .= ($check ? $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now enabled.')) : $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now disabled.')));
|
||||
}
|
||||
echo '
|
||||
$echo .= '
|
||||
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
|
||||
<form action="'.htmlentities($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<label>'.$this->l('Your country').'</label>
|
||||
@@ -165,8 +167,8 @@ class VatNumber extends Module
|
||||
<select name="vatnumber_country">
|
||||
<option value="0">'.$this->l('-- Choose a country --').'</option>';
|
||||
foreach (Country::getCountries((int)($cookie->id_lang)) as $country)
|
||||
echo ' <option value="'.$country['id_country'].'" '.(Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')) == $country['id_country'] ? 'selected="selected"' : '').'>'.$country['name'].'</option>';
|
||||
echo ' </select>
|
||||
$echo .= ' <option value="'.$country['id_country'].'" '.(Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')) == $country['id_country'] ? 'selected="selected"' : '').'>'.$country['name'].'</option>';
|
||||
$echo .= ' </select>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<label>'.$this->l('Enable checking of the VAT number with the WebService').'</label>
|
||||
@@ -180,6 +182,7 @@ class VatNumber extends Module
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>';
|
||||
return $echo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user