Skip to content

Commit

Permalink
[INTERNAL] fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijusCoding committed Jan 13, 2025
1 parent a5bd322 commit c9d01a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion controllers/admin/AdminDPDBalticsAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
exit;
}

class AdminDPDBalticsAjaxController extends AbstractAdminController
class
AdminDPDBalticsAjaxController extends AbstractAdminController
{
public function ajaxProcessImportZones()
{
Expand Down
4 changes: 4 additions & 0 deletions controllers/admin/AdminDPDBalticsSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ public function postProcess()
$this->errors[] = $e->getMessage();
}

if (!$isModuleVersionLatest) {
$this->errors[] = $this->l('Please upgrade DPD Baltics module');
}

if (Tools::isSubmit('submitOptionsconfiguration')) {
/** @var ProductService $productService */
$productService = $this->module->getModuleContainer()->get('invertus.dpdbaltics.service.product.product_service');
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Utility/ModuleVersionUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public function __construct(DPDBaltics $module)
$this->moduleVersion = $module->version;
}

public function isVersionLessThan(string $version): bool
public function isVersionLatest(string $version): bool
{
return version_compare($this->moduleVersion, $version, '<');
return version_compare($this->moduleVersion, $version, '>=');
}
}
4 changes: 2 additions & 2 deletions src/Validate/Version/ModuleLatestVersionValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public function __construct(ModuleVersionUtility $moduleVersionUtility)
public function validate(): bool
{
try {
return $this->moduleVersionUtility->isVersionLessThan($this->getLatestModuleVersion());
return $this->moduleVersionUtility->isVersionLatest($this->getLatestModuleVersionGithub());
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}

private function getLatestModuleVersion(): string
private function getLatestModuleVersionGithub(): string
{
try {
$ch = curl_init();
Expand Down

0 comments on commit c9d01a2

Please sign in to comment.