Commit d8a4c52bd2e2aef0debbb8510757fa4d733edb9a
1 parent
fdafc51d
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. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7840 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
29 additions
and
25 deletions
plugins/rssplugin/KTrss.inc.php
| @@ -5,32 +5,32 @@ | @@ -5,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU General Public License version 3 as published by the | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | * these Appropriate Legal Notices must retain the display of the "Powered by | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | - * copyright notice. | 32 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 33 | + * copyright notice. | ||
| 34 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -103,7 +103,7 @@ class KTrss{ | @@ -103,7 +103,7 @@ class KTrss{ | ||
| 103 | function getFolderList($iUserId){ | 103 | function getFolderList($iUserId){ |
| 104 | $sQuery = "SELECT folder_id as id FROM folder_subscriptions WHERE user_id = ?"; | 104 | $sQuery = "SELECT folder_id as id FROM folder_subscriptions WHERE user_id = ?"; |
| 105 | $aParams = array($iUserId); | 105 | $aParams = array($iUserId); |
| 106 | - $aFolderList = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id'); | 106 | + $aFolderList = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id'); |
| 107 | 107 | ||
| 108 | if (PEAR::isError($aFolderList)) { | 108 | if (PEAR::isError($aFolderList)) { |
| 109 | // XXX: log error | 109 | // XXX: log error |
| @@ -206,6 +206,7 @@ class KTrss{ | @@ -206,6 +206,7 @@ class KTrss{ | ||
| 206 | function getOneDocument($iDocumentId, $iUserId){ | 206 | function getOneDocument($iDocumentId, $iUserId){ |
| 207 | $aDData = KTrss::getDocumentData($iUserId, $iDocumentId); | 207 | $aDData = KTrss::getDocumentData($iUserId, $iDocumentId); |
| 208 | $aDTransactions = KTrss::getDocumentTransactions($iDocumentId); | 208 | $aDTransactions = KTrss::getDocumentTransactions($iDocumentId); |
| 209 | + | ||
| 209 | if($aDData){ | 210 | if($aDData){ |
| 210 | $aDData['itemType'] = 'document'; | 211 | $aDData['itemType'] = 'document'; |
| 211 | 212 | ||
| @@ -635,14 +636,16 @@ class KTrss{ | @@ -635,14 +636,16 @@ class KTrss{ | ||
| 635 | 636 | ||
| 636 | // get a listing of the latest 3 transactions for a document | 637 | // get a listing of the latest 3 transactions for a document |
| 637 | function getDocumentTransactions($iDocumentId){ | 638 | function getDocumentTransactions($iDocumentId){ |
| 638 | - $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 " . | ||
| 639 | - "FROM document_transactions AS DT INNER JOIN users AS U ON DT.user_id = U.id " . | ||
| 640 | - "INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace " . | ||
| 641 | - "LEFT JOIN document_metadata_version AS DMV ON DT.document_id = DMV.document_id " . | ||
| 642 | - "LEFT JOIN documents AS D ON DT.document_id = D.id " . | ||
| 643 | - "WHERE DT.document_id = ? " . | ||
| 644 | - "ORDER BY DT.datetime DESC " . | ||
| 645 | - "LIMIT 4"; | 639 | + $sQuery = "SELECT DT.datetime AS datetime, 'Document' AS type, DMV.name, D.full_path AS fullpath, |
| 640 | + DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment | ||
| 641 | + FROM document_transactions AS DT | ||
| 642 | + INNER JOIN users AS U ON DT.user_id = U.id | ||
| 643 | + INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace | ||
| 644 | + LEFT JOIN documents AS D ON DT.document_id = D.id | ||
| 645 | + LEFT JOIN document_metadata_version AS DMV ON D.metadata_version_id = DMV.id | ||
| 646 | + WHERE DT.document_id = ? | ||
| 647 | + ORDER BY DT.datetime DESC | ||
| 648 | + LIMIT 4"; | ||
| 646 | 649 | ||
| 647 | $aParams = array($iDocumentId); | 650 | $aParams = array($iDocumentId); |
| 648 | $aDocumentTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); | 651 | $aDocumentTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); |
| @@ -653,13 +656,14 @@ class KTrss{ | @@ -653,13 +656,14 @@ class KTrss{ | ||
| 653 | 656 | ||
| 654 | // Get a listing of the latest 3 transactions for a folder | 657 | // Get a listing of the latest 3 transactions for a folder |
| 655 | function getFolderTransactions($iFolderId){ | 658 | function getFolderTransactions($iFolderId){ |
| 656 | - $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 " . | ||
| 657 | - "FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id " . | ||
| 658 | - "LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace " . | ||
| 659 | - "LEFT JOIN folders AS F ON FT.folder_id = F.id " . | ||
| 660 | - "WHERE FT.folder_id = ? " . | ||
| 661 | - "ORDER BY FT.datetime DESC " . | ||
| 662 | - "LIMIT 4"; | 659 | + $sQuery = "SELECT FT.datetime AS datetime, 'Folder' AS type, F.name, F.full_path AS fullpath, |
| 660 | + DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment | ||
| 661 | + FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id | ||
| 662 | + LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace | ||
| 663 | + LEFT JOIN folders AS F ON FT.folder_id = F.id | ||
| 664 | + WHERE FT.folder_id = ? | ||
| 665 | + ORDER BY FT.datetime DESC | ||
| 666 | + LIMIT 4"; | ||
| 663 | 667 | ||
| 664 | $aParams = array($iFolderId); | 668 | $aParams = array($iFolderId); |
| 665 | $aFolderTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); | 669 | $aFolderTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); |