From 5b03d5ffe136bbb92efad7d18fdb1d91a611eee5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 5 Aug 2010 22:25:57 +0000 Subject: [PATCH] Added sorting for later easier inserting of more array elements --- inc/extensions/ext-network.php | 2 ++ inc/libs/network_functions.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 4fb25ee3af..13411f758e 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -153,7 +153,9 @@ PRIMARY KEY (`network_translation_id`) `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `network_api_index` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, +`sort` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, UNIQUE `provider_type_key` (`network_id`,`network_type_id`,`network_api_index`), +INDEX (`sort`), PRIMARY KEY (`network_api_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Translation of API responses, generic data, DO NOT ALTER!'"); diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 23ccf54b90..b9554d6664 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -651,7 +651,7 @@ INNER JOIN ON `network_api_index`=`network_translation_id` ORDER BY - `network_api_id` ASC', __FUNCTION__, __LINE__); + `sort` ASC', __FUNCTION__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result) > 0) { @@ -1205,6 +1205,16 @@ function doAdminNetworkProcessAddNetworkApiTranslation () { // Add id setPostRequestParameter('network_id', bigintval(getRequestParameter('network'))); + // Add sorting + setPostRequestParameter('sort', countSumTotalData( + postRequestParameter('network_id'), + 'network_api_translation', + 'network_api_id', + 'network_id', + true, + sprintf(" AND `network_type_id`=%s", bigintval(postRequestParameter('network_type_id'))) + )); + // Add the whole request to database SQL_QUERY('INSERT INTO `{?_MYSQL_PREFIX?}_network_api_translation` -- 2.39.2