예제 #1
0
 /**
  * @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();
 }
예제 #2
0
 /**
  * Saves this object
  *
  * @return bool
  **/
 public function save()
 {
     $result = parent::save();
     if ($result) {
         $this->resetTimeOfModification();
     }
     return $result;
 }
예제 #3
0
 public function save()
 {
     $this->_mapper->access($this, 'WRITE');
     $this->mdate = M('Tools')->date()->dbDateTime();
     if ($this->stable) {
         $this->setName();
     }
     parent::save();
     foreach ($this->values() as $item) {
         $item->save();
     }
     $this->_mapper->createStable($this);
     $this->_mapper->_setCollection('hide', $this, $this->_hide);
     $this->_mapper->_setCollection('other', $this, $this->_other);
 }
예제 #4
0
 public function save()
 {
     $this->_mapper->access($this, 'OFS-WRITE-INFO');
     if ($this->_props['name'] === NULL) {
         $this->_props['name'] = $this->_mapper->uniqueFilename();
     }
     if (is_array($this->_props['properties'])) {
         $this->_props['properties'] = serialize($this->_props['properties']);
     }
     $this->_props['type'] = $this->getType();
     $this->_props['mdate'] = M('Tools')->date()->dbDateTime();
     return parent::save();
 }
예제 #5
0
 public function save(RM_Account_iUser $obUser = NULL, $update_root = FALSE)
 {
     // не менять state вложенных сообщений
     if ($this->level > 0 && $this->state && $this->state != 'simple') {
         throw new Exception(__METHOD__ . "(): Cannot change state of nested message");
     }
     if (!parent::save()) {
         return FALSE;
     }
     $this->_mapper->tree->rebuildNode($this);
     if (isNull($obUser)) {
         $obUser = me();
     }
     /*		if (!$this->isState($this->state) || $this->state == 'new')
     		{
     			$this->_initState($this->state);
     			$this->state()->saveStateHistory($obUser);
     		}*/
     if ($this->_state_changed == TRUE) {
         $this->state()->saveStateHistory($obUser, $this->_state_changed_time);
         $this->_state_changed = FALSE;
         $this->_state_changed_time = NULL;
     }
     // set branch as updated
     if ($this->level > 0) {
         $rootTicket = $this->getRootOfBranch();
         $rootTicket->modified = M('Tools')->date()->dbDateTime();
         if ($update_root == TRUE) {
             $rootTicket->renew($obUser);
         } else {
             $rootTicket->save();
         }
         // save only
         //if (!$rootTicket->isState('new'))
     }
     return TRUE;
 }
예제 #6
0
 /**
  * Saves this object
  *
  * @return bool
  **/
 public function save()
 {
     if ($this->_existsInDb()) {
         $this->access('EDIT');
     }
     $this->_checkEntityFields();
     $this->_mapper->tree->rebuildNode($this);
     return parent::save();
 }
예제 #7
0
 /**
  * Enter description here...
  *
  * @return void
  */
 public function save()
 {
     $this->getState()->execute();
     if ($this->_checkData()) {
         $this->_saveTypeProps();
         parent::save();
     }
     return TRUE;
 }
예제 #8
0
 /**
  * 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();
 }
예제 #9
0
 public function save()
 {
     if (!$this->cdate) {
         $this->cdate = M('Date')->dbDateTime();
     }
     $this->mdate = M('Date')->dbDateTime();
     if (!$this->calculated) {
         $this->calculated = 0;
     }
     parent::save();
 }
예제 #10
0
 /**
  * Saves this object
  *
  * @return bool
  **/
 public function save()
 {
     $this->user_id = me()->id();
     $this->eng_name = mb_strtolower($this->eng_name, mb_detect_encoding($this->eng_name));
     $this->rus_name = mb_strtolower($this->rus_name, mb_detect_encoding($this->rus_name));
     return parent::save();
 }
예제 #11
0
 /**
  *	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();
 }
예제 #12
0
 /**
  * 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();
 }
예제 #13
0
 /**
  * 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();
 }
예제 #14
0
 /**
  * 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();
 }
예제 #15
0
 /**
  * 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();
 }
예제 #16
0
 /**
  * Saves report object
  *
  * @return void
  **/
 public function save()
 {
     // проверим права доступа на запись отчета
     $this->_mapper->access($this, 'WRITE');
     // выставим текущую дату модификации
     $this->mdate = M('Tools')->date()->dbDateTime();
     // получим объект валидатор в зависимости от контекста
     $this->validator($this->_mapper->getValidator($this));
     // проверим чтобы parent_id не был равен id этого отчета
     if ($this->parent_id === $this->id()) {
         throw new RM_Base_Exception_BadUsage(__METHOD__ . "(): Parent id cannot be equal primary id!");
     }
     // клиент сохраняет отчет, который является дочерним по отношению к другому
     // в такой ситуации родительский отчет удалить, а у нашего подменить hash_id
     $this->_replaceParentIfCan();
     // выставим некоторые свойства по умолчанию
     // see __set() for details
     if (is_null($this->parent_id)) {
         $this->parent_id = 0;
     }
     if (!$this->stable) {
         $this->stable = 0;
     }
     if (is_null($this->is_dynamic)) {
         $this->is_dynamic = 0;
     }
     if (!$this->brand_id) {
         $this->brand_id = NULL;
     }
     $this->_mapper->_setCollection('hide', $this, $this->_invisible);
     $this->_mapper->_setCollection('group', $this, $this->_grouping);
     // сохраним отчет в базе
     return parent::save();
 }
예제 #17
0
파일: Item.class.php 프로젝트: evilgeny/bob
 /**
  * Save object
  *
  * @return bool 
  */
 public function save()
 {
     $this->invoice_state = $this->_state()->getName();
     $this->mdate = M('Date')->dbDateTime();
     return parent::save();
 }