Skip to content

Commit

Permalink
Merge pull request #162 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 5.0.1
  • Loading branch information
Hlavtox authored Feb 28, 2024
2 parents 9f18ece + 3406505 commit efdc504
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions classes/Hook/HookActionValidateOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ public function __construct(Ps_Googleanalytics $module, Context $context)
*/
public function run()
{
// Check if we are creating backoffice order
if ($this->context->controller->controller_name != 'AdminOrders' && $this->context->controller->controller_name != 'Admin') {
// Check if we are creating backoffice order, we are only launching this hook when creating backoffice order
// For FO purposes, we use displayOrderConfirmation.
if (empty($this->context->controller->controller_name)
|| !in_array($this->context->controller->controller_name, ['AdminOrders', 'Admin'])) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_googleanalytics</name>
<displayName><![CDATA[Google Analytics]]></displayName>
<version><![CDATA[5.0.0]]></version>
<version><![CDATA[5.0.1]]></version>
<description><![CDATA[Gain clear insights into important metrics about your customers, using Google Analytics]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
Expand Down
6 changes: 4 additions & 2 deletions controllers/admin/AdminGanalyticsAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ public function init()

if (Validate::isLoadedObject($order) && (isset($this->context->employee->id) && $this->context->employee->id)) {
(new GanalyticsRepository())->markOrderAsSent((int) $orderId);
$this->ajaxDie('OK');
$this->ajaxRender('OK');
exit;
}

$this->ajaxDie('KO');
$this->ajaxRender('KO');
exit;
}
}
6 changes: 4 additions & 2 deletions controllers/front/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public function initContent()
$order = new Order($orderId);

if (!Validate::isLoadedObject($order) || $order->id_customer != (int) Tools::getValue('customer')) {
$this->ajaxDie('KO');
$this->ajaxRender('KO');
exit;
}

(new GanalyticsRepository())->markOrderAsSent((int) $orderId);

$this->ajaxDie('OK');
$this->ajaxRender('OK');
exit;
}
}
2 changes: 1 addition & 1 deletion ps_googleanalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct()
{
$this->name = 'ps_googleanalytics';
$this->tab = 'analytics_stats';
$this->version = '5.0.0';
$this->version = '5.0.1';
$this->ps_versions_compliancy = ['min' => '1.7.7', 'max' => _PS_VERSION_];
$this->author = 'PrestaShop';
$this->module_key = 'fd2aaefea84ac1bb512e6f1878d990b8';
Expand Down
1 change: 1 addition & 0 deletions tests/phpstan/phpstan-1.7.7.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ parameters:
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string given.#'

0 comments on commit efdc504

Please sign in to comment.