Commit d6027be1dee7e91b6ccda0c58a5cc1cae6706a17

Authored by megan_w
1 parent fe06af3d

KTS-2622

"Copying a folder containing Checkout documents results in the copied documents also being checked out like the originals."
Fixed. Added code to cancel the checkout.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7598 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/documentutil.inc.php
@@ -10,32 +10,32 @@ @@ -10,32 +10,32 @@
10 * KnowledgeTree Open Source Edition 10 * KnowledgeTree Open Source Edition
11 * Document Management Made Simple 11 * Document Management Made Simple
12 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 12 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
13 - * 13 + *
14 * This program is free software; you can redistribute it and/or modify it under 14 * This program is free software; you can redistribute it and/or modify it under
15 * the terms of the GNU General Public License version 3 as published by the 15 * the terms of the GNU General Public License version 3 as published by the
16 * Free Software Foundation. 16 * Free Software Foundation.
17 - * 17 + *
18 * This program is distributed in the hope that it will be useful, but WITHOUT 18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 20 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 * details. 21 * details.
22 - * 22 + *
23 * You should have received a copy of the GNU General Public License 23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>. 24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 - * 25 + *
26 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 26 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
27 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 27 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
28 - * 28 + *
29 * The interactive user interfaces in modified source and object code versions 29 * The interactive user interfaces in modified source and object code versions
30 * of this program must display Appropriate Legal Notices, as required under 30 * of this program must display Appropriate Legal Notices, as required under
31 * Section 5 of the GNU General Public License version 3. 31 * Section 5 of the GNU General Public License version 3.
32 - * 32 + *
33 * In accordance with Section 7(b) of the GNU General Public License version 3, 33 * In accordance with Section 7(b) of the GNU General Public License version 3,
34 * these Appropriate Legal Notices must retain the display of the "Powered by 34 * these Appropriate Legal Notices must retain the display of the "Powered by
35 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 35 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
36 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 36 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
37 - * must display the words "Powered by KnowledgeTree" and retain the original  
38 - * copyright notice. 37 + * must display the words "Powered by KnowledgeTree" and retain the original
  38 + * copyright notice.
39 * Contributor( s): ______________________________________ 39 * Contributor( s): ______________________________________
40 */ 40 */
41 41
@@ -191,17 +191,17 @@ class KTDocumentUtil { @@ -191,17 +191,17 @@ class KTDocumentUtil {
191 191
192 return true; 192 return true;
193 } 193 }
194 - 194 +
195 function archive($oDocument, $sReason) { 195 function archive($oDocument, $sReason) {
196 - 196 +
197 $this->startTransaction(); 197 $this->startTransaction();
198 $oDocument->setStatusID(ARCHIVED); 198 $oDocument->setStatusID(ARCHIVED);
199 $res = $oDocument->update(); 199 $res = $oDocument->update();
200 - 200 +
201 if (PEAR::isError($res) || ($res === false)) { 201 if (PEAR::isError($res) || ($res === false)) {
202 return PEAR::raiseError(_kt('There was a database error while trying to archive this file')); 202 return PEAR::raiseError(_kt('There was a database error while trying to archive this file'));
203 } 203 }
204 - 204 +
205 $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update'); 205 $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update');
206 $oDocumentTransaction->create(); 206 $oDocumentTransaction->create();
207 207
@@ -222,12 +222,12 @@ class KTDocumentUtil { @@ -222,12 +222,12 @@ class KTDocumentUtil {
222 return $ret; 222 return $ret;
223 } 223 }
224 } 224 }
225 - 225 +
226 // fire subscription alerts for the archived document 226 // fire subscription alerts for the archived document
227 $oSubscriptionEvent = new SubscriptionEvent(); 227 $oSubscriptionEvent = new SubscriptionEvent();
228 $oFolder = Folder::get($oDocument->getFolderID()); 228 $oFolder = Folder::get($oDocument->getFolderID());
229 $oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder); 229 $oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder);
230 - 230 +
231 return true; 231 return true;
232 } 232 }
233 233
@@ -904,6 +904,10 @@ class KTDocumentUtil { @@ -904,6 +904,10 @@ class KTDocumentUtil {
904 $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId()); 904 $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId());
905 if (PEAR::isError($res)) { return $res; } 905 if (PEAR::isError($res)) { return $res; }
906 906
  907 + $oNewDocument->setIsCheckedOut(false);
  908 + $oNewDocument->setCheckedOutUserID(-1);
  909 +
  910 +
907 // finally, copy the actual file. 911 // finally, copy the actual file.
908 $oStorage =& KTStorageManagerUtil::getSingleton(); 912 $oStorage =& KTStorageManagerUtil::getSingleton();
909 $res = $oStorage->copy($oDocument, $oNewDocument); 913 $res = $oStorage->copy($oDocument, $oNewDocument);
@@ -967,7 +971,7 @@ class KTDocumentUtil { @@ -967,7 +971,7 @@ class KTDocumentUtil {
967 return $ret; 971 return $ret;
968 } 972 }
969 } 973 }
970 - 974 +
971 // fire subscription alerts for the copied document 975 // fire subscription alerts for the copied document
972 $oSubscriptionEvent = new SubscriptionEvent(); 976 $oSubscriptionEvent = new SubscriptionEvent();
973 $oFolder = Folder::get($oDocument->getFolderID()); 977 $oFolder = Folder::get($oDocument->getFolderID());
@@ -1077,7 +1081,7 @@ class KTDocumentUtil { @@ -1077,7 +1081,7 @@ class KTDocumentUtil {
1077 return $ret; 1081 return $ret;
1078 } 1082 }
1079 } 1083 }
1080 - 1084 +
1081 // fire subscription alerts for the moved document 1085 // fire subscription alerts for the moved document
1082 $oSubscriptionEvent = new SubscriptionEvent(); 1086 $oSubscriptionEvent = new SubscriptionEvent();
1083 $oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder); 1087 $oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder);