Index: branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php =================================================================== diff -u -N -r16692 -r16779 --- branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 16692) +++ branches/5.2.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 16779) @@ -1,6 +1,6 @@ getObject(Array ('skip_autoload' => true)); $options = $object->GetFieldOptions('ExportPresets'); - $export_settings = $this->Application->RecallPersistentVar('export_settings'); + $where_clause = array( + 'ItemPrefix = ' . $this->Conn->qstr($event->Prefix), + 'PortalUserId = ' . $this->Application->RecallVar('user_id'), + ); + $sql = 'SELECT PresetData, PresetName + FROM ' . TABLE_PREFIX . 'ExportUserPresets + WHERE (' . implode(') AND (', $where_clause) . ')'; + $export_settings = $this->Conn->GetCol($sql, 'PresetName'); if ( !$export_settings ) { return; } - $export_settings = unserialize($export_settings); - - if ( !isset($export_settings[$event->Prefix]) ) { - return; - } - $export_presets = array ('' => ''); - foreach ($export_settings[$event->Prefix] as $key => $val) { - $export_presets[implode('|', $val['ExportColumns'])] = $key; + foreach ( $export_settings as $name => $data ) { + $data = json_decode($data, true); + $export_presets[implode('|', $data['ExportColumns'])] = $name; } $options['options'] = $export_presets; @@ -1488,12 +1490,13 @@ if ( $this->verifyOptions($event) ) { if ( $this->_getExportSavePreset($object) ) { - $name = $object->GetDBField('ExportPresetName'); - - $export_settings = $this->Application->RecallPersistentVar('export_settings'); - $export_settings = $export_settings ? unserialize($export_settings) : array (); - $export_settings[$event->Prefix][$name] = $field_values; - $this->Application->StorePersistentVar('export_settings', serialize($export_settings)); + $fields_hash = array( + 'PortalUserId' => $this->Application->RecallVar('user_id'), + 'ItemPrefix' => $event->Prefix, + 'PresetName' => $object->GetDBField('ExportPresetName'), + 'PresetData' => json_encode($field_values), + ); + $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'ExportUserPresets', 'REPLACE'); } $progress_t = $this->Application->RecallVar('export_progress_t');