diff --git a/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php b/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php index 719f1160..2fd79dfd 100644 --- a/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php +++ b/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php @@ -5,6 +5,7 @@ namespace ClickAndCollect\Controller\backOffice; use ClickAndCollect\ClickAndCollect; use PointRetrait\Model\PdrPlacesQuery; use PointRetrait\Model\PdrPlaces; +use PointRetrait\Model\PdrScheduleQuery; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Propel; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -106,15 +107,23 @@ class PlaceController extends BaseAdminController return $response; $placeId = $this->getRequest()->get('attr-place-id'); - $query = PdrPlacesQuery::create()->findById($placeId); - if ($query === null) + $query1 = PdrScheduleQuery::create()->findByIdPlace($placeId); + if ($query1 === null) $error_msg = "Place not found by Id"; - else - { + else { $con = Propel::getConnection(); $con->beginTransaction(); - $query->delete($con); + $query1->delete($con); $con->commit(); + + $query2 = PdrPlacesQuery::create()->findById($placeId); + if ($query2 === null) + $error_msg = "Place not found by Id"; + else { + $con->beginTransaction(); + $query2->delete($con); + $con->commit(); + } } if ($this->getRequest()->request->get("success_url") == null) { diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html b/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html index a2c89cc5..eb93a806 100644 --- a/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html +++ b/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html @@ -39,7 +39,7 @@