Commit 8fd00e2f7743b657a16d3786a2b93fd4aa27b4fa

Authored by bshuttle
1 parent 3af983ad

Fix for KTS-1336: Copy doesn't appear in transaction history.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5964 c91229c3-7414-0410-bfa2-8a42b809f60b
docs/VERSION.txt
1 -3.1.6.5 1 +3.1.6.6
lib/documentmanagement/documentutil.inc.php
@@ -767,7 +767,7 @@ class KTDocumentUtil { @@ -767,7 +767,7 @@ class KTDocumentUtil {
767 } 767 }
768 768
769 769
770 - function copy($oDocument, $oDestinationFolder) { 770 + function copy($oDocument, $oDestinationFolder, $sReason = null) {
771 // 1. generate a new triad of content, metadata and core objects. 771 // 1. generate a new triad of content, metadata and core objects.
772 // 2. update the storage path. 772 // 2. update the storage path.
773 //print '--------------------------------- BEFORE'; 773 //print '--------------------------------- BEFORE';
@@ -852,6 +852,18 @@ class KTDocumentUtil { @@ -852,6 +852,18 @@ class KTDocumentUtil {
852 KTDocumentUtil::updateSearchableText($oNewDocument); 852 KTDocumentUtil::updateSearchableText($oNewDocument);
853 KTPermissionUtil::updatePermissionLookup($oNewDocument); 853 KTPermissionUtil::updatePermissionLookup($oNewDocument);
854 854
  855 + if (is_null($sReason)) {
  856 + $sReason = '';
  857 + }
  858 +
  859 +
  860 + $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf("Copied to folder \"%s\". %s", $oDestinationFolder->getName(), $sReason), 'ktcore.transactions.copy');
  861 + $oDocumentTransaction->create();
  862 +
  863 + $oSrcFolder = Folder::get($oDocument->getFolderID());
  864 + $oDocumentTransaction = & new DocumentTransaction($oNewDocument, sprintf("Copied from original in folder \"%s\". %s", $oSrcFolder->getName(), $sReason), 'ktcore.transactions.copy');
  865 + $oDocumentTransaction->create();
  866 +
855 return $oNewDocument; 867 return $oNewDocument;
856 } 868 }
857 869
plugins/ktcore/KTDocumentActions.php
@@ -605,7 +605,7 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction { @@ -605,7 +605,7 @@ class KTDocumentCancelCheckOutAction extends KTDocumentAction {
605 'action' => 'checkin', 605 'action' => 'checkin',
606 'fail_action' => 'main', 606 'fail_action' => 'main',
607 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), 607 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument),
608 - 'submit_label' => _kt("Cancel Checkin"), 608 + 'submit_label' => _kt("Cancel Checkout"),
609 'context' => &$this, 609 'context' => &$this,
610 )); 610 ));
611 $oForm->setWidgets(array( 611 $oForm->setWidgets(array(
@@ -1143,7 +1143,7 @@ class KTDocumentCopyAction extends KTDocumentAction { @@ -1143,7 +1143,7 @@ class KTDocumentCopyAction extends KTDocumentAction {
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 - $oNewDoc = KTDocumentUtil::copy($this->oDocument, $this->oFolder); 1146 + $oNewDoc = KTDocumentUtil::copy($this->oDocument, $this->oFolder, $sReason);
1147 if (PEAR::isError($oNewDoc)) { 1147 if (PEAR::isError($oNewDoc)) {
1148 $this->errorRedirectTo("main", _kt("Failed to copy document: ") . $oNewDoc->getMessage(), sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $this->oFolder->getId())); 1148 $this->errorRedirectTo("main", _kt("Failed to copy document: ") . $oNewDoc->getMessage(), sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $this->oFolder->getId()));
1149 exit(0); 1149 exit(0);
@@ -1179,9 +1179,9 @@ class KTDocumentCopyAction extends KTDocumentAction { @@ -1179,9 +1179,9 @@ class KTDocumentCopyAction extends KTDocumentAction {
1179 $ret = $oTrigger->postValidate(); 1179 $ret = $oTrigger->postValidate();
1180 } 1180 }
1181 1181
1182 - $aOptions = array('user' => $oUser);  
1183 - $oDocumentTransaction = & new DocumentTransaction($oNewDoc, "Document copied from old version.", 'ktcore.transactions.create', $aOptions);  
1184 - $res = $oDocumentTransaction->create(); 1182 + //$aOptions = array('user' => $oUser);
  1183 + //$oDocumentTransaction = & new DocumentTransaction($oNewDoc, "Document copied from old version.", 'ktcore.transactions.create', $aOptions);
  1184 + //$res = $oDocumentTransaction->create();
1185 1185
1186 $_SESSION['KTInfoMessage'][] = _kt('Document copied.'); 1186 $_SESSION['KTInfoMessage'][] = _kt('Document copied.');
1187 1187
sql/mysql/upgrade/3.1.6.6/copy_transaction.sql 0 → 100644
  1 +TRUNCATE `zseq_document_transaction_types_lookup`;
  2 +INSERT INTO `zseq_document_transaction_types_lookup` SELECT MAX(`id`) FROM `document_transaction_types_lookup`;
  3 +SELECT @foo:=id + 1 FROM `zseq_document_transaction_types_lookup`;
  4 +
  5 +INSERT INTO document_transaction_types_lookup VALUES (@foo, 'Copy', 'ktcore.transactions.copy');
  6 +
  7 +TRUNCATE `zseq_document_transaction_types_lookup`;
  8 +INSERT INTO `zseq_document_transaction_types_lookup` SELECT MAX(`id`) FROM `document_transaction_types_lookup`;