Checked coupon type before trying to get the service.

This commit is contained in:
Franck Allimant
2014-05-30 20:17:41 +02:00
parent de5a2025cd
commit 919e0ac09b

View File

@@ -622,16 +622,21 @@ class CouponController extends BaseAdminController
return $response;
}
$this->checkXmlHttpRequest();
if (! empty($couponServiceId)) {
$this->checkXmlHttpRequest();
/** @var CouponInterface $coupon */
$couponManager = $this->container->get($couponServiceId);
/** @var CouponInterface $coupon */
$couponManager = $this->container->get($couponServiceId);
if (!$couponManager instanceof CouponInterface) {
$this->pageNotFound();
if (!$couponManager instanceof CouponInterface) {
$this->pageNotFound();
}
$response = new ResponseRest($couponManager->drawBackOfficeInputs());
}
else {
$response = new ResponseRest('');
}
$response = new ResponseRest($couponManager->drawBackOfficeInputs());
return $response;
}