diff --git a/module/CudiBundle/Controller/Admin/ArticleController.php b/module/CudiBundle/Controller/Admin/ArticleController.php index 8d8e165acd..b82ba91fdd 100644 --- a/module/CudiBundle/Controller/Admin/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/ArticleController.php @@ -185,24 +185,6 @@ public function deleteAction() ); } - public function historyAction() - { - $article = $this->getArticleEntity(); - if ($article === null) { - return new ViewModel(); - } - - $history = $this->getEntityManager() - ->getRepository('CudiBundle\Entity\Article\History') - ->findAllByArticle($article); - - return new ViewModel( - array( - 'history' => $history, - 'current' => $article, - ) - ); - } public function searchAction() { diff --git a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php index 10ced13e43..2f18c4394d 100644 --- a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php @@ -282,6 +282,16 @@ public function deleteAction() if ($saleArticle === null) { return new ViewModel(); } + + $bookings = $this->getEntityManager() + ->getRepository('CudiBundle\Entity\Sale\Booking') + ->findAllActiveByArticleAndPeriod($saleArticle, $this->getActiveStockPeriodEntity()); + + $idsCancelled = array(); + foreach ($bookings as $booking) { + $booking->setStatus('canceled', $this->getEntityManager()); + $idsCancelled[] = $booking->getId(); + } $saleArticle->setIsHistory(true); $this->getEntityManager()->flush(); @@ -291,6 +301,7 @@ public function deleteAction() 'result' => (object) array('status' => 'success'), ) ); + } public function assignAllAction()