Skip to content

Commit 3c7ce80

Browse files
committed
[*] MO : Spaces, commas and linebreak fixes.
1 parent 67e2707 commit 3c7ce80

9 files changed

+41
-24
lines changed

checkpendingorders.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_once(_PS_ROOT_DIR_.'/init.php');
44
require_once(dirname(__FILE__).'/klarnaofficial.php');
55

6-
$shops = Shop::getShops(true,null,true);
6+
$shops = Shop::getShops(true, null, true);
77
$order_status_ids = "";
88
foreach ($shops as $shop) {
99
$order_status_ids .= Configuration::get('KPM_PENDING_PP', null, null, $shop).",";
@@ -25,4 +25,3 @@
2525
}
2626
}
2727
echo "Done";
28-
?>

controllers/front/checkoutklarna.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public function postProcess()
136136
$vouchererrors = Tools::displayError('This voucher does not exists');
137137
}
138138
}
139-
//FORCE html_entity_decode SINCE PRESTASHOP Demand escape:html in tpl files but already does this on displayError..
139+
//FORCE html_entity_decode SINCE PRESTASHOP Demand escape:html
140+
//in tpl files but already does this on displayError..
140141
$this->context->smarty->assign(array(
141142
'vouchererrors' => html_entity_decode($vouchererrors),
142143
'discount_name' => Tools::safeOutput($code),
@@ -504,11 +505,13 @@ public function initContent()
504505
$create['merchant_reference']['orderid2'] = ''.(int) ($this->context->cart->id);
505506

506507
if ((int)Configuration::get('KCO_ADD_NEWSLETTERBOX') == 0) {
507-
$create['options']['additional_checkbox']['text'] = $this->module->getL('Subscribe to our newsletter.');
508+
$create['options']['additional_checkbox']['text'] = ''.
509+
$this->module->getL('Subscribe to our newsletter.');
508510
$create['options']['additional_checkbox']['checked'] = false;
509511
$create['options']['additional_checkbox']['required'] = false;
510512
} elseif ((int)Configuration::get('KCO_ADD_NEWSLETTERBOX') == 1) {
511-
$create['options']['additional_checkbox']['text'] = $this->module->getL('Subscribe to our newsletter.');
513+
$create['options']['additional_checkbox']['text'] = ''.
514+
$this->module->getL('Subscribe to our newsletter.');
512515
$create['options']['additional_checkbox']['checked'] = true;
513516
$create['options']['additional_checkbox']['required'] = false;
514517
}
@@ -693,7 +696,7 @@ public function initContent()
693696
));
694697
} catch (Exception $e) {
695698
$message = $e->getMessage();
696-
if($message == "Connection to 'https://checkout.klarna.com/checkout/orders' failed.") {
699+
if ($message == "Connection to 'https://checkout.klarna.com/checkout/orders' failed.") {
697700
$connectionerror = true;
698701
} else {
699702
$connectionerror = false;

controllers/front/checkoutklarnauk.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ public function postProcess()
153153
$vouchererrors = Tools::displayError('This voucher does not exists');
154154
}
155155
}
156-
//FORCE html_entity_decode SINCE PRESTASHOP Demand escape:html in tpl files but already does this on displayError..
156+
//FORCE html_entity_decode SINCE PRESTASHOP Demand escape:html in
157+
//tpl files but already does this on displayError..
157158
$this->context->smarty->assign(array(
158159
'vouchererrors' => html_entity_decode($vouchererrors),
159160
'discount_name' => Tools::safeOutput($code),
@@ -520,11 +521,13 @@ public function initContent()
520521
$create['merchant_urls']['push'] = $pushPage;
521522
$create['merchant_reference2'] = ''.(int) ($this->context->cart->id);
522523
if ((int)Configuration::get('KCO_ADD_NEWSLETTERBOX') == 0) {
523-
$create['options']['additional_checkbox']['text'] = $this->module->getL('Subscribe to our newsletter.');
524+
$create['options']['additional_checkbox']['text'] = ''.
525+
$this->module->getL('Subscribe to our newsletter.');
524526
$create['options']['additional_checkbox']['checked'] = false;
525527
$create['options']['additional_checkbox']['required'] = false;
526528
} elseif ((int)Configuration::get('KCO_ADD_NEWSLETTERBOX') == 1) {
527-
$create['options']['additional_checkbox']['text'] = $this->module->getL('Subscribe to our newsletter.');
529+
$create['options']['additional_checkbox']['text'] = ''.
530+
$this->module->getL('Subscribe to our newsletter.');
528531
$create['options']['additional_checkbox']['checked'] = true;
529532
$create['options']['additional_checkbox']['required'] = false;
530533
}

controllers/front/kpmpartpayment.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,11 @@ public function initContent()
481481
$data['payment_methods'][] = $newPclass;
482482
$use_case = '';
483483
if ($languageIso == 'de') {
484-
$use_case = file_get_contents(dirname(__FILE__)."/../../libraries/germanterms.txt");
484+
$use_case = Tools::file_get_contents(dirname(__FILE__)."/../../libraries/germanterms.txt");
485485
$use_case = str_replace("(eid)", $eid, $use_case);
486486
}
487487
if ($languageIso == 'nl') {
488-
$use_case = file_get_contents(dirname(__FILE__)."/../../libraries/netherlandsterms.txt");
488+
$use_case = Tools::file_get_contents(dirname(__FILE__)."/../../libraries/netherlandsterms.txt");
489489
$use_case = str_replace("(url)", $this->context->shop->virtual_uri, $use_case);
490490
}
491491
foreach ($kpm_invoice as $pclass) {

controllers/front/push.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public function postProcess()
7878
$update = array();
7979
$klarnaorder = new Klarna_Checkout_Order($connector, $checkoutId);
8080
$klarnaorder->fetch();
81-
//print_r($klarnaorder);
8281
if ($klarnaorder['status'] == 'checkout_complete') {
8382
$id_cart = $klarnaorder['merchant_reference']['orderid2'];
8483
$cart = new Cart((int) ($id_cart));
@@ -158,7 +157,11 @@ public function postProcess()
158157
$newsletter = 0;
159158
$newsletter_setting = (int)Configuration::get('KCO_ADD_NEWSLETTERBOX', null, $cart->id_shop);
160159
if ($newsletter_setting == 0 || $newsletter_setting == 1) {
161-
if(isset($klarnaorder['merchant_requested']) && isset($klarnaorder['merchant_requested']['additional_checkbox']) && $klarnaorder['merchant_requested']['additional_checkbox'] == true) {
160+
if (
161+
isset($klarnaorder['merchant_requested']) &&
162+
isset($klarnaorder['merchant_requested']['additional_checkbox']) &&
163+
$klarnaorder['merchant_requested']['additional_checkbox'] == true
164+
) {
162165
$newsletter = 1;
163166
}
164167
} elseif ($newsletter_setting == 2) {
@@ -168,7 +171,8 @@ public function postProcess()
168171
if ($id_customer > 0) {
169172
$customer = new Customer($id_customer);
170173
if ($newsletter == 1) {
171-
$sql_update_customer = "UPDATE "._DB_PREFIX_."customer SET newsletter=1 WHERE id_customer=$id_customer;";
174+
$sql_update_customer = "UPDATE "._DB_PREFIX_."customer SET newsletter=1".
175+
" WHERE id_customer=$id_customer;";
172176
Db::getInstance()->execute(pSQL($sql_update_customer));
173177
}
174178
} else {

controllers/front/pushuk.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ public function postProcess()
140140
$newsletter = 0;
141141
$newsletter_setting = (int)Configuration::get('KCO_ADD_NEWSLETTERBOX', null, $cart->id_shop);
142142
if ($newsletter_setting == 0 || $newsletter_setting == 1) {
143-
if(isset($klarnaorder['merchant_requested']) && isset($klarnaorder['merchant_requested']['additional_checkbox']) && $klarnaorder['merchant_requested']['additional_checkbox'] == true) {
143+
if (
144+
isset($checkout['merchant_requested']) &&
145+
isset($checkout['merchant_requested']['additional_checkbox']) &&
146+
$checkout['merchant_requested']['additional_checkbox'] == true
147+
) {
144148
$newsletter = 1;
145149
}
146150
} elseif ($newsletter_setting == 2) {
@@ -151,7 +155,8 @@ public function postProcess()
151155
if ($id_customer > 0) {
152156
$customer = new Customer($id_customer);
153157
if ($newsletter == 1) {
154-
$sql_update_customer = "UPDATE "._DB_PREFIX_."customer SET newsletter=1 WHERE id_customer=$id_customer;";
158+
$sql_update_customer = "UPDATE "._DB_PREFIX_."customer SET newsletter=1".
159+
" WHERE id_customer=$id_customer;";
155160
Db::getInstance()->execute(pSQL($sql_update_customer));
156161
}
157162
} else {

klarnaofficial.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -2939,23 +2939,26 @@ public function checkPendingStatus($id_order)
29392939
$currencyIso = '';
29402940
$k = $this->initKlarnaAPI($eid, $shared_secret, $countryIso, $languageIso, $currencyIso, $id_shop);
29412941
$status = $k->checkOrderStatus($reservation_number);
2942-
if($status == KlarnaFlags::ACCEPTED) {
2942+
if ($status == KlarnaFlags::ACCEPTED) {
29432943
$order = new Order($id_order);
2944-
if (Validate::isLoadedObject($order))
2945-
{
2944+
if (Validate::isLoadedObject($order)) {
29462945
$new_status = Configuration::get('KPM_ACCEPTED_INVOICE', null, null, $order->id_shop);
29472946
$history = new OrderHistory();
29482947
$history->id_order = $id_order;
2949-
$history->changeIdOrderState(intval($new_status), $id_order, true);
2948+
$history->changeIdOrderState((int)$new_status, $id_order, true);
29502949
$history->addWithemail(true, null);
29512950
}
29522951
} elseif ($status == KlarnaFlags::DENIED) {
29532952
$order = new Order($id_order);
29542953
if (Validate::isLoadedObject($order)) {
2955-
$cancel_status = ((int)(Configuration::get('PS_OS_CANCELED'))>0 ? Configuration::get('PS_OS_CANCELED') : _PS_OS_CANCELED_);
2954+
if ((int)(Configuration::get('PS_OS_CANCELED'))>0) {
2955+
$cancel_status = Configuration::get('PS_OS_CANCELED');
2956+
} else {
2957+
$cancel_status = _PS_OS_CANCELED_;
2958+
}
29562959
$history = new OrderHistory();
29572960
$history->id_order = $id_order;
2958-
$history->changeIdOrderState(intval($new_status), $id_order, true);
2961+
$history->changeIdOrderState((int)$cancel_status, $id_order, true);
29592962
$history->addWithemail(true, null);
29602963
}
29612964
}

views/templates/front/kco_height.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{if isset($klarna_error)}
3131
{if isset($connectionerror)}
3232
{if $connectionerror}
33-
<a href="{$link->getPageLink("order", true)}" class="button btn btn-default button-medium">{l s='Go to checkout' mod='klarnacheckout'}</a><br /><br />
33+
<a href="{$link->getPageLink("order", true)|escape:'html':'UTF-8'}" class="button btn btn-default button-medium">{l s='Go to checkout' mod='klarnaofficial'}</a><br /><br />
3434
{/if}
3535
{/if}
3636
<div class="alert alert-warning">

views/templates/front/kco_twocolumns.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{if isset($klarna_error)}
3131
{if isset($connectionerror)}
3232
{if $connectionerror}
33-
<a href="{$link->getPageLink("order", true)}" class="button btn btn-default button-medium">{l s='Go to checkout' mod='klarnacheckout'}</a><br /><br />
33+
<a href="{$link->getPageLink("order", true)|escape:'html':'UTF-8'}" class="button btn btn-default button-medium">{l s='Go to checkout' mod='klarnaofficial'}</a><br /><br />
3434
{/if}
3535
{/if}
3636
<div class="alert alert-warning">

0 commit comments

Comments
 (0)