Example #1
0
 public function delete($id)
 {
     //调用父类add方法
     $result = parent::delete($id);
     //删除文件夹
     $this->deldir('./Uploads/' . $id);
     return $result;
 }
Example #2
0
 public function delete()
 {
     if ($this->getCashAccount()->getBalanceInCent() != 0) {
         throw new Exception_BuisnessLogic("Das Konto von " . $this->getName() . " ist nicht ausgeglichen.");
     }
     if ($this->getCashAccount()->delete() > 0) {
         parent::delete();
     }
 }
Example #3
0
 public function delete($id)
 {
     $this->mapping->table = 'users_roles';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'userID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     try {
         parent::delete($id);
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(get_called_class() . "::" . __FUNCTION__, Text::read('message.model.error.delete'), $exception);
     }
 }
Example #4
0
 public function delete($id)
 {
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'featureID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     try {
         $this->dbh->beginTransaction();
         parent::delete($id);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.delete'), $exception);
     }
 }
 public function deleteResponse($id)
 {
     $id = (int) $id;
     $url = 'canned_responses/' . $id;
     return parent::delete($url);
 }
 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     $o_trans = null;
     if (!$this->inTransaction()) {
         $o_trans = new Transaction($this->getDb());
         $this->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vn_id = $this->getPrimaryKey();
     if (($vn_rc = parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) && (!$this->hasField('deleted') || caGetOption('hard', $pa_options, false))) {
         // Delete any associated attributes and attribute_values
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\tUSING ca_attributes \n\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.attribute_id = ca_attributes.attribute_id \n\t\t\t\t\tWHERE ca_attributes.table_num = ? AND ca_attributes.row_id = ?\n\t\t\t\t", array((int) $this->tableNum(), (int) $vn_id)))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attributes\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ttable_num = ? AND row_id = ?\n\t\t\t\t", array((int) $this->tableNum(), (int) $vn_id)))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         //
         // Remove any authority attributes that reference this row
         //
         if ($vn_element_type = (int) AuthorityAttributeValue::tableToElementType($this->tableName())) {
             if ($qr_res = $this->getDb()->query("\n\t\t\t\t\t\tSELECT ca.table_num, ca.row_id FROM ca_attributes ca\n\t\t\t\t\t\tINNER JOIN ca_attribute_values AS cav ON cav.attribute_id = ca.attribute_id \n\t\t\t\t\t\tINNER JOIN ca_metadata_elements AS cme ON cav.element_id = cme.element_id \n\t\t\t\t\t\tWHERE cme.datatype = ? AND cav.value_integer1 = ?\n\t\t\t\t\t", array($vn_element_type, (int) $vn_id))) {
                 $va_ids = array();
                 while ($qr_res->nextRow()) {
                     $va_ids[$qr_res->get('table_num')][] = $qr_res->get('row_id');
                 }
                 if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\t\t\tUSING ca_metadata_elements \n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.element_id = ca_metadata_elements.element_id \n\t\t\t\t\t\t\tWHERE ca_metadata_elements.datatype = ? AND ca_attribute_values.value_integer1 = ?\n\t\t\t\t\t\t", array($vn_element_type, (int) $vn_id)))) {
                     $this->errors = $this->getDb()->errors();
                     if ($o_trans) {
                         $o_trans->rollback();
                     }
                     if ($vb_web_set_change_log_unit_id) {
                         BaseModel::unsetChangeLogUnitID();
                     }
                     return false;
                 } else {
                     $o_indexer = new SearchIndexer($this->getDb());
                     foreach ($va_ids as $vs_table => $va_ids) {
                         $o_indexer->reindexRows($vs_table, $va_ids, array('transaction' => $o_trans));
                     }
                 }
             }
         }
         if ($o_trans) {
             $o_trans->commit();
         }
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         return $vn_rc;
     }
     if ($o_trans) {
         $vn_rc ? $o_trans->commit() : $o_trans->rollback();
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return $vn_rc;
 }
Example #7
0
 public function delete($id)
 {
     $id = (int) $id;
     $url = 'groups/' . $id;
     return parent::delete($url);
 }
Example #8
0
 public function delete()
 {
     $this->limit()->delete();
     return parent::delete();
 }
Example #9
0
 public function delete()
 {
     if ($this->hasDefaultProfileImage() == false) {
         $this->profileImage->delete();
     }
     foreach ($this->createdTasks as $task) {
         $task->delete();
     }
     foreach ($this->notificationEvents as $events) {
         $events->delete();
     }
     parent::delete();
 }
Example #10
0
 public function delete($id)
 {
     $data = $this->selectPhoto($id);
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'photoID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     try {
         $this->dbh->beginTransaction();
         parent::delete($id);
         $this->dbh->commit();
         // Elimina foto
         foreach (Config::read('upload.thumbnails')["types"] as $description) {
             $file = new File(Config::read('path.photos') . '/' . $data->album . '/' . $description . '-' . $data->url);
             $file->removeFile();
         }
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.delete'), $exception);
     }
 }
Example #11
0
 /**
  * delete user
  *
  * @param int
  */
 public function delete($id)
 {
     // check rights - client can delete only users who he created
     if (!$this->user->isAllowed(new UserResource($id), Acl::PRIVILEGE_DELETE)) {
         throw new OperationNotAllowedException();
     }
     parent::delete($id);
     dibi::query('CALL usersAfterDelete(%i)', $id);
 }
Example #12
0
 public function delete($login)
 {
     $url = 'agents/' . $login;
     return parent::delete($url);
 }
 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     if (!$this->inTransaction()) {
         $o_trans = new Transaction($this->getDb());
         $this->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vn_id = $this->getPrimaryKey();
     if (parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) {
         // Delete any associated attributes and attribute_values
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\tUSING ca_attributes \n\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.attribute_id = ca_attributes.attribute_id \n\t\t\t\t\tWHERE ca_attributes.table_num = ? AND ca_attributes.row_id = ?\n\t\t\t\t", (int) $this->tableNum(), (int) $vn_id))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attributes\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ttable_num = ? AND row_id = ?\n\t\t\t\t", (int) $this->tableNum(), (int) $vn_id))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if ($o_trans) {
             $o_trans->commit();
         }
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         return true;
     }
     if ($o_trans) {
         $o_trans->rollback();
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return false;
 }
Example #14
0
 function delete($o = null, $log = true)
 {
     // Remove all entry comments
     $this->comment->get();
     $this->comment->delete_all();
     parent::delete($o, $log);
 }
Example #15
0
 public function delete($pb_delete_related = false, $pa_options = NULL, $pa_fields = NULL, $pa_table_list = NULL)
 {
     $vn_rc = parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list);
     $this->flushLocaleListCache();
     return $vn_rc;
 }
Example #16
0
 public function delete($id)
 {
     $data = $this->selectForDetail($id);
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'productID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     try {
         $this->dbh->beginTransaction();
         parent::delete($id);
         $this->dbh->commit();
         // Elimina álbum de fotos
         $this->albumModel->delete($data->album);
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.delete'), $exception);
     }
 }
 public function deleteResponse($id)
 {
     $this->ensureInteger($id);
     $url = self::METHOD_PATH . '/' . $id;
     return parent::delete($url);
 }
 /**
  *
  */
 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     //$t_element = new ca_metadata_elements($this->get('element_id'));
     $t_element = ca_attributes::getElementInstance($this->get('element_id'));
     switch ($vn_data_type = $t_element->get('datatype')) {
         case 15:
             // FT_FILE
             $this->useBlobAsFileField(true);
             // force value_blob field to be treated as FT_FILE field by BaseModel
             break;
         case 16:
             // FT_MEDIA
             $this->useBlobAsMediaField(true);
             // force value_blob field to be treated as FT_MEDIA field by BaseModel
             break;
         default:
             // Reset value_blob field to default (FT_TEXT) – should already be that but we reset it just in case
             $this->useBlobAsMediaField(false);
             break;
     }
     return parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list);
 }
Example #19
0
 public function delete()
 {
     $this->user()->delete();
     return parent::delete();
 }
Example #20
0
 /**
  * Delete the model.
  *
  * @throws \Exception
  */
 public function delete()
 {
     \Cache::forget(self::getCacheKey($this->localizable_id, $this->region_code));
     parent::delete();
 }
 public function delete($login)
 {
     $url = self::METHOD_PATH . '/' . $login;
     return parent::delete($url);
 }