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