/** * Description... * * @return void **/ public function delete() { if (count($this->_mapper->getUsers()->filter('company_id=?', $this->id())) > 0) { throw new RM_Validator_Exception(M('Base')->error('has_clients')); } parent::delete(); }
/** * @see RM_Store_Object::save() */ public function save() { if (!$this->_existsInDb()) { $this->_mapper->access($this, 'CATEGORY.CREATE'); } if (!$this->owner_id) { $this->owner_id = -1; } if (!$this->generaltype_id && $this->name) { $this->generaltype_id = M('Guid')->get(G('generaltype-fake')); } if (!$this->cdate) { $this->cdate = M('Date')->dbDateTime(); } $mask = array(); foreach ($this->_props as $name => $value) { if ($value != $this->_propInitial($name)) { $mask = $this->_mapper->_getCheckMaskArray($name); } } $this->changed_by = me()->id(); if ($mask) { $this->_mapper->access($this, join('|', $mask)); } $this->mdate = M('Date')->dbDateTime(); return parent::save(); }
public function free() { unset($this->_mapper); parent::free(); }
/** * Deletes this object * * @return bool **/ public function delete() { // нельзя удалить, если привязан к брикам if (count($this->getBricks()) > 0) { $res = new RM_Base_Result(); $res->error('attribute_has_brick'); throw new RM_Validator_Exception($res); } if (parent::delete()) { // удалить все зависимости value // удалить master2slave зависимости // .... хотя это делать не нужно, потому как если нету привязки к брикам, то и value нельзя привязать $this->resetTimeOfModification(); return TRUE; } return FALSE; }
/** * Deletes ticket * * @return void */ public function delete() { $this->_mapper->tree->removeNode($this); $this->state()->deleteStateHistory(); $this->_mapper->deleteFromUnread($this); if ($this->level > 0 && !isNull($obRootTicket = $this->getRootOfBranch())) { $branch = $obRootTicket->getBranch(); $obRootTicket->branch_count = count($branch); $obRootTicket->save(); } return parent::delete(); }
/** * Deletes this object and children nodes * * @return bool **/ public function delete() { $this->access('EDIT'); foreach ($this->getChildren() as $obEntity) { $this->_mapper->tree->removeNode($obEntity); $obEntity->delete(); } $this->_mapper->tree->removeNode($this); return parent::delete(); }
public function delete() { $this->_fs()->delete(); parent::delete(); }
/** * Deletes report object * * @return void **/ public function delete() { // проверим права доступа на запись отчета $this->_mapper->access($this, 'DELETE'); $result = parent::delete(); if ($result) { $this->_mapper->_deleteCollection('hide', $this); $this->_mapper->_deleteCollection('group', $this); // delete related objects $this->removeAllDiagrams(); $this->removeAllValues(); $this->removeAllRestrictions(); // delete related tables $table_name = $this->getTableName(); M('Db')->setCurrentConnection('storage'); foreach (M('Db')->query('SHOW TABLES LIKE ?', $table_name . '%') as $row) { M('Db')->exec('DROP TABLE IF EXISTS ' . array_pop($row)); } M('Db')->setCurrentConnection('default'); // TODO: // delete permissions } return $result; }
/** * Deletes this object * * @return bool **/ public function delete() { // нельзя удалить, если привязаны брики // You cannot delete object because there are bricks linked with this entity if (count($this->getBricks()) > 0) { $res = new RM_Base_Result(); $res->error('has_brick'); throw new RM_Validator_Exception($res); } // нельзя удалить, если привязаны штрих-коды // You cannot delete object because there are barcodes linked with this entity if (count($this->getBarcodes()) > 0) { $res = new RM_Base_Result(); $res->error('has_barcode'); throw new RM_Validator_Exception($res); } /* foreach($this->getBricks() as $obBrick) $obBrick->removeFlavour($this); foreach($this->getBarcodes() as $obBarcode) $obBarcode->removeFlavour($this);*/ return parent::delete(); }
/** * Deletes this object * * @return bool **/ public function delete() { // нельзя удалить, если привязан к атрибутам if (count($this->getAttributes()) > 0) { $res = new RM_Base_Result(); $res->error('value_has_attribute'); throw new RM_Validator_Exception($res); } if (parent::delete()) { // удалить master2slave зависимости $this->resetTimeOfModification(); return TRUE; } return FALSE; }
/** * Description... * * @return void **/ public function save() { if (!$this->_existsInDb() || $this->_propInitial('company_id') && $this->_propInitial('company_id') != $this->company_id) { if (!isNull($company = $this->_mapper->loadCompanyById($this->_propInitial('company_id')))) { $company->getCompanyGroup()->removeUserFromGroup($this); } if (!isNull($company) && !isNull($company->getCompanyGroup())) { if (!isNull($company = $this->company(TRUE)) && !isNull($company->getCompanyGroup())) { $company->getCompanyGroup()->addUserToGroup($this); } } } parent::save(); }
/** * Enter description here... * * @return bool */ public function save() { if ($this->_existsInDb() && M('Holder')->usePermissions()) { M('Permission')->verify('HOLDER.EDIT', $this); } if ($this->_propsInitial['is_closed']) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ": you can't change closed holder"); } if ($this->_propsInitial['is_personal'] != $this->_props['is_personal']) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ": you can't change 'is_personal' value"); } if ($this->_propsInitial['city_id'] != $this->_props['city_id']) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ": you can't change city"); } if (!$this->canClose() && $this->is_closed) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : you can\'t close not empty holder'); } if (!$this->is_closed) { $this->is_closed = 0; } if (!$this->is_personal) { $this->is_personal = 0; } return parent::save(); }
/** * Save object * * @return bool */ public function save() { if ($this->from_holder_id == $this->to_holder_id) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : save invoice with from_holder_id = to_holder_id '); } if ($this->is_deleted || $this->state == RM_Holder_Invoice_State::CLOSED) { return FALSE; } if ($this->_canClouseInvoice()) { $this->changeState(RM_Holder_Invoice_State::CLOSED); } $this->state = $this->getState()->getName(); if (!$this->is_deleted) { $this->is_deleted = 0; } return parent::save(); }
/** * Enter description here... * * @return bool */ public function save() { $this->_countCartTotal(); foreach ($this->_items as $obCartItem) { $obCartItem->save(); } if (!$this->user_id) { $this->user_id = 0; } return parent::save(); }
/** * Description... * * @return void **/ public function delete() { if (!isNull($this->image())) { $this->image()->delete(); } parent::delete(); }
/** * Description... * * @return void **/ public function delete() { foreach ($this->_mapper->collectParams($this) as $item) { $item->delete(); } if (!isNull($this->_fs())) { $this->_fs()->delete(); } $this->_mapper->_deleteCollection('hide', $this); $this->_mapper->_deleteCollection('other', $this); $this->_mapper->_deleteCollection('other', $this); $this->_mapper->_deleteStorage($this); parent::delete(); }
/** * Deletes this object * * @return bool **/ public function delete() { // нельзя удалить, если привязаны "дочерние" entities if (count($this->getChildren()) > 0) { $res = new RM_Base_Result(); $res->error($this->type() . '_has_children'); throw new RM_Validator_Exception($res); } // нельзя удалить, если привязаны штрих-коды if (count($this->getBarcodes()) > 0) { $res = new RM_Base_Result(); $res->error('has_barcode'); throw new RM_Validator_Exception($res); } $result = parent::delete(); if ($result) { $this->resetTimeOfModification(); } return $result; }
/** * Save object * * @return bool */ public function save() { $this->invoice_state = $this->_state()->getName(); $this->mdate = M('Date')->dbDateTime(); return parent::save(); }
/** * Enter description here... * */ public function saveReceipt($typeValue = 0) { $this->_props['bit_mask'] = $this->_props['bit_mask'] | $typeValue; if ($this->_existsInDb() && $this->_propInitial('bdate') != $this->bdate) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : you can\'t change receipt `bdate`'); } if ($this->_propInitial('bit_mask') == 0 && $typeValue != $this->_mapper->_getBitMaskByName('real')) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ' : you can\'t change deleted `receipt`'); } return parent::save(); }
/** * Enter description here... * * @return bool */ public function save() { if (!$this->is_visible) { $this->is_visible = 0; } if (!$this->is_exists) { $this->is_exists = 0; } if (!$this->ord) { $this->ord = 0; } return parent::save(); }
public function delete() { $this->_mapper->memberDeleteAll($this); parent::delete(); }
/** * Enter description here... * * @return void */ public function delete() { if (!$this->canDelete()) { throw new RM_Base_Exception_BadUsage(__METHOD__ . ': please use canDelete() method for check delete possibility'); } return parent::delete(); }