Exemplo n.º 1
0
 function admin_delete($id = null)
 {
     if (!$id) {
         $this->Session->setFlash(__('That template could not be found', true));
         $this->redirect($this->referer());
     }
     $template = $this->Template->read(null, $id);
     if (!empty($template['Campaign'])) {
         $this->Session->setFlash(__('There are some campaigns using that template', true));
         $this->redirect($this->referer());
     }
     if (!empty($template['Newsletter'])) {
         $this->Session->setFlash(__('There are some newsletters using that template', true));
         $this->redirect($this->referer());
     }
     parent::admin_delete($id);
 }