Index: core/install/upgrades.sql
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/upgrades.sql (revision 15965)
+++ core/install/upgrades.sql (revision )
@@ -2989,3 +2989,8 @@
l<%PRIMARY_LANGUAGE%>_PlainTextBody = REPLACE(l<%PRIMARY_LANGUAGE%>_PlainTextBody, '', ''),
l<%PRIMARY_LANGUAGE%>_HtmlBody = REPLACE(l<%PRIMARY_LANGUAGE%>_HtmlBody, '', '')
WHERE TemplateName IN ('USER.SUBSCRIBE', 'USER.UNSUBSCRIBE');
+
+ALTER TABLE CategoryItems ADD Id int(11) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (Id);
+ALTER TABLE UserGroupRelations DROP PRIMARY KEY;
+ALTER TABLE UserGroupRelations ADD Id int(11) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (Id), ADD UNIQUE KEY UserGroup (PortalUserId, GroupId);
+ALTER TABLE SpamControl ADD Id int(11) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (Id);
\ No newline at end of file
Index: core/units/user_groups/user_groups_eh.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/user_groups/user_groups_eh.php (revision 15965)
+++ core/units/user_groups/user_groups_eh.php (revision )
@@ -43,8 +43,12 @@
$new_groups = array_diff($new_groups, $old_groups);
if ($new_groups) {
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN(Id) FROM ' . $table_name .' WHERE Id < 0' );
+
foreach ($new_groups as $new_group) {
+ $new_id--;
$fields_hash = Array (
+ 'Id' => $new_id,
'GroupId' => $new_group,
'PortalUserId' => $user_id,
);
@@ -73,8 +77,12 @@
$new_users = array_diff($new_users, $old_users);
if ($new_users) {
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN(Id) FROM ' . $table_name .' WHERE Id < 0' );
+
foreach ($new_users as $new_user) {
+ $new_id--;
$fields_hash = Array (
+ 'Id' => $new_id,
'GroupId' => $group_id,
'PortalUserId' => $new_user,
);
\ No newline at end of file
Index: core/units/category_items/category_items_event_handler.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/category_items/category_items_event_handler.php (revision 15965)
+++ core/units/category_items/category_items_event_handler.php (revision )
@@ -54,60 +54,10 @@
$table_info = $object->getLinkedInfo();
$this->Conn->Query('UPDATE ' . $object->TableName . ' SET PrimaryCat = 0 WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId']);
- $this->Conn->Query('UPDATE ' . $object->TableName . ' SET PrimaryCat = 1 WHERE (' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'] . ') AND (CategoryId = ' . $id . ')');
+ $this->Conn->Query('UPDATE ' . $object->TableName . ' SET PrimaryCat = 1 WHERE (' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'] . ') AND (Id = ' . $id . ')');
}
$event->SetRedirectParam('opener', 's');
- }
-
- /**
- * Apply custom processing to item
- *
- * @param kEvent $event
- * @param string $type
- * @return void
- * @access protected
- */
- protected function customProcessing(kEvent $event, $type)
- {
- if ( $event->Name == 'OnMassDelete' ) {
- $object = $event->getObject();
- $table_info = $object->getLinkedInfo();
-
- switch ($type) {
- case 'before':
- $ids = $event->getEventParam('ids');
-
- if ( $ids ) {
- $sql = 'SELECT CategoryId
- FROM ' . $object->TableName . '
- WHERE (PrimaryCat = 0) AND (' . $table_info['ForeignKey'] . '=' . $table_info['ParentId'] . ') AND CategoryId IN (' . implode(',', $ids) . ')';
- $event->setEventParam('ids', $this->Conn->GetCol($sql));
- }
- break;
-
- // not needed because 'before' does not allow to delete primary cat!
- /*case 'after':
- // set 1st not deleted category as primary
- $sql = 'SELECT COUNT(*)
- FROM ' . $object->TableName . '
- WHERE (PrimaryCat = 1) AND (' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'] . ')';
- $has_primary = $this->Conn->GetOne($sql);
-
- if ( !$has_primary ) {
- $sql = 'SELECT CategoryId
- FROM ' . $object->TableName . '
- WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'];
- $cat_id = $this->Conn->GetOne($sql);
-
- $sql = 'UPDATE ' . $object->TableName . '
- SET PrimaryCat = 1
- WHERE (' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'] . ') AND (CategoryId = ' . $cat_id . ')';
- $this->Conn->Query($sql);
- }
- break;*/
- }
- }
}
/**
\ No newline at end of file
Index: core/kernel/utility/temp_handler.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/kernel/utility/temp_handler.php (revision 15965)
+++ core/kernel/utility/temp_handler.php (revision )
@@ -736,7 +736,8 @@
// copy ALL records with positive ids (since negative ids were processed above) to live table
$sql = 'INSERT INTO ' . $this->_tableName . '
SELECT *
- FROM ' . $this->_getTempTableName();
+ FROM ' . $this->_getTempTableName() . '
+ WHERE 1';
$this->Conn->Query($this->_addConstrain($sql));
$this->_saveId('', $live_ids);
@@ -806,7 +807,8 @@
{
if ( !$ids ) {
$sql = 'SELECT ' . $this->_idField . '
- FROM ' . $this->_getTempTableName();
+ FROM ' . $this->_getTempTableName() . '
+ WHERE 1';
$ids = $this->Conn->GetCol($this->_addConstrain($sql));
}
\ No newline at end of file
Index: core/admin_templates/users/users_edit_groups.tpl
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/admin_templates/users/users_edit_groups.tpl (revision 15965)
+++ core/admin_templates/users/users_edit_groups.tpl (revision )
@@ -94,7 +94,7 @@
-
+
\ No newline at end of file
Index: core/units/category_items/category_items_config.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/category_items/category_items_config.php (revision 15965)
+++ core/units/category_items/category_items_config.php (revision )
@@ -16,7 +16,7 @@
$config = Array (
'Prefix' => 'ci',
- 'ItemClass' => Array ('class' => 'CategoryItems_DBItem', 'file' => 'category_items_dbitem.php', 'build_event' => 'OnItemBuild'),
+ 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'CategoryItemsEventHander', 'file' => 'category_items_event_handler.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'CategoryItemsTagProcessor', 'file' => 'category_items_tag_processor.php', 'build_event' => 'OnBuild'),
@@ -29,7 +29,7 @@
4 => 'event',
),
- 'IDField' => 'CategoryId', // in this case idfield doesn't exit in destination table
+ 'IDField' => 'Id',
'StatusField' => Array ('PrimaryCat'), // field, that is affected by Approve/Decline events
'TableName' => TABLE_PREFIX.'CategoryItems',
@@ -41,7 +41,6 @@
'CalculatedFields' => Array (
'' => Array (
- 'DummyId' => 'IF(ISNULL(c.CategoryId),0,c.CategoryId)',
'CategoryStatus'=> 'c.Status',
)
),
@@ -58,7 +57,7 @@
),
'Fields' => Array (
- 'DummyId' => Array (),
+ 'Id' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CategoryId' => Array ('type' => 'int', 'not_null'=>1,'default'=>0),
'ItemResourceId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'PrimaryCat' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
@@ -68,7 +67,6 @@
'VirtualFields' => Array (
'CategoryName' => Array ('type' => 'string', 'default' => ''),
- 'DummyId' => Array ('type' => 'int', 'default' => 0),
'CategoryStatus' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'default' => 1),
),
\ No newline at end of file
Index: core/kernel/db/cat_dbitem.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/kernel/db/cat_dbitem.php (revision 15965)
+++ core/kernel/db/cat_dbitem.php (revision )
@@ -409,7 +409,7 @@
$this->Conn->Query($sql);
}
else {
- $fields_hash = Array(
+ $fields_hash = Array (
'CategoryId' => $category_id,
'ItemResourceId' => $this->GetField('ResourceId'),
'PrimaryCat' => $is_primary ? 1 : 0,
@@ -417,6 +417,11 @@
'Filename' => $this->useFilenames ? (string)$this->GetDBField('Filename') : '', // because some prefixes does not use filenames,
);
+ if ( $this->Application->IsTempTable($table) ) {
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN(Id) FROM ' . $table .' WHERE Id < 0' );
+ $fields_hash['Id'] = $new_id - 1;
+ }
+
$this->Conn->doInsert($fields_hash, $table);
}
\ No newline at end of file
Index: core/units/user_groups/user_groups_dbitem.php
===================================================================
--- core/units/user_groups/user_groups_dbitem.php (revision 15965)
+++ core/units/user_groups/user_groups_dbitem.php (revision 15965)
@@ -1,42 +0,0 @@
-getLinkedInfo($this->Special, true);
-
- if ( $table_info ) {
- // we have parent info, then use it
- $keys_hash = Array ($this->IDField => $this->GetID(), $table_info['ForeignKey'] => $table_info['ParentId']);
- }
-
- return parent::GetKeyClause($method, $keys_hash);
- }
-}
\ No newline at end of file
Index: core/admin_templates/groups/groups_edit_users.tpl
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/admin_templates/groups/groups_edit_users.tpl (revision 15965)
+++ core/admin_templates/groups/groups_edit_users.tpl (revision )
@@ -86,7 +86,7 @@
-
+
\ No newline at end of file
Index: core/units/category_items/category_items_dbitem.php
===================================================================
--- core/units/category_items/category_items_dbitem.php (revision 15965)
+++ core/units/category_items/category_items_dbitem.php (revision 15965)
@@ -1,47 +0,0 @@
-getLinkedInfo();
-
- return '(CategoryId=' . $this->GetID() . ' AND ' . $table_info['ForeignKey'] . '=' . $table_info['ParentId'] . ')';
- }
-
- /**
- * Generate and set new temporary id
- *
- * @return void
- * @access public
- */
- public function setTempID()
- {
- // don't set temp id for this item
- }
-}
\ No newline at end of file
Index: core/kernel/db/cat_event_handler.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/kernel/db/cat_event_handler.php (revision 15965)
+++ core/kernel/db/cat_event_handler.php (revision )
@@ -2200,7 +2200,7 @@
$object->SetDBField($cached_field, $object->GetField($id_field));
$options = $object->GetFieldOptions($id_field);
-
+ $user_id = $this->Application->RecallVar('user_id');
if ( isset($options['options'][$user_id]) ) {
$object->SetDBField($cached_field, $options['options'][$user_id]);
}
\ No newline at end of file