Module Mondial Relay + quelques modifs de design

This commit is contained in:
2019-11-26 19:08:48 +01:00
parent 332ebfbcb7
commit fe1d343503
27 changed files with 74 additions and 3126 deletions

View File

@@ -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);
}
}