Index: trunk/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r4664 -r4758 --- trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4664) +++ trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4758) @@ -1,8 +1,8 @@ setEventParam('PermSection', $this->Application->GetVar('section')); return parent::CheckPermission($event); } - - + + /** * Apply any custom changes to list's sql query * @@ -25,10 +25,10 @@ function SetCustomQuery(&$event) { $object =& $event->getObject(); - + $module = $this->Application->GetVar('module'); $section = $this->Application->GetVar('section'); - + $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module)); $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section)); } @@ -41,7 +41,7 @@ function OnBeforeItemUpdate(&$event) { $object =& $event->getObject(); - + // if password field is empty, then don't update if ($object->GetDBField('element_type') == 'password') { if (trim($object->GetDBField('VariableValue')) == '') { @@ -52,24 +52,24 @@ $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); } } - + $field_values = $this->Application->GetVar($event->getPrefixSpecial(true)); - + $state_country_hash = Array( 'Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country' ); - + $field_name = $object->GetDBField('VariableName'); if (isset($state_country_hash[$field_name])) { // if this is state field $check_state = $object->GetDBField('VariableValue'); $check_country = $field_values[ $state_country_hash[$field_name] ]['VariableValue']; - + if (!($check_country && $check_state)) { return true; } - + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); $state_iso = $cs_helper->CheckState($check_state, $check_country); if ($state_iso !== false) { @@ -79,17 +79,17 @@ { $errormsgs = $this->Application->GetVar('errormsgs'); $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special]; - + $errors[$field_name] = 'la_InvalidState'; $errormsgs[$event->Prefix_Special] = $errors; - + $this->Application->SetVar('errormsgs', $errormsgs); $event->status = erFAIL; } } - + } - + /** * Enter description here... * @@ -105,8 +105,8 @@ $object->SetFieldOptions('VariableValue', $field_options); } } - } - + } + /** * Enter description here... * @@ -115,37 +115,41 @@ function OnUpdate(&$event) { if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { - + // 1. save user selected module root category $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); $new_category_id = getArrayValue($items_info, 'ModuleRootCategory', 'VariableValue'); if ($new_category_id) { unset($items_info['ModuleRootCategory']); $this->Application->SetVar($event->getPrefixSpecial(true), $items_info); } - + parent::OnUpdate($event); - + if ($event->status == erSUCCESS && $new_category_id !== false) { // root category was submitted $module = $this->Application->GetVar('module'); $root_category_id = $this->Application->findModule('Name', $module, 'RootCat'); - + if ($root_category_id != $new_category_id) { // root category differs from one in db $fields_hash = Array('RootCat' => $new_category_id); $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Modules', 'Name = '.$this->Conn->qstr($module)); } } + + if ($event->status == erSUCCESS) { // reset cache + $this->Application->UnitConfigReader->ResetParsedData(); + } } - + if ($this->Application->GetVar('errormsgs')) { // because we have list out there, and this is item $this->Application->removeObject($event->getPrefixSpecial()); $event->redirect = false; } } - + /** * Enter description here... * @@ -163,11 +167,11 @@ $array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue']; } } - + $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! $event->redirect = false; }*/ - + /** * Allows to process module root category selection * @@ -176,10 +180,10 @@ function OnSelectItems(&$event) { $object =& $event->getObject( Array('skip_autoload' => true) ); - + $items_info = $this->Application->GetVar('c'); list($resource_id, $field_values) = each($items_info); - + if ($resource_id) { $sql = 'SELECT CategoryId FROM '.TABLE_PREFIX.'Category @@ -189,9 +193,9 @@ } $this->finalizePopup($event); } - + } - - + + ?> \ No newline at end of file