Example #1
0
 public function beforeDelete($cascade = true)
 {
     if (!empty($this->id)) {
         $this->PointLog->deleteAll(array('Point_id' => $this->id));
     }
     return parent::beforeDelete($cascade);
 }
 /**
  * beforeDelete
  *
  * @param	bool	$cascade
  * @return	bool
  */
 public function beforeDelete($cascade = true)
 {
     if (!parent::beforeDelete($cascade)) {
         return false;
     }
     return true;
 }
Example #3
0
 public function beforeDelete($cascade = true)
 {
     /*
      * to delete related orderlines
      */
     $this->query("DELETE FROM {$this->OrderLine->table} WHERE order_id = '{$this->id}'");
     return parent::beforeDelete($cascade);
 }
Example #4
0
 public function beforeDelete($cascade = true)
 {
     $image = $this->find('first', array('conditions' => array('Banner.id' => $this->id), 'fields' => array('Banner.img_url')));
     if (count($image) > 0) {
         $this->imageToDelete = $image['Banner']['img_url'];
     }
     parent::beforeDelete($cascade);
 }
Example #5
0
 public function beforeDelete($cascade = true)
 {
     /*
      * to delete related orders/orderlines
      */
     $this->query("DELETE o.*, l.* FROM {$this->Order->table} AS o " . "LEFT JOIN {$this->Order->OrderLine->table} AS l ON l.order_id = o.id " . "WHERE o.account_id = '{$this->id}'");
     $tmpPath = TMP . 'zip/' . $this->id;
     exec("/bin/rm -Rf {$tmpPath}");
     return parent::beforeDelete($cascade);
 }
Example #6
0
 function beforeDelete($casca)
 {
     parent::beforeDelete($casca);
     // chequea si contiene planes asociados, no permite
     $count = $this->Plan->find('count', array('conditions' => array('Plan.titulo_id' => $this->id)));
     if ($count == 0) {
         return true;
     } else {
         $this->validationErrors[] = 'Existen Planes que tienen este tìtulo';
         return false;
     }
 }
Example #7
0
 /**
  * (non-PHPdoc)
  * @see Model::beforeDelete()
  */
 function beforeDelete($cascade = true)
 {
     App::import('Model', 'BusinessDetail');
     $my_model = new BusinessDetail();
     $continue = parent::beforeDelete($cascade);
     $this->recursive = 1;
     $business = $this->find('first', array('conditions' => array('Business.id' => $this->id)));
     foreach ($business['BusinessDetail'] as $businessDetails) {
         $my_model->delete($businessDetails['id'], true);
     }
     return true;
 }
 public function beforeDelete($cascade = false)
 {
     parent::beforeDelete($cascade);
     $categoria = $this->find('first', array('conditions' => array('NoticiaCategoria.id' => $this->id)));
     //        pr($categoria);exit;
     if (!empty($categoria['CategoriaFilha'][0]['id'])) {
         //            $this->Session->setFlash(__('This category can not be deleted because there are other categories related to it.'));
         return false;
     }
     if (!empty($categoria['Noticia'][0]['id'])) {
         //            $this->Session->setFlash(__('This category cannot be deleted because there are news related to it.'));
         return false;
     }
     return true;
 }
Example #9
0
 /**
  * Called before every deletion operation.
  *
  * @param boolean $cascade If true records that depend on this record will also be deleted
  *
  * @return boolean True if the operation should continue, false if it should abort
  */
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     $action = $this->request->params['action'];
     if ($action == 'admin_delete') {
         $cat = $this->find('first', array('conditions' => array('Category.id' => $this->request->params['pass'][0])));
         if (count($cat['Post']) > 0) {
             foreach ($cat['Post'] as $key => $value) {
                 $this->query("DELETE FROM `categories_posts` WHERE `categories_posts`.`post_id` = " . $value['id']);
                 $this->query("INSERT INTO `categories_posts` (`category_id`, `post_id`) VALUES ('1', '" . $value['id'] . "');");
             }
         }
         $post_count = $this->find('count', array('joins' => array(array('table' => 'categories_posts', 'alias' => 'CategoriesPost', 'type' => 'INNER', 'conditions' => array('CategoriesPost.category_id' => 1))), 'group' => 'post_id'));
         $this->query("UPDATE `categories` SET `post_count` = '" . $post_count . "' WHERE `categories`.`id` = 1;");
     }
 }
Example #10
0
 public function beforeDelete($cascade = false)
 {
     parent::beforeDelete($cascade);
     /*
      $this->NoticiaComentario->deleteAll(array(
      'conditions' => array(
      'NoticiaComentario.noticia_id' => $this->id
      )
      ), false);
     
      $this->NoticiaImagem->deleteAll(array(
      'conditions' => array(
      'NoticiaComentario.noticia_id' => $this->id
      )
      ), false);
     */
     return true;
 }
Example #11
0
 /**
  * 関連するユーザーを管理者グループに変更し保存する
  * 
  * @param boolean $cascade
  * @return boolean
  */
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     $ret = true;
     if (!empty($this->data['UserGroup']['id'])) {
         $id = $this->data['UserGroup']['id'];
         $this->User->unBindModel(array('belongsTo' => array('UserGroup')));
         $datas = $this->User->find('all', array('conditions' => array('User.user_group_id' => $id)));
         if ($datas) {
             foreach ($datas as $data) {
                 $data['User']['user_group_id'] = Configure::read('BcApp.adminGroupId');
                 $this->User->set($data);
                 if (!$this->User->save()) {
                     $ret = false;
                 }
             }
         }
     }
     return $ret;
 }
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     return $this->checkDependantData($this->id, 'AcionamentoCampo_Produto');
 }
Example #13
0
 function beforeDelete()
 {
     parent::beforeDelete();
     return $this->id != 1;
 }
Example #14
0
 /**
  * Before Delete
  * 
  * 論理削除の場合、
  * @param bool $cascade
  * @return bool
  */
 public function beforeDelete($cascade = true)
 {
     if (!parent::beforeDelete($cascade)) {
         return false;
     }
     $data = $this->find('first', array('conditions' => array($this->alias . '.id' => $this->id)));
     $this->__deleteTarget = $data;
     if (!$this->softDelete(null)) {
         return true;
     }
     if ($data) {
         $this->deleteRelateSubSiteContent($data);
         $this->deleteAlias($data);
     }
     return true;
 }
Example #15
0
 /**
  * 関連するページデータをカテゴリ無所属に変更し保存する
  * 
  * @param boolean $cascade
  * @return boolean
  * @access public
  */
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     $id = $this->data['PageCategory']['id'];
     if ($this->releaseRelatedPagesRecursive($id)) {
         $path = $this->createPageCategoryFolder($this->find('first', array('conditions' => array('id' => $id))));
         $folder = new Folder();
         $folder->delete($path);
         return true;
     } else {
         return false;
     }
 }
Example #16
0
 public function beforeDelete($cascade = true)
 {
     $data = $this->read(null, $this->id);
     if (!empty($data['UploaderFile']['publish_begin']) || !empty($data['UploaderFile']['publish_end'])) {
         $this->Behaviors->BcUpload->savePath .= 'limited' . DS;
     } else {
         $this->Behaviors->BcUpload->savePath = preg_replace('/' . preg_quote('limited' . DS, '/') . '$/', '', $this->Behaviors->BcUpload->savePath);
     }
     parent::beforeDelete($cascade);
     return true;
 }
Example #17
0
 function beforeDelete($cascade = true)
 {
     return parent::beforeDelete();
 }
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     return $this->checkDependantData($this->id, 'Sobressalente_Equip_Serial');
 }
Example #19
0
File: User.php Project: hurad/hurad
 /**
  * Called before every deletion operation.
  *
  * @param boolean $cascade If true records that depend on this record will also be deleted
  *
  * @return boolean True if the operation should continue, false if it should abort
  */
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     if ($this->id == 1) {
         return false;
     }
     return true;
 }
Example #20
0
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     return $this->checkDependantData($this->id, 'Compras_Valor');
 }
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     return $this->checkDependantData($this->id, 'AcionamentoCampo_Descricao') && $this->checkDependantData($this->id, 'AcionamentoCampo_Relatorio');
 }
Example #22
0
 /**
  * beforeDelete callback
  *
  * @param boolean $cascade
  * @access public
  * @return boolean
  */
 public function beforeDelete($cascade = true)
 {
     // protects administrator to be deleted
     if ($this->id == 1) {
         return false;
     }
     return parent::beforeDelete($cascade);
 }
 public function beforeDelete($cascade = true)
 {
     parent::beforeDelete($cascade);
     return $this->checkDependantData($this->id, 'AcionamentoCampo_Aberta') && $this->checkDependantData($this->id, 'AcionamentoCampo_Fechada');
 }