Création du module FedEx
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Colissimo;
|
||||
|
||||
use Colissimo\Model\Config\ColissimoConfigValue;
|
||||
use Colissimo\Model\Config\FedExConfigValue;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Install\Database;
|
||||
@@ -35,7 +35,7 @@ class Colissimo extends AbstractDeliveryModule
|
||||
public static function getPrices()
|
||||
{
|
||||
if (null === self::$prices) {
|
||||
self::$prices = json_decode(Colissimo::getConfigValue(ColissimoConfigValue::PRICES, null), true);
|
||||
self::$prices = json_decode(FedEx::getConfigValue(FedExConfigValue::PRICES, null), true);
|
||||
}
|
||||
|
||||
return self::$prices;
|
||||
@@ -43,7 +43,7 @@ class Colissimo extends AbstractDeliveryModule
|
||||
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
self::setConfigValue(ColissimoConfigValue::ENABLED, 1);
|
||||
self::setConfigValue(FedExConfigValue::ENABLED, 1);
|
||||
|
||||
$database = new Database($con);
|
||||
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
||||
@@ -51,7 +51,7 @@ class Colissimo extends AbstractDeliveryModule
|
||||
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
if (0 == self::getConfigValue(ColissimoConfigValue::ENABLED, 1)) {
|
||||
if (0 == self::getConfigValue(FedExConfigValue::ENABLED, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class Colissimo extends AbstractDeliveryModule
|
||||
*/
|
||||
public static function getPostageAmount($areaId, $weight)
|
||||
{
|
||||
$freeshipping = Colissimo::getConfigValue(ColissimoConfigValue::FREE_SHIPPING);
|
||||
$freeshipping = FedEx::getConfigValue(FedExConfigValue::FREE_SHIPPING);
|
||||
$postage = 0;
|
||||
if (!$freeshipping) {
|
||||
$prices = self::getPrices();
|
||||
@@ -164,14 +164,14 @@ class Colissimo extends AbstractDeliveryModule
|
||||
|
||||
$tableExists = $database->execute("SHOW TABLES LIKE 'colissimo_freeshipping'")->rowCount();
|
||||
|
||||
if (Colissimo::getConfigValue(ColissimoConfigValue::FREE_SHIPPING, null) == null && $tableExists) {
|
||||
if (FedEx::getConfigValue(FedExConfigValue::FREE_SHIPPING, null) == null && $tableExists) {
|
||||
$result = $database->execute('SELECT active FROM colissimo_freeshipping WHERE id=1')->fetch()["active"];
|
||||
Colissimo::setConfigValue(ColissimoConfigValue::FREE_SHIPPING, $result);
|
||||
FedEx::setConfigValue(FedExConfigValue::FREE_SHIPPING, $result);
|
||||
$database->execute("DROP TABLE `colissimo_freeshipping`");
|
||||
}
|
||||
|
||||
if (is_readable($uploadDir) && Colissimo::getConfigValue(ColissimoConfigValue::PRICES, null) == null) {
|
||||
Colissimo::setConfigValue(ColissimoConfigValue::PRICES, file_get_contents($uploadDir));
|
||||
if (is_readable($uploadDir) && FedEx::getConfigValue(FedExConfigValue::PRICES, null) == null) {
|
||||
FedEx::setConfigValue(FedExConfigValue::PRICES, file_get_contents($uploadDir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user