Commit 79e2c38d233a72c01677a812cd5ac64def64cfee

Authored by Neil Blakey-Milner
1 parent a01482b6

When downloading a particular version of a document, record that version

as the version number in the transaction.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4702 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -60,7 +60,7 @@ class DocumentTransaction {
60 60 $this->iDocumentID = $oDocument->getID();
61 61 $this->sComment = $sNewComment;
62 62 $this->sTransactionNS = $sTransactionNS;
63   - $this->sVersion = $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber();
  63 + $this->sVersion = KTUtil::arrayGet($aOptions, 'version', $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber());
64 64 $oFolder = Folder::get($oDocument->getFolderId());
65 65 $this->sFileName = addslashes($oFolder->sFullPath . "/" . $oFolder->getName() . "/" . $oDocument->getName());
66 66  
... ...
lib/storage/ondiskpathstoragemanager.inc.php
... ... @@ -124,6 +124,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager {
124 124 $oContentVersion = KTDocumentContentVersion::get($iVersionId);
125 125 $oConfig =& KTConfig::getSingleton();
126 126 $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oContentVersion));
  127 + $sVersion = sprintf("%d.%d", $oContentVersion->getMajorVersionNumber(), $oContentVersion->getMinorVersionNumber());
127 128 if (file_exists($sPath)) {
128 129 //set the correct headers
129 130 header("Content-Type: " .
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -35,14 +35,17 @@ class KTDocumentViewAction extends KTDocumentAction {
35 35  
36 36 function do_main() {
37 37 $oStorage =& KTStorageManagerUtil::getSingleton();
38   - $oDocumentTransaction = & new DocumentTransaction($this->oDocument, "Document downloaded", 'ktcore.transactions.download');
39   - $oDocumentTransaction->create();
40   - $sVersion = KTUtil::arrayGet($_REQUEST, 'version');
41   - if ($sVersion) {
42   - $oStorage->downloadVersion($this->oDocument, $sVersion);
  38 + $aOptions = array();
  39 + $iVersion = KTUtil::arrayGet($_REQUEST, 'version');
  40 + if ($iVersion) {
  41 + $oVersion = KTDocumentContentVersion::get($iVersion);
  42 + $aOptions['version'] = sprintf("%d.%d", $oVersion->getMajorVersionNumber(), $oVersion->getMinorVersionNumber());;
  43 + $oStorage->downloadVersion($this->oDocument, $iVersion);
43 44 } else {
44 45 $oStorage->download($this->oDocument);
45 46 }
  47 + $oDocumentTransaction = & new DocumentTransaction($this->oDocument, "Document downloaded", 'ktcore.transactions.download', $aOptions);
  48 + $oDocumentTransaction->create();
46 49 exit(0);
47 50 }
48 51 }
... ...