Commit de9daff763086ecc6ec2be4c01905c626a72fb0d

Authored by kevin_fourie
1 parent 45ffc3fb

Merged in from STABLE trunk...

KTC-590
"An immutable document can be checked out via the bulk checkout option"
Fixed. Bulk checkout now checks if the document is immutable.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3a-Release-Branch@9219 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/KTBulkActions.php
@@ -884,6 +884,11 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { @@ -884,6 +884,11 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
884 884
885 function check_entity($oEntity) { 885 function check_entity($oEntity) {
886 if(is_a($oEntity, 'Document')) { 886 if(is_a($oEntity, 'Document')) {
  887 + if($oEntity->getImmutable())
  888 + {
  889 + return PEAR::raiseError(_kt('Document cannot be checked out as it is immutable'));
  890 + }
  891 +
887 // Check that the document isn't already checked out 892 // Check that the document isn't already checked out
888 if ($oEntity->getIsCheckedOut()) { 893 if ($oEntity->getIsCheckedOut()) {
889 $checkedOutUser = $oEntity->getCheckedOutUserID(); 894 $checkedOutUser = $oEntity->getCheckedOutUserID();
@@ -1045,6 +1050,11 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { @@ -1045,6 +1050,11 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
1045 1050
1046 if(is_a($oEntity, 'Document')) { 1051 if(is_a($oEntity, 'Document')) {
1047 1052
  1053 + if($oEntity->getImmutable())
  1054 + {
  1055 + return PEAR::raiseError($oEntity->getName() .': '. _kt('Document cannot be checked out as it is immutable'));
  1056 + }
  1057 +
1048 if($oEntity->getIsCheckedOut()){ 1058 if($oEntity->getIsCheckedOut()){
1049 $checkedOutUser = $oEntity->getCheckedOutUserID(); 1059 $checkedOutUser = $oEntity->getCheckedOutUserID();
1050 $sUserId = $_SESSION['userID']; 1060 $sUserId = $_SESSION['userID'];
@@ -1151,6 +1161,12 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { @@ -1151,6 +1161,12 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
1151 $oDocument->switchToLinkedCore(); 1161 $oDocument->switchToLinkedCore();
1152 } 1162 }
1153 1163
  1164 + if($oDocument->getImmutable())
  1165 + {
  1166 + $this->addErrorMessage($oDocument->getName() .': '. _kt('Document cannot be checked out as it is immutable'));
  1167 + continue;
  1168 + }
  1169 +
1154 // Check if the action is restricted by workflow on the document 1170 // Check if the action is restricted by workflow on the document
1155 if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.checkout')){ 1171 if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.checkout')){
1156 $this->addErrorMessage($oDocument->getName().': '._kt('Checkout is restricted by the workflow state.')); 1172 $this->addErrorMessage($oDocument->getName().': '._kt('Checkout is restricted by the workflow state.'));