// Context part 27

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7812 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-07-29 14:29:57 +00:00
parent 35748d1b8f
commit 5d090a25b3
66 changed files with 532 additions and 813 deletions
+8 -13
View File
@@ -166,10 +166,9 @@ abstract class PrepaidServices extends PaymentModule
public function createDisposition($cart)
{
$context = Context::getContext();
$currency = new Currency((int)($cart->id_currency));
$language = $this->_getSupportedLanguageIsoById($context->language->id);
$language = $this->_getSupportedLanguageIsoById($this->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 +352,13 @@ abstract class PrepaidServices extends PaymentModule
private function _displayInfos()
{
$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($context->language->id).'">'.$this->getL('register').'</a>
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($this->context->language->id).'">'.$this->getL('register').'</a>
</fieldset>
<div class="clear" /><br />';
}
@@ -534,7 +532,6 @@ abstract class PrepaidServices extends PaymentModule
public function hookPayment($params)
{
$context = Context::getContext();
// check currency
$currency = new Currency((int)($params['cart']->id_currency));
@@ -555,7 +552,7 @@ abstract class PrepaidServices extends PaymentModule
if ($amount > $this->max_amount)
return false;
$context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
$this->context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
'payment_name' => $this->displayName,
'module_name' => $this->name));
@@ -565,19 +562,17 @@ abstract class PrepaidServices extends PaymentModule
public function hookPaymentReturn($params)
{
$context = Context::getContext();
if ($params['objOrder']->module != $this->name)
return;
$context->smarty->assign('payment_name', $this->displayName);
$this->context->smarty->assign('payment_name', $this->displayName);
return $this->display(__FILE__, $this->name.'-confirmation.tpl');
}
public function hookAdminOrder($params)
{
$context = Context::getContext();
$error = 0;
$order = new Order((int)($params['id_order']));
@@ -593,12 +588,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 = $context->currency;
$currency = $this->context->currency;
// if the disposition is not "active"
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
{
$context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
$this->context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl');
}
@@ -629,7 +624,7 @@ abstract class PrepaidServices extends PaymentModule
if (Tools::getIsset('pp_error'))
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
$context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
$this->context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
'payment_name' => $order->payment,
'error' => $error_msg,
'currency' => $currency->getSign('right'),