Index: trunk/kernel/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r4043 -r4207 --- trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4043) +++ trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4207) @@ -28,6 +28,8 @@ 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')) == '') { $field_options = $object->GetFieldOptions('VariableValue'); @@ -38,36 +40,36 @@ } } - $submitted_vars = $this->Application->GetVar('conf'); + $field_values = $this->Application->GetVar($event->getPrefixSpecial(true)); - //$this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State'); - $this->state_country_pairs = Array('Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country'); + $state_country_hash = Array('Comm_State' => 'Comm_Country', + 'Comm_Shipping_State' => 'Comm_Shipping_Country'); - if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ) { - //$this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue'); - $check_state = $object->GetDBField('VariableValue'); - $check_country = $submitted_vars[$this->state_country_pairs[$object->GetDBField('VariableName')]]['VariableValue']; - //} - //if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) ) - //{ - $cs_helper = &$this->Application->recallObject('CountryStatesHelper'); - $state_valid_code = $cs_helper->CheckState( $check_state, $check_country ); - if ($state_valid_code !== false) - { - $object->SetDBField('VariableValue', $state_valid_code); + $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) { + $object->SetDBField('VariableValue', $state_iso); + } else { $errormsgs = $this->Application->GetVar('errormsgs'); $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special]; - $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState'; + $errors[$field_name] = 'la_InvalidState'; $errormsgs[$event->Prefix_Special] = $errors; $this->Application->SetVar('errormsgs', $errormsgs); - - $event->redirect = false; $event->status = erFAIL; } } @@ -105,6 +107,8 @@ $event->SetRedirectParam('opener', 's'); if ($this->Application->GetVar('errormsgs')) { + // because we have list out there, and this is item + $this->Application->removeObject($event->getPrefixSpecial()); $event->redirect = false; } } Index: trunk/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r4043 -r4207 --- trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4043) +++ trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4207) @@ -28,6 +28,8 @@ 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')) == '') { $field_options = $object->GetFieldOptions('VariableValue'); @@ -38,36 +40,36 @@ } } - $submitted_vars = $this->Application->GetVar('conf'); + $field_values = $this->Application->GetVar($event->getPrefixSpecial(true)); - //$this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State'); - $this->state_country_pairs = Array('Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country'); + $state_country_hash = Array('Comm_State' => 'Comm_Country', + 'Comm_Shipping_State' => 'Comm_Shipping_Country'); - if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ) { - //$this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue'); - $check_state = $object->GetDBField('VariableValue'); - $check_country = $submitted_vars[$this->state_country_pairs[$object->GetDBField('VariableName')]]['VariableValue']; - //} - //if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) ) - //{ - $cs_helper = &$this->Application->recallObject('CountryStatesHelper'); - $state_valid_code = $cs_helper->CheckState( $check_state, $check_country ); - if ($state_valid_code !== false) - { - $object->SetDBField('VariableValue', $state_valid_code); + $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) { + $object->SetDBField('VariableValue', $state_iso); + } else { $errormsgs = $this->Application->GetVar('errormsgs'); $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special]; - $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState'; + $errors[$field_name] = 'la_InvalidState'; $errormsgs[$event->Prefix_Special] = $errors; $this->Application->SetVar('errormsgs', $errormsgs); - - $event->redirect = false; $event->status = erFAIL; } } @@ -105,6 +107,8 @@ $event->SetRedirectParam('opener', 's'); if ($this->Application->GetVar('errormsgs')) { + // because we have list out there, and this is item + $this->Application->removeObject($event->getPrefixSpecial()); $event->redirect = false; } } Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r3391 -r4207 --- trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3391) +++ trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4207) @@ -12,12 +12,10 @@ */ function SetCustomQuery(&$event) { - if($event->Special == 'module') - { + if ($event->Special == 'module') { $object =& $event->getObject(); - $this->Application->LinkVar('module', 'current_module'); - $module = $this->Application->GetVar('module'); - $object->addFilter('module_filter', '%1$s.Module = \''.$module.'\''); + $module_owner = $this->Application->GetLinkedVar('module'); + $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner)); } } Index: trunk/kernel/units/modules/modules_event_handler.php =================================================================== diff -u -N -r1591 -r4207 --- trunk/kernel/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 1591) +++ trunk/kernel/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 4207) @@ -3,32 +3,21 @@ class ModulesEventHandler extends InpDBEventHandler { /** - * Builds list - * - * @param kEvent $event - * @access protected - */ - function OnListBuild(&$event) - { - parent::OnListBuild($event); - } - - /** * Builds item * * @param kEvent $event * @access protected */ function OnItemBuild(&$event) { - $this->Application->SetVar( $event->getPrefixSpecial(true).'_id', $event->Special); + $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special); parent::OnItemBuild($event); } function SetCustomQuery(&$event) { - $object=&$event->getObject(); - $object->addFilter('current_module', 'Name='.$event->Special); + $object =& $event->getObject(); + $object->addFilter('current_module', 'Name = '.$event->Special); } } Index: trunk/core/units/modules/modules_event_handler.php =================================================================== diff -u -N -r1591 -r4207 --- trunk/core/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 1591) +++ trunk/core/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 4207) @@ -3,32 +3,21 @@ class ModulesEventHandler extends InpDBEventHandler { /** - * Builds list - * - * @param kEvent $event - * @access protected - */ - function OnListBuild(&$event) - { - parent::OnListBuild($event); - } - - /** * Builds item * * @param kEvent $event * @access protected */ function OnItemBuild(&$event) { - $this->Application->SetVar( $event->getPrefixSpecial(true).'_id', $event->Special); + $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special); parent::OnItemBuild($event); } function SetCustomQuery(&$event) { - $object=&$event->getObject(); - $object->addFilter('current_module', 'Name='.$event->Special); + $object =& $event->getObject(); + $object->addFilter('current_module', 'Name = '.$event->Special); } } Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r3391 -r4207 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3391) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4207) @@ -12,12 +12,10 @@ */ function SetCustomQuery(&$event) { - if($event->Special == 'module') - { + if ($event->Special == 'module') { $object =& $event->getObject(); - $this->Application->LinkVar('module', 'current_module'); - $module = $this->Application->GetVar('module'); - $object->addFilter('module_filter', '%1$s.Module = \''.$module.'\''); + $module_owner = $this->Application->GetLinkedVar('module'); + $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner)); } } Index: trunk/kernel/units/help/help_tag_processor.php =================================================================== diff -u -N -r2990 -r4207 --- trunk/kernel/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 2990) +++ trunk/kernel/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4207) @@ -30,7 +30,7 @@ function ShowHelp($params) { $module = $this->Application->GetVar('h_module'); - if (!$module) $module = $this->Application->RecallVar('current_module'); + if (!$module) $module = $this->Application->RecallVar('module'); $title_preset = $this->Application->GetVar('h_title_preset'); $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) ); Index: trunk/core/units/help/help_tag_processor.php =================================================================== diff -u -N -r2990 -r4207 --- trunk/core/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 2990) +++ trunk/core/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4207) @@ -30,7 +30,7 @@ function ShowHelp($params) { $module = $this->Application->GetVar('h_module'); - if (!$module) $module = $this->Application->RecallVar('current_module'); + if (!$module) $module = $this->Application->RecallVar('module'); $title_preset = $this->Application->GetVar('h_title_preset'); $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) ); Index: trunk/kernel/admin_templates/config/config_search.tpl =================================================================== diff -u -N -r4052 -r4207 --- trunk/kernel/admin_templates/config/config_search.tpl (.../config_search.tpl) (revision 4052) +++ trunk/kernel/admin_templates/config/config_search.tpl (.../config_search.tpl) (revision 4207) @@ -4,7 +4,7 @@ - +