public function actionDelete($id) { $productCategory = ProductCategory::GetById(intval($id)); $isDeleted = $productCategory->delete(); if ($isDeleted) { $this->redirect(array($this->getId() . '/index')); } else { Yii::app()->user->setFlash('notification', Zurmo::t('ProductTemplatesModule', 'The product category is associated to product templates or has child categories in the system hence could not be deleted')); $this->redirect(Zurmo::app()->request->getUrlReferrer()); } }
public function actionDelete($id) { $productTemplate = ProductTemplate::GetById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($productTemplate); //Check if product template has associated products if ($productTemplate->delete()) { $this->redirect(array($this->getId() . '/index')); } else { Yii::app()->user->setFlash('notification', Zurmo::t('ProductTemplatesModule', 'The product template is associated to products in the system hence could not be deleted')); $this->redirect(Zurmo::app()->request->getUrlReferrer()); } }