From d8a4c52bd2e2aef0debbb8510757fa4d733edb9a Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Tue, 18 Dec 2007 12:34:47 +0000 Subject: [PATCH] KTS-2467 "OSS: FedoraCore5: The RSS feed to a subscribed document is not rendered correctly." Fixed. Changed the sql to use the metadata version id and not the document id when joining to the document_metadata_version table. --- plugins/rssplugin/KTrss.inc.php | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/plugins/rssplugin/KTrss.inc.php b/plugins/rssplugin/KTrss.inc.php index 7997317..dddea9d 100644 --- a/plugins/rssplugin/KTrss.inc.php +++ b/plugins/rssplugin/KTrss.inc.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -103,7 +103,7 @@ class KTrss{ function getFolderList($iUserId){ $sQuery = "SELECT folder_id as id FROM folder_subscriptions WHERE user_id = ?"; $aParams = array($iUserId); - $aFolderList = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id'); + $aFolderList = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id'); if (PEAR::isError($aFolderList)) { // XXX: log error @@ -206,6 +206,7 @@ class KTrss{ function getOneDocument($iDocumentId, $iUserId){ $aDData = KTrss::getDocumentData($iUserId, $iDocumentId); $aDTransactions = KTrss::getDocumentTransactions($iDocumentId); + if($aDData){ $aDData['itemType'] = 'document'; @@ -635,14 +636,16 @@ class KTrss{ // get a listing of the latest 3 transactions for a document function getDocumentTransactions($iDocumentId){ - $sQuery = "SELECT DT.datetime AS datetime, 'Document' AS type, DMV.name, D.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment " . - "FROM document_transactions AS DT INNER JOIN users AS U ON DT.user_id = U.id " . - "INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace " . - "LEFT JOIN document_metadata_version AS DMV ON DT.document_id = DMV.document_id " . - "LEFT JOIN documents AS D ON DT.document_id = D.id " . - "WHERE DT.document_id = ? " . - "ORDER BY DT.datetime DESC " . - "LIMIT 4"; + $sQuery = "SELECT DT.datetime AS datetime, 'Document' AS type, DMV.name, D.full_path AS fullpath, + DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment + FROM document_transactions AS DT + INNER JOIN users AS U ON DT.user_id = U.id + INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace + LEFT JOIN documents AS D ON DT.document_id = D.id + LEFT JOIN document_metadata_version AS DMV ON D.metadata_version_id = DMV.id + WHERE DT.document_id = ? + ORDER BY DT.datetime DESC + LIMIT 4"; $aParams = array($iDocumentId); $aDocumentTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); @@ -653,13 +656,14 @@ class KTrss{ // Get a listing of the latest 3 transactions for a folder function getFolderTransactions($iFolderId){ - $sQuery = "SELECT FT.datetime AS datetime, 'Folder' AS type, F.name, F.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment " . - "FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id " . - "LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace " . - "LEFT JOIN folders AS F ON FT.folder_id = F.id " . - "WHERE FT.folder_id = ? " . - "ORDER BY FT.datetime DESC " . - "LIMIT 4"; + $sQuery = "SELECT FT.datetime AS datetime, 'Folder' AS type, F.name, F.full_path AS fullpath, + DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment + FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id + LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace + LEFT JOIN folders AS F ON FT.folder_id = F.id + WHERE FT.folder_id = ? + ORDER BY FT.datetime DESC + LIMIT 4"; $aParams = array($iFolderId); $aFolderTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); -- libgit2 0.21.4