Module Mondial Relay + quelques modifs de design
This commit is contained in:
8
local/modules/MondialRelay/Config/drop.sql
Normal file
8
local/modules/MondialRelay/Config/drop.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_pickup_address`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_price`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_insurance`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_zone_configuration`;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -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>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ return array(
|
||||
'Find a pickup location around you' => 'Trouver un point relais autour de vous',
|
||||
'Loading...' => 'Chargement...',
|
||||
'Mondial Relay home delivery' => 'Livraison Mondial Relay à mon domicile',
|
||||
'Mondial Relay pickup location' => 'Adresse du point relais Mondial Relay',
|
||||
'Mondial Relay pickup location' => ' Point relais Mondial Relay',
|
||||
'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
|
||||
'No pickup locations were found for this address.' => 'Nous n\'avons pas trouvé de point relais autour de cette adresse.',
|
||||
'Oops, something goes wrong, please try again.' => 'Oups, quelque chose n\'a pas fonctionné correctement. Merci de recommencer.',
|
||||
|
||||
@@ -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