From 37e2f639d790e301e5051dad9caf545ce80006ab Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Fri, 30 May 2014 20:17:41 +0200 Subject: [PATCH] Checked coupon type before trying to get the service. --- .../Controller/Admin/CouponController.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index abf3177aa..db199c23a 100644 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -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; }