Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r5185 -r5340 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5185) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5340) @@ -64,8 +64,8 @@ return true; } } - - + + $section = $event->getSection(); if (!preg_match('/^CATEGORY:(.*)/', $section)) { // only if not category item events @@ -96,7 +96,7 @@ parent::mapPermissions(); $permissions = Array( 'OnLoad' => Array('self' => 'view', 'subitem' => 'view'), - + 'OnNew' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnCreate' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnUpdate' => Array('self' => 'edit', 'subitem' => 'add|edit'), @@ -1399,12 +1399,12 @@ $t = $this->Application->RecallVar('return_template'); $this->Application->RemoveVar('return_template'); - + // restore original "m" prefix all params, that have values before opening selector $return_m = $this->Application->RecallVar('return_m'); $this->Application->RemoveVar('return_m'); $this->Application->HttpQuery->parseEnvPart($return_m); - + $pass_events = $event->getEventParam('pass_events'); $redirect_params = array_merge_recursive2($event->redirect_params, Array('m_opener' => 'u', '__URLENCODE__' => 1)); @@ -1672,13 +1672,13 @@ $object =& $event->getObject(); $this->RemoveRequiredFields($object); $event->CallSubEvent('OnPreSave'); - + if ($event->status == erSUCCESS) { - + $resource_id = $this->Application->GetVar('translator_resource_id'); if ($resource_id) { $t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes')); - + $cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true)); $cdata->Load($resource_id, 'ResourceId'); if (!$cdata->isLoaded()) { @@ -1687,7 +1687,7 @@ } $this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID()); } - + $event->redirect = $this->Application->GetVar('translator_t'); $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'), $event->getPrefixSpecial(true).'_id' => $object->GetID(), @@ -1696,14 +1696,14 @@ 'trans_field' => $this->Application->GetVar('translator_field'), 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'), ); - + // 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect) $last_template = $this->Application->RecallVar('last_template'); preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets); $this->Application->StoreVar('return_template', $this->Application->GetVar('t')); } } - + function RemoveRequiredFields(&$object) { // making all field non-required to achieve successful presave @@ -1715,7 +1715,7 @@ } } } - + /** * Dynamically fills customdata config * @@ -1741,7 +1741,7 @@ // config doesn't have custom fields return false; } - + // 2. create fields (for customdata item) $fields = $this->Application->getUnitOption($event->Prefix, 'Fields', Array()); $field_options = Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'db_type' => 'text', 'default' => ''); @@ -1753,7 +1753,7 @@ // 3. create virtual & calculated fields (for main item) $calculated_fields = $this->Application->getUnitOption($main_prefix.'.', 'CalculatedFields', Array()); $virtual_fields = $this->Application->getUnitOption($main_prefix, 'VirtualFields', Array()); - + $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); @@ -1766,7 +1766,7 @@ else { unset($field_options['options'], $field_options['formatter']); } - + $custom_name = $custom_params['FieldName']; $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id); if (!isset($virtual_fields['cust_'.$custom_name])) {