18 require_once SQ_INCLUDE_PATH.
'/asset.inc';
43 $this->_ser_attrs = TRUE;
44 parent::__construct($assetid);
61 if (!parent::_preCreateCheck($link))
return FALSE;
63 $name = trim($this->
attr(
'name'));
65 trigger_localised_error(
'CORE0083', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
83 $allowed = parent::_getAllowedLinks();
84 $allowed[SQ_LINK_NOTICE][
'asset'] = Array(
'card' =>
'M',
'exclusive' => FALSE);
102 return $this->
attr(
'name');
124 if (isset($this->_tmp[
'vars_set'][
'code'][
'old_value'])) {
125 $old_link_value = $this->_tmp[
'vars_set'][
'code'][
'old_value'];
126 $new_link_value = $this->
attr(
'code');
127 $am = $GLOBALS[
'SQ_SYSTEM']->am;
128 $links = $am->getLinks($this->
id, SQ_LINK_NOTICE,
'', FALSE,
'major', $old_link_value);
130 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
131 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
134 foreach ($links as $link) {
135 if (!$am->updateLink($link[
'linkid'], $link[
'link_type'], $new_link_value)) {
136 throw new Exception(
"The value of the notice link #{$link['linkid']} could not be updated to $new_link_value");
140 if (!parent::saveAttributes($dont_run_updated)) {
141 throw new Exception(
'The attributes could not be saved');
144 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
145 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
149 }
catch (Exception $e) {
150 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
151 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
156 return parent::saveAttributes($dont_run_updated);
174 if (isset($this->_tmp[
'vars_set'][$name][
'old_value'])) {
175 $value = $this->_tmp[
'vars_set'][$name][
'old_value'];
177 $value = $this->
attr(
'code');
193 return $this->
attr(
'rules');
208 $rules = $this->
attr(
'rules');
209 $am = $GLOBALS[
'SQ_SYSTEM']->am;
211 foreach ($rules as $rule) {
212 $rule_type_code = $rule[
'rule_type_code'];
213 $am->includeAsset($rule_type_code);
214 $rule_asset =
new $rule_type_code();
215 $rule_asset->evaluate($asset_data, $rule[
'rule_data']);