-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from alma/release/v4.2.0
Release v4.2.0
- Loading branch information
Showing
66 changed files
with
2,029 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
services: | ||
_defaults: | ||
public: true | ||
|
||
##################### | ||
# PS Account | ||
alma.ps_accounts_installer: | ||
public: true | ||
class: 'PrestaShop\PsAccountsInstaller\Installer\Installer' | ||
arguments: | ||
- '5.0' | ||
|
||
alma.ps_accounts_facade: | ||
public: true | ||
class: 'PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts' | ||
arguments: | ||
- '@alma.ps_accounts_installer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
alma/controllers/hook/ActionAdminOrdersListingFieldsModifierHookController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
/** | ||
* 2018-2024 Alma SAS. | ||
* | ||
* THE MIT LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
* Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
* | ||
* @author Alma SAS <[email protected]> | ||
* @copyright 2018-2024 Alma SAS | ||
* @license https://opensource.org/licenses/MIT The MIT License | ||
*/ | ||
|
||
namespace Alma\PrestaShop\Controllers\Hook; | ||
|
||
use Alma\PrestaShop\Builders\Helpers\InsuranceHelperBuilder; | ||
use Alma\PrestaShop\Helpers\InsuranceHelper; | ||
use Alma\PrestaShop\Helpers\SettingsHelper; | ||
use Alma\PrestaShop\Hooks\AdminHookController; | ||
|
||
class ActionAdminOrdersListingFieldsModifierHookController extends AdminHookController | ||
{ | ||
/** | ||
* @var InsuranceHelper | ||
*/ | ||
protected $insuranceHelper; | ||
|
||
public function canRun() | ||
{ | ||
// Front controllers can run if the module is properly configured ... | ||
return SettingsHelper::isFullyConfigured() | ||
// ... and the plugin is in LIVE mode, or the visitor is an admin | ||
&& $this->insuranceHelper->isInsuranceActivated(); | ||
} | ||
|
||
/** | ||
* @param $module | ||
*/ | ||
public function __construct($module) | ||
{ | ||
parent::__construct($module); | ||
|
||
$insuranceHelperBuilder = new InsuranceHelperBuilder(); | ||
$this->insuranceHelper = $insuranceHelperBuilder->getInstance(); | ||
} | ||
|
||
/** | ||
* Run Controller | ||
* | ||
* @param array $params | ||
* | ||
* @return void | ||
*/ | ||
public function run($params) | ||
{ | ||
if (array_key_exists('select', $params)) { | ||
$params['select'] .= ' ,IF(aip.`id_order` IS NOT NULL,1,0) as has_alma_insurance '; | ||
} | ||
if (array_key_exists('join', $params)) { | ||
$params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'alma_insurance_product aip ON (a.id_order = aip.id_order)'; | ||
} | ||
if (array_key_exists('group_by', $params)) { | ||
$params['group_by'] .= 'GROUP BY a.id_order'; | ||
} | ||
$params['fields']['has_alma_insurance'] = [ | ||
'title' => 'Has Insurance', | ||
'type' => 'bool', | ||
'tmpTableFilter' => true, | ||
]; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
alma/controllers/hook/ActionFrontControllerSetVariablesHookController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* 2018-2024 Alma SAS. | ||
* | ||
* THE MIT LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
* Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
* | ||
* @author Alma SAS <[email protected]> | ||
* @copyright 2018-2024 Alma SAS | ||
* @license https://opensource.org/licenses/MIT The MIT License | ||
*/ | ||
|
||
namespace Alma\PrestaShop\Controllers\Hook; | ||
|
||
use Alma\PrestaShop\Helpers\ConstantsHelper; | ||
use Alma\PrestaShop\Hooks\FrontendHookController; | ||
use Alma\PrestaShop\Repositories\ProductRepository; | ||
|
||
if (!defined('_PS_VERSION_')) { | ||
exit; | ||
} | ||
|
||
class ActionFrontControllerSetVariablesHookController extends FrontendHookController | ||
{ | ||
protected $productRepository; | ||
|
||
public function __construct($module, $productRepository = null) | ||
{ | ||
parent::__construct($module); | ||
|
||
if (is_null($productRepository)) { | ||
$productRepository = new ProductRepository(); | ||
} | ||
|
||
$this->productRepository = $productRepository; | ||
} | ||
|
||
/** | ||
* @param $params | ||
* | ||
* @return bool | ||
*/ | ||
public function run($params) | ||
{ | ||
if ($this->checkIsInsuranceProduct($params)) { | ||
return $params['templateVars']['configuration']['is_catalog'] = true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* @param $params | ||
* | ||
* @return bool | ||
*/ | ||
private function checkIsInsuranceProduct($params) | ||
{ | ||
$templateVars = $params['templateVars']; | ||
$idInsuranceProduct = $this->productRepository->getProductIdByReference(ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE); | ||
|
||
if ( | ||
is_null($idInsuranceProduct) || | ||
!array_key_exists('page', $templateVars) || | ||
$templateVars['page']['page_name'] !== 'product' || | ||
!array_key_exists('product-id-' . $idInsuranceProduct, $templateVars['page']['body_classes']) | ||
) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.