Skip to content

Commit

Permalink
Merge branch 'release/3.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
iljamobilemojo committed May 17, 2022
2 parents 105d513 + 780b455 commit 2a7f79f
Show file tree
Hide file tree
Showing 19 changed files with 431 additions and 64 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
.dockerignore
.gitignore
.git
docker-compose.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
node_modules
package-lock.json
.DS_Store
146 changes: 130 additions & 16 deletions EnderecoShopware5Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function deactivate(DeactivateContext $deactivateContext)
public function uninstall(UninstallContext $uninstallContext)
{
$service = $this->container->get('shopware_attribute.crud_service');

// Standard address table attributes.
if ($service->get('s_user_addresses_attributes', 'enderecoamsts')) {
$service->delete('s_user_addresses_attributes', 'enderecoamsts');
}
Expand All @@ -89,15 +91,48 @@ public function uninstall(UninstallContext $uninstallContext)
if ($service->get('s_user_addresses_attributes', 'enderecoamsapredictions')) {
$service->delete('s_user_addresses_attributes', 'enderecoamsapredictions');
}

// Attributes for street name and building number.
if ($service->get('s_user_addresses_attributes', 'enderecostreetname')) {
$service->delete('s_user_addresses_attributes', 'enderecostreetname');
}
if ($service->get('s_user_addresses_attributes', 'enderecobuildingnumber')) {
$service->delete('s_user_addresses_attributes', 'enderecobuildingnumber');
}

// Order billing address table attributes.
if ($service->get('s_order_billingaddress_attributes', 'enderecoamsts')) {
$service->delete('s_order_billingaddress_attributes', 'enderecoamsts');
}
if ($service->get('s_order_billingaddress_attributes', 'enderecoamsstatus')) {
$service->delete('s_order_billingaddress_attributes', 'enderecoamsstatus');
}
if ($service->get('s_order_billingaddress_attributes', 'enderecoamsapredictions')) {
$service->delete('s_order_billingaddress_attributes', 'enderecoamsapredictions');
}
if ($service->get('s_order_billingaddress_attributes', 'enderecostreetname')) {
$service->delete('s_order_billingaddress_attributes', 'enderecostreetname');
}
if ($service->get('s_order_billingaddress_attributes', 'enderecobuildingnumber')) {
$service->delete('s_order_billingaddress_attributes', 'enderecobuildingnumber');
}

// Order shipping address table attributes.
if ($service->get('s_order_shippingaddress_attributes', 'enderecoamsts')) {
$service->delete('s_order_shippingaddress_attributes', 'enderecoamsts');
}
if ($service->get('s_order_shippingaddress_attributes', 'enderecoamsstatus')) {
$service->delete('s_order_shippingaddress_attributes', 'enderecoamsstatus');
}
if ($service->get('s_order_shippingaddress_attributes', 'enderecoamsapredictions')) {
$service->delete('s_order_shippingaddress_attributes', 'enderecoamsapredictions');
}
if ($service->get('s_order_shippingaddress_attributes', 'enderecostreetname')) {
$service->delete('s_order_shippingaddress_attributes', 'enderecostreetname');
}
if ($service->get('s_order_shippingaddress_attributes', 'enderecobuildingnumber')) {
$service->delete('s_order_shippingaddress_attributes', 'enderecobuildingnumber');
}


// Attribute sin the order.
if ($service->get('s_order_attributes', 'endereco_order_billingamsts')) {
$service->delete('s_order_attributes', 'endereco_order_billingamsts');
Expand Down Expand Up @@ -130,6 +165,8 @@ private function _addAttributes()
* @var \Shopware\Bundle\AttributeBundle\Service\CrudService
*/
$service = $this->container->get('shopware_attribute.crud_service');

// Default address attributes.
if (!$service->get('s_user_addresses_attributes', 'enderecoamsts')) {
$service->update('s_user_addresses_attributes', 'enderecoamsts', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Zeitpunkt der Adressprüfung',
Expand All @@ -146,10 +183,101 @@ private function _addAttributes()
}
if (!$service->get('s_user_addresses_attributes', 'enderecoamsapredictions')) {
$service->update('s_user_addresses_attributes', 'enderecoamsapredictions', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'JSON mit möglicher Adresskorrekturen',
'displayInBackend' => false,
'custom' => true
]);
}
if (!$service->get('s_user_addresses_attributes', 'enderecostreetname')) {
$service->update('s_user_addresses_attributes', 'enderecostreetname', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Straßenname',
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_user_addresses_attributes', 'enderecobuildingnumber')) {
$service->update('s_user_addresses_attributes', 'enderecobuildingnumber', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Hausnummer',
'displayInBackend' => true,
'custom' => true
]);
}

// Billing address attributes.
if (!$service->get('s_order_billingaddress_attributes', 'enderecoamsts')) {
$service->update('s_order_billingaddress_attributes', 'enderecoamsts', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Zeitpunkt der Adressprüfung',
'custom' => true,
'displayInBackend' => true
]);
}
if (!$service->get('s_order_billingaddress_attributes', 'enderecoamsstatus')) {
$service->update('s_order_billingaddress_attributes', 'enderecoamsstatus', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Status der Adressprüfung',
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_order_billingaddress_attributes', 'enderecoamsapredictions')) {
$service->update('s_order_billingaddress_attributes', 'enderecoamsapredictions', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'JSON mit möglicher Adresskorrekturen',
'displayInBackend' => false,
'custom' => true
]);
}
if (!$service->get('s_order_billingaddress_attributes', 'enderecostreetname')) {
$service->update('s_order_billingaddress_attributes', 'enderecostreetname', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Straßenname',
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_order_billingaddress_attributes', 'enderecobuildingnumber')) {
$service->update('s_order_billingaddress_attributes', 'enderecobuildingnumber', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Hausnummer',
'displayInBackend' => true,
'custom' => true
]);
}

// Shipping address attributes.
if (!$service->get('s_order_shippingaddress_attributes', 'enderecoamsts')) {
$service->update('s_order_shippingaddress_attributes', 'enderecoamsts', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Zeitpunkt der Adressprüfung',
'custom' => true,
'displayInBackend' => true
]);
}
if (!$service->get('s_order_shippingaddress_attributes', 'enderecoamsstatus')) {
$service->update('s_order_shippingaddress_attributes', 'enderecoamsstatus', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Status der Adressprüfung',
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_order_shippingaddress_attributes', 'enderecoamsapredictions')) {
$service->update('s_order_shippingaddress_attributes', 'enderecoamsapredictions', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'JSON mit möglicher Adresskorrekturen',
'displayInBackend' => false,
'custom' => true
]);
}
if (!$service->get('s_order_shippingaddress_attributes', 'enderecostreetname')) {
$service->update('s_order_shippingaddress_attributes', 'enderecostreetname', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Straßenname',
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_order_shippingaddress_attributes', 'enderecobuildingnumber')) {
$service->update('s_order_shippingaddress_attributes', 'enderecobuildingnumber', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'label' => 'Hausnummer',
'displayInBackend' => true,
'custom' => true
]);
}

// Order attributes.
if (!$service->get('s_order_attributes', 'endereco_order_billingamsts')) {
$service->update('s_order_attributes', 'endereco_order_billingamsts', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'displayInBackend' => false,
Expand All @@ -175,20 +303,6 @@ private function _addAttributes()
]);
}

// Attributes for street name and building number.
if (!$service->get('s_user_addresses_attributes', 'enderecostreetname')) {
$service->update('s_user_addresses_attributes', 'enderecostreetname', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'displayInBackend' => true,
'custom' => true
]);
}
if (!$service->get('s_user_addresses_attributes', 'enderecobuildingnumber')) {
$service->update('s_user_addresses_attributes', 'enderecobuildingnumber', \Shopware\Bundle\AttributeBundle\Service\TypeMapping::TYPE_STRING, [
'displayInBackend' => true,
'custom' => true
]);
}

// If current plugin is EnderecoAMS, the GitHub version is not installed, try to remove old attributes.
$temp = explode('\\', get_class($this));
$className = $temp[count($temp)-1];
Expand Down
1 change: 0 additions & 1 deletion README.md

This file was deleted.

Loading

0 comments on commit 2a7f79f

Please sign in to comment.