/** * Override update() to generate sortable version of user-defined identifier field */ public function update($pa_options = null) { global $AUTH_CURRENT_USER_ID; if ($this->getAppConfig()->get('perform_item_level_access_checking')) { if ($this->checkACLAccessForUser(new ca_users($AUTH_CURRENT_USER_ID)) < __CA_ACL_EDIT_ACCESS__) { $this->postError(2580, _t("You do not have edit access for this item: %1/%2", $this->tableName(), $this->getPrimaryKey()), "BundlableLabelableBaseModelWithAttributes->update()"); return false; } } $vb_we_set_transaction = false; if (!$this->inTransaction()) { $this->setTransaction(new Transaction($this->getDb())); $vb_we_set_transaction = true; } $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID(); $this->opo_app_plugin_manager->hookBeforeBundleUpdate(array('id' => $this->getPrimaryKey(), 'table_num' => $this->tableNum(), 'table_name' => $this->tableName(), 'instance' => $this)); $va_errors = array(); if (!$this->_validateIncomingAdminIDNo(true, false)) { $va_errors = $this->errors(); // don't save number if it's invalid if ($vs_idno_field = $this->getProperty('ID_NUMBERING_ID_FIELD')) { $this->set($vs_idno_field, $this->getOriginalValue($vs_idno_field)); } } else { $this->_generateSortableIdentifierValue(); } // Process "access_inherit_from_parent" flag where supported if ((bool) $this->getAppConfig()->get($this->tableName() . '_allow_access_inheritance') && $this->hasField('access_inherit_from_parent')) { // Child record with inheritance set if ((bool) $this->get('access_inherit_from_parent') && ($vn_parent_id = $this->get('parent_id')) > 0) { $t_parent = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum(), false); if ($t_parent->load($vn_parent_id)) { $this->set('access', $t_parent->set('access')); } } // Parent record for which access is changing if ($this->changed('access')) { $this->getDb()->query("\n\t\t\t\t\tUPDATE " . $this->tableName() . " SET access = ? \n\t\t\t\t\tWHERE\n\t\t\t\t\t\tparent_id = ? AND access_inherit_from_parent = 1\n\t\t\t\t", array((int) $this->get('access'), $this->getPrimaryKey())); } } $vn_rc = parent::update($pa_options); $this->errors = array_merge($this->errors, $va_errors); $this->opo_app_plugin_manager->hookAfterBundleUpdate(array('id' => $this->getPrimaryKey(), 'table_num' => $this->tableNum(), 'table_name' => $this->tableName(), 'instance' => $this)); if ($vb_web_set_change_log_unit_id) { BaseModel::unsetChangeLogUnitID(); } if ($vb_we_set_transaction) { $this->removeTransaction($vn_rc); } SearchResult::clearResultCacheForRow($this->tableName(), $this->getPrimaryKey()); return $vn_rc; }
public function update($pa_options = null) { $this->set('settings', ca_metadata_elements::$s_settings_cache[$this->getPrimaryKey()]); return parent::update($pa_options); }
/** * Override update() to generate sortable version of user-defined identifier field */ public function update($pa_options = null) { global $AUTH_CURRENT_USER_ID; if ($this->getAppConfig()->get('perform_item_level_access_checking')) { if ($this->checkACLAccessForUser(new ca_users($AUTH_CURRENT_USER_ID)) < __CA_ACL_EDIT_ACCESS__) { $this->postError(2580, _t("You do not have edit access for this item: %1/%2", $this->tableName(), $this->getPrimaryKey()), "BundlableLabelableBaseModelWithAttributes->update()"); return false; } } $vb_we_set_transaction = false; if (!$this->inTransaction()) { $this->setTransaction(new Transaction($this->getDb())); $vb_we_set_transaction = true; } $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID(); $this->opo_app_plugin_manager->hookBeforeBundleUpdate(array('id' => $this->getPrimaryKey(), 'table_num' => $this->tableNum(), 'table_name' => $this->tableName(), 'instance' => $this)); $va_errors = array(); if (!$this->_validateIncomingAdminIDNo(true, false)) { $va_errors = $this->errors(); // don't save number if it's invalid if ($vs_idno_field = $this->getProperty('ID_NUMBERING_ID_FIELD')) { $this->set($vs_idno_field, $this->getOriginalValue($vs_idno_field)); } } else { $this->_generateSortableIdentifierValue(); } $vn_rc = parent::update($pa_options); $this->errors = array_merge($this->errors, $va_errors); $this->opo_app_plugin_manager->hookAfterBundleUpdate(array('id' => $this->getPrimaryKey(), 'table_num' => $this->tableNum(), 'table_name' => $this->tableName(), 'instance' => $this)); if ($vb_web_set_change_log_unit_id) { BaseModel::unsetChangeLogUnitID(); } if ($vb_we_set_transaction) { $this->removeTransaction($vn_rc); } return $vn_rc; }
public function update($pa_options = null) { $this->set('settings', MemoryCache::fetch($this->getPrimaryKey(), 'ElementSettings')); return parent::update($pa_options); }