@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | if ($this->origin == 'notify') { |
77 | 77 | $jsonResponse->printResponse(); |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | if ($exception->getMessage() == AlreadyProcessedException::ERROR_MESSAGE) { |
80 | 80 | return; |
81 | 81 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if ($this->origin == 'notify') { |
110 | 110 | $jsonResponse->printResponse(); |
111 | - } else { |
|
111 | + }else { |
|
112 | 112 | return $jsonResponse; |
113 | 113 | } |
114 | 114 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | try { |
181 | 181 | $this->checkPagantisStatus(array('AUTHORIZED')); |
182 | 182 | } catch (\Exception $e) { |
183 | - if ($this->findOscommerceOrderId()!='') { |
|
183 | + if ($this->findOscommerceOrderId() != '') { |
|
184 | 184 | throw new AlreadyProcessedException(); |
185 | - } else { |
|
185 | + }else { |
|
186 | 186 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
187 | 187 | $status = $this->pagantisOrder->getStatus(); |
188 | - } else { |
|
188 | + }else { |
|
189 | 189 | $status = '-'; |
190 | 190 | } |
191 | 191 | throw new WrongStatusException($status); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | { |
201 | 201 | global $order; |
202 | 202 | |
203 | - if ($order->info['order_status']!=='1') { |
|
203 | + if ($order->info['order_status'] !== '1') { |
|
204 | 204 | throw new AlreadyProcessedException(); |
205 | 205 | } |
206 | 206 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($orderId == null) { |
278 | 278 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where timestamp<".(time() - 5); |
279 | 279 | tep_db_query($query); |
280 | - } elseif ($orderId!='') { |
|
280 | + } elseif ($orderId != '') { |
|
281 | 281 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'"; |
282 | 282 | tep_db_query($query); |
283 | 283 | } |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | if (!$payed) { |
330 | 330 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
331 | 331 | $status = $this->pagantisOrder->getStatus(); |
332 | - } else { |
|
332 | + }else { |
|
333 | 333 | $status = '-'; |
334 | 334 | } |
335 | 335 | throw new WrongStatusException($status); |
336 | 336 | } |
337 | - } else { |
|
337 | + }else { |
|
338 | 338 | throw new OrderNotFoundException(); |
339 | 339 | } |
340 | 340 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | tep_db_query($query); |
368 | 368 | |
369 | 369 | $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin); |
370 | - $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
370 | + $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
371 | 371 | ('$comment', ".$insert_id.", '2', -1, now() )"; |
372 | 372 | tep_db_query($query); |
373 | 373 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | private function insertLog($exception) |
393 | 393 | { |
394 | 394 | if ($exception instanceof \Exception) { |
395 | - $logEntry= new LogEntry(); |
|
395 | + $logEntry = new LogEntry(); |
|
396 | 396 | $logEntryJson = $logEntry->error($exception)->toJson(); |
397 | 397 | |
398 | 398 | $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')"; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $checkoutStepShippingMethodSearch = WebDriverBy::id('checkout-shipping-method-load'); |
40 | 40 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepShippingMethodSearch); |
41 | 41 | $this->webDriver->wait()->until($condition); |
42 | - $this->assertTrue((bool) $condition); |
|
42 | + $this->assertTrue((bool)$condition); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $billingAddressSelector = WebDriverBy::id('billing-address-select'); |
55 | 55 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($billingAddressSelector); |
56 | 56 | $this->webDriver->wait()->until($condition); |
57 | - $this->assertTrue((bool) $condition); |
|
57 | + $this->assertTrue((bool)$condition); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | $faker = Factory::create(); |
65 | 65 | $this->configuration['dni'] = $this->getDNI(); |
66 | 66 | $this->configuration['firstname'] = $faker->firstName; |
67 | - $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName; |
|
67 | + $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName; |
|
68 | 68 | $this->configuration['company'] = $faker->company; |
69 | 69 | $this->configuration['zip'] = '28'.$faker->randomNumber(3, true); |
70 | 70 | $this->configuration['address'] = $faker->streetAddress; |
71 | - $this->configuration['phone'] = '6' . $faker->randomNumber(8); |
|
72 | - $this->configuration['email'] = date('ymd') . '@pagantis.com'; |
|
71 | + $this->configuration['phone'] = '6'.$faker->randomNumber(8); |
|
72 | + $this->configuration['email'] = date('ymd').'@pagantis.com'; |
|
73 | 73 | parent::__construct($name, $data, $dataName); |
74 | 74 | } |
75 | 75 | /** |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getDNI() |
79 | 79 | { |
80 | - $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1); |
|
81 | - $value = (int) ($dni / 23); |
|
80 | + $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1); |
|
81 | + $value = (int)($dni / 23); |
|
82 | 82 | $value *= 23; |
83 | - $value= $dni - $value; |
|
84 | - $letter= "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
85 | - $dniLetter= substr($letter, $value, 1); |
|
83 | + $value = $dni - $value; |
|
84 | + $letter = "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
85 | + $dniLetter = substr($letter, $value, 1); |
|
86 | 86 | return $dni.$dniLetter; |
87 | 87 | } |
88 | 88 |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function checkPagantisOrderId() |
141 | 141 | { |
142 | - $orderId=0; |
|
142 | + $orderId = 0; |
|
143 | 143 | $notifyUrl = self::OSCURL.self::NOTIFICATION_FOLDER.'?order='.$orderId; |
144 | 144 | $this->assertNotEmpty($notifyUrl, $notifyUrl); |
145 | 145 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->assertEquals( |
150 | 150 | $response->body->merchant_order_id, |
151 | 151 | $orderId, |
152 | - $response->body->merchant_order_id.'!='. $orderId |
|
152 | + $response->body->merchant_order_id.'!='.$orderId |
|
153 | 153 | ); |
154 | 154 | $this->assertContains( |
155 | 155 | NoIdentificationException::ERROR_MESSAGE, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | sleep(3); |
97 | 97 | $productLinkElement->click(); |
98 | 98 | $this->assertSame( |
99 | - self::PRODUCT_NAME . ', ' . self::TITLE, |
|
99 | + self::PRODUCT_NAME.', '.self::TITLE, |
|
100 | 100 | $this->webDriver->getTitle() |
101 | 101 | ); |
102 | 102 | } |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $paymentFormElement = WebDriverBy::className('FieldsPreview-desc'); |
182 | 182 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
183 | 183 | $this->webDriver->wait()->until($condition); |
184 | - $this->assertTrue((bool) $condition); |
|
184 | + $this->assertTrue((bool)$condition); |
|
185 | 185 | $this->assertSame( |
186 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
186 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
187 | 187 | $this->findByClass('FieldsPreview-desc')->getText() |
188 | 188 | ); |
189 | 189 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->description = MODULE_HEADER_TAGS_PAGANTIS_DESCRIPTION; |
26 | 26 | $this->sort_order = 0; |
27 | 27 | |
28 | - if ( defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS') ) { |
|
28 | + if (defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS')) { |
|
29 | 29 | $this->enabled = (MODULE_HEADER_TAGS_PAGANTIS_STATUS == 'True'); |
30 | 30 | } |
31 | 31 | $this->extraConfig = $this->getExtraConfig(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private function getConfig($config = '') |
58 | 58 | { |
59 | - $query = "select configuration_value from ".TABLE_CONFIGURATION . " where configuration_key = '" . $config . "'"; |
|
59 | + $query = "select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = '".$config."'"; |
|
60 | 60 | $result = tep_db_query($query); |
61 | 61 | $resultArray = tep_db_fetch_array($result); |
62 | 62 | return $resultArray['configuration_value']; |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | echo ' if (typeof pgSDK != \'undefined\') {'; |
94 | 94 | echo ' var price = null;'; |
95 | 95 | echo ' var quantity = null;'; |
96 | - echo ' var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'; |
|
97 | - echo ' var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'; |
|
98 | - echo ' var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'; |
|
96 | + echo ' var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'; |
|
97 | + echo ' var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'; |
|
98 | + echo ' var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'; |
|
99 | 99 | |
100 | 100 | echo ' if (positionSelector === \'default\') {'; |
101 | 101 | echo ' positionSelector = \'.pagantisSimulator\''; |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | echo ' pgSDK.product_simulator = {};'; |
116 | 116 | echo ' pgSDK.product_simulator.id = \'product-simulator\';'; |
117 | - echo ' pgSDK.product_simulator.publicKey = \'' . $this->pk . '\';'; |
|
117 | + echo ' pgSDK.product_simulator.publicKey = \''.$this->pk.'\';'; |
|
118 | 118 | echo ' pgSDK.product_simulator.selector = positionSelector;'; |
119 | - echo ' pgSDK.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'; |
|
120 | - echo ' pgSDK.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'; |
|
121 | - echo ' pgSDK.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'; |
|
122 | - echo ' pgSDK.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'; |
|
119 | + echo ' pgSDK.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'; |
|
120 | + echo ' pgSDK.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'; |
|
121 | + echo ' pgSDK.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'; |
|
122 | + echo ' pgSDK.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'; |
|
123 | 123 | |
124 | 124 | echo ' if (priceSelector !== \'default\') {'; |
125 | 125 | echo ' pgSDK.product_simulator.itemAmountSelector = priceSelector;'; |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | function install() { |
161 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
161 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | 165 | function remove() { |
166 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
166 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | function keys() { |
@@ -156,7 +156,7 @@ |
||
156 | 156 | try { |
157 | 157 | include_once('./ext/modules/payment/pagantis/vendor/autoload.php'); |
158 | 158 | global $order, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, |
159 | - $payment, $comments, $customer_default_address_id, $cartID; |
|
159 | + $payment, $comments, $customer_default_address_id, $cartID; |
|
160 | 160 | $global_vars = array(); |
161 | 161 | $global_vars['customer_id'] = serialize($customer_id); |
162 | 162 | $global_vars['sendTo'] = serialize($sendto); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
61 | 61 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CATALOG_TITLE; // Payment module title in Catalog |
64 | 64 | } |
65 | 65 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | "%s://%s%s%s", |
73 | 73 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
74 | 74 | $_SERVER['SERVER_NAME'], |
75 | - isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '', |
|
75 | + isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '', |
|
76 | 76 | $_SERVER['REQUEST_URI'] |
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
80 | - $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
|
80 | + $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /*************** |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | throw new UnknownException("Order not found"); |
177 | 177 | } |
178 | 178 | |
179 | - $id_hash = time() . serialize($order->products) . '' . serialize($order->customer) . '' . serialize($order->delivery); |
|
179 | + $id_hash = time().serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery); |
|
180 | 180 | $this->os_order_reference = md5($id_hash); |
181 | 181 | $_SESSION['order_id'] = $this->os_order_reference; |
182 | 182 | |
183 | 183 | $userAddress = new Address(); |
184 | 184 | $userAddress |
185 | 185 | ->setZipCode($order->billing['postcode']) |
186 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
186 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
187 | 187 | ->setCountryCode('ES') |
188 | 188 | ->setCity($order->billing['city']) |
189 | 189 | ->setAddress($order->billing['street_address']) |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $orderShippingAddress = new Address(); |
196 | 196 | $orderShippingAddress |
197 | 197 | ->setZipCode($order->delivery['postcode']) |
198 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
198 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
199 | 199 | ->setCountryCode('ES') |
200 | 200 | ->setCity($order->delivery['city']) |
201 | 201 | ->setAddress($order->delivery['street_address']) |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
206 | 206 | $orderUser |
207 | 207 | ->setAddress($userAddress) |
208 | - ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
|
208 | + ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
|
209 | 209 | ->setBillingAddress($orderBillingAddress) |
210 | 210 | ->setEmail($order->customer['email_address']) |
211 | 211 | ->setFixPhone($order->customer['telephone']) |
@@ -240,9 +240,8 @@ discard block |
||
240 | 240 | ->setPromotedAmount(0) |
241 | 241 | ->setTotalAmount(intval($order->info['total'] * 100)); |
242 | 242 | |
243 | - $callback_url = $this->base_url . '/ext/modules/payment/pagantis/notify.php'; |
|
244 | - $checkoutProcessUrl = htmlspecialchars_decode |
|
245 | - ( |
|
243 | + $callback_url = $this->base_url.'/ext/modules/payment/pagantis/notify.php'; |
|
244 | + $checkoutProcessUrl = htmlspecialchars_decode( |
|
246 | 245 | tep_href_link( |
247 | 246 | FILENAME_CHECKOUT_PROCESS, |
248 | 247 | "order_id=$this->os_order_reference&from=order", |
@@ -293,16 +292,16 @@ discard block |
||
293 | 292 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
294 | 293 | $url = $pagantisOrder->getActionUrls()->getForm(); |
295 | 294 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
296 | - } else { |
|
295 | + }else { |
|
297 | 296 | throw new OrderNotFoundException(); |
298 | 297 | } |
299 | 298 | |
300 | 299 | if ($url == "") { |
301 | 300 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
302 | - } else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') { |
|
301 | + }else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') { |
|
303 | 302 | $output = "\n"; |
304 | - $output .= tep_draw_hidden_field("formUrl", $url) . "\n"; |
|
305 | - $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
|
303 | + $output .= tep_draw_hidden_field("formUrl", $url)."\n"; |
|
304 | + $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n"; |
|
306 | 305 | return $output; |
307 | 306 | |
308 | 307 | } //TODO IFRAME |
@@ -342,7 +341,7 @@ discard block |
||
342 | 341 | public function check() |
343 | 342 | { |
344 | 343 | if (!isset($this->_check)) { |
345 | - $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " |
|
344 | + $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." |
|
346 | 345 | where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'"); |
347 | 346 | $this->_check = tep_db_num_rows($check_query); |
348 | 347 | } |
@@ -361,7 +360,7 @@ discard block |
||
361 | 360 | tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL')); |
362 | 361 | return 'failed'; |
363 | 362 | } |
364 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
363 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
365 | 364 | ( |
366 | 365 | configuration_title, |
367 | 366 | configuration_key, |
@@ -384,7 +383,7 @@ discard block |
||
384 | 383 | ', |
385 | 384 | now() |
386 | 385 | )"); |
387 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
386 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
388 | 387 | ( |
389 | 388 | configuration_title, |
390 | 389 | configuration_key, |
@@ -404,7 +403,7 @@ discard block |
||
404 | 403 | '0', |
405 | 404 | now() |
406 | 405 | )"); |
407 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " |
|
406 | + tep_db_query("insert into ".TABLE_CONFIGURATION." |
|
408 | 407 | ( |
409 | 408 | configuration_title, |
410 | 409 | configuration_key, |
@@ -435,14 +434,14 @@ discard block |
||
435 | 434 | */ |
436 | 435 | private function installPagantisTables() |
437 | 436 | { |
438 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
|
437 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( |
|
439 | 438 | id int NOT NULL AUTO_INCREMENT, |
440 | 439 | log text NOT NULL, |
441 | 440 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
442 | 441 | UNIQUE KEY id (id))"; |
443 | 442 | tep_db_query($sql); |
444 | 443 | |
445 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
|
444 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." ( |
|
446 | 445 | id int NOT NULL AUTO_INCREMENT, |
447 | 446 | config varchar(60) NOT NULL, |
448 | 447 | value varchar(200) NOT NULL, |
@@ -450,10 +449,10 @@ discard block |
||
450 | 449 | tep_db_query($sql); |
451 | 450 | |
452 | 451 | // check if table has records |
453 | - $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG); |
|
452 | + $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG); |
|
454 | 453 | if (tep_db_num_rows($check_query) === 0) { |
455 | 454 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
456 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " |
|
455 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." |
|
457 | 456 | ( |
458 | 457 | config, |
459 | 458 | value |
@@ -467,7 +466,7 @@ discard block |
||
467 | 466 | } |
468 | 467 | } |
469 | 468 | |
470 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
|
469 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." ( |
|
471 | 470 | id int NOT NULL AUTO_INCREMENT, |
472 | 471 | os_order_id varchar(50), |
473 | 472 | os_order_reference varchar(50) NOT NULL, |
@@ -476,7 +475,7 @@ discard block |
||
476 | 475 | UNIQUE KEY id(id))"; |
477 | 476 | tep_db_query($sql); |
478 | 477 | |
479 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
|
478 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." ( |
|
480 | 479 | id varchar(50) NOT NULL, |
481 | 480 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
482 | 481 | UNIQUE KEY id(id))"; |
@@ -488,30 +487,30 @@ discard block |
||
488 | 487 | */ |
489 | 488 | public function remove() |
490 | 489 | { |
491 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'"); |
|
490 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
|
492 | 491 | if (tep_db_num_rows($checkTable) > 0) { |
493 | - tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
|
492 | + tep_db_query("drop table ".TABLE_PAGANTIS_LOG); |
|
494 | 493 | } |
495 | 494 | |
496 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
|
495 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
|
497 | 496 | if (tep_db_num_rows($checkTable) > 0) { |
498 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
|
497 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG); |
|
499 | 498 | } |
500 | 499 | |
501 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'"); |
|
500 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
|
502 | 501 | if (tep_db_num_rows($checkTable) > 0) { |
503 | - tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
|
502 | + tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS); |
|
504 | 503 | } |
505 | 504 | |
506 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'"); |
|
505 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
|
507 | 506 | if (tep_db_num_rows($checkTable) > 0) { |
508 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
|
507 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY); |
|
509 | 508 | } |
510 | 509 | |
511 | - $query = "delete from " . TABLE_ORDERS_STATUS . " where orders_status_id='6'"; |
|
510 | + $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'"; |
|
512 | 511 | tep_db_query($query); |
513 | 512 | |
514 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'"; |
|
513 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'"; |
|
515 | 514 | tep_db_query($query); |
516 | 515 | |
517 | 516 | $this->uninstallSimulator(); |
@@ -564,14 +563,14 @@ discard block |
||
564 | 563 | */ |
565 | 564 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
566 | 565 | { |
567 | - $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'"; |
|
566 | + $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'"; |
|
568 | 567 | $resultsSelect = tep_db_query($query); |
569 | 568 | $countResults = tep_db_num_rows($resultsSelect); |
570 | 569 | if ($countResults == 0) { |
571 | - $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " |
|
570 | + $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." |
|
572 | 571 | (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
573 | - } else { |
|
574 | - $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' |
|
572 | + }else { |
|
573 | + $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' |
|
575 | 574 | where os_order_reference='$orderId'"; |
576 | 575 | } |
577 | 576 | tep_db_query($query); |
@@ -582,10 +581,10 @@ discard block |
||
582 | 581 | */ |
583 | 582 | private function getExtraConfig() |
584 | 583 | { |
585 | - $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
|
584 | + $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
|
586 | 585 | $response = array(); |
587 | 586 | if (tep_db_num_rows($checkTable) > 0) { |
588 | - $query = "select * from " . TABLE_PAGANTIS_CONFIG; |
|
587 | + $query = "select * from ".TABLE_PAGANTIS_CONFIG; |
|
589 | 588 | $result = tep_db_query($query); |
590 | 589 | $resultArray = tep_db_fetch_array($result); |
591 | 590 | $response = array(); |
@@ -599,34 +598,34 @@ discard block |
||
599 | 598 | |
600 | 599 | private function installSimulator() |
601 | 600 | { |
602 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
601 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
603 | 602 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
604 | 603 | and configuration_value like '%ht_pagantis.php%';"); |
605 | 604 | if (tep_db_num_rows($checkSimulator) > 0) { |
606 | 605 | return true; |
607 | 606 | } |
608 | 607 | |
609 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
608 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php') |
|
610 | 609 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
611 | 610 | tep_db_query($query); |
612 | 611 | |
613 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
612 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
614 | 613 | } |
615 | 614 | |
616 | 615 | private function uninstallSimulator() |
617 | 616 | { |
618 | - $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." |
|
617 | + $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." |
|
619 | 618 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED' |
620 | 619 | and configuration_value like '%ht_pagantis.php%';"); |
621 | 620 | if (tep_db_num_rows($checkSimulator) == 0) { |
622 | 621 | return true; |
623 | 622 | } |
624 | 623 | |
625 | - $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
624 | + $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '') |
|
626 | 625 | where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'"; |
627 | 626 | tep_db_query($query); |
628 | 627 | |
629 | - $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
628 | + $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'"; |
|
630 | 629 | tep_db_query($query); |
631 | 630 | } |
632 | 631 | } |
633 | 632 | \ No newline at end of file |