// Context part 11

This commit is contained in:
tDidierjean
2011-07-18 15:50:58 +00:00
parent 4b7dee58b7
commit 6551a3ece7
60 changed files with 378 additions and 520 deletions
+12 -12
View File
@@ -166,10 +166,10 @@ abstract class PrepaidServices extends PaymentModule
public function createDisposition($cart)
{
global $cookie;
$context = Context::getContext();
$currency = new Currency((int)($cart->id_currency));
$language = $this->_getSupportedLanguageIsoById((int)($cookie->id_lang));
$language = $this->_getSupportedLanguageIsoById($context->language->id);
$mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code);
$mtid = $cart->id.'-'.time();
$amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.','');
@@ -353,14 +353,14 @@ abstract class PrepaidServices extends PaymentModule
private function _displayInfos()
{
global $cookie;
$context = Context::getContext();
return '<fieldset id="infos_cashticket">
<legend><img src="'._MODULE_DIR_.$this->name.'/img/payment-small.png" alt="" />'.$this->displayName.'</legend>
<center><img src="'._MODULE_DIR_.$this->name.'/img/payment.png" alt="" class="logo" /></center>
'.$this->getL('introduction').'
<br /><br />
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink((int)$cookie->id_lang).'">'.$this->getL('register').'</a>
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($context->language->id).'">'.$this->getL('register').'</a>
</fieldset>
<div class="clear" /><br />';
}
@@ -534,7 +534,7 @@ abstract class PrepaidServices extends PaymentModule
public function hookPayment($params)
{
global $smarty;
$context = Context::getContext();
// check currency
$currency = new Currency((int)($params['cart']->id_currency));
@@ -555,7 +555,7 @@ abstract class PrepaidServices extends PaymentModule
if ($amount > $this->max_amount)
return false;
$smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
$context->controller->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
'payment_name' => $this->displayName,
'module_name' => $this->name));
@@ -565,19 +565,19 @@ abstract class PrepaidServices extends PaymentModule
public function hookPaymentReturn($params)
{
global $smarty, $cookie;
$context = Context::getContext();
if ($params['objOrder']->module != $this->name)
return;
$smarty->assign('payment_name', $this->displayName);
$context->controller->smarty->assign('payment_name', $this->displayName);
return $this->display(__FILE__, $this->name.'-confirmation.tpl');
}
public function hookAdminOrder($params)
{
global $smarty, $cookie;
$context = Context::getContext();
$error = 0;
$order = new Order((int)($params['id_order']));
@@ -593,12 +593,12 @@ abstract class PrepaidServices extends PaymentModule
// check disposition state
$res = PrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']);
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$currency = $context->currency;
// if the disposition is not "active"
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
{
$smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
$context->controller->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl');
}
@@ -629,7 +629,7 @@ abstract class PrepaidServices extends PaymentModule
if (Tools::getIsset('pp_error'))
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
$smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
$context->controller->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
'payment_name' => $order->payment,
'error' => $error_msg,
'currency' => $currency->getSign('right'),