/**
  * Deletes the given servicepack
  */
 public function deleteAction()
 {
     $spId = $this->getRequest()->getParam('id');
     $sp = $this->_spSrv->load($spId);
     if (empty($sp)) {
         throw new NotFoundException('ServicePack ' . $spId . ' not found', 404);
     }
     // Check permissions
     $this->_helper->allowed('delete', $sp);
     // Remove the user
     $this->_spSrv->delete($sp);
     $this->view->data = true;
 }
 public function discountsAction()
 {
     if (!$this->_hasParam('id')) {
         throw new InvalidArgumentException("Null Identifier recived");
     }
     $id = $this->_getParam('id');
     if (!$this->getRequest()->isPut()) {
         throw new UnexpectedException("Resquest must be PUT");
     }
     $sp = $this->_spSrv->load($id);
     if (empty($sp)) {
         throw new NotFoundException("ServicePack {$id} not found", 404);
     }
     if (!$sp instanceof ServicePackModel) {
         throw new InvalidArgumentException('No service pack given');
     }
     $this->_helper->allowed('read', $sp);
     // Check permissions
     $this->_helper->allowed('update_discounts', $sp);
     $data = $this->_helper->requestData();
     $this->_setDiscounts($sp, $data);
 }