Correction d'un bogue dans le module MondialRelay 1.0.7
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.0.5</version>
|
||||
<version>1.0.7</version>
|
||||
<author>
|
||||
<name>Franck Allimant</name>
|
||||
<company>CQFDev</company>
|
||||
|
||||
@@ -57,6 +57,10 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ApiClient
|
||||
* @throws \SoapFault
|
||||
*/
|
||||
protected function getWebServiceClient()
|
||||
{
|
||||
return new ApiClient(
|
||||
@@ -136,19 +140,19 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface
|
||||
$countryHasRelay = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the area delivery type matches the selected one, or if no zone is selected
|
||||
if (null === $selectedDeliveryType || $zoneDeliveryType === $selectedDeliveryType) {
|
||||
// Check if we have a price slice
|
||||
if (null !== $deliveryPrice = MondialRelayDeliveryPriceQuery::create()
|
||||
->filterByAreaId($area->getAreaId())
|
||||
->filterByMaxWeight($weight, Criteria::GREATER_EQUAL)
|
||||
->orderByMaxWeight(Criteria::ASC)
|
||||
->findOne()) {
|
||||
$price = min($price, $deliveryPrice->getPriceWithTax());
|
||||
// If the area delivery type matches the selected one, or if no zone is selected
|
||||
if (null === $selectedDeliveryType || $zoneDeliveryType === $selectedDeliveryType) {
|
||||
// Check if we have a price slice
|
||||
if (null !== $deliveryPrice = MondialRelayDeliveryPriceQuery::create()
|
||||
->filterByAreaId($area->getAreaId())
|
||||
->filterByMaxWeight($weight, Criteria::GREATER_EQUAL)
|
||||
->orderByMaxWeight(Criteria::ASC)
|
||||
->findOne()) {
|
||||
$price = min($price, $deliveryPrice->getPriceWithTax());
|
||||
|
||||
$deliveryDelay = $zoneConfig->getDeliveryTime();
|
||||
$deliveryDelay = $zoneConfig->getDeliveryTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +73,15 @@ class DeliveryPrice extends BaseLoop implements ArraySearchLoopInterface
|
||||
$results = [];
|
||||
|
||||
if (null !== $country = CountryQuery::create()->findPk($this->getCountryId())) {
|
||||
if (null !== $stateId = $this->getStateId()) {
|
||||
$state = StateQuery::create()->findPk($this->$stateId());
|
||||
} else {
|
||||
$state = null;
|
||||
if ($country->getHasStates()) {
|
||||
if (null !== $stateId = $this->getStateId()) {
|
||||
$state = StateQuery::create()->findPk($this->$stateId());
|
||||
} else {
|
||||
$state = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
$state = null;
|
||||
|
||||
$mode = $this->getMode();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use MondialRelay\Model\MondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use Payzen\Model\Thelia\Model\ModuleConfigQuery;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
@@ -29,6 +30,7 @@ use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\Message;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleConfig;
|
||||
use Thelia\Model\ModuleImageQuery;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
@@ -101,7 +103,7 @@ class MondialRelay extends AbstractDeliveryModule
|
||||
self::setConfigValue(self::CODE_ENSEIGNE, "BDTEST13");
|
||||
self::setConfigValue(self::PRIVATE_KEY, "PrivateK");
|
||||
self::setConfigValue(self::WEBSERVICE_URL, "https://api.mondialrelay.com/Web_Services.asmx?WSDL");
|
||||
self::setConfigValue(self::GOOGLE_MAPS_API_KEY, "AIzaSyBY_RCM1zkJ0-Df1XMTq3fDzypFC95ZNFE");
|
||||
self::setConfigValue(self::GOOGLE_MAPS_API_KEY, "get_your_own_api_key");
|
||||
self::setConfigValue(self::ALLOW_HOME_DELIVERY, true);
|
||||
self::setConfigValue(self::ALLOW_RELAY_DELIVERY, true);
|
||||
self::setConfigValue(self::ALLOW_INSURANCE, true);
|
||||
@@ -205,4 +207,28 @@ class MondialRelay extends AbstractDeliveryModule
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
* @param bool $deleteModuleData
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
|
||||
{
|
||||
if ($deleteModuleData) {
|
||||
// Delete message
|
||||
MessageQuery::create()->filterByName(self::TRACKING_MESSAGE_NAME)->delete($con);
|
||||
|
||||
// Delete module config data
|
||||
ModuleConfigQuery::create()->filterByModuleId(self::getModuleId())->delete($con);
|
||||
|
||||
// Delete module tables.
|
||||
if (null !== $con) {
|
||||
$database = new Database($con);
|
||||
$database->insertSql(null, [__DIR__ . '/Config/drop.sql']);
|
||||
}
|
||||
}
|
||||
|
||||
parent::destroy($con, $deleteModuleData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user