Skip to content

Commit

Permalink
fix: fix multiple bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chartechlabs committed Nov 12, 2020
1 parent d2530fe commit bb65095
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Controllers/Frontend/EnderecoShopware5Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ public function countryAction() {
$countryRepository = $this->container->get('models')->getRepository(\Shopware\Models\Country\Country::class);

if (isset($countryId) && '' !== $countryId) {
$return = strtolower($countryRepository->find($countryId)->getIso());
$temp = $countryRepository->find($countryId);
if ($temp) {
$return = strtolower($temp->getIso());
}
} elseif (isset($countryCode) && '' !== $countryCode) {
$return = strtolower($countryRepository->findOneBy(array('iso' => $countryCode))->getId());
$temp = $countryRepository->findOneBy(array('iso' => $countryCode));
if ($temp) {
$return = strtolower($temp->getId());
}
}

Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender();
Expand Down
1 change: 1 addition & 0 deletions Resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
<option><value>pr</value><label lang="de">Puerto Rico</label><label lang="en">Puerto Rico</label></option>
<option><value>qa</value><label lang="de">Katar</label><label lang="en">Qatar</label></option>
<option><value>re</value><label lang="de">Réunion</label><label lang="en">Réunion</label></option>
<option><value>xk</value><label lang="de">Republik Kosovo</label><label lang="en">Republic of Kosovo</label></option>
<option><value>ro</value><label lang="de">Rumänien</label><label lang="en">Romania</label></option>
<option><value>ru</value><label lang="de">Russische Föderation</label><label lang="en">Russian Federation</label></option>
<option><value>rw</value><label lang="de">Ruanda</label><label lang="en">Rwanda</label></option>
Expand Down
22 changes: 22 additions & 0 deletions Services/EnderecoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Shopware\Models\Country\Country;
use Shopware\Models\Customer\Address;
use Shopware\Models\Customer\AddressRepository;
use GuzzleHttp\Exception\RequestException;

class EnderecoService {
private $logger;
Expand Down Expand Up @@ -172,6 +173,13 @@ public function checkAddresses($addressIdArray = array()) {
}
$checkedAddressesCounter++;
}
} catch (RequestException $e) {
if ($e->hasResponse()) {
$response = $e->getResponse();
if (500 <= $response->getStatusCode()) {
$this->logger->addError($e->getMessage());
}
}
} catch(\Exception $e) {
$this->logger->addError($e->getMessage());
}
Expand Down Expand Up @@ -216,6 +224,13 @@ public function sendDoAccountings($sessionIds = array()) {
);
$anyDoAccounting = true;

} catch (RequestException $e) {
if ($e->hasResponse()) {
$response = $e->getResponse();
if (500 <= $response->getStatusCode()) {
$this->logger->addError($e->getMessage());
}
}
} catch(\Exception $e) {
$this->logger->addError($e->getMessage());
}
Expand Down Expand Up @@ -243,6 +258,13 @@ public function sendDoAccountings($sessionIds = array()) {
'body' => json_encode($message)
)
);
} catch (RequestException $e) {
if ($e->hasResponse()) {
$response = $e->getResponse();
if (500 <= $response->getStatusCode()) {
$this->logger->addError($e->getMessage());
}
}
} catch(\Exception $e) {
$this->logger->addError($e->getMessage());
}
Expand Down
45 changes: 44 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<label lang="en">Endereco Address-Services for Shopware (Download)</label>
<label lang="de">Endereco Adress-Services für Shopware (Download)</label>

<version>3.3.0</version>
<version>3.3.3</version>

<link>https://www.endereco.de/shopware</link>

Expand All @@ -31,6 +31,49 @@

<logo>/custom/plugins/EnderecoShopware5Client/logo.png</logo>

<changelog version="3.3.3">
<changes lang="de">
<![CDATA[
<p>BUGfix: 400 Fehler wegen gesperrten Diensten werden nicht mehr geloggt.</p>
<p>BUGfix: bei Auflösung von Landes-ID zu Landeskürzel und umgekehrt, wird explizit geprüft, ob ein Objekt gefunden wurde.</p>
<p>Feature: Republik Kosovo zur Auswahl der Standardländer hinzugefügt.</p>
]]>
</changes>
<changes lang="en">
<![CDATA[
<p>BUGfix: Errors with 400 code because of not assigned services will not be logged anymore.</p>
<p>BUGfix: Country-ID to Country-Code and vice-versa mappings check if repository returns an objekt before reading the field value.</p>
<p>Feature: Added Republic of Kosovo to default countries selector.</p>
]]>
</changes>
</changelog>

<changelog version="3.3.2">
<changes lang="de">
<![CDATA[
BUGfix: Attributennamen in address/form.tpl berichtigt
]]>
</changes>
<changes lang="en">
<![CDATA[
BUGfix: corrected attribute names in address/form.tpl
]]>
</changes>
</changelog>

<changelog version="3.3.1">
<changes lang="de">
<![CDATA[
BUGfix: löst das Problem mit fehlender Spalte
]]>
</changes>
<changes lang="en">
<![CDATA[
BUGfix: fix the bug with missing column
]]>
</changes>
</changelog>

<changelog version="3.3.0">
<changes lang="de">
<![CDATA[
Expand Down

0 comments on commit bb65095

Please sign in to comment.