diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..e4cca152 --- /dev/null +++ b/.htaccess @@ -0,0 +1,14 @@ +# Apache 2.2 + + + order allow,deny + deny from all + + + +# Apache 2.4 + + + Require all denied + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f964d3..c3550d83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -169,4 +169,9 @@ ## [3.2.20] - One page checkout compatibility improvements - Multiple payment transaction and total price fix -- Carriers error handling improvements \ No newline at end of file + +## [3.2.21] +- Fixed label printing error and 0 goods price displaying +- Improved price calculation +- Fixed issues with carrier shown as "Free" when it is not needed to display +- Carriers error handling improvements diff --git a/config/config.yml b/config/config.yml index 0f0eb6a3..8953dfef 100644 --- a/config/config.yml +++ b/config/config.yml @@ -16,6 +16,7 @@ imports: - { resource: command.yml } - { resource: presenter.yml } - { resource: templateRender.yml } + - { resource: verification.yml } services: _defaults: diff --git a/config/verification.yml b/config/verification.yml new file mode 100644 index 00000000..fa1f7c2a --- /dev/null +++ b/config/verification.yml @@ -0,0 +1,12 @@ +services: + _defaults: + public: true + + invertus.dpdbaltics.verification.is_address_in_zone: + class: 'Invertus\dpdBaltics\Verification\IsAddressInZone' + arguments: + - '@invertus.dpdbaltics.repository.zone_range_repository' + - '@invertus.dpdbaltics.verification.is_address_in_range' + + invertus.dpdbaltics.verification.is_address_in_range: + class: 'Invertus\dpdBaltics\Verification\IsAddressInRange' \ No newline at end of file diff --git a/controllers/admin/AdminDPDAjaxOnBoardController.php b/controllers/admin/AdminDPDAjaxOnBoardController.php index 5def0581..fd25eaab 100644 --- a/controllers/admin/AdminDPDAjaxOnBoardController.php +++ b/controllers/admin/AdminDPDAjaxOnBoardController.php @@ -19,6 +19,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDAjaxOnBoardController extends AbstractAdminController { /** diff --git a/controllers/admin/AdminDPDBalticsAddressTemplateController.php b/controllers/admin/AdminDPDBalticsAddressTemplateController.php index de9d2501..580709c5 100644 --- a/controllers/admin/AdminDPDBalticsAddressTemplateController.php +++ b/controllers/admin/AdminDPDBalticsAddressTemplateController.php @@ -32,6 +32,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsAddressTemplateController extends AbstractAdminController { diff --git a/controllers/admin/AdminDPDBalticsAjaxController.php b/controllers/admin/AdminDPDBalticsAjaxController.php index 5de134de..d7ffdaf1 100644 --- a/controllers/admin/AdminDPDBalticsAjaxController.php +++ b/controllers/admin/AdminDPDBalticsAjaxController.php @@ -21,6 +21,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsAjaxController extends AbstractAdminController { public function ajaxProcessImportZones() diff --git a/controllers/admin/AdminDPDBalticsAjaxShipmentsController.php b/controllers/admin/AdminDPDBalticsAjaxShipmentsController.php index dfe05417..8cbd44fc 100644 --- a/controllers/admin/AdminDPDBalticsAjaxShipmentsController.php +++ b/controllers/admin/AdminDPDBalticsAjaxShipmentsController.php @@ -33,6 +33,10 @@ require_once dirname(__DIR__) . '/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsAjaxShipmentsController extends AbstractAdminController { protected $ajaxActions = ['save', 'save_and_print', 'updateAddressBlock', 'getProductPriceByID', 'print']; diff --git a/controllers/admin/AdminDPDBalticsCollectionRequestController.php b/controllers/admin/AdminDPDBalticsCollectionRequestController.php index 32cad447..ac96f856 100644 --- a/controllers/admin/AdminDPDBalticsCollectionRequestController.php +++ b/controllers/admin/AdminDPDBalticsCollectionRequestController.php @@ -18,8 +18,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - use Invertus\dpdBaltics\Builder\Template\Admin\PhoneInputBuilder; use Invertus\dpdBaltics\Controller\AbstractAdminController; use Invertus\dpdBaltics\Converter\FormDataConverter; @@ -34,6 +32,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsCollectionRequestController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsCourierRequestController.php b/controllers/admin/AdminDPDBalticsCourierRequestController.php index 9d527ccf..d1b57a79 100644 --- a/controllers/admin/AdminDPDBalticsCourierRequestController.php +++ b/controllers/admin/AdminDPDBalticsCourierRequestController.php @@ -36,6 +36,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsCourierRequestController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsImportExportController.php b/controllers/admin/AdminDPDBalticsImportExportController.php index 660734ee..3679ba43 100644 --- a/controllers/admin/AdminDPDBalticsImportExportController.php +++ b/controllers/admin/AdminDPDBalticsImportExportController.php @@ -40,6 +40,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsImportExportController extends AbstractAdminController { public function init() diff --git a/controllers/admin/AdminDPDBalticsLogsController.php b/controllers/admin/AdminDPDBalticsLogsController.php index af7ed497..8c674204 100644 --- a/controllers/admin/AdminDPDBalticsLogsController.php +++ b/controllers/admin/AdminDPDBalticsLogsController.php @@ -18,12 +18,14 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - use Invertus\dpdBaltics\Controller\AbstractAdminController; require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsLogsController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsModuleController.php b/controllers/admin/AdminDPDBalticsModuleController.php index 07a5e9cd..03949f1c 100644 --- a/controllers/admin/AdminDPDBalticsModuleController.php +++ b/controllers/admin/AdminDPDBalticsModuleController.php @@ -18,11 +18,14 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Infrastructure\Bootstrap\ModuleTabs; require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsModuleController extends ModuleAdminController { public function postProcess() diff --git a/controllers/admin/AdminDPDBalticsOrderReturnController.php b/controllers/admin/AdminDPDBalticsOrderReturnController.php index a9396198..9cd8c1dc 100644 --- a/controllers/admin/AdminDPDBalticsOrderReturnController.php +++ b/controllers/admin/AdminDPDBalticsOrderReturnController.php @@ -18,12 +18,14 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - use Invertus\dpdBaltics\Controller\AbstractAdminController; require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsOrderReturnController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsPriceRulesController.php b/controllers/admin/AdminDPDBalticsPriceRulesController.php index 25fc48b9..2aa0ebf4 100644 --- a/controllers/admin/AdminDPDBalticsPriceRulesController.php +++ b/controllers/admin/AdminDPDBalticsPriceRulesController.php @@ -21,6 +21,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsPriceRulesController extends AbstractAdminController { /** @var DPDPriceRule */ diff --git a/controllers/admin/AdminDPDBalticsProductsAvailabilityController.php b/controllers/admin/AdminDPDBalticsProductsAvailabilityController.php index 706a61b4..a7c44d45 100644 --- a/controllers/admin/AdminDPDBalticsProductsAvailabilityController.php +++ b/controllers/admin/AdminDPDBalticsProductsAvailabilityController.php @@ -18,6 +18,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsProductsAvailabilityController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsProductsController.php b/controllers/admin/AdminDPDBalticsProductsController.php index 4328d9f7..14c85dc1 100644 --- a/controllers/admin/AdminDPDBalticsProductsController.php +++ b/controllers/admin/AdminDPDBalticsProductsController.php @@ -19,6 +19,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsProductsController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsPudoAjaxController.php b/controllers/admin/AdminDPDBalticsPudoAjaxController.php index 50fe08e9..a39d021c 100644 --- a/controllers/admin/AdminDPDBalticsPudoAjaxController.php +++ b/controllers/admin/AdminDPDBalticsPudoAjaxController.php @@ -18,7 +18,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Controller\AbstractAdminController; use Invertus\dpdBaltics\Provider\CurrentCountryProvider; @@ -29,6 +28,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsPudoAjaxController extends AbstractAdminController { public function postProcess() diff --git a/controllers/admin/AdminDPDBalticsRequestSupportController.php b/controllers/admin/AdminDPDBalticsRequestSupportController.php index 116c6ba0..cba799d1 100644 --- a/controllers/admin/AdminDPDBalticsRequestSupportController.php +++ b/controllers/admin/AdminDPDBalticsRequestSupportController.php @@ -17,6 +17,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsRequestSupportController extends AbstractAdminController { public function postProcess() diff --git a/controllers/admin/AdminDPDBalticsSettingsController.php b/controllers/admin/AdminDPDBalticsSettingsController.php index 820795ec..6db327da 100644 --- a/controllers/admin/AdminDPDBalticsSettingsController.php +++ b/controllers/admin/AdminDPDBalticsSettingsController.php @@ -18,7 +18,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Builder\Template\Admin\InfoBlockBuilder; use Invertus\dpdBaltics\Collection\DPDProductInstallCollection; use Invertus\dpdBaltics\Config\Config; @@ -37,6 +36,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsSettingsController extends AbstractAdminController { private const FILE_NAME = 'AdminDPDBalticsSettingsController'; diff --git a/controllers/admin/AdminDPDBalticsShipmentController.php b/controllers/admin/AdminDPDBalticsShipmentController.php index cec280e7..3e83c29b 100644 --- a/controllers/admin/AdminDPDBalticsShipmentController.php +++ b/controllers/admin/AdminDPDBalticsShipmentController.php @@ -18,12 +18,14 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - use Invertus\dpdBaltics\Controller\AbstractAdminController; require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsShipmentController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsShipmentSettingsController.php b/controllers/admin/AdminDPDBalticsShipmentSettingsController.php index b8021c3f..f3375dfd 100644 --- a/controllers/admin/AdminDPDBalticsShipmentSettingsController.php +++ b/controllers/admin/AdminDPDBalticsShipmentSettingsController.php @@ -18,7 +18,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Controller\AbstractAdminController; use Invertus\dpdBaltics\Infrastructure\Bootstrap\ModuleTabs; @@ -32,6 +31,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsShipmentSettingsController extends AbstractAdminController { public function __construct() diff --git a/controllers/admin/AdminDPDBalticsZonesController.php b/controllers/admin/AdminDPDBalticsZonesController.php index 0fcf56f0..3035b19b 100644 --- a/controllers/admin/AdminDPDBalticsZonesController.php +++ b/controllers/admin/AdminDPDBalticsZonesController.php @@ -27,6 +27,10 @@ require_once dirname(__DIR__).'/../vendor/autoload.php'; +if (!defined('_PS_VERSION_')) { + exit; +} + class AdminDPDBalticsZonesController extends AbstractAdminController { /** diff --git a/controllers/front/Ajax.php b/controllers/front/Ajax.php index 65c6e53f..40e73f76 100644 --- a/controllers/front/Ajax.php +++ b/controllers/front/Ajax.php @@ -28,6 +28,10 @@ use Invertus\dpdBalticsApi\Exception\DPDBalticsAPIException; use Symfony\Component\HttpFoundation\Response; +if (!defined('_PS_VERSION_')) { + exit; +} + class DpdBalticsAjaxModuleFrontController extends ModuleFrontController { const FILENAME = 'Ajax'; diff --git a/controllers/front/CronJob.php b/controllers/front/CronJob.php index 0f5cf3b6..0ea0ed59 100644 --- a/controllers/front/CronJob.php +++ b/controllers/front/CronJob.php @@ -18,11 +18,14 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Provider\ZoneRangeProvider; use Invertus\dpdBaltics\Service\Import\API\ParcelShopImport; +if (!defined('_PS_VERSION_')) { + exit; +} + class DpdbalticsCronJobModuleFrontController extends ModuleFrontController { public function postProcess() diff --git a/controllers/front/ShipmentReturn.php b/controllers/front/ShipmentReturn.php index 2d6c8219..7cc71b5f 100644 --- a/controllers/front/ShipmentReturn.php +++ b/controllers/front/ShipmentReturn.php @@ -18,7 +18,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Repository\ShipmentRepository; use Invertus\dpdBaltics\Service\API\LabelApiService; @@ -26,6 +25,10 @@ use Invertus\dpdBaltics\Service\ShipmentService; use Invertus\dpdBalticsApi\Exception\DPDBalticsAPIException; +if (!defined('_PS_VERSION_')) { + exit; +} + class DpdbalticsShipmentReturnModuleFrontController extends ModuleFrontController { const FILENAME = 'ShipmentReturn'; diff --git a/dpdbaltics.php b/dpdbaltics.php index 7654451b..b0efd776 100644 --- a/dpdbaltics.php +++ b/dpdbaltics.php @@ -18,27 +18,21 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ -use Invertus\dpdBaltics\Grid\Row\PrintAccessibilityChecker; use Invertus\dpdBaltics\Builder\Template\Front\CarrierOptionsBuilder; use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Controller\AbstractAdminController; use Invertus\dpdBaltics\Grid\LinkRowActionCustom; use Invertus\dpdBaltics\Grid\SubmitBulkActionCustom; -use invertus\dpdbaltics\install\installer; -use Invertus\dpdBaltics\Logger\Logger; use Invertus\dpdBaltics\OnBoard\Service\OnBoardService; use Invertus\dpdBaltics\Repository\AddressTemplateRepository; use Invertus\dpdBaltics\Repository\OrderRepository; use Invertus\dpdBaltics\Repository\ParcelShopRepository; use Invertus\dpdBaltics\Repository\PhonePrefixRepository; -use Invertus\dpdBaltics\Repository\PriceRuleRepository; use Invertus\dpdBaltics\Repository\ProductRepository; use Invertus\dpdBaltics\Repository\PudoRepository; use Invertus\dpdBaltics\Repository\ReceiverAddressRepository; use Invertus\dpdBaltics\Repository\ShipmentRepository; use Invertus\dpdBaltics\Repository\ZoneRepository; -use Invertus\dpdBaltics\Service\API\LabelApiService; -use Invertus\dpdBaltics\Service\API\ParcelShopSearchApiService; use Invertus\dpdBaltics\Service\CarrierPhoneService; use Invertus\dpdBaltics\Service\Exception\ExceptionService; use Invertus\dpdBaltics\Service\GoogleApiService; @@ -46,7 +40,6 @@ use Invertus\dpdBaltics\Service\OrderService; use Invertus\dpdBaltics\Service\Parcel\ParcelShopService; use Invertus\dpdBaltics\Service\Payment\PaymentService; -use Invertus\dpdBaltics\Service\PriceRuleService; use Invertus\dpdBaltics\Service\PudoService; use Invertus\dpdBaltics\Service\ShipmentService; use Invertus\dpdBaltics\Service\ShippingPriceCalculationService; @@ -58,17 +51,17 @@ use Invertus\dpdBalticsApi\Api\DTO\Response\ParcelShopSearchResponse; use Invertus\dpdBalticsApi\Exception\DPDBalticsAPIException; use Invertus\dpdBalticsApi\Factory\SerializerFactory; -use PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction; use PrestaShop\PrestaShop\Core\Grid\Action\Row\RowActionCollection; -use PrestaShop\PrestaShop\Core\Grid\Action\Row\Type\LinkRowAction; use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ActionColumn; -use Symfony\Component\Config\ConfigCache; use Symfony\Component\Config\FileLocator; -use Symfony\Component\Console\Application; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +if (!defined('_PS_VERSION_')) { + exit; +} + + class DPDBaltics extends CarrierModule { /** @@ -91,7 +84,7 @@ public function __construct() $this->author = 'Invertus'; $this->tab = 'shipping_logistics'; $this->description = 'DPD Baltics shipping integration'; - $this->version = '3.2.20'; + $this->version = '3.2.21'; $this->ps_versions_compliancy = ['min' => '1.7.1.0', 'max' => _PS_VERSION_]; $this->need_instance = 0; parent::__construct(); @@ -548,7 +541,7 @@ public function getOrderShippingCostExternal($cart) /** @var ShippingPriceCalculationService $shippingPriceCalculationService */ $shippingPriceCalculationService = $this->getModuleContainer()->get('invertus.dpdbaltics.service.shipping_price_calculation_service'); - return $shippingPriceCalculationService->calculate($cart, $carrier, $deliveryAddress); + return $shippingPriceCalculationService->calculate($cart, $carrier, $deliveryAddress); } public function hookDisplayCarrierExtraContent($params) @@ -707,7 +700,7 @@ public function hookDisplayCarrierExtraContent($params) ); $return .= $this->context->smarty->fetch( - $this->getLocalPath() . '/views/templates/hook/front/pudo-points.tpl' + 'module:dpdbaltics/views/templates/hook/front/pudo-points.tpl' ); } @@ -1226,7 +1219,7 @@ public function hookDisplayOrderDetail($params) ] ); $html = $this->context->smarty->fetch( - $this->getLocalPath() . 'views/templates/hook/front/order-detail.tpl' + 'module:dpdbaltics/views/templates/hook/front/order-detail.tpl' ); return $html; diff --git a/index.php b/index.php new file mode 100644 index 00000000..3c82fdf6 --- /dev/null +++ b/index.php @@ -0,0 +1,29 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/src/Adapter/AddressAdapter.php b/src/Adapter/AddressAdapter.php index 6c8f47ea..c951fa24 100644 --- a/src/Adapter/AddressAdapter.php +++ b/src/Adapter/AddressAdapter.php @@ -18,6 +18,11 @@ use Invertus\dpdBaltics\Config\Config; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + + /** * Class DPDAddressAdapter */ diff --git a/src/Adapter/DPDConfigurationAdapter.php b/src/Adapter/DPDConfigurationAdapter.php index 4fa96f5f..faed3b23 100644 --- a/src/Adapter/DPDConfigurationAdapter.php +++ b/src/Adapter/DPDConfigurationAdapter.php @@ -14,6 +14,11 @@ use Configuration; +if (!defined('_PS_VERSION_')) { + exit; +} + + class DPDConfigurationAdapter { public function get($key) diff --git a/src/Adapter/LinkAdapter.php b/src/Adapter/LinkAdapter.php index 2c6c6aa4..997bdeaf 100644 --- a/src/Adapter/LinkAdapter.php +++ b/src/Adapter/LinkAdapter.php @@ -18,9 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - namespace Invertus\dpdBaltics\Adapter; +if (!defined('_PS_VERSION_')) { + exit; +} + class LinkAdapter { public function getUrlSmarty($params) diff --git a/src/Adapter/ZipCodeAdapter.php b/src/Adapter/ZipCodeAdapter.php index db8f7882..c77926e8 100644 --- a/src/Adapter/ZipCodeAdapter.php +++ b/src/Adapter/ZipCodeAdapter.php @@ -16,6 +16,11 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + + /** * Class DPDZipCodeAdapter * @package src\Adapter diff --git a/src/Adapter/ZoneAdapter.php b/src/Adapter/ZoneAdapter.php index e8795c96..9658ec92 100644 --- a/src/Adapter/ZoneAdapter.php +++ b/src/Adapter/ZoneAdapter.php @@ -17,6 +17,11 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\DTO\ZoneRangeObject; +if (!defined('_PS_VERSION_')) { + exit; +} + + class ZoneAdapter { /** diff --git a/src/Builder/BuilderInterface.php b/src/Builder/BuilderInterface.php index 4008dd78..13d9f02a 100644 --- a/src/Builder/BuilderInterface.php +++ b/src/Builder/BuilderInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Builder; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Interface DPDBuilderInterface - holds the interface required for builders to execute */ diff --git a/src/Builder/CarrierBuilder.php b/src/Builder/CarrierBuilder.php index 3094ea86..31d0710c 100644 --- a/src/Builder/CarrierBuilder.php +++ b/src/Builder/CarrierBuilder.php @@ -18,6 +18,10 @@ use PrestaShopException; use Shop; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDCarrierBuilder - creates carrier */ diff --git a/src/Builder/CarrierImageBuilder.php b/src/Builder/CarrierImageBuilder.php index f2c66db9..4e1707a0 100644 --- a/src/Builder/CarrierImageBuilder.php +++ b/src/Builder/CarrierImageBuilder.php @@ -15,6 +15,10 @@ use DPDBaltics; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDCarrierImageBuilder - stores carrier images by associated carrier * @package src\Builder diff --git a/src/Builder/Template/Admin/InfoBlockBuilder.php b/src/Builder/Template/Admin/InfoBlockBuilder.php index 561617a7..c89cc4b1 100644 --- a/src/Builder/Template/Admin/InfoBlockBuilder.php +++ b/src/Builder/Template/Admin/InfoBlockBuilder.php @@ -16,6 +16,10 @@ use Invertus\dpdBaltics\Builder\Template\TemplateBuilderInterface; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class InfoBlockBuilder implements TemplateBuilderInterface { /** diff --git a/src/Builder/Template/Admin/LogBlockBuilder.php b/src/Builder/Template/Admin/LogBlockBuilder.php index 4d4d9358..c359beb2 100644 --- a/src/Builder/Template/Admin/LogBlockBuilder.php +++ b/src/Builder/Template/Admin/LogBlockBuilder.php @@ -34,6 +34,10 @@ use Shop; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class LogBlockBuilder { /** diff --git a/src/Builder/Template/Admin/PhoneInputBuilder.php b/src/Builder/Template/Admin/PhoneInputBuilder.php index 2a2085f6..55232866 100644 --- a/src/Builder/Template/Admin/PhoneInputBuilder.php +++ b/src/Builder/Template/Admin/PhoneInputBuilder.php @@ -24,6 +24,10 @@ use DPDBaltics; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class PhoneInputBuilder { /** diff --git a/src/Builder/Template/Admin/ProductBlockBuilder.php b/src/Builder/Template/Admin/ProductBlockBuilder.php index 77844140..ed76e529 100644 --- a/src/Builder/Template/Admin/ProductBlockBuilder.php +++ b/src/Builder/Template/Admin/ProductBlockBuilder.php @@ -35,6 +35,10 @@ use Shop; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductBlockBuilder { /** diff --git a/src/Builder/Template/Admin/WarningBlockBuilder.php b/src/Builder/Template/Admin/WarningBlockBuilder.php index ee18db91..35a31d2c 100644 --- a/src/Builder/Template/Admin/WarningBlockBuilder.php +++ b/src/Builder/Template/Admin/WarningBlockBuilder.php @@ -16,6 +16,10 @@ use Invertus\dpdBaltics\Builder\Template\TemplateBuilderInterface; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class WarningBlockBuilder implements TemplateBuilderInterface { /** diff --git a/src/Builder/Template/Front/CarrierOptionsBuilder.php b/src/Builder/Template/Front/CarrierOptionsBuilder.php index 473ded32..81073c90 100644 --- a/src/Builder/Template/Front/CarrierOptionsBuilder.php +++ b/src/Builder/Template/Front/CarrierOptionsBuilder.php @@ -32,6 +32,10 @@ use PrestaShopBundle\Controller\Admin\ProductController; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class CarrierOptionsBuilder { /** @@ -112,7 +116,7 @@ public function renderCarrierOptionsInProductPage() ]); return $this->context->smarty->fetch( - $this->moduleLocalPath . 'views/templates/hook/front/product-page-carriers.tpl' + 'module:dpdbaltics/views/templates/hook/front/product-page-carriers.tpl' ); } } diff --git a/src/Builder/Template/SearchBoxBuilder.php b/src/Builder/Template/SearchBoxBuilder.php index 8689e33d..5b56efba 100644 --- a/src/Builder/Template/SearchBoxBuilder.php +++ b/src/Builder/Template/SearchBoxBuilder.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Plugin\SearchBox\DPDSearchBoxPluginFactory; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class SearchBoxBuilder { /** diff --git a/src/Builder/Template/TemplateBuilderInterface.php b/src/Builder/Template/TemplateBuilderInterface.php index 881310ca..1150bdf9 100644 --- a/src/Builder/Template/TemplateBuilderInterface.php +++ b/src/Builder/Template/TemplateBuilderInterface.php @@ -14,6 +14,10 @@ use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + interface TemplateBuilderInterface { /** diff --git a/src/Collection/DPDProductInstallCollection.php b/src/Collection/DPDProductInstallCollection.php index d1c46935..10cc493e 100644 --- a/src/Collection/DPDProductInstallCollection.php +++ b/src/Collection/DPDProductInstallCollection.php @@ -16,6 +16,11 @@ use Invertus\dpdBaltics\DTO\DPDProductInstall; use Iterator; +if (!defined('_PS_VERSION_')) { + exit; +} + + class DPDProductInstallCollection implements ArrayAccess, Iterator { /** diff --git a/src/Collection/ZoneRangeObjectCollection.php b/src/Collection/ZoneRangeObjectCollection.php index cbca5df9..bc87708d 100644 --- a/src/Collection/ZoneRangeObjectCollection.php +++ b/src/Collection/ZoneRangeObjectCollection.php @@ -16,6 +16,11 @@ use Invertus\dpdBaltics\DTO\ZoneRangeObject; use Iterator; +if (!defined('_PS_VERSION_')) { + exit; +} + + class ZoneRangeObjectCollection implements ArrayAccess, Iterator { /** diff --git a/src/Config/ApiConfiguration.php b/src/Config/ApiConfiguration.php index 978b0f32..79921eb4 100644 --- a/src/Config/ApiConfiguration.php +++ b/src/Config/ApiConfiguration.php @@ -26,6 +26,11 @@ use Invertus\dpdBalticsApi\ApiConfig\ApiConfig; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + + class ApiConfiguration implements ApiConfigurationInterface { public function getUrl() diff --git a/src/Config/Config.php b/src/Config/Config.php index c50f5c1d..5284bdca 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -28,6 +28,11 @@ use Invertus\dpdBaltics\DTO\DPDProductInstall; use Module; +if (!defined('_PS_VERSION_')) { + exit; +} + + class Config { diff --git a/src/Controller/AbstractAdminController.php b/src/Controller/AbstractAdminController.php index a40c4382..a8d637ab 100644 --- a/src/Controller/AbstractAdminController.php +++ b/src/Controller/AbstractAdminController.php @@ -34,6 +34,11 @@ use ModuleAdminController; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + + class AbstractAdminController extends ModuleAdminController { const FILENAME = 'DPDAbstractAdminController'; diff --git a/src/Controller/OrderLabelController.php b/src/Controller/OrderLabelController.php index ac37dd2d..f733f402 100644 --- a/src/Controller/OrderLabelController.php +++ b/src/Controller/OrderLabelController.php @@ -34,6 +34,11 @@ use Symfony\Component\HttpFoundation\Response; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + + class OrderLabelController extends FrameworkBundleAdminController { /** diff --git a/src/Converter/FormDataConverter.php b/src/Converter/FormDataConverter.php index 30981496..9bd4ab73 100644 --- a/src/Converter/FormDataConverter.php +++ b/src/Converter/FormDataConverter.php @@ -26,6 +26,11 @@ use Invertus\dpdBaltics\DTO\ShipmentData; use Symfony\Component\DependencyInjection\Container; +if (!defined('_PS_VERSION_')) { + exit; +} + + class FormDataConverter { public function convertShipmentFormDataToShipmentObj($formData) diff --git a/src/Core/Shared/Repository/LanguageRepository.php b/src/Core/Shared/Repository/LanguageRepository.php index 65ee3d64..88af45c9 100644 --- a/src/Core/Shared/Repository/LanguageRepository.php +++ b/src/Core/Shared/Repository/LanguageRepository.php @@ -20,9 +20,13 @@ namespace Invertus\dpdBaltics\Core\Shared\Repository; - use Invertus\dpdBaltics\Infrastructure\Repository\CollectionRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + + class LanguageRepository extends CollectionRepository implements LanguageRepositoryInterface { public function __construct() diff --git a/src/Core/Shared/Repository/LanguageRepositoryInterface.php b/src/Core/Shared/Repository/LanguageRepositoryInterface.php index baa64a0a..8ca4457c 100644 --- a/src/Core/Shared/Repository/LanguageRepositoryInterface.php +++ b/src/Core/Shared/Repository/LanguageRepositoryInterface.php @@ -22,6 +22,11 @@ use Invertus\dpdBaltics\Infrastructure\Repository\ReadOnlyCollectionRepositoryInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + + interface LanguageRepositoryInterface extends ReadOnlyCollectionRepositoryInterface { /** diff --git a/src/Core/Shared/Repository/TabRepository.php b/src/Core/Shared/Repository/TabRepository.php index 833ca71f..9e42a8b6 100644 --- a/src/Core/Shared/Repository/TabRepository.php +++ b/src/Core/Shared/Repository/TabRepository.php @@ -22,6 +22,11 @@ use Invertus\dpdBaltics\Infrastructure\Repository\CollectionRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + + class TabRepository extends CollectionRepository implements TabRepositoryInterface { public function __construct() diff --git a/src/Core/Shared/Repository/TabRepositoryInterface.php b/src/Core/Shared/Repository/TabRepositoryInterface.php index 90a67eba..3a8ee980 100644 --- a/src/Core/Shared/Repository/TabRepositoryInterface.php +++ b/src/Core/Shared/Repository/TabRepositoryInterface.php @@ -22,6 +22,11 @@ use Invertus\dpdBaltics\Infrastructure\Repository\ReadOnlyCollectionRepositoryInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + + interface TabRepositoryInterface extends ReadOnlyCollectionRepositoryInterface { } diff --git a/src/DTO/CollectionRequestData.php b/src/DTO/CollectionRequestData.php index 7fdcdac9..ee2713e4 100644 --- a/src/DTO/CollectionRequestData.php +++ b/src/DTO/CollectionRequestData.php @@ -18,9 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ +namespace Invertus\dpdBaltics\DTO; +if (!defined('_PS_VERSION_')) { + exit; +} -namespace Invertus\dpdBaltics\DTO; class CollectionRequestData { diff --git a/src/DTO/CourierRequestData.php b/src/DTO/CourierRequestData.php index 887bcaa4..773c1763 100644 --- a/src/DTO/CourierRequestData.php +++ b/src/DTO/CourierRequestData.php @@ -18,10 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - namespace Invertus\dpdBaltics\DTO; +if (!defined('_PS_VERSION_')) { + exit; +} + class CourierRequestData { /** diff --git a/src/DTO/DPDProductInstall.php b/src/DTO/DPDProductInstall.php index 7b7019a0..d9018647 100644 --- a/src/DTO/DPDProductInstall.php +++ b/src/DTO/DPDProductInstall.php @@ -18,9 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - namespace Invertus\dpdBaltics\DTO; +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDProductInstall { private $id; diff --git a/src/DTO/ShipmentData.php b/src/DTO/ShipmentData.php index 7604bde7..f10db84a 100644 --- a/src/DTO/ShipmentData.php +++ b/src/DTO/ShipmentData.php @@ -18,10 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - namespace Invertus\dpdBaltics\DTO; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentData { /** diff --git a/src/DTO/ZoneRangeObject.php b/src/DTO/ZoneRangeObject.php index 3b7daf31..c4019e8e 100644 --- a/src/DTO/ZoneRangeObject.php +++ b/src/DTO/ZoneRangeObject.php @@ -14,6 +14,10 @@ use Invertus\dpdBaltics\Validate\Zone\ZoneRangeValidate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneRangeObject { /** diff --git a/src/Entity/DPDAddressTemplate.php b/src/Entity/DPDAddressTemplate.php index b6f79d69..374ecdd5 100644 --- a/src/Entity/DPDAddressTemplate.php +++ b/src/Entity/DPDAddressTemplate.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDAddressTemplate extends ObjectModel { const ADDRESS_TYPE_COLLECTION_REQUEST = 'collection_request'; diff --git a/src/Entity/DPDCollectionRequest.php b/src/Entity/DPDCollectionRequest.php index faf02321..dd339c8d 100644 --- a/src/Entity/DPDCollectionRequest.php +++ b/src/Entity/DPDCollectionRequest.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDCollectionRequest extends ObjectModel { const ADDRESS_TYPE_COMPANY = 'company'; diff --git a/src/Entity/DPDCourierRequest.php b/src/Entity/DPDCourierRequest.php index 691c4c21..5ab6528c 100644 --- a/src/Entity/DPDCourierRequest.php +++ b/src/Entity/DPDCourierRequest.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDCourierRequest extends ObjectModel { diff --git a/src/Entity/DPDLog.php b/src/Entity/DPDLog.php index 380b75cd..ba0e904f 100644 --- a/src/Entity/DPDLog.php +++ b/src/Entity/DPDLog.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDLog extends ObjectModel { diff --git a/src/Entity/DPDOrderDeliveryTime.php b/src/Entity/DPDOrderDeliveryTime.php index 60d90448..4d90ba00 100644 --- a/src/Entity/DPDOrderDeliveryTime.php +++ b/src/Entity/DPDOrderDeliveryTime.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDOrderDeliveryTime extends ObjectModel { /** diff --git a/src/Entity/DPDOrderPhone.php b/src/Entity/DPDOrderPhone.php index 3b5ac1e5..1ca45d7d 100644 --- a/src/Entity/DPDOrderPhone.php +++ b/src/Entity/DPDOrderPhone.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDOrderPhone extends ObjectModel { /** diff --git a/src/Entity/DPDParcel.php b/src/Entity/DPDParcel.php index b167732d..afa84876 100644 --- a/src/Entity/DPDParcel.php +++ b/src/Entity/DPDParcel.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDParcel extends ObjectModel { const DISTRIBUTION_NONE = 'none'; diff --git a/src/Entity/DPDPrestashopCarrier.php b/src/Entity/DPDPrestashopCarrier.php index 97067ecc..3460c338 100644 --- a/src/Entity/DPDPrestashopCarrier.php +++ b/src/Entity/DPDPrestashopCarrier.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDPrestashopCarrier extends Carrier { public function insertDeliveryPlaceholder($psZones) diff --git a/src/Entity/DPDPriceRule.php b/src/Entity/DPDPriceRule.php index 889354ad..8cd83c9a 100644 --- a/src/Entity/DPDPriceRule.php +++ b/src/Entity/DPDPriceRule.php @@ -14,6 +14,11 @@ use Invertus\dpdBaltics\Repository\PriceRuleRepository; use Invertus\dpdBaltics\Repository\ZoneRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + + /** * Class DPDPriceRule */ @@ -257,10 +262,14 @@ public function isApplicableByAddress(Address $address) /** @var DPDBaltics $module */ $module = Module::getInstanceByName('dpdbaltics'); - /** @var ZoneRepository $zoneRepo */ - $zoneRepo = $module->getModuleContainer()->get('invertus.dpdbaltics.repository.zone_repository'); + /** @var \Invertus\dpdBaltics\Verification\IsAddressInZone $isAddressInZone */ + $isAddressInZone = $module->getModuleContainer('invertus.dpdbaltics.verification.is_address_in_zone'); + + /** @var DPDZoneRepository $repo */ + $repo = $module->getModuleContainer()->get('invertus.dpdbaltics.repository.dpdzone_repository'); + $zonesIds = $repo->getZonesIdsByPriceRule($this->id); - return $zoneRepo->findZoneInRangeByAddress($address); + return $isAddressInZone->verify($address, $zonesIds); } public function isApplicableByPrice($price, $idCurrency) diff --git a/src/Entity/DPDProduct.php b/src/Entity/DPDProduct.php index 5128fb01..e5d52517 100644 --- a/src/Entity/DPDProduct.php +++ b/src/Entity/DPDProduct.php @@ -18,6 +18,9 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ +if (!defined('_PS_VERSION_')) { + exit; +} class DPDProduct extends ObjectModel { diff --git a/src/Entity/DPDProductAvailability.php b/src/Entity/DPDProductAvailability.php index 00027a8d..65265b0f 100644 --- a/src/Entity/DPDProductAvailability.php +++ b/src/Entity/DPDProductAvailability.php @@ -18,6 +18,9 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ +if (!defined('_PS_VERSION_')) { + exit; +} class DPDProductAvailability extends ObjectModel { diff --git a/src/Entity/DPDPudo.php b/src/Entity/DPDPudo.php index 771b058b..dd922e9f 100644 --- a/src/Entity/DPDPudo.php +++ b/src/Entity/DPDPudo.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDPudo extends ObjectModel { /** @var int */ diff --git a/src/Entity/DPDReceiverAddress.php b/src/Entity/DPDReceiverAddress.php index 440f8b8c..cc8114f6 100644 --- a/src/Entity/DPDReceiverAddress.php +++ b/src/Entity/DPDReceiverAddress.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDReceiverAddress extends ObjectModel { /** diff --git a/src/Entity/DPDShipment.php b/src/Entity/DPDShipment.php index 71071fbb..cf5a9e1b 100644 --- a/src/Entity/DPDShipment.php +++ b/src/Entity/DPDShipment.php @@ -18,7 +18,9 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - +if (!defined('_PS_VERSION_')) { + exit; +} class DPDShipment extends ObjectModel { diff --git a/src/Entity/DPDShipmentError.php b/src/Entity/DPDShipmentError.php index ad8437f0..866d7be0 100644 --- a/src/Entity/DPDShipmentError.php +++ b/src/Entity/DPDShipmentError.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDShipmentError extends ObjectModel { public $id_dpd_shipment_error; diff --git a/src/Entity/DPDShop.php b/src/Entity/DPDShop.php index eb4fa559..4839dbbe 100644 --- a/src/Entity/DPDShop.php +++ b/src/Entity/DPDShop.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDShop extends ObjectModel { /** diff --git a/src/Entity/DPDShopWorkHours.php b/src/Entity/DPDShopWorkHours.php index f628a9b7..e0aaa4af 100644 --- a/src/Entity/DPDShopWorkHours.php +++ b/src/Entity/DPDShopWorkHours.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDShopWorkHours extends ObjectModel { /** diff --git a/src/Entity/DPDZone.php b/src/Entity/DPDZone.php index 9781f620..f4c048ac 100644 --- a/src/Entity/DPDZone.php +++ b/src/Entity/DPDZone.php @@ -13,6 +13,10 @@ use Invertus\dpdBaltics\Repository\ZoneRangeRepository; use Invertus\dpdBaltics\Validate\Zone\ZoneRangeValidate; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDZone */ diff --git a/src/Entity/DPDZoneRange.php b/src/Entity/DPDZoneRange.php index 40795833..8f4255c6 100644 --- a/src/Entity/DPDZoneRange.php +++ b/src/Entity/DPDZoneRange.php @@ -10,6 +10,10 @@ * International Registered Trademark & Property of INVERTUS, UAB */ +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDZoneRange */ diff --git a/src/Exception/DpdCarrierException.php b/src/Exception/DpdCarrierException.php index 63241de7..514d799c 100644 --- a/src/Exception/DpdCarrierException.php +++ b/src/Exception/DpdCarrierException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class DpdCarrierException extends Exception { } diff --git a/src/Exception/EntityAddException.php b/src/Exception/EntityAddException.php index 88e1954e..33b952f0 100644 --- a/src/Exception/EntityAddException.php +++ b/src/Exception/EntityAddException.php @@ -17,11 +17,14 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - - -class EntityAddException extends Exception -{ - const DPD_PARCEL_SHOP_EXCEPTION = 0; - - const DPD_PARCEL_SHOP_WORK_HOURS_EXCEPTION = 1; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class EntityAddException extends Exception +{ + const DPD_PARCEL_SHOP_EXCEPTION = 0; + + const DPD_PARCEL_SHOP_WORK_HOURS_EXCEPTION = 1; } \ No newline at end of file diff --git a/src/Exception/ImportException.php b/src/Exception/ImportException.php index 9d4b1478..d6b3e26a 100644 --- a/src/Exception/ImportException.php +++ b/src/Exception/ImportException.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + use Exception; class ImportException extends Exception diff --git a/src/Exception/ParcelEmailException.php b/src/Exception/ParcelEmailException.php index fe8ed0a1..78c7b99c 100644 --- a/src/Exception/ParcelEmailException.php +++ b/src/Exception/ParcelEmailException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelEmailException extends Exception { } diff --git a/src/Exception/ProductAvailabilityUpdateException.php b/src/Exception/ProductAvailabilityUpdateException.php index e0168a5f..3005bf85 100644 --- a/src/Exception/ProductAvailabilityUpdateException.php +++ b/src/Exception/ProductAvailabilityUpdateException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductAvailabilityUpdateException extends Exception { } diff --git a/src/Exception/ProductUpdateException.php b/src/Exception/ProductUpdateException.php index 24832559..313ca75c 100644 --- a/src/Exception/ProductUpdateException.php +++ b/src/Exception/ProductUpdateException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductUpdateException extends Exception { } diff --git a/src/Exception/ZoneUpdateException.php b/src/Exception/ZoneUpdateException.php index 954b14f5..d8bf6386 100644 --- a/src/Exception/ZoneUpdateException.php +++ b/src/Exception/ZoneUpdateException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneUpdateException extends Exception { } diff --git a/src/Exception/ZoneValidateException.php b/src/Exception/ZoneValidateException.php index d6e8c97e..3c657294 100644 --- a/src/Exception/ZoneValidateException.php +++ b/src/Exception/ZoneValidateException.php @@ -14,6 +14,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneValidateException extends Exception { } diff --git a/src/Factory/APIParamsFactory.php b/src/Factory/APIParamsFactory.php index 98469016..ff5f5b1a 100644 --- a/src/Factory/APIParamsFactory.php +++ b/src/Factory/APIParamsFactory.php @@ -27,6 +27,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBalticsApi\Factory\APIParamsFactoryInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class APIParamsFactory implements APIParamsFactoryInterface { /** diff --git a/src/Factory/ArrayFactory.php b/src/Factory/ArrayFactory.php index 27babce1..6137b2db 100644 --- a/src/Factory/ArrayFactory.php +++ b/src/Factory/ArrayFactory.php @@ -22,6 +22,10 @@ use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ArrayFactory { /** diff --git a/src/Factory/ContextFactory.php b/src/Factory/ContextFactory.php index 317752e0..d4b40ef6 100644 --- a/src/Factory/ContextFactory.php +++ b/src/Factory/ContextFactory.php @@ -23,6 +23,10 @@ use Context; use Country; +if (!defined('_PS_VERSION_')) { + exit; +} + class ContextFactory { public static function getContext() diff --git a/src/Factory/ParcelTrackingUrlFactory.php b/src/Factory/ParcelTrackingUrlFactory.php index 08c41bc5..3760ffb7 100644 --- a/src/Factory/ParcelTrackingUrlFactory.php +++ b/src/Factory/ParcelTrackingUrlFactory.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Util\CountryUtility; use Invertus\dpdBaltics\Util\StringUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelTrackingUrlFactory { /** diff --git a/src/Factory/ShipmentDataFactory.php b/src/Factory/ShipmentDataFactory.php index 28b59341..15dfe6ea 100644 --- a/src/Factory/ShipmentDataFactory.php +++ b/src/Factory/ShipmentDataFactory.php @@ -36,6 +36,10 @@ use Invertus\dpdBaltics\Repository\ShipmentRepository; use Order; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentDataFactory { /** diff --git a/src/Factory/ShopFactory.php b/src/Factory/ShopFactory.php index cd04cf55..3c2d733f 100644 --- a/src/Factory/ShopFactory.php +++ b/src/Factory/ShopFactory.php @@ -1,22 +1,22 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 - */ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ namespace Invertus\dpdBaltics\Factory; @@ -25,6 +25,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Object\OpeningHours; use Invertus\dpdBalticsApi\Api\DTO\Object\ParcelShop; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShopFactory { /** diff --git a/src/File/UploadedFile.php b/src/File/UploadedFile.php index da3bd143..7835d5e1 100644 --- a/src/File/UploadedFile.php +++ b/src/File/UploadedFile.php @@ -15,6 +15,10 @@ use Module; use RuntimeException; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDUploadedFile */ diff --git a/src/Grid/LinkRowActionCustom.php b/src/Grid/LinkRowActionCustom.php index 01f84494..ba1347f9 100644 --- a/src/Grid/LinkRowActionCustom.php +++ b/src/Grid/LinkRowActionCustom.php @@ -24,6 +24,10 @@ use PrestaShop\PrestaShop\Core\Grid\Action\Row\AccessibilityChecker\AccessibilityCheckerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +if (!defined('_PS_VERSION_')) { + exit; +} + final class LinkRowActionCustom extends AbstractRowAction { /** diff --git a/src/Grid/Row/PrintAccessibilityChecker.php b/src/Grid/Row/PrintAccessibilityChecker.php index 8ee9a453..77bec09b 100644 --- a/src/Grid/Row/PrintAccessibilityChecker.php +++ b/src/Grid/Row/PrintAccessibilityChecker.php @@ -16,6 +16,9 @@ use PrestaShop\PrestaShop\Core\Grid\Action\Row\AccessibilityChecker\AccessibilityCheckerInterface; +if (!defined('_PS_VERSION_')) { + exit; +} final class PrintAccessibilityChecker implements AccessibilityCheckerInterface { /** diff --git a/src/Grid/SubmitBulkActionCustom.php b/src/Grid/SubmitBulkActionCustom.php index 492c4457..10bb52b8 100644 --- a/src/Grid/SubmitBulkActionCustom.php +++ b/src/Grid/SubmitBulkActionCustom.php @@ -24,6 +24,10 @@ use PrestaShop\PrestaShop\Core\Grid\Action\ModalOptions; use Symfony\Component\OptionsResolver\OptionsResolver; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class BulkAction holds data about single bulk action available in grid. */ diff --git a/src/Helper/ShipmentHelper.php b/src/Helper/ShipmentHelper.php index 2b8e792f..188524ac 100644 --- a/src/Helper/ShipmentHelper.php +++ b/src/Helper/ShipmentHelper.php @@ -16,6 +16,10 @@ use DPDShipment; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentHelper { public function getReference($orderId, $orderReference) diff --git a/src/Infrastructure/Adapter/ModuleFactory.php b/src/Infrastructure/Adapter/ModuleFactory.php index e6882c2b..ae133278 100644 --- a/src/Infrastructure/Adapter/ModuleFactory.php +++ b/src/Infrastructure/Adapter/ModuleFactory.php @@ -1,9 +1,23 @@ + * @copyright Copyright (c) permanent, INVERTUS, UAB + * @license Addons PrestaShop license limitation + * @see /LICENSE + * + * International Registered Trademark & Property of INVERTUS, UAB + */ namespace Invertus\dpdBaltics\Infrastructure\Adapter; use Module; +if (!defined('_PS_VERSION_')) { + exit; +} + class ModuleFactory { /** diff --git a/src/Infrastructure/Bootstrap/Exception/CouldNotInstallModule.php b/src/Infrastructure/Bootstrap/Exception/CouldNotInstallModule.php index b23bcbf7..bab6ad22 100644 --- a/src/Infrastructure/Bootstrap/Exception/CouldNotInstallModule.php +++ b/src/Infrastructure/Bootstrap/Exception/CouldNotInstallModule.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\Infrastructure\Exception\DpdException; use Invertus\dpdBaltics\Infrastructure\Exception\ExceptionCode; +if (!defined('_PS_VERSION_')) { + exit; +} + final class CouldNotInstallModule extends DpdException { public static function failedToInstallModuleTab(\Exception $exception, $moduleTab) diff --git a/src/Infrastructure/Bootstrap/Exception/CouldNotUninstallModule.php b/src/Infrastructure/Bootstrap/Exception/CouldNotUninstallModule.php index 913d6ac7..1cecb18f 100644 --- a/src/Infrastructure/Bootstrap/Exception/CouldNotUninstallModule.php +++ b/src/Infrastructure/Bootstrap/Exception/CouldNotUninstallModule.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\Infrastructure\Exception\DpdException; use Invertus\dpdBaltics\Infrastructure\Exception\ExceptionCode; +if (!defined('_PS_VERSION_')) { + exit; +} + final class CouldNotUninstallModule extends DpdException { public static function failedToUninstallModuleTab(\Exception $exception, $moduleTab) diff --git a/src/Infrastructure/Bootstrap/Install/Installer.php b/src/Infrastructure/Bootstrap/Install/Installer.php index db21ce65..516391f8 100644 --- a/src/Infrastructure/Bootstrap/Install/Installer.php +++ b/src/Infrastructure/Bootstrap/Install/Installer.php @@ -1,9 +1,22 @@ + * @copyright Copyright (c) permanent, INVERTUS, UAB + * @license Addons PrestaShop license limitation + * @see /LICENSE + * + * International Registered Trademark & Property of INVERTUS, UAB + */ namespace Invertus\dpdBaltics\Infrastructure\Bootstrap\Install; use Invertus\dpdBaltics\Infrastructure\Bootstrap\Exception\CouldNotInstallModule; +if (!defined('_PS_VERSION_')) { + exit; +} + class Installer implements InstallerInterface { private $moduleTabInstaller; diff --git a/src/Infrastructure/Bootstrap/Install/InstallerInterface.php b/src/Infrastructure/Bootstrap/Install/InstallerInterface.php index 7a4566d4..907102c9 100644 --- a/src/Infrastructure/Bootstrap/Install/InstallerInterface.php +++ b/src/Infrastructure/Bootstrap/Install/InstallerInterface.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\Infrastructure\Bootstrap\Exception\CouldNotInstallModule; +if (!defined('_PS_VERSION_')) { + exit; +} + interface InstallerInterface { /** diff --git a/src/Infrastructure/Bootstrap/Install/ModuleTabInstaller.php b/src/Infrastructure/Bootstrap/Install/ModuleTabInstaller.php index d60903db..7a7b5545 100644 --- a/src/Infrastructure/Bootstrap/Install/ModuleTabInstaller.php +++ b/src/Infrastructure/Bootstrap/Install/ModuleTabInstaller.php @@ -19,6 +19,10 @@ use Invertus\dpdBaltics\Infrastructure\Utility\VersionUtility; use Tab as PrestashopTab; +if (!defined('_PS_VERSION_')) { + exit; +} + final class ModuleTabInstaller implements InstallerInterface { private $module; diff --git a/src/Infrastructure/Bootstrap/ModuleTabs.php b/src/Infrastructure/Bootstrap/ModuleTabs.php index 56cc16cd..23fef637 100644 --- a/src/Infrastructure/Bootstrap/ModuleTabs.php +++ b/src/Infrastructure/Bootstrap/ModuleTabs.php @@ -1,9 +1,22 @@ + * @copyright Copyright (c) permanent, INVERTUS, UAB + * @license Addons PrestaShop license limitation + * @see /LICENSE + * + * International Registered Trademark & Property of INVERTUS, UAB + */ namespace Invertus\dpdBaltics\Infrastructure\Bootstrap; use Invertus\dpdBaltics\Infrastructure\Adapter\ModuleFactory; +if (!defined('_PS_VERSION_')) { + exit; +} + class ModuleTabs { const FILE_NAME = 'TabService'; diff --git a/src/Infrastructure/Bootstrap/Uninstall/ModuleTabUninstaller.php b/src/Infrastructure/Bootstrap/Uninstall/ModuleTabUninstaller.php index 86bd2ff0..8a2ee562 100644 --- a/src/Infrastructure/Bootstrap/Uninstall/ModuleTabUninstaller.php +++ b/src/Infrastructure/Bootstrap/Uninstall/ModuleTabUninstaller.php @@ -25,6 +25,10 @@ use Invertus\dpdBaltics\Infrastructure\Bootstrap\ModuleTabs; use Tab as PrestashopTab; +if (!defined('_PS_VERSION_')) { + exit; +} + class ModuleTabUninstaller implements UninstallerInterface { private $moduleTabs; diff --git a/src/Infrastructure/Bootstrap/Uninstall/Uninstaller.php b/src/Infrastructure/Bootstrap/Uninstall/Uninstaller.php index 4efe0e2a..d865888f 100644 --- a/src/Infrastructure/Bootstrap/Uninstall/Uninstaller.php +++ b/src/Infrastructure/Bootstrap/Uninstall/Uninstaller.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\Infrastructure\Bootstrap\Exception\CouldNotUninstallModule; +if (!defined('_PS_VERSION_')) { + exit; +} + class Uninstaller implements UninstallerInterface { private $moduleTabUninstaller; diff --git a/src/Infrastructure/Bootstrap/Uninstall/UninstallerInterface.php b/src/Infrastructure/Bootstrap/Uninstall/UninstallerInterface.php index 1118a915..4f3236a4 100644 --- a/src/Infrastructure/Bootstrap/Uninstall/UninstallerInterface.php +++ b/src/Infrastructure/Bootstrap/Uninstall/UninstallerInterface.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\Infrastructure\Bootstrap\Exception\CouldNotUninstallModule; +if (!defined('_PS_VERSION_')) { + exit; +} + interface UninstallerInterface { /** diff --git a/src/Infrastructure/Exception/DpdException.php b/src/Infrastructure/Exception/DpdException.php index 5ec8b7db..b732212b 100644 --- a/src/Infrastructure/Exception/DpdException.php +++ b/src/Infrastructure/Exception/DpdException.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\Infrastructure\Utility\ExceptionUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + class DpdException extends \Exception { private $context; diff --git a/src/Infrastructure/Exception/ExceptionCode.php b/src/Infrastructure/Exception/ExceptionCode.php index 26bd6319..e1678307 100644 --- a/src/Infrastructure/Exception/ExceptionCode.php +++ b/src/Infrastructure/Exception/ExceptionCode.php @@ -20,6 +20,10 @@ namespace Invertus\dpdBaltics\Infrastructure\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + //NOTE class to define most used exception codes for our development. class ExceptionCode { diff --git a/src/Infrastructure/Repository/CollectionRepository.php b/src/Infrastructure/Repository/CollectionRepository.php index 4f0c2b06..bcc5a5d5 100644 --- a/src/Infrastructure/Repository/CollectionRepository.php +++ b/src/Infrastructure/Repository/CollectionRepository.php @@ -22,6 +22,10 @@ use PrestaShopCollection; +if (!defined('_PS_VERSION_')) { + exit; +} + class CollectionRepository implements ReadOnlyCollectionRepositoryInterface { /** diff --git a/src/Infrastructure/Repository/ReadOnlyCollectionRepositoryInterface.php b/src/Infrastructure/Repository/ReadOnlyCollectionRepositoryInterface.php index e3e50d3e..3ee4ce3e 100644 --- a/src/Infrastructure/Repository/ReadOnlyCollectionRepositoryInterface.php +++ b/src/Infrastructure/Repository/ReadOnlyCollectionRepositoryInterface.php @@ -23,6 +23,10 @@ use ObjectModel; use PrestaShopCollection; +if (!defined('_PS_VERSION_')) { + exit; +} + interface ReadOnlyCollectionRepositoryInterface { /** diff --git a/src/Infrastructure/Utility/ExceptionUtility.php b/src/Infrastructure/Utility/ExceptionUtility.php index de248b05..4839751d 100644 --- a/src/Infrastructure/Utility/ExceptionUtility.php +++ b/src/Infrastructure/Utility/ExceptionUtility.php @@ -20,6 +20,10 @@ namespace Invertus\dpdBaltics\Infrastructure\Utility; +if (!defined('_PS_VERSION_')) { + exit; +} + class ExceptionUtility { public static function toArray(\Exception $exception) diff --git a/src/Infrastructure/Utility/VersionUtility.php b/src/Infrastructure/Utility/VersionUtility.php index 8130c901..96df39fe 100644 --- a/src/Infrastructure/Utility/VersionUtility.php +++ b/src/Infrastructure/Utility/VersionUtility.php @@ -20,6 +20,10 @@ namespace Invertus\dpdBaltics\Infrastructure\Utility; +if (!defined('_PS_VERSION_')) { + exit; +} + class VersionUtility { public static function isPsVersionLessThan($version) diff --git a/src/Install/Installer.php b/src/Install/Installer.php index 2e806e4c..23a3374c 100644 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -37,6 +37,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class Installer { const FILE_NAME = 'Installer'; diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index 98b2d24b..453d3aae 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -29,6 +29,10 @@ use PrestaShopException; use Psr\Log\LoggerInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class Logger implements LoggerInterface { diff --git a/src/ORM/EntityManager.php b/src/ORM/EntityManager.php index f278c217..09b0f0d0 100644 --- a/src/ORM/EntityManager.php +++ b/src/ORM/EntityManager.php @@ -15,6 +15,10 @@ use Db; use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDEntityManager */ diff --git a/src/OnBoard/AbstractOnBoardStep.php b/src/OnBoard/AbstractOnBoardStep.php index 1c5d4f00..1494930c 100644 --- a/src/OnBoard/AbstractOnBoardStep.php +++ b/src/OnBoard/AbstractOnBoardStep.php @@ -16,6 +16,10 @@ use Invertus\dpdBaltics\OnBoard\Service\OnBoardStepActionService; use Invertus\dpdBaltics\OnBoard\Service\OnBoardStepDataService; +if (!defined('_PS_VERSION_')) { + exit; +} + abstract class AbstractOnBoardStep implements OnBoardStepInterface { /** diff --git a/src/OnBoard/Builder/OnBoardBlockBuilder.php b/src/OnBoard/Builder/OnBoardBlockBuilder.php index e5b44f0b..bf1b51e6 100644 --- a/src/OnBoard/Builder/OnBoardBlockBuilder.php +++ b/src/OnBoard/Builder/OnBoardBlockBuilder.php @@ -15,6 +15,10 @@ use DPDBaltics; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardBlockBuilder { /** diff --git a/src/OnBoard/Objects/OnBoardButton.php b/src/OnBoard/Objects/OnBoardButton.php index 678a2aa1..1d613754 100644 --- a/src/OnBoard/Objects/OnBoardButton.php +++ b/src/OnBoard/Objects/OnBoardButton.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\OnBoard\Objects; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardButton { /** diff --git a/src/OnBoard/Objects/OnBoardFastMoveButton.php b/src/OnBoard/Objects/OnBoardFastMoveButton.php index 1c9c5df6..b15b5923 100644 --- a/src/OnBoard/Objects/OnBoardFastMoveButton.php +++ b/src/OnBoard/Objects/OnBoardFastMoveButton.php @@ -14,6 +14,10 @@ use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardFastMoveButton { /** diff --git a/src/OnBoard/Objects/OnBoardParagraph.php b/src/OnBoard/Objects/OnBoardParagraph.php index 72283c05..af51b677 100644 --- a/src/OnBoard/Objects/OnBoardParagraph.php +++ b/src/OnBoard/Objects/OnBoardParagraph.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\OnBoard\Objects; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardParagraph { /** diff --git a/src/OnBoard/Objects/OnBoardProgressBar.php b/src/OnBoard/Objects/OnBoardProgressBar.php index d76ed935..04e9c335 100644 --- a/src/OnBoard/Objects/OnBoardProgressBar.php +++ b/src/OnBoard/Objects/OnBoardProgressBar.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\OnBoard\Objects; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardProgressBar { /** diff --git a/src/OnBoard/Objects/OnBoardTemplateData.php b/src/OnBoard/Objects/OnBoardTemplateData.php index 68d75e1a..2cda4786 100644 --- a/src/OnBoard/Objects/OnBoardTemplateData.php +++ b/src/OnBoard/Objects/OnBoardTemplateData.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\OnBoard\Objects; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardTemplateData { /** diff --git a/src/OnBoard/OnBoardStepInterface.php b/src/OnBoard/OnBoardStepInterface.php index 926d0642..44b40512 100644 --- a/src/OnBoard/OnBoardStepInterface.php +++ b/src/OnBoard/OnBoardStepInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\OnBoard; +if (!defined('_PS_VERSION_')) { + exit; +} + interface OnBoardStepInterface { /** diff --git a/src/OnBoard/OnBoardSteps/StepImport1.php b/src/OnBoard/OnBoardSteps/StepImport1.php index d7dd8545..8eed5e4b 100644 --- a/src/OnBoard/OnBoardSteps/StepImport1.php +++ b/src/OnBoard/OnBoardSteps/StepImport1.php @@ -20,6 +20,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepImport1 extends AbstractOnBoardStep { const FILE_NAME = 'StepImport1'; diff --git a/src/OnBoard/OnBoardSteps/StepImport2.php b/src/OnBoard/OnBoardSteps/StepImport2.php index dc4997f3..8e4c4afa 100644 --- a/src/OnBoard/OnBoardSteps/StepImport2.php +++ b/src/OnBoard/OnBoardSteps/StepImport2.php @@ -21,6 +21,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepImport2 extends AbstractOnBoardStep { const FILE_NAME = 'StepImport2'; diff --git a/src/OnBoard/OnBoardSteps/StepImportFinish.php b/src/OnBoard/OnBoardSteps/StepImportFinish.php index 1b74a9c4..adc2d533 100644 --- a/src/OnBoard/OnBoardSteps/StepImportFinish.php +++ b/src/OnBoard/OnBoardSteps/StepImportFinish.php @@ -20,6 +20,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepImportFinish extends AbstractOnBoardStep { const FILE_NAME = 'StepImportFinish'; diff --git a/src/OnBoard/OnBoardSteps/StepMain1.php b/src/OnBoard/OnBoardSteps/StepMain1.php index 4f033e2e..3aa85517 100644 --- a/src/OnBoard/OnBoardSteps/StepMain1.php +++ b/src/OnBoard/OnBoardSteps/StepMain1.php @@ -18,6 +18,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepMain1 extends AbstractOnBoardStep { const FILE_NAME = 'StepMain1'; diff --git a/src/OnBoard/OnBoardSteps/StepMain2.php b/src/OnBoard/OnBoardSteps/StepMain2.php index 0bff8336..d8972122 100644 --- a/src/OnBoard/OnBoardSteps/StepMain2.php +++ b/src/OnBoard/OnBoardSteps/StepMain2.php @@ -16,6 +16,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepMain2 extends AbstractOnBoardStep { const FILE_NAME = 'StepMain2'; diff --git a/src/OnBoard/OnBoardSteps/StepMain3.php b/src/OnBoard/OnBoardSteps/StepMain3.php index b42a3a00..786182e5 100644 --- a/src/OnBoard/OnBoardSteps/StepMain3.php +++ b/src/OnBoard/OnBoardSteps/StepMain3.php @@ -18,6 +18,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepMain3 extends AbstractOnBoardStep { const FILE_NAME = 'StepMain3'; diff --git a/src/OnBoard/OnBoardSteps/StepManualConfigFinish.php b/src/OnBoard/OnBoardSteps/StepManualConfigFinish.php index db98f8d9..9b4c85f1 100644 --- a/src/OnBoard/OnBoardSteps/StepManualConfigFinish.php +++ b/src/OnBoard/OnBoardSteps/StepManualConfigFinish.php @@ -17,6 +17,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualConfigFinish extends AbstractOnBoardStep { const FILE_NAME = 'StepManualConfigFinish'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules0.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules0.php index 34e200ec..7d56fdc8 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules0.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules0.php @@ -20,6 +20,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules0 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules0'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules1.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules1.php index 3f70aa9f..b11ab916 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules1.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules1.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules1 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules1'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules2.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules2.php index 41e4cf1e..7a3c1f84 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules2.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules2.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules2 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules2'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules3.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules3.php index bd97598a..edbadcab 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules3.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules3.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules3 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules3'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules4.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules4.php index 11fb825f..e31f940e 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules4.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules4.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules4 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules4'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules5.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules5.php index a8eccf66..40403ad8 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules5.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules5.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules5 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules5'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules6.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules6.php index 78b2a36c..facf904a 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules6.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules6.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules6 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules6'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules7.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules7.php index f5747b26..d2bebb76 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules7.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules7.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules7 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules7'; diff --git a/src/OnBoard/OnBoardSteps/StepManualPriceRules8.php b/src/OnBoard/OnBoardSteps/StepManualPriceRules8.php index 3dfb8098..02efac9e 100644 --- a/src/OnBoard/OnBoardSteps/StepManualPriceRules8.php +++ b/src/OnBoard/OnBoardSteps/StepManualPriceRules8.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualPriceRules8 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualPriceRules8'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts0.php b/src/OnBoard/OnBoardSteps/StepManualProducts0.php index 7ca4406c..8bbbf1b3 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts0.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts0.php @@ -20,6 +20,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts0 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts0'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts1.php b/src/OnBoard/OnBoardSteps/StepManualProducts1.php index c9320d35..2ce6add0 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts1.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts1.php @@ -21,6 +21,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts1 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts1'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts2.php b/src/OnBoard/OnBoardSteps/StepManualProducts2.php index d0a5e366..f97be743 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts2.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts2.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts2 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts2'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts3.php b/src/OnBoard/OnBoardSteps/StepManualProducts3.php index 5f54a7fa..a58a3bcc 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts3.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts3.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts3 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts3'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts4.php b/src/OnBoard/OnBoardSteps/StepManualProducts4.php index 48d4fb49..1eddd2fd 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts4.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts4.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts4 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts4'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts5.php b/src/OnBoard/OnBoardSteps/StepManualProducts5.php index 83f1ad28..1f9a4b84 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts5.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts5.php @@ -24,6 +24,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts5 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts5'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts5Shop.php b/src/OnBoard/OnBoardSteps/StepManualProducts5Shop.php index 5f36c392..460e1422 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts5Shop.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts5Shop.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts5Shop extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts5Shop'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts6.php b/src/OnBoard/OnBoardSteps/StepManualProducts6.php index 9c9fd312..88bd13fd 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts6.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts6.php @@ -24,6 +24,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts6 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts6'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts7.php b/src/OnBoard/OnBoardSteps/StepManualProducts7.php index 21c06e5c..ccf7138d 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts7.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts7.php @@ -24,6 +24,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts7 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts7'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts8.php b/src/OnBoard/OnBoardSteps/StepManualProducts8.php index 36a2d7cc..2dd6137f 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts8.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts8.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts8 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts8'; diff --git a/src/OnBoard/OnBoardSteps/StepManualProducts9.php b/src/OnBoard/OnBoardSteps/StepManualProducts9.php index 34d31f40..7932fd3b 100644 --- a/src/OnBoard/OnBoardSteps/StepManualProducts9.php +++ b/src/OnBoard/OnBoardSteps/StepManualProducts9.php @@ -21,6 +21,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardProgressBar; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualProducts9 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualProducts9'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones0.php b/src/OnBoard/OnBoardSteps/StepManualZones0.php index 0add626f..f639792c 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones0.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones0.php @@ -20,6 +20,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones0 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones0'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones1.php b/src/OnBoard/OnBoardSteps/StepManualZones1.php index 58b754fe..efc549bb 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones1.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones1.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Configuration; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones1 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones1'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones2.php b/src/OnBoard/OnBoardSteps/StepManualZones2.php index 9526d668..cddf0e23 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones2.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones2.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones2 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones2'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones3.php b/src/OnBoard/OnBoardSteps/StepManualZones3.php index f60e45f6..86207820 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones3.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones3.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones3 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones3'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones4.php b/src/OnBoard/OnBoardSteps/StepManualZones4.php index 82b22f43..b83d9cd9 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones4.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones4.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones4 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones4'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones5.php b/src/OnBoard/OnBoardSteps/StepManualZones5.php index a7f5b696..08d6278d 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones5.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones5.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones5 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones5'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZones6.php b/src/OnBoard/OnBoardSteps/StepManualZones6.php index 3b93f03f..a3143de6 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZones6.php +++ b/src/OnBoard/OnBoardSteps/StepManualZones6.php @@ -22,6 +22,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardProgressBar; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZones6 extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZones6'; diff --git a/src/OnBoard/OnBoardSteps/StepManualZonesAfterImport.php b/src/OnBoard/OnBoardSteps/StepManualZonesAfterImport.php index bf590ffb..3f88aeb4 100644 --- a/src/OnBoard/OnBoardSteps/StepManualZonesAfterImport.php +++ b/src/OnBoard/OnBoardSteps/StepManualZonesAfterImport.php @@ -19,6 +19,10 @@ use Invertus\dpdBaltics\OnBoard\Objects\OnBoardParagraph; use Invertus\dpdBaltics\OnBoard\Objects\OnBoardTemplateData; +if (!defined('_PS_VERSION_')) { + exit; +} + class StepManualZonesAfterImport extends AbstractOnBoardStep { const FILE_NAME = 'StepManualZonesAfterImport'; diff --git a/src/OnBoard/Provider/OnBoardStepStrategyProvider.php b/src/OnBoard/Provider/OnBoardStepStrategyProvider.php index 8dcc1060..ab2a828a 100644 --- a/src/OnBoard/Provider/OnBoardStepStrategyProvider.php +++ b/src/OnBoard/Provider/OnBoardStepStrategyProvider.php @@ -14,6 +14,10 @@ use Invertus\dpdBaltics\OnBoard\OnBoardStepInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardStepStrategyProvider { /** diff --git a/src/OnBoard/Service/OnBoardService.php b/src/OnBoard/Service/OnBoardService.php index 0d27f6b6..802156c0 100644 --- a/src/OnBoard/Service/OnBoardService.php +++ b/src/OnBoard/Service/OnBoardService.php @@ -12,13 +12,16 @@ namespace Invertus\dpdBaltics\OnBoard\Service; - use Configuration; use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\OnBoard\Builder\OnBoardBlockBuilder; use Invertus\dpdBaltics\OnBoard\Provider\OnBoardStepStrategyProvider; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardService { /** diff --git a/src/OnBoard/Service/OnBoardStepActionService.php b/src/OnBoard/Service/OnBoardStepActionService.php index 72e78881..425c3e67 100644 --- a/src/OnBoard/Service/OnBoardStepActionService.php +++ b/src/OnBoard/Service/OnBoardStepActionService.php @@ -19,6 +19,10 @@ use Invertus\dpdBaltics\Config\Config; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardStepActionService { /** @var DPDBaltics */ diff --git a/src/OnBoard/Service/OnBoardStepDataService.php b/src/OnBoard/Service/OnBoardStepDataService.php index cf034aa4..2a07b729 100644 --- a/src/OnBoard/Service/OnBoardStepDataService.php +++ b/src/OnBoard/Service/OnBoardStepDataService.php @@ -21,6 +21,10 @@ use Invertus\dpdBaltics\Repository\ProductRepository; use Invertus\dpdBaltics\Repository\ZoneRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class OnBoardStepDataService { /** diff --git a/src/Plugin/DPDPluginInterface.php b/src/Plugin/DPDPluginInterface.php index 6a689694..d7680151 100644 --- a/src/Plugin/DPDPluginInterface.php +++ b/src/Plugin/DPDPluginInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Plugin; +if (!defined('_PS_VERSION_')) { + exit; +} + interface DPDPluginInterface { public function getJs(); diff --git a/src/Plugin/PluginInterface.php b/src/Plugin/PluginInterface.php index ca7ac2e3..7f2d3915 100644 --- a/src/Plugin/PluginInterface.php +++ b/src/Plugin/PluginInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Plugin; +if (!defined('_PS_VERSION_')) { + exit; +} + interface PluginInterface { public function getJs(); diff --git a/src/Plugin/SearchBox/Chosen.php b/src/Plugin/SearchBox/Chosen.php index 83b1f940..2c258024 100644 --- a/src/Plugin/SearchBox/Chosen.php +++ b/src/Plugin/SearchBox/Chosen.php @@ -17,6 +17,10 @@ use Module; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class Chosen implements SearchBoxPluginInterface, PluginInterface { private $placeholderText; diff --git a/src/Plugin/SearchBox/DPDSearchBoxPluginFactory.php b/src/Plugin/SearchBox/DPDSearchBoxPluginFactory.php index a5e39544..e2da78bb 100644 --- a/src/Plugin/SearchBox/DPDSearchBoxPluginFactory.php +++ b/src/Plugin/SearchBox/DPDSearchBoxPluginFactory.php @@ -15,6 +15,10 @@ use Module; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDSearchBoxPluginFactory { /** diff --git a/src/Plugin/SearchBox/DPDSearchBoxPluginInterface.php b/src/Plugin/SearchBox/DPDSearchBoxPluginInterface.php index ede19b71..50e32832 100644 --- a/src/Plugin/SearchBox/DPDSearchBoxPluginInterface.php +++ b/src/Plugin/SearchBox/DPDSearchBoxPluginInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Plugin\SearchBox; +if (!defined('_PS_VERSION_')) { + exit; +} + interface DPDSearchBoxPluginInterface { /** diff --git a/src/Plugin/SearchBox/SearchBoxPluginFactory.php b/src/Plugin/SearchBox/SearchBoxPluginFactory.php index 272c52a4..d8c09cd6 100644 --- a/src/Plugin/SearchBox/SearchBoxPluginFactory.php +++ b/src/Plugin/SearchBox/SearchBoxPluginFactory.php @@ -15,6 +15,10 @@ use Module; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class SearchBoxPluginFactory { /** diff --git a/src/Plugin/SearchBox/SearchBoxPluginInterface.php b/src/Plugin/SearchBox/SearchBoxPluginInterface.php index b4d648d6..8055aeb7 100644 --- a/src/Plugin/SearchBox/SearchBoxPluginInterface.php +++ b/src/Plugin/SearchBox/SearchBoxPluginInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Plugin\SearchBox; +if (!defined('_PS_VERSION_')) { + exit; +} + interface SearchBoxPluginInterface { /** diff --git a/src/Presenter/DeliveryTimePresenter.php b/src/Presenter/DeliveryTimePresenter.php index b2180fd3..2bf37a5d 100644 --- a/src/Presenter/DeliveryTimePresenter.php +++ b/src/Presenter/DeliveryTimePresenter.php @@ -25,6 +25,10 @@ use DPDBaltics; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class DeliveryTimePresenter { /** @@ -57,7 +61,7 @@ public function getDeliveryTimeTemplate($countryIso, $city) ); return $this->context->smarty->fetch( - $this->module->getLocalPath().'/views/templates/hook/front/carrier-delivery-time.tpl' + 'module:dpdbaltics/views/templates/hook/front/carrier-delivery-time.tpl' ); } } \ No newline at end of file diff --git a/src/Presenter/SameDayDeliveryMessagePresenter.php b/src/Presenter/SameDayDeliveryMessagePresenter.php index 4a58087f..946c66a5 100644 --- a/src/Presenter/SameDayDeliveryMessagePresenter.php +++ b/src/Presenter/SameDayDeliveryMessagePresenter.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Util\TimeZoneUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + class SameDayDeliveryMessagePresenter { @@ -64,7 +68,7 @@ public function getSameDayDeliveryMessageTemplate() ); return $this->context->smarty->fetch( - $this->module->getLocalPath() . '/views/templates/hook/front/carrier-same-day-delivery-message.tpl' + 'module:dpdbaltics/views/templates/hook/front/carrier-same-day-delivery-message.tpl' ); } } \ No newline at end of file diff --git a/src/Provider/CurrentCountryProvider.php b/src/Provider/CurrentCountryProvider.php index 6726361b..ed43d750 100644 --- a/src/Provider/CurrentCountryProvider.php +++ b/src/Provider/CurrentCountryProvider.php @@ -28,6 +28,10 @@ use Validate; use Configuration; +if (!defined('_PS_VERSION_')) { + exit; +} + class CurrentCountryProvider { private $context; diff --git a/src/Provider/ImportExportOptionsProvider.php b/src/Provider/ImportExportOptionsProvider.php index 1415f222..f2f99ff3 100644 --- a/src/Provider/ImportExportOptionsProvider.php +++ b/src/Provider/ImportExportOptionsProvider.php @@ -24,6 +24,10 @@ use DPDBaltics; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class ImportExportOptionsProvider { diff --git a/src/Provider/ImportExportURLProvider.php b/src/Provider/ImportExportURLProvider.php index 3d227db8..598377bc 100644 --- a/src/Provider/ImportExportURLProvider.php +++ b/src/Provider/ImportExportURLProvider.php @@ -17,6 +17,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Infrastructure\Bootstrap\ModuleTabs; +if (!defined('_PS_VERSION_')) { + exit; +} + class ImportExportURLProvider { private $context; diff --git a/src/Provider/ProductAvailabilityProvider.php b/src/Provider/ProductAvailabilityProvider.php index d5fb15b9..5859ab7a 100644 --- a/src/Provider/ProductAvailabilityProvider.php +++ b/src/Provider/ProductAvailabilityProvider.php @@ -30,6 +30,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductAvailabilityProvider { /** diff --git a/src/Provider/ProductShippingCostProvider.php b/src/Provider/ProductShippingCostProvider.php index 2888bb0b..a3adaa55 100644 --- a/src/Provider/ProductShippingCostProvider.php +++ b/src/Provider/ProductShippingCostProvider.php @@ -34,6 +34,10 @@ use Product; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductShippingCostProvider { /** diff --git a/src/Provider/ZoneRangeProvider.php b/src/Provider/ZoneRangeProvider.php index 462a1a3e..246e974f 100644 --- a/src/Provider/ZoneRangeProvider.php +++ b/src/Provider/ZoneRangeProvider.php @@ -30,6 +30,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneRangeProvider { /** diff --git a/src/Repository/AbstractEntityRepository.php b/src/Repository/AbstractEntityRepository.php index 7ad33990..ec7e4544 100644 --- a/src/Repository/AbstractEntityRepository.php +++ b/src/Repository/AbstractEntityRepository.php @@ -14,6 +14,10 @@ use Db; +if (!defined('_PS_VERSION_')) { + exit; +} + abstract class AbstractEntityRepository { /** diff --git a/src/Repository/AddressRepository.php b/src/Repository/AddressRepository.php index 935c65c0..aed83b57 100644 --- a/src/Repository/AddressRepository.php +++ b/src/Repository/AddressRepository.php @@ -24,6 +24,10 @@ use DbQuery; use DPDAddressTemplate; +if (!defined('_PS_VERSION_')) { + exit; +} + class AddressRepository extends AbstractEntityRepository { public function getAddressPhonesAndCodes($idAddressTemplate) diff --git a/src/Repository/AddressTemplateRepository.php b/src/Repository/AddressTemplateRepository.php index 3ae03fc5..42617718 100644 --- a/src/Repository/AddressTemplateRepository.php +++ b/src/Repository/AddressTemplateRepository.php @@ -24,6 +24,10 @@ use DbQuery; use DPDAddressTemplate; +if (!defined('_PS_VERSION_')) { + exit; +} + class AddressTemplateRepository extends AbstractEntityRepository { public function getReturnServiceAddressTemplates() diff --git a/src/Repository/CarrierRepository.php b/src/Repository/CarrierRepository.php index 424e8216..7bad4557 100644 --- a/src/Repository/CarrierRepository.php +++ b/src/Repository/CarrierRepository.php @@ -24,6 +24,10 @@ use DbQuery; use PrestaShopDatabaseException; +if (!defined('_PS_VERSION_')) { + exit; +} + class CarrierRepository extends AbstractEntityRepository { /** diff --git a/src/Repository/CodPaymentRepository.php b/src/Repository/CodPaymentRepository.php index 9e86561e..e0e3442c 100644 --- a/src/Repository/CodPaymentRepository.php +++ b/src/Repository/CodPaymentRepository.php @@ -25,6 +25,10 @@ use DbQuery; use Invertus\dpdBaltics\Repository\AbstractEntityRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * NOTICE OF LICENSE * diff --git a/src/Repository/CollectionRequestRepository.php b/src/Repository/CollectionRequestRepository.php index f70f40eb..7f3ea4cc 100644 --- a/src/Repository/CollectionRequestRepository.php +++ b/src/Repository/CollectionRequestRepository.php @@ -14,6 +14,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class CollectionRequestRepository extends AbstractEntityRepository { public function getPhonesAndCodes($idCollectionRequest) diff --git a/src/Repository/CourierRequestRepository.php b/src/Repository/CourierRequestRepository.php index e236d75a..42bc02ce 100644 --- a/src/Repository/CourierRequestRepository.php +++ b/src/Repository/CourierRequestRepository.php @@ -14,6 +14,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class CourierRequestRepository extends AbstractEntityRepository { public function getPhonesAndCodes($idCourierRequest) diff --git a/src/Repository/DPDZoneRepository.php b/src/Repository/DPDZoneRepository.php index 1ba16fc4..7a18f0fa 100644 --- a/src/Repository/DPDZoneRepository.php +++ b/src/Repository/DPDZoneRepository.php @@ -15,6 +15,10 @@ use DbQuery; use PrestaShopDatabaseException; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDZoneRepository */ diff --git a/src/Repository/LogsRepository.php b/src/Repository/LogsRepository.php index 5d30ad52..2c0b5a54 100644 --- a/src/Repository/LogsRepository.php +++ b/src/Repository/LogsRepository.php @@ -26,6 +26,10 @@ use PrestaShopDatabaseException; use PrestaShopException; +if (!defined('_PS_VERSION_')) { + exit; +} + class LogsRepository extends AbstractEntityRepository { /** diff --git a/src/Repository/OrderDeliveryTimeRepository.php b/src/Repository/OrderDeliveryTimeRepository.php index b56a73f7..4b1e8400 100644 --- a/src/Repository/OrderDeliveryTimeRepository.php +++ b/src/Repository/OrderDeliveryTimeRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class OrderDeliveryTimeRepository extends AbstractEntityRepository { public function getOrderDeliveryIdByCartId($cartId) diff --git a/src/Repository/OrderRepository.php b/src/Repository/OrderRepository.php index e68d209d..cc6b6c9e 100644 --- a/src/Repository/OrderRepository.php +++ b/src/Repository/OrderRepository.php @@ -14,6 +14,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class OrderRepository extends AbstractEntityRepository { public function getDPDOrderIdByOrderId($idOrder) diff --git a/src/Repository/ParcelShopRepository.php b/src/Repository/ParcelShopRepository.php index 94519cd1..e18df98f 100644 --- a/src/Repository/ParcelShopRepository.php +++ b/src/Repository/ParcelShopRepository.php @@ -1,22 +1,22 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 - */ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ namespace Invertus\dpdBaltics\Repository; @@ -25,6 +25,10 @@ use Db; use Invertus\dpdBalticsApi\Api\DTO\Object\ParcelShop; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelShopRepository extends AbstractEntityRepository { public function deleteShopsByCountryCode($countryCode) diff --git a/src/Repository/PaymentRepository.php b/src/Repository/PaymentRepository.php index 7bd190ae..75a19313 100644 --- a/src/Repository/PaymentRepository.php +++ b/src/Repository/PaymentRepository.php @@ -25,6 +25,10 @@ use DbQuery; use PaymentModule; +if (!defined('_PS_VERSION_')) { + exit; +} + class PaymentRepository extends AbstractEntityRepository { public function updatePriceRulePayments($idPriceRule, array $paymentMethods, $checkAll = 0) diff --git a/src/Repository/PhonePrefixRepository.php b/src/Repository/PhonePrefixRepository.php index 097f511b..a251ffae 100644 --- a/src/Repository/PhonePrefixRepository.php +++ b/src/Repository/PhonePrefixRepository.php @@ -25,6 +25,10 @@ use DbQuery; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class PhonePrefixRepository extends AbstractEntityRepository { /** diff --git a/src/Repository/PhoneRepository.php b/src/Repository/PhoneRepository.php index 7431a9ac..76c7496a 100644 --- a/src/Repository/PhoneRepository.php +++ b/src/Repository/PhoneRepository.php @@ -24,6 +24,10 @@ use DbQuery; use DPDOrderPhone; +if (!defined('_PS_VERSION_')) { + exit; +} + class PhoneRepository extends AbstractEntityRepository { public function getOrderPhoneIdByCartId($idCart) diff --git a/src/Repository/PriceRuleRepository.php b/src/Repository/PriceRuleRepository.php index c9572803..afd217bb 100644 --- a/src/Repository/PriceRuleRepository.php +++ b/src/Repository/PriceRuleRepository.php @@ -31,6 +31,10 @@ use PrestaShopDatabaseException; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class PriceRuleRepository extends AbstractEntityRepository { diff --git a/src/Repository/ProductAvailabilityRepository.php b/src/Repository/ProductAvailabilityRepository.php index fe631392..e0d63296 100644 --- a/src/Repository/ProductAvailabilityRepository.php +++ b/src/Repository/ProductAvailabilityRepository.php @@ -14,6 +14,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductAvailabilityRepository extends AbstractEntityRepository { public function getProductAvailabilityByReference($dpdProductReference) diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php index e09e6ca2..268ed9f2 100644 --- a/src/Repository/ProductRepository.php +++ b/src/Repository/ProductRepository.php @@ -29,6 +29,10 @@ use PrestaShopCollection; use PrestaShopDatabaseException; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductRepository extends AbstractEntityRepository { public function getAllProducts() diff --git a/src/Repository/ProductShopRepository.php b/src/Repository/ProductShopRepository.php index bc9d8066..ef684de7 100644 --- a/src/Repository/ProductShopRepository.php +++ b/src/Repository/ProductShopRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductShopRepository extends AbstractEntityRepository { public function deleteProductShops($productId) diff --git a/src/Repository/ProductZoneRepository.php b/src/Repository/ProductZoneRepository.php index 2488e81c..8e1fcde2 100644 --- a/src/Repository/ProductZoneRepository.php +++ b/src/Repository/ProductZoneRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductZoneRepository extends AbstractEntityRepository { public function deleteProductZones($productId) diff --git a/src/Repository/PudoRepository.php b/src/Repository/PudoRepository.php index e419d3b8..fbb7eeef 100644 --- a/src/Repository/PudoRepository.php +++ b/src/Repository/PudoRepository.php @@ -15,6 +15,10 @@ use DbQuery; use DPDPudo; +if (!defined('_PS_VERSION_')) { + exit; +} + class PudoRepository extends AbstractEntityRepository { public function getIdByCart($cartId) diff --git a/src/Repository/ReceiverAddressRepository.php b/src/Repository/ReceiverAddressRepository.php index 97431259..17f907b1 100644 --- a/src/Repository/ReceiverAddressRepository.php +++ b/src/Repository/ReceiverAddressRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ReceiverAddressRepository extends AbstractEntityRepository { public function getAddressIdByOrderId($orderid) diff --git a/src/Repository/ShipmentRepository.php b/src/Repository/ShipmentRepository.php index 7a63009d..918d9899 100644 --- a/src/Repository/ShipmentRepository.php +++ b/src/Repository/ShipmentRepository.php @@ -27,6 +27,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\DTO\ShipmentData; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentRepository extends AbstractEntityRepository { public function getIdByOrderId($idOrder) diff --git a/src/Repository/ShopRepository.php b/src/Repository/ShopRepository.php index 8bf60ef5..f6e96d54 100644 --- a/src/Repository/ShopRepository.php +++ b/src/Repository/ShopRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShopRepository extends AbstractEntityRepository { public function removeServiceCarrierShops($productId) diff --git a/src/Repository/ZoneRangeRepository.php b/src/Repository/ZoneRangeRepository.php index 75a7c01c..be2801d4 100644 --- a/src/Repository/ZoneRangeRepository.php +++ b/src/Repository/ZoneRangeRepository.php @@ -23,6 +23,10 @@ use DbQuery; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneRangeRepository extends AbstractEntityRepository { public function findInZones(array $zoneIds, $countryId) @@ -50,4 +54,30 @@ public function findAllZoneRangeCountryIds() FROM `' . _DB_PREFIX_ . 'dpd_zone_range` '); } + + public function findBy(array $criteria, $limit = null, array $notEqualsCriteria = []) + { + $query = new DbQuery(); + $query->select( + 'dzr.id_dpd_zone_range, dzr.id_dpd_zone, dzr.id_country, dzr.include_all_zip_codes' + ); + $query->select('dzr.zip_code_from, dzr.zip_code_to'); + $query->from('dpd_zone_range', 'dzr'); + + foreach ($criteria as $field => $value) { + $query->where('dzr.'.bqSQL($field).' = "'.pSQL($value).'"'); + } + + foreach ($notEqualsCriteria as $field => $value) { + $query->where('dzr.'.bqSQL($field).' != "'.pSQL($value).'"'); + } + + if ($limit) { + $query->limit((int) $limit); + } + + $result = $this->db->executeS($query); + + return $result ? $result : []; + } } diff --git a/src/Repository/ZoneRepository.php b/src/Repository/ZoneRepository.php index d0620df8..6ff9aa2b 100644 --- a/src/Repository/ZoneRepository.php +++ b/src/Repository/ZoneRepository.php @@ -27,6 +27,10 @@ use Invertus\dpdBaltics\Validate\Zone\ZoneRangeValidate; use PrestaShopDatabaseException; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneRepository extends AbstractEntityRepository { /** diff --git a/src/Service/API/CollectionRequestService.php b/src/Service/API/CollectionRequestService.php index b2badeb5..ddfe5077 100644 --- a/src/Service/API/CollectionRequestService.php +++ b/src/Service/API/CollectionRequestService.php @@ -30,6 +30,10 @@ use Invertus\dpdBalticsApi\Factory\APIRequest\CollectionRequestFactory; use Symfony\Component\Config\Definition\Exception\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class CollectionRequestService { const FILE_NAME = 'CollectionRequestService'; diff --git a/src/Service/API/CourierRequestService.php b/src/Service/API/CourierRequestService.php index 1958fe1c..4da67a9c 100644 --- a/src/Service/API/CourierRequestService.php +++ b/src/Service/API/CourierRequestService.php @@ -29,6 +29,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Response\courierRequestResponse; use Invertus\dpdBalticsApi\Factory\APIRequest\courierRequestFactory; +if (!defined('_PS_VERSION_')) { + exit; +} + class CourierRequestService { diff --git a/src/Service/API/LabelApiService.php b/src/Service/API/LabelApiService.php index 2451bdb3..ff41a2b4 100644 --- a/src/Service/API/LabelApiService.php +++ b/src/Service/API/LabelApiService.php @@ -29,6 +29,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Response\ParcelPrintResponse; use Invertus\dpdBalticsApi\Factory\APIRequest\ParcelPrintFactory; +if (!defined('_PS_VERSION_')) { + exit; +} + class LabelApiService { /** diff --git a/src/Service/API/ParcelShopSearchApiService.php b/src/Service/API/ParcelShopSearchApiService.php index 1f409c44..602947d6 100644 --- a/src/Service/API/ParcelShopSearchApiService.php +++ b/src/Service/API/ParcelShopSearchApiService.php @@ -27,6 +27,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Request\ParcelShopSearchRequest; use Invertus\dpdBalticsApi\Factory\APIRequest\ParcelShopSearchFactory; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelShopSearchApiService { /** diff --git a/src/Service/API/ShipmentApiService.php b/src/Service/API/ShipmentApiService.php index 9c40edbe..c3f07e3b 100644 --- a/src/Service/API/ShipmentApiService.php +++ b/src/Service/API/ShipmentApiService.php @@ -38,6 +38,10 @@ use Invertus\dpdBaltics\Util\StringUtility; use Message; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentApiService { /** diff --git a/src/Service/Address/AddressTemplateService.php b/src/Service/Address/AddressTemplateService.php index 416fe80d..d593faef 100644 --- a/src/Service/Address/AddressTemplateService.php +++ b/src/Service/Address/AddressTemplateService.php @@ -24,6 +24,10 @@ use Invertus\dpdBaltics\Repository\ShopRepository; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class AddressTemplateService { /** diff --git a/src/Service/Address/ReceiverAddressService.php b/src/Service/Address/ReceiverAddressService.php index 37d23f96..4e1c05f2 100644 --- a/src/Service/Address/ReceiverAddressService.php +++ b/src/Service/Address/ReceiverAddressService.php @@ -40,6 +40,10 @@ use State; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ReceiverAddressService { diff --git a/src/Service/Carrier/CarrierUpdateHandler.php b/src/Service/Carrier/CarrierUpdateHandler.php index 3b8538bd..3c3d8d9c 100644 --- a/src/Service/Carrier/CarrierUpdateHandler.php +++ b/src/Service/Carrier/CarrierUpdateHandler.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Repository\ProductRepository; use Invertus\dpdBaltics\Service\Product\ProductService; +if (!defined('_PS_VERSION_')) { + exit; +} + class CarrierUpdateHandler { /** diff --git a/src/Service/Carrier/CreateCarrierService.php b/src/Service/Carrier/CreateCarrierService.php index 9b49baba..ca800fde 100644 --- a/src/Service/Carrier/CreateCarrierService.php +++ b/src/Service/Carrier/CreateCarrierService.php @@ -36,6 +36,10 @@ use Validate; use Zone; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * NOTICE OF LICENSE * diff --git a/src/Service/Carrier/PrestashopCarrierRegenerationHandler.php b/src/Service/Carrier/PrestashopCarrierRegenerationHandler.php index de3bd855..db4d1210 100644 --- a/src/Service/Carrier/PrestashopCarrierRegenerationHandler.php +++ b/src/Service/Carrier/PrestashopCarrierRegenerationHandler.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Exception\DpdCarrierException; use Invertus\dpdBaltics\Install\Installer; +if (!defined('_PS_VERSION_')) { + exit; +} + class PrestashopCarrierRegenerationHandler { private $moduleInstaller; diff --git a/src/Service/Carrier/UpdateCarrierService.php b/src/Service/Carrier/UpdateCarrierService.php index 5b06f56d..c3b76639 100644 --- a/src/Service/Carrier/UpdateCarrierService.php +++ b/src/Service/Carrier/UpdateCarrierService.php @@ -30,6 +30,10 @@ use Invertus\dpdBaltics\Validate\Carrier\CarrierUpdateValidate; use Language; +if (!defined('_PS_VERSION_')) { + exit; +} + class UpdateCarrierService { /** diff --git a/src/Service/CarrierPhoneService.php b/src/Service/CarrierPhoneService.php index 5febbb9b..8639e337 100644 --- a/src/Service/CarrierPhoneService.php +++ b/src/Service/CarrierPhoneService.php @@ -24,6 +24,10 @@ use DPDOrderPhone; use Invertus\dpdBaltics\Validate\Compatibility\OpcModuleCompatibilityValidator; +if (!defined('_PS_VERSION_')) { + exit; +} + class CarrierPhoneService { const LITHUANIA_FULL_PHONE_PREFIX = '370'; @@ -106,7 +110,7 @@ public function getCarrierPhoneTemplate($cartId, $carrierReference) ); return $this->context->smarty->fetch( - $this->module->getLocalPath().'/views/templates/hook/front/carrier-phone-number.tpl' + 'module:dpdbaltics/views/templates/hook/front/carrier-phone-number.tpl' ); } diff --git a/src/Service/DPDFlashMessageService.php b/src/Service/DPDFlashMessageService.php index 1439a61b..dde0ac96 100644 --- a/src/Service/DPDFlashMessageService.php +++ b/src/Service/DPDFlashMessageService.php @@ -15,6 +15,10 @@ use Context; use Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class DPDFlashMessageService { private $context; diff --git a/src/Service/Email/Handler/ParcelTrackingEmailHandler.php b/src/Service/Email/Handler/ParcelTrackingEmailHandler.php index 8c24e121..9f2538e6 100644 --- a/src/Service/Email/Handler/ParcelTrackingEmailHandler.php +++ b/src/Service/Email/Handler/ParcelTrackingEmailHandler.php @@ -29,6 +29,10 @@ use Module; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelTrackingEmailHandler { /** diff --git a/src/Service/Exception/ExceptionService.php b/src/Service/Exception/ExceptionService.php index ec1d9bda..6806517f 100644 --- a/src/Service/Exception/ExceptionService.php +++ b/src/Service/Exception/ExceptionService.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Validate\ShipmentData\Exception\InvalidShipmentDataField; use Invertus\dpdBalticsApi\Exception\DPDBalticsAPIException; +if (!defined('_PS_VERSION_')) { + exit; +} + class ExceptionService { const SHORT_CLASS_NAME = 'ExceptionService'; diff --git a/src/Service/Export/AddressTemplatesExport.php b/src/Service/Export/AddressTemplatesExport.php index fae0bb71..2ac200ff 100644 --- a/src/Service/Export/AddressTemplatesExport.php +++ b/src/Service/Export/AddressTemplatesExport.php @@ -28,6 +28,10 @@ use Invertus\dpdBaltics\Repository\AddressTemplateRepository; use PrestaShopCollection; +if (!defined('_PS_VERSION_')) { + exit; +} + class AddressTemplatesExport implements ExportableInterface { const FILE_NAME = 'AddressTemplatesExport'; diff --git a/src/Service/Export/ExportProvider.php b/src/Service/Export/ExportProvider.php index b376a8a5..1a64e4c2 100644 --- a/src/Service/Export/ExportProvider.php +++ b/src/Service/Export/ExportProvider.php @@ -17,6 +17,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\Repository\ZoneRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class ExportProvider { const FILE_NAME = 'ExportProvider'; diff --git a/src/Service/Export/ExportableInterface.php b/src/Service/Export/ExportableInterface.php index e65ff785..535b8058 100644 --- a/src/Service/Export/ExportableInterface.php +++ b/src/Service/Export/ExportableInterface.php @@ -21,6 +21,10 @@ namespace Invertus\dpdBaltics\Service\Export; +if (!defined('_PS_VERSION_')) { + exit; +} + interface ExportableInterface { /** diff --git a/src/Service/Export/PriceRulesExport.php b/src/Service/Export/PriceRulesExport.php index 89b11b9a..ff4604ee 100644 --- a/src/Service/Export/PriceRulesExport.php +++ b/src/Service/Export/PriceRulesExport.php @@ -31,6 +31,10 @@ use PaymentModule; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDPriceRulesExport is responsible for providing price rules data that needs to be exported */ diff --git a/src/Service/Export/ProductExport.php b/src/Service/Export/ProductExport.php index dce31e4a..3c193fed 100644 --- a/src/Service/Export/ProductExport.php +++ b/src/Service/Export/ProductExport.php @@ -32,6 +32,10 @@ use Invertus\dpdBaltics\Repository\ZoneRepository; use Language; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductExport implements ExportableInterface { diff --git a/src/Service/Export/SettingsExport.php b/src/Service/Export/SettingsExport.php index 9fb33053..b85d9029 100644 --- a/src/Service/Export/SettingsExport.php +++ b/src/Service/Export/SettingsExport.php @@ -25,6 +25,10 @@ use DPDBaltics; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDSettingsExport is responsible returning settings data to be exported */ diff --git a/src/Service/Export/ZoneExport.php b/src/Service/Export/ZoneExport.php index 62bcf787..56cb5281 100644 --- a/src/Service/Export/ZoneExport.php +++ b/src/Service/Export/ZoneExport.php @@ -28,6 +28,10 @@ use Invertus\dpdBaltics\Config\Config; use PrestaShopCollection; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneExport implements ExportableInterface { const FILE_NAME = 'ZoneExport'; diff --git a/src/Service/GoogleApiService.php b/src/Service/GoogleApiService.php index 18666793..57fffa62 100644 --- a/src/Service/GoogleApiService.php +++ b/src/Service/GoogleApiService.php @@ -22,6 +22,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class GoogleApiService { public $geolocationApi; diff --git a/src/Service/Import/API/ParcelShopImport.php b/src/Service/Import/API/ParcelShopImport.php index ffba332c..49d29c94 100644 --- a/src/Service/Import/API/ParcelShopImport.php +++ b/src/Service/Import/API/ParcelShopImport.php @@ -31,6 +31,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Response\ParcelShopSearchResponse; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelShopImport { const FILE_NAME = 'ParcelShopImport'; diff --git a/src/Service/Import/AddressTemplatesImport.php b/src/Service/Import/AddressTemplatesImport.php index 5cea7fb9..9122576a 100644 --- a/src/Service/Import/AddressTemplatesImport.php +++ b/src/Service/Import/AddressTemplatesImport.php @@ -30,6 +30,10 @@ use Shop; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class AddressTemplatesImport implements ImportableInterface { const FILE_NAME = 'AddressTemplatesImport'; diff --git a/src/Service/Import/ImportMainZone.php b/src/Service/Import/ImportMainZone.php index 333c4824..2a52c325 100644 --- a/src/Service/Import/ImportMainZone.php +++ b/src/Service/Import/ImportMainZone.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Service\Import; +if (!defined('_PS_VERSION_')) { + exit; +} + class ImportMainZone { /** diff --git a/src/Service/Import/ImportProvider.php b/src/Service/Import/ImportProvider.php index dc2e566b..0cf7bac8 100644 --- a/src/Service/Import/ImportProvider.php +++ b/src/Service/Import/ImportProvider.php @@ -19,6 +19,10 @@ use Invertus\dpdBaltics\Exception\ImportException; use Invertus\dpdBaltics\File\UploadedFile; +if (!defined('_PS_VERSION_')) { + exit; +} + class ImportProvider { const FILE_NAME = 'ImportProvider'; diff --git a/src/Service/Import/ImportableInterface.php b/src/Service/Import/ImportableInterface.php index 3cfa65be..d8b0257c 100644 --- a/src/Service/Import/ImportableInterface.php +++ b/src/Service/Import/ImportableInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Service\Import; +if (!defined('_PS_VERSION_')) { + exit; +} + interface ImportableInterface { /** diff --git a/src/Service/Import/PriceRulesImport.php b/src/Service/Import/PriceRulesImport.php index 75726ced..767f4710 100644 --- a/src/Service/Import/PriceRulesImport.php +++ b/src/Service/Import/PriceRulesImport.php @@ -33,6 +33,10 @@ use PaymentModule; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class PriceRulesImport implements ImportableInterface { const FILE_NAME = 'PriceRulesImport'; diff --git a/src/Service/Import/ProductImport.php b/src/Service/Import/ProductImport.php index 2333ad77..667caa9a 100644 --- a/src/Service/Import/ProductImport.php +++ b/src/Service/Import/ProductImport.php @@ -33,6 +33,10 @@ use Invertus\dpdBaltics\Service\Export\ProductExport; use Language; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductImport implements ImportableInterface { diff --git a/src/Service/Import/SettingsImport.php b/src/Service/Import/SettingsImport.php index bb6d5cac..7ea3a1cf 100644 --- a/src/Service/Import/SettingsImport.php +++ b/src/Service/Import/SettingsImport.php @@ -29,6 +29,10 @@ use Invertus\dpdBaltics\Service\Export\SettingsExport; use Shop; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDSettingsImport is responsible for importing module settings */ diff --git a/src/Service/Import/ZipImport.php b/src/Service/Import/ZipImport.php index e3397ba3..226cbb26 100644 --- a/src/Service/Import/ZipImport.php +++ b/src/Service/Import/ZipImport.php @@ -35,6 +35,10 @@ use Smarty; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZipImport { /** diff --git a/src/Service/Import/ZoneImport.php b/src/Service/Import/ZoneImport.php index d5f7e637..25a52e4d 100644 --- a/src/Service/Import/ZoneImport.php +++ b/src/Service/Import/ZoneImport.php @@ -27,6 +27,10 @@ use Smarty; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneImport implements ImportableInterface { const FILE_NAME = 'ZoneImport'; diff --git a/src/Service/Label/LabelPositionService.php b/src/Service/Label/LabelPositionService.php index 63f89b78..cb28bf93 100644 --- a/src/Service/Label/LabelPositionService.php +++ b/src/Service/Label/LabelPositionService.php @@ -29,6 +29,10 @@ use Invertus\dpdBaltics\Config\Config; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class LabelPositionService { const FILE_NAME = 'LabelPositionService'; diff --git a/src/Service/Label/LabelPrintingService.php b/src/Service/Label/LabelPrintingService.php index f35355e6..a369d185 100644 --- a/src/Service/Label/LabelPrintingService.php +++ b/src/Service/Label/LabelPrintingService.php @@ -32,6 +32,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Response\ShipmentCreationResponse; use Invertus\dpdBalticsApi\Exception\DPDBalticsAPIException; +if (!defined('_PS_VERSION_')) { + exit; +} + class LabelPrintingService { /** diff --git a/src/Service/Label/LabelUrlFormatter.php b/src/Service/Label/LabelUrlFormatter.php index 3b88a61d..f9c4f0f0 100644 --- a/src/Service/Label/LabelUrlFormatter.php +++ b/src/Service/Label/LabelUrlFormatter.php @@ -20,12 +20,14 @@ declare(strict_types=1); - namespace Invertus\dpdBaltics\Service\Label; - use Invertus\dpdBaltics\Adapter\LinkAdapter; +if (!defined('_PS_VERSION_')) { + exit; +} + class LabelUrlFormatter { private $linkAdapter; diff --git a/src/Service/LabelPrintingService.php b/src/Service/LabelPrintingService.php index 3421756a..acebe0f8 100644 --- a/src/Service/LabelPrintingService.php +++ b/src/Service/LabelPrintingService.php @@ -16,6 +16,10 @@ use Invertus\dpdBaltics\Service\API\LabelApiService; use Invertus\dpdBalticsApi\Api\DTO\Response\ParcelPrintResponse; +if (!defined('_PS_VERSION_')) { + exit; +} + class LabelPrintingService { private $labelApiService; diff --git a/src/Service/LanguageService.php b/src/Service/LanguageService.php index cc22c60e..007e10b9 100644 --- a/src/Service/LanguageService.php +++ b/src/Service/LanguageService.php @@ -14,6 +14,10 @@ use Language; +if (!defined('_PS_VERSION_')) { + exit; +} + class LanguageService { public function getShopLanguagesIsoCodes() diff --git a/src/Service/LogsService.php b/src/Service/LogsService.php index a487bf44..e57014ab 100644 --- a/src/Service/LogsService.php +++ b/src/Service/LogsService.php @@ -27,6 +27,10 @@ use PrestaShopDatabaseException; use PrestaShopException; +if (!defined('_PS_VERSION_')) { + exit; +} + class LogsService { const FILE_NAME = 'LogsService'; diff --git a/src/Service/OrderDeliveryTimeService.php b/src/Service/OrderDeliveryTimeService.php index 78de302a..11a0df69 100644 --- a/src/Service/OrderDeliveryTimeService.php +++ b/src/Service/OrderDeliveryTimeService.php @@ -24,6 +24,10 @@ use DPDOrderDeliveryTime; use Invertus\dpdBaltics\Repository\OrderDeliveryTimeRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class OrderDeliveryTimeService { /** diff --git a/src/Service/OrderService.php b/src/Service/OrderService.php index c469d2ae..1163d6a1 100644 --- a/src/Service/OrderService.php +++ b/src/Service/OrderService.php @@ -29,6 +29,10 @@ use Order; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class OrderService { /** diff --git a/src/Service/Parcel/ParcelShopService.php b/src/Service/Parcel/ParcelShopService.php index 6d131976..51e425da 100644 --- a/src/Service/Parcel/ParcelShopService.php +++ b/src/Service/Parcel/ParcelShopService.php @@ -1,22 +1,22 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 - */ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ namespace Invertus\dpdBaltics\Service\Parcel; @@ -25,6 +25,10 @@ use Invertus\dpdBaltics\Repository\ParcelShopRepository; use Invertus\dpdBalticsApi\Api\DTO\Object\ParcelShop; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelShopService { /** diff --git a/src/Service/Parcel/ParcelUpdateService.php b/src/Service/Parcel/ParcelUpdateService.php index f8f8c5b7..062dd7b4 100644 --- a/src/Service/Parcel/ParcelUpdateService.php +++ b/src/Service/Parcel/ParcelUpdateService.php @@ -1,22 +1,22 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 - */ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ namespace Invertus\dpdBaltics\Service\Parcel; @@ -29,6 +29,10 @@ use Invertus\dpdBalticsApi\Api\DTO\Object\OpeningHours; use Invertus\dpdBalticsApi\Api\DTO\Object\ParcelShop; +if (!defined('_PS_VERSION_')) { + exit; +} + class ParcelUpdateService { diff --git a/src/Service/Payment/PaymentService.php b/src/Service/Payment/PaymentService.php index 9d17829c..7e7d3de9 100644 --- a/src/Service/Payment/PaymentService.php +++ b/src/Service/Payment/PaymentService.php @@ -43,6 +43,10 @@ use Shop; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class PaymentService { diff --git a/src/Service/PriceRuleService.php b/src/Service/PriceRuleService.php index b23bbc91..df4b520c 100644 --- a/src/Service/PriceRuleService.php +++ b/src/Service/PriceRuleService.php @@ -39,6 +39,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class PriceRuleService { diff --git a/src/Service/Product/ProductAvailabilityService.php b/src/Service/Product/ProductAvailabilityService.php index 74df9718..f8816aba 100644 --- a/src/Service/Product/ProductAvailabilityService.php +++ b/src/Service/Product/ProductAvailabilityService.php @@ -32,6 +32,10 @@ use Invertus\dpdBaltics\Util\ProductUtility; use Invertus\dpdBaltics\Util\TimeZoneUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductAvailabilityService { /** diff --git a/src/Service/Product/ProductService.php b/src/Service/Product/ProductService.php index fb980277..1ac204ca 100644 --- a/src/Service/Product/ProductService.php +++ b/src/Service/Product/ProductService.php @@ -32,6 +32,10 @@ use Invertus\dpdBaltics\Service\Carrier\CreateCarrierService; use PrestaShop\PrestaShop\Adapter\Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductService { /** diff --git a/src/Service/Product/UpdateProductShopService.php b/src/Service/Product/UpdateProductShopService.php index 3694a4b1..1429e8f2 100644 --- a/src/Service/Product/UpdateProductShopService.php +++ b/src/Service/Product/UpdateProductShopService.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Exception\ProductUpdateException; use Invertus\dpdBaltics\Repository\ProductShopRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class UpdateProductShopService { /** diff --git a/src/Service/Product/UpdateProductZoneService.php b/src/Service/Product/UpdateProductZoneService.php index c1ca3611..c3d70f8a 100644 --- a/src/Service/Product/UpdateProductZoneService.php +++ b/src/Service/Product/UpdateProductZoneService.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Exception\ProductUpdateException; use Invertus\dpdBaltics\Repository\ProductZoneRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class UpdateProductZoneService { /** diff --git a/src/Service/PudoService.php b/src/Service/PudoService.php index 6e59cd97..a150b347 100644 --- a/src/Service/PudoService.php +++ b/src/Service/PudoService.php @@ -44,6 +44,10 @@ use Smarty; use Tools; +if (!defined('_PS_VERSION_')) { + exit; +} + class PudoService { /** @var array */ diff --git a/src/Service/ShipmentService.php b/src/Service/ShipmentService.php index fdcac7b6..1a1f2e8e 100644 --- a/src/Service/ShipmentService.php +++ b/src/Service/ShipmentService.php @@ -57,6 +57,10 @@ use OrderCarrier; use PrestaShop\Decimal\DecimalNumber; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentService { @@ -221,15 +225,15 @@ public function createShipmentFromOrder(Order $order) private function createNonDistributedShipment(Order $order, $idProduct, $isTestMode) { $products = $order->getProducts(); - $parcelPrice = $order->getTotalPaid(); + $goodsPrice = $order->total_paid; $parcelWeight = 0; foreach ($products as $product) { $parcelWeight += $product['weight'] * $product['product_quantity']; } - $parcelPrice = $this->calculateParcelPriceWithOrderDiscount($order, $parcelPrice); - $shipment = $this->createShipment($order, $idProduct, $isTestMode, 1, $parcelWeight, $parcelPrice); + $goodsPrice = $this->calculateParcelPriceWithOrderDiscount($order, $goodsPrice); + $shipment = $this->createShipment($order, $idProduct, $isTestMode, 1, $parcelWeight, $goodsPrice); if (!$shipment->id) { return false; diff --git a/src/Service/ShippingPriceCalculationService.php b/src/Service/ShippingPriceCalculationService.php index 1bbc8e3f..927cb8ec 100644 --- a/src/Service/ShippingPriceCalculationService.php +++ b/src/Service/ShippingPriceCalculationService.php @@ -25,6 +25,10 @@ use Context; use Invertus\dpdBaltics\Repository\PriceRuleRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShippingPriceCalculationService { /** @@ -48,7 +52,7 @@ public function __construct( * @param Cart $cart * @param Address $deliveryAddress * - * @return float + * @return float|false */ public function calculate(Cart $cart, \Carrier $carrier, Address $deliveryAddress) { @@ -60,12 +64,18 @@ public function calculate(Cart $cart, \Carrier $carrier, Address $deliveryAddres true ); - $shippingCosts += $this->priceRuleService->applyPriceRuleForCarrier( + $result = $this->priceRuleService->applyPriceRuleForCarrier( $cart, $priceRulesIds, Context::getContext()->shop->id ); + if (!$result) { + return false; + } + + $shippingCosts += $result; + $shippingCosts += $this->applyAdditionalCosts($cart); return $shippingCosts; diff --git a/src/Service/TrackingService.php b/src/Service/TrackingService.php index 7d0a01bf..e464882b 100644 --- a/src/Service/TrackingService.php +++ b/src/Service/TrackingService.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class TrackingService { const MAX_TRACKING_NUMBER_LENGTH= 59; diff --git a/src/Service/Zone/DeleteZoneService.php b/src/Service/Zone/DeleteZoneService.php index 7ad4bcda..85bcf747 100644 --- a/src/Service/Zone/DeleteZoneService.php +++ b/src/Service/Zone/DeleteZoneService.php @@ -30,6 +30,10 @@ use PrestaShopException; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class DeleteZoneService { const FILE_NAME = 'DeleteZoneService'; diff --git a/src/Service/Zone/UpdateZoneService.php b/src/Service/Zone/UpdateZoneService.php index dcbb0b00..77aa6b4c 100644 --- a/src/Service/Zone/UpdateZoneService.php +++ b/src/Service/Zone/UpdateZoneService.php @@ -28,6 +28,10 @@ use Invertus\dpdBaltics\Exception\ZoneUpdateException; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class UpdateZoneService { /** diff --git a/src/Templating/DPDRenderableInterface.php b/src/Templating/DPDRenderableInterface.php index c501509d..15a5ca0a 100644 --- a/src/Templating/DPDRenderableInterface.php +++ b/src/Templating/DPDRenderableInterface.php @@ -12,6 +12,10 @@ namespace Invertus\dpdBaltics\Templating; +if (!defined('_PS_VERSION_')) { + exit; +} + interface DPDRenderableInterface { /** diff --git a/src/Templating/InfoBlockRender.php b/src/Templating/InfoBlockRender.php index 5e5238b6..350f14a5 100644 --- a/src/Templating/InfoBlockRender.php +++ b/src/Templating/InfoBlockRender.php @@ -15,6 +15,10 @@ use Invertus\dpdBaltics\Builder\Template\Admin\InfoBlockBuilder; use Smarty; +if (!defined('_PS_VERSION_')) { + exit; +} + class InfoBlockRender { diff --git a/src/Uninstaller/ModuleTabs/ModuleTabsUninstaller.php b/src/Uninstaller/ModuleTabs/ModuleTabsUninstaller.php index 8e39eb46..ed655c60 100644 --- a/src/Uninstaller/ModuleTabs/ModuleTabsUninstaller.php +++ b/src/Uninstaller/ModuleTabs/ModuleTabsUninstaller.php @@ -25,6 +25,10 @@ use Invertus\psModuleTabs\Object\TabsCollection; use Tab; +if (!defined('_PS_VERSION_')) { + exit; +} + class ModuleTabsUninstaller { /** diff --git a/src/Util/CountryUtility.php b/src/Util/CountryUtility.php index 31f648d1..8e874e2e 100644 --- a/src/Util/CountryUtility.php +++ b/src/Util/CountryUtility.php @@ -26,6 +26,10 @@ use Invertus\dpdBaltics\Provider\CurrentCountryProvider; use PrestaShop\PrestaShop\Adapter\Country\CountryDataProvider; +if (!defined('_PS_VERSION_')) { + exit; +} + class CountryUtility { public static function isEstonia() diff --git a/src/Util/FileDownload.php b/src/Util/FileDownload.php index 61adfa96..bc924875 100644 --- a/src/Util/FileDownload.php +++ b/src/Util/FileDownload.php @@ -25,6 +25,10 @@ use DPDBaltics; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class FileDownload { diff --git a/src/Util/NumberUtility.php b/src/Util/NumberUtility.php index fb3b6ede..34cfe123 100644 --- a/src/Util/NumberUtility.php +++ b/src/Util/NumberUtility.php @@ -23,6 +23,10 @@ namespace Invertus\dpdBaltics\Util; +if (!defined('_PS_VERSION_')) { + exit; +} + class NumberUtility { public static function isValidPhone($number) diff --git a/src/Util/ProductUtility.php b/src/Util/ProductUtility.php index 67d8d135..9a6d03f3 100644 --- a/src/Util/ProductUtility.php +++ b/src/Util/ProductUtility.php @@ -23,6 +23,10 @@ use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class ProductUtility { public static function hasAvailability($productReference) { diff --git a/src/Util/ServerGlobalsUtility.php b/src/Util/ServerGlobalsUtility.php index d964f7e5..7916adfe 100644 --- a/src/Util/ServerGlobalsUtility.php +++ b/src/Util/ServerGlobalsUtility.php @@ -23,6 +23,9 @@ namespace Invertus\dpdBaltics\Util; +if (!defined('_PS_VERSION_')) { + exit; +} class ServerGlobalsUtility { diff --git a/src/Util/StringUtility.php b/src/Util/StringUtility.php index 72dce3d7..c0663f3c 100644 --- a/src/Util/StringUtility.php +++ b/src/Util/StringUtility.php @@ -23,6 +23,9 @@ namespace Invertus\dpdBaltics\Util; +if (!defined('_PS_VERSION_')) { + exit; +} class StringUtility { @@ -34,7 +37,7 @@ public static function toLowerCase($string) } public static function trimString($message) { - return strlen($message) > self::REMARK_LIMIT ? substr($message,0,self::REMARK_LIMIT)."..." : $message; + return mb_strlen($message) > self::REMARK_LIMIT ? mb_substr($message, 0, self::REMARK_LIMIT) . "..." : $message; } public static function removeSpecialCharacters($string) { diff --git a/src/Util/TimeZoneUtility.php b/src/Util/TimeZoneUtility.php index 91f9cac4..f174fc2f 100644 --- a/src/Util/TimeZoneUtility.php +++ b/src/Util/TimeZoneUtility.php @@ -26,6 +26,9 @@ use DateTimeZone; use Invertus\dpdBaltics\Config\Config; +if (!defined('_PS_VERSION_')) { + exit; +} class TimeZoneUtility { public static function getBalticTimeZone($format = 'H:i') diff --git a/src/Validate/Carrier/CarrierUpdateValidate.php b/src/Validate/Carrier/CarrierUpdateValidate.php index c84e608d..161eda0f 100644 --- a/src/Validate/Carrier/CarrierUpdateValidate.php +++ b/src/Validate/Carrier/CarrierUpdateValidate.php @@ -20,6 +20,10 @@ use Square\Models\Order; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + class CarrierUpdateValidate { /** diff --git a/src/Validate/Carrier/PudoValidate.php b/src/Validate/Carrier/PudoValidate.php index b4e6db79..d5e15b9a 100644 --- a/src/Validate/Carrier/PudoValidate.php +++ b/src/Validate/Carrier/PudoValidate.php @@ -27,6 +27,10 @@ use Invertus\dpdBaltics\Repository\PudoRepository; use PrestaShop\PrestaShop\Core\Foundation\IoC\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class PudoValidate { diff --git a/src/Validate/Compatibility/OpcModuleCompatibilityValidator.php b/src/Validate/Compatibility/OpcModuleCompatibilityValidator.php index dbf3d191..dd169a1a 100644 --- a/src/Validate/Compatibility/OpcModuleCompatibilityValidator.php +++ b/src/Validate/Compatibility/OpcModuleCompatibilityValidator.php @@ -29,6 +29,10 @@ use Invertus\dpdBaltics\Util\StringUtility; use Module; +if (!defined('_PS_VERSION_')) { + exit; +} + class OpcModuleCompatibilityValidator { public function isOpcModuleInUse(): bool diff --git a/src/Validate/CourierRequest/CourierRequestValidator.php b/src/Validate/CourierRequest/CourierRequestValidator.php index 87057765..bd79b895 100644 --- a/src/Validate/CourierRequest/CourierRequestValidator.php +++ b/src/Validate/CourierRequest/CourierRequestValidator.php @@ -25,6 +25,10 @@ use Invertus\dpdBaltics\Config\Config; use Invertus\dpdBaltics\DTO\CourierRequestData; +if (!defined('_PS_VERSION_')) { + exit; +} + class CourierRequestValidator { public function validate(CourierRequestData $courierRequestData, $countryIso) diff --git a/src/Validate/Phone/PhoneNumberValidator.php b/src/Validate/Phone/PhoneNumberValidator.php index b4b7e5d4..fc5f593d 100644 --- a/src/Validate/Phone/PhoneNumberValidator.php +++ b/src/Validate/Phone/PhoneNumberValidator.php @@ -28,6 +28,10 @@ use Invertus\dpdBaltics\Util\NumberUtility; use Invertus\dpdBaltics\Util\StringUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + class PhoneNumberValidator { diff --git a/src/Validate/ShipmentData/Exception/InvalidShipmentDataField.php b/src/Validate/ShipmentData/Exception/InvalidShipmentDataField.php index 9e11987f..21309d35 100644 --- a/src/Validate/ShipmentData/Exception/InvalidShipmentDataField.php +++ b/src/Validate/ShipmentData/Exception/InvalidShipmentDataField.php @@ -18,9 +18,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ - namespace Invertus\dpdBaltics\Validate\ShipmentData\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class InvalidShipmentDataField extends \Exception { const ERROR_MESSAGE_CODE_INVALID_PRODUCT = 1; diff --git a/src/Validate/ShipmentData/ShipmentDataValidator.php b/src/Validate/ShipmentData/ShipmentDataValidator.php index 35d5ce84..92ade18f 100644 --- a/src/Validate/ShipmentData/ShipmentDataValidator.php +++ b/src/Validate/ShipmentData/ShipmentDataValidator.php @@ -24,6 +24,10 @@ use Invertus\dpdBaltics\DTO\ShipmentData; use Invertus\dpdBaltics\Validate\ShipmentData\Exception\InvalidShipmentDataField; +if (!defined('_PS_VERSION_')) { + exit; +} + class ShipmentDataValidator { /** diff --git a/src/Validate/Weight/CartWeightValidator.php b/src/Validate/Weight/CartWeightValidator.php index 9d6dce63..312495b9 100644 --- a/src/Validate/Weight/CartWeightValidator.php +++ b/src/Validate/Weight/CartWeightValidator.php @@ -24,7 +24,9 @@ use Invertus\dpdBaltics\Config\Config; use Validate; - +if (!defined('_PS_VERSION_')) { + exit; +} class CartWeightValidator { diff --git a/src/Validate/Zone/ZoneDeleteValidate.php b/src/Validate/Zone/ZoneDeleteValidate.php index d3a8bbc4..b35eb337 100644 --- a/src/Validate/Zone/ZoneDeleteValidate.php +++ b/src/Validate/Zone/ZoneDeleteValidate.php @@ -19,6 +19,10 @@ use Invertus\dpdBaltics\Repository\PriceRuleRepository; use Invertus\dpdBaltics\Repository\ProductRepository; +if (!defined('_PS_VERSION_')) { + exit; +} + class ZoneDeleteValidate { /** diff --git a/src/Validate/Zone/ZoneRangeValidate.php b/src/Validate/Zone/ZoneRangeValidate.php index 6b4eae82..f4321356 100644 --- a/src/Validate/Zone/ZoneRangeValidate.php +++ b/src/Validate/Zone/ZoneRangeValidate.php @@ -27,6 +27,10 @@ use Tools; use Validate; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Class DPDZoneRangeValidate */ diff --git a/src/Verification/IsAddressInRange.php b/src/Verification/IsAddressInRange.php new file mode 100644 index 00000000..87e28077 --- /dev/null +++ b/src/Verification/IsAddressInRange.php @@ -0,0 +1,58 @@ + + * @copyright Copyright (c) permanent, INVERTUS, UAB + * @license Addons PrestaShop license limitation + * @see /LICENSE + * + * International Registered Trademark & Property of INVERTUS, UAB + */ + +namespace Invertus\dpdBaltics\Verification; + +use Invertus\dpdBaltics\Repository\ZoneRangeRepository; +use Invertus\dpdBaltics\Validate\Zone\ZoneRangeValidate; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class IsAddressInRange +{ + /** + * Check if address falls into given zones + * + * @param \Address $address + * @param array $zones + * + * @return bool + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public function verify(\Address $address, array $range) + { + $idCountry = $address->id_country ?: (int)\Configuration::get('PS_COUNTRY_DEFAULT'); + + //NOTE: if countries do not match, we continue. + if ((int) $idCountry !== (int) $address->id_country) { + return false; + } + + if ($range['include_all_zip_codes']) { + return true; + } + + if (ZoneRangeValidate::isZipCodeInRange( + $address->postcode, + $range['zip_code_from'], + $range['zip_code_to'], + $idCountry + )) { + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/src/Verification/IsAddressInZone.php b/src/Verification/IsAddressInZone.php new file mode 100644 index 00000000..cf9ceb6a --- /dev/null +++ b/src/Verification/IsAddressInZone.php @@ -0,0 +1,76 @@ + + * @copyright Copyright (c) permanent, INVERTUS, UAB + * @license Addons PrestaShop license limitation + * @see /LICENSE + * + * International Registered Trademark & Property of INVERTUS, UAB + */ + +namespace Invertus\dpdBaltics\Verification; + +use Invertus\dpdBaltics\Repository\ZoneRangeRepository; +use Invertus\dpdBaltics\Validate\Zone\ZoneRangeValidate; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class IsAddressInZone +{ + /** + * @var ZoneRangeRepository + */ + private $zoneRangeRepository; + /** + * @var IsAddressInRange + */ + private $isAddressInRange; + + public function __construct( + ZoneRangeRepository $zoneRangeRepository, + IsAddressInRange $isAddressInRange + ) { + $this->zoneRangeRepository = $zoneRangeRepository; + $this->isAddressInRange = $isAddressInRange; + } + + /** + * Check if address falls into given zones + * + * @param \Address $address + * @param array $zones + * + * @return bool + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public function verify(\Address $address, array $zones) + { + $idCountry = $address->id_country ?: (int)\Configuration::get('PS_COUNTRY_DEFAULT'); + + foreach ($zones as $zone) { + // Get ranges by zone and country + $ranges = $this->zoneRangeRepository->findBy([ + 'id_dpd_zone' => $zone['id'], + // Check by country as well, because the zone must match the country of address + 'id_country' => $idCountry, + ]); + + if (empty($ranges)) { + continue; + } + + foreach ($ranges as $range) { + if ($this->isAddressInRange->verify($address, $range)) { + return true; + } + } + } + + return false; + } +} \ No newline at end of file diff --git a/src/Verification/index.php b/src/Verification/index.php new file mode 100644 index 00000000..74851d77 --- /dev/null +++ b/src/Verification/index.php @@ -0,0 +1,30 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit;