Added isPaymentModuleFor() and isDeliveryModuleFor() toi BaseModule

This commit is contained in:
Franck Allimant
2014-04-04 02:31:51 +02:00
parent c39a944172
commit dc22938512

View File

@@ -33,6 +33,7 @@ use Thelia\Model\Map\ModuleTableMap;
use Thelia\Model\ModuleI18nQuery;
use Thelia\Model\Map\ModuleImageTableMap;
use Thelia\Model\ModuleI18n;
use Thelia\Model\Order;
use Thelia\Tools\Image;
use Thelia\Exception\ModuleException;
use Thelia\Model\Module;
@@ -262,6 +263,30 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return basename(dirname($this->reflected->getFileName()));
}
/**
* Check if this module is the payment module for a given order
*
* @param Order $order an order
* @return bool true if this module is the payment module for the given order.
*/
public function isPaymentModuleFor(Order $order) {
$model = $this->getModuleModel();
return $order->getPaymentModuleId() == $model->getId();
}
/**
* Check if this module is the delivery module for a given order
*
* @param Order $order an order
* @return bool true if this module is the delivery module for the given order.
*/
public function isDeliveryModuleFor(Order $order) {
$model = $this->getModuleModel();
return $order->getDeliveryModuleId() == $model->getId();
}
/**
*
* This method allow adding new compilers to Thelia container