Commit a7cd3405b786d2f56320f62c98cfc175e8f85f69
1 parent
cdd0fd32
KTS-3774
"Although 'Action Restrictions' for 'Archive' is set the user can still 'Archive' the document via the bulk actions when in folder view." Fixed. Added a check for workflow before doing the archive. KTS-3758 "When attempting to Archive a folder that contains no documents the Status is given as being 'Non-numeric identifier'" Fixed. Added a check around explode($sDocuments) to create an empty array if $sDocuments is empty otherwise it creates an array containing an empty array which is not seen as empty. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@9468 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
19 additions
and
3 deletions
lib/documentmanagement/documentutil.inc.php
| ... | ... | @@ -194,6 +194,11 @@ class KTDocumentUtil { |
| 194 | 194 | return PEAR::raiseError(_kt('There was a database error while trying to archive this file')); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | + // Ensure the action is not blocked | |
| 198 | + if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.archive')){ | |
| 199 | + return PEAR::raiseError(_kt('Document cannot be archived as it is restricted by the workflow.')); | |
| 200 | + } | |
| 201 | + | |
| 197 | 202 | //delete all shortcuts linking to this document |
| 198 | 203 | $aSymlinks = $oDocument->getSymbolicLinks(); |
| 199 | 204 | foreach($aSymlinks as $aSymlink){ | ... | ... |
plugins/ktcore/KTBulkActions.php
| ... | ... | @@ -103,13 +103,15 @@ class KTBulkDeleteAction extends KTBulkAction { |
| 103 | 103 | * @return KTForm the form |
| 104 | 104 | */ |
| 105 | 105 | function form_confirm() { |
| 106 | + $cancelUrl = $this->getReturnUrl(); | |
| 107 | + | |
| 106 | 108 | $oForm = new KTForm; |
| 107 | 109 | $oForm->setOptions(array( |
| 108 | 110 | 'label' => _kt('Are you sure?'), |
| 109 | 111 | 'description' => _kt('There are shortcuts linking to some of the documents or folders in your selection; continuing will automatically delete the shortcuts. Would you like to continue?'), |
| 110 | 112 | 'action' => 'collectinfo', |
| 111 | 113 | 'fail_action' => 'main', |
| 112 | - 'cancel_url' => KTBrowseUtil::getUrlForFolder($this->oFolder), | |
| 114 | + 'cancel_url' => $cancelUrl, | |
| 113 | 115 | 'submit_label' => _kt('Continue'), |
| 114 | 116 | 'context' => $this, |
| 115 | 117 | )); |
| ... | ... | @@ -539,6 +541,11 @@ class KTBulkArchiveAction extends KTBulkAction { |
| 539 | 541 | if($oEntity->isSymbolicLink()){ |
| 540 | 542 | return PEAR::raiseError(_kt("It is not possible to archive a shortcut. Please archive the target document or folder instead.")); |
| 541 | 543 | } |
| 544 | + if(is_a($oEntity, 'Document')){ | |
| 545 | + if(!KTWorkflowUtil::actionEnabledForDocument($oEntity, 'ktcore.actions.document.archive')){ | |
| 546 | + return PEAR::raiseError(_kt('Document cannot be archived as it is restricted by the workflow.')); | |
| 547 | + } | |
| 548 | + } | |
| 542 | 549 | return parent::check_entity($oEntity); |
| 543 | 550 | } |
| 544 | 551 | |
| ... | ... | @@ -548,13 +555,15 @@ class KTBulkArchiveAction extends KTBulkAction { |
| 548 | 555 | * @return KTForm the form |
| 549 | 556 | */ |
| 550 | 557 | function form_confirm() { |
| 558 | + $cancelUrl = $this->getReturnUrl(); | |
| 559 | + | |
| 551 | 560 | $oForm = new KTForm; |
| 552 | 561 | $oForm->setOptions(array( |
| 553 | 562 | 'label' => _kt('Are you sure?'), |
| 554 | 563 | 'description' => _kt('There are shortcuts linking to some of the documents or folders in your selection; continuing will automatically delete the shortcuts. Would you like to continue?'), |
| 555 | 564 | 'action' => 'collectinfo', |
| 556 | 565 | 'fail_action' => 'main', |
| 557 | - 'cancel_url' => KTBrowseUtil::getUrlForFolder($this->oFolder), | |
| 566 | + 'cancel_url' => $cancelUrl, | |
| 558 | 567 | 'submit_label' => _kt('Continue'), |
| 559 | 568 | 'context' => $this, |
| 560 | 569 | )); |
| ... | ... | @@ -640,7 +649,7 @@ class KTBulkArchiveAction extends KTBulkAction { |
| 640 | 649 | |
| 641 | 650 | // Get documents in folder |
| 642 | 651 | $sDocuments = $oFolder->getDocumentIDs($sFolderId); |
| 643 | - $aDocuments = explode(',', $sDocuments); | |
| 652 | + $aDocuments = (!empty($sDocuments)) ? explode(',', $sDocuments) : array(); | |
| 644 | 653 | |
| 645 | 654 | // Get all the folders within the folder |
| 646 | 655 | $sWhereClause = "parent_folder_ids = '{$sFolderId}' OR |
| ... | ... | @@ -680,6 +689,8 @@ class KTBulkArchiveAction extends KTBulkAction { |
| 680 | 689 | return $res; |
| 681 | 690 | } |
| 682 | 691 | } |
| 692 | + }else { | |
| 693 | + return PEAR::raiseError(_kt('The folder contains no documents to archive.')); | |
| 683 | 694 | } |
| 684 | 695 | return true; |
| 685 | 696 | } | ... | ... |