Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Initial logic rework #95

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,3 @@ services:
- '@invertus.dpdbaltics.factory.tab_factory'
- '@invertus.dpdbaltics.service.carrier.create_carrier_service'
- '@invertus.dpdbaltics.repository.carrier_repository'

invertus.dpdbaltics.orm.entity_manager:
class: 'Invertus\dpdBaltics\ORM\EntityManager'
1 change: 0 additions & 1 deletion config/import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
class: 'Invertus\dpdBaltics\Service\Import\ZoneImport'
arguments:
- '@dpdbaltics'
- '@invertus.dpdbaltics.orm.entity_manager'
- '@invertus.dpdbaltics.adapter.zone_adapter'
- '@invertus.dpdbaltics.validate.zone.zone_range_validate'
- '@invertus.dpdbaltics.repository.dpdzone_repository'
Expand Down
4 changes: 0 additions & 4 deletions config/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
arguments:
- '@dpdbaltics'
- '@context'
- '@invertus.dpdbaltics.orm.entity_manager'
- '@invertus.dpdbaltics.repository.phone_prefix_repository'
- '@invertus.dpdbaltics.repository.order_repository'

Expand Down Expand Up @@ -196,9 +195,6 @@ services:

invertus.dpdbaltics.service.google_api_service:
class: 'Invertus\dpdBaltics\Service\GoogleApiService'
arguments:
- '@language'
- '@shop'

invertus.dpdbaltics.logger.logger:
class: 'Invertus\dpdBaltics\Logger\Logger'
Expand Down
2 changes: 0 additions & 2 deletions config/validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ services:
class: 'Invertus\dpdBaltics\Validate\Zone\ZoneDeleteValidate'
arguments:
- '@dpdbaltics'
- '@invertus.dpdbaltics.orm.entity_manager'


invertus.dpdbaltics.validate.carrier.carrier_update_validate:
class: 'Invertus\dpdBaltics\Validate\Carrier\CarrierUpdateValidate'
Expand Down
168 changes: 85 additions & 83 deletions controllers/admin/AdminDPDBalticsAddressTemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ private function getFieldFormVars()
$priceRuleShops = $shopRepository->getAddressTemplateShops($this->object->id);

$shops = Shop::getShops(true);
if (count($shops) > 1) {
$isMultiShop = (bool) Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && (count($shops) > 1);

if ($isMultiShop) {
$allShopsSelected = false;

// Checking if "All shops" option is selected
Expand Down Expand Up @@ -149,100 +151,100 @@ private function initForm()
$this->loadObject(true);
$dpdCountries = Country::getCountries($this->context->language->id, false);

$isEECountry = CountryUtility::isEstonia();

$inputs = [
[
'label' => $this->l('Name'),
'type' => 'text',
'name' => 'name',
'required' => true,
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Address type'),
'name' => 'type',
'type' => $isEECountry ? 'hidden' : 'radio',
'default_value' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'values' => [
[
'id' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'value' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'label' => $this->l('Collection request'),
],
[
'id' => DPDAddressTemplate::ADDRESS_TYPE_RETURN_SERVICE,
'value' => DPDAddressTemplate::ADDRESS_TYPE_RETURN_SERVICE,
'label' => $this->l('Return service'),
],
],
],
[
'label' => $this->l('Full name/Company name'),
'name' => 'full_name',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Mobile phone'),
'name' => 'mobile_phone',
'type' => 'free',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Email address'),
'name' => 'email',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Country'),
'name' => 'dpd_country_id',
'type' => 'select',
'class' => 'fixed-width-xxl chosen',
'options' => [
'id' => 'id_country',
'name' => 'name',
'query' => $dpdCountries,
],
],
[
'label' => $this->l('Zip code'),
'name' => 'zip_code',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('City/Region'),
'name' => 'dpd_city_name',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Address'),
'name' => 'address',
'type' => 'text',
'class' => 'fixed-width-xxl',
]
];

$shops = Shop::getShops(true);
$receiverShop = null;
if (count($shops) > 1) {
$receiverShop = [
$isMultiShop = (bool) Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && (count($shops) > 1);

if ($isMultiShop) {
$inputs[] = [
'label' => $this->l('Receiver shops'),
'name' => 'search_block_shops',
'type' => 'free',
'form_group_class' => 'dpd-price-rule-shops',
];
}
$isEECountry = false;
if (CountryUtility::isEstonia()) {
$isEECountry = true;
}

$this->fields_form = [
'legend' => [
'title' => $this->l('Address template'),
],
'input' => [
[
'label' => $this->l('Name'),
'type' => 'text',
'name' => 'name',
'required' => true,
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Address type'),
'name' => 'type',
'type' => $isEECountry ? 'hidden' : 'radio',
'default_value' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'values' => [
[
'id' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'value' => DPDAddressTemplate::ADDRESS_TYPE_COLLECTION_REQUEST,
'label' => $this->l('Collection request'),
],
[
'id' => DPDAddressTemplate::ADDRESS_TYPE_RETURN_SERVICE,
'value' => DPDAddressTemplate::ADDRESS_TYPE_RETURN_SERVICE,
'label' => $this->l('Return service'),
],
],
],
[
'label' => $this->l('Full name/Company name'),
'name' => 'full_name',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Mobile phone'),
'name' => 'mobile_phone',
'type' => 'free',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Email address'),
'name' => 'email',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Country'),
'name' => 'dpd_country_id',
'type' => 'select',
'class' => 'fixed-width-xxl chosen',
'options' => [
'id' => 'id_country',
'name' => 'name',
'query' => $dpdCountries,
],
],
[
'label' => $this->l('Zip code'),
'name' => 'zip_code',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('City/Region'),
'name' => 'dpd_city_name',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
[
'label' => $this->l('Address'),
'name' => 'address',
'type' => 'text',
'class' => 'fixed-width-xxl',
],
$receiverShop
],
'input' => $inputs,
'submit' => [
'title' => $this->l('Save'),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ private function initForm()
$this->loadObject(true);
$dpdCountries = Country::getCountries($this->context->language->id, false);

$dpdPickupCountryId = null;
$dpdReceiverCountryId = null;

$this->multiple_fieldsets = true;

$date = new DateTime(isset($this->fields_value['shipment_date']) ? $this->fields_value['shipment_date'] : null);
Expand Down
Loading