Commit cbd66de3110dfd089974bf59641228d087cfb737
1 parent
0d921723
Use the new moveDocument arguments, and rename oFolder to oNewFolder to
make more understandable. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3627 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
6 additions
and
3 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php
| @@ -119,9 +119,11 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | @@ -119,9 +119,11 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | ||
| 119 | 119 | ||
| 120 | //we're trying to move a document | 120 | //we're trying to move a document |
| 121 | $oDocument = & Document::get($fDocumentIDs[$i]); | 121 | $oDocument = & Document::get($fDocumentIDs[$i]); |
| 122 | - $oFolder = & Folder::get($fFolderID); | 122 | + $oNewFolder = & Folder::get($fFolderID); |
| 123 | $iOldFolderID = $oDocument->getFolderID(); | 123 | $iOldFolderID = $oDocument->getFolderID(); |
| 124 | 124 | ||
| 125 | + $oOldFolder =& Folder::get($iOldFolderID); | ||
| 126 | + | ||
| 125 | // check that there is no filename collision in the destination directory | 127 | // check that there is no filename collision in the destination directory |
| 126 | $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); | 128 | $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); |
| 127 | 129 | ||
| @@ -131,7 +133,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | @@ -131,7 +133,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | ||
| 131 | continue; | 133 | continue; |
| 132 | } | 134 | } |
| 133 | 135 | ||
| 134 | - if (!Permission::userHasDocumentWritePermission($oDocument) || !Permission::userHasFolderWritePermission($oFolder)) { | 136 | + if (!Permission::userHasDocumentWritePermission($oDocument) || !Permission::userHasFolderWritePermission($oNewFolder)) { |
| 135 | array_push($aUnmovedDocs, array($oDocument, _("You do not have rights to move this document"))); | 137 | array_push($aUnmovedDocs, array($oDocument, _("You do not have rights to move this document"))); |
| 136 | continue; | 138 | continue; |
| 137 | } | 139 | } |
| @@ -150,7 +152,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | @@ -150,7 +152,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | ||
| 150 | //get the old document path | 152 | //get the old document path |
| 151 | $sOldDocumentFileSystemPath = Folder::getFolderPath($iOldFolderID) . $oDocument->getFileName(); | 153 | $sOldDocumentFileSystemPath = Folder::getFolderPath($iOldFolderID) . $oDocument->getFileName(); |
| 152 | //move the document on the file system | 154 | //move the document on the file system |
| 153 | - if (!$oStorage->moveDocument($sOldDocumentFileSystemPath, $oDocument, $oFolder)) { | 155 | + if (!$oStorage->moveDocument($oDocument, $oOldFolder, $oNewFolder)) { |
| 154 | $oDocument->setFolderID($iOldFolderID); | 156 | $oDocument->setFolderID($iOldFolderID); |
| 155 | $oDocument->update(true); | 157 | $oDocument->update(true); |
| 156 | 158 | ||
| @@ -158,6 +160,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | @@ -158,6 +160,7 @@ for ($i = 0; $i < count($fDocumentIDs); $i++) { | ||
| 158 | array_push($aUnmovedDocs, array($oDocument, _("Could not move document on file system"))); | 160 | array_push($aUnmovedDocs, array($oDocument, _("Could not move document on file system"))); |
| 159 | continue; | 161 | continue; |
| 160 | } | 162 | } |
| 163 | + $oDocument->update(); | ||
| 161 | 164 | ||
| 162 | // fire subscription alerts for the moved document (and the folder its in) | 165 | // fire subscription alerts for the moved document (and the folder its in) |
| 163 | $count = SubscriptionEngine::fireSubscription($fDocumentIDs[$i], SubscriptionConstants::subscriptionAlertType("MovedDocument"), | 166 | $count = SubscriptionEngine::fireSubscription($fDocumentIDs[$i], SubscriptionConstants::subscriptionAlertType("MovedDocument"), |