// Little change on adminpayment
This commit is contained in:
@@ -25,26 +25,26 @@
|
|||||||
*}
|
*}
|
||||||
|
|
||||||
{extends file="helper/view/view.tpl"}
|
{extends file="helper/view/view.tpl"}
|
||||||
|
|
||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
|
{if !$shop_context}
|
||||||
|
<div class="warn">{l s='You have more than one shop. You need to select one to configure payment.'}</div>
|
||||||
|
{else}
|
||||||
|
<h2 class="space">{l s='Payment modules list'}</h2>
|
||||||
|
{if isset($url_modules)}
|
||||||
|
<input type="button" class="button" onclick="document.location='{$url_modules}'" value="{l s='Click to see the list of payment modules.'}" /><br>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<h2 class="space">{l s='Payment modules list'}</h2>
|
|
||||||
{if isset($url_modules)}
|
|
||||||
<input type="button" class="button" onclick="document.location='{$url_modules}'" value="{l s='Click to see the list of payment modules.'}" /><br>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
{if $display_restrictions}
|
|
||||||
<br /><h2 class="space">{l s='Payment module restrictions'}</h2>
|
|
||||||
{foreach $lists as $list}
|
|
||||||
{include file='payment/restrictions.tpl'}
|
|
||||||
<br />
|
|
||||||
{/foreach}
|
|
||||||
{else}
|
|
||||||
<br />
|
<br />
|
||||||
<div class='warn'>{l s='No payment module installed'}</div>
|
|
||||||
{/if}
|
{if $display_restrictions}
|
||||||
|
<br /><h2 class="space">{l s='Payment module restrictions'}</h2>
|
||||||
|
{foreach $lists as $list}
|
||||||
|
{include file='payment/restrictions.tpl'}
|
||||||
|
<br />
|
||||||
|
{/foreach}
|
||||||
|
{else}
|
||||||
|
<br />
|
||||||
|
<div class='warn'>{l s='No payment module installed'}</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
$countries = DB::getInstance()->executeS('
|
$countries = DB::getInstance()->executeS('
|
||||||
SELECT id_country
|
SELECT id_country
|
||||||
FROM '._DB_PREFIX_.'module_country
|
FROM '._DB_PREFIX_.'module_country
|
||||||
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shop_id
|
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
|
||||||
);
|
);
|
||||||
foreach ($countries as $country)
|
foreach ($countries as $country)
|
||||||
$module->country[] = $country['id_country'];
|
$module->country[] = $country['id_country'];
|
||||||
@@ -56,7 +56,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
$currencies = DB::getInstance()->executeS('
|
$currencies = DB::getInstance()->executeS('
|
||||||
SELECT id_currency
|
SELECT id_currency
|
||||||
FROM '._DB_PREFIX_.'module_currency
|
FROM '._DB_PREFIX_.'module_currency
|
||||||
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shop_id
|
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
|
||||||
);
|
);
|
||||||
foreach ($currencies as $currency)
|
foreach ($currencies as $currency)
|
||||||
$module->currency[] = $currency['id_currency'];
|
$module->currency[] = $currency['id_currency'];
|
||||||
@@ -66,7 +66,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
$groups = DB::getInstance()->executeS('
|
$groups = DB::getInstance()->executeS('
|
||||||
SELECT id_group
|
SELECT id_group
|
||||||
FROM '._DB_PREFIX_.'module_group
|
FROM '._DB_PREFIX_.'module_group
|
||||||
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shop_id
|
WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
|
||||||
);
|
);
|
||||||
foreach ($groups as $group)
|
foreach ($groups as $group)
|
||||||
$module->group[] = $group['id_group'];
|
$module->group[] = $group['id_group'];
|
||||||
@@ -86,17 +86,20 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('submitModulecountry'))
|
if ($this->tabAccess['edit'] === '1')
|
||||||
$this->saveRestrictions('country');
|
{
|
||||||
else if (Tools::isSubmit('submitModulecurrency'))
|
if (Tools::isSubmit('submitModulecountry'))
|
||||||
$this->saveRestrictions('currency');
|
$this->saveRestrictions('country');
|
||||||
else if (Tools::isSubmit('submitModulegroup'))
|
else if (Tools::isSubmit('submitModulecurrency'))
|
||||||
$this->saveRestrictions('group');
|
$this->saveRestrictions('currency');
|
||||||
|
else if (Tools::isSubmit('submitModulegroup'))
|
||||||
|
$this->saveRestrictions('group');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function saveRestrictions($type)
|
private function saveRestrictions($type)
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'module_'.$type.' WHERE id_shop = '.Context::getContext()->shop->getID(true));
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_'.bqSQL($type).'` WHERE id_shop = '.Context::getContext()->shop->getID(true));
|
||||||
foreach ($this->payment_modules as $module)
|
foreach ($this->payment_modules as $module)
|
||||||
if ($module->active && isset($_POST[$module->name.'_'.$type.'']))
|
if ($module->active && isset($_POST[$module->name.'_'.$type.'']))
|
||||||
foreach ($_POST[$module->name.'_'.$type.''] as $selected)
|
foreach ($_POST[$module->name.'_'.$type.''] as $selected)
|
||||||
@@ -114,7 +117,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function initView()
|
public function initView()
|
||||||
{
|
{
|
||||||
// link to modules page
|
// link to modules page
|
||||||
if (isset($this->payment_modules[0]))
|
if (isset($this->payment_modules[0]))
|
||||||
$token_modules = Tools::getAdminToken('AdminModules'.(int)Tab::getIdFromClassName('AdminModules').(int)$this->context->employee->id);
|
$token_modules = Tools::getAdminToken('AdminModules'.(int)Tab::getIdFromClassName('AdminModules').(int)$this->context->employee->id);
|
||||||
@@ -176,6 +179,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
$lists[$key_list] = $list;
|
$lists[$key_list] = $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$shop_context = (!Shop::isFeatureActive() || $this->context->shop->getContextType() == Shop::CONTEXT_SHOP);
|
||||||
$this->tpl_view_vars = array(
|
$this->tpl_view_vars = array(
|
||||||
'url_modules' => isset($token_modules) ? 'index.php?tab=AdminModules&token='.$token_modules.'&&filterCategory=payments_gateways' : null,
|
'url_modules' => isset($token_modules) ? 'index.php?tab=AdminModules&token='.$token_modules.'&&filterCategory=payments_gateways' : null,
|
||||||
'display_restrictions' => $display_restrictions,
|
'display_restrictions' => $display_restrictions,
|
||||||
@@ -183,6 +187,7 @@ class AdminPaymentControllerCore extends AdminController
|
|||||||
'ps_base_uri' => __PS_BASE_URI__,
|
'ps_base_uri' => __PS_BASE_URI__,
|
||||||
'payment_modules' => $this->payment_modules,
|
'payment_modules' => $this->payment_modules,
|
||||||
'url_submit' => self::$currentIndex.'&token='.$this->token,
|
'url_submit' => self::$currentIndex.'&token='.$this->token,
|
||||||
|
'shop_context' => $shop_context
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->toolbar_title = $this->l('Paiement');
|
$this->toolbar_title = $this->l('Paiement');
|
||||||
|
|||||||
Reference in New Issue
Block a user