diff --git a/lib/actions/documentaction.inc.php b/lib/actions/documentaction.inc.php index d0be1e1..c829687 100644 --- a/lib/actions/documentaction.inc.php +++ b/lib/actions/documentaction.inc.php @@ -53,6 +53,9 @@ class KTDocumentAction extends KTStandardDispatcher { if (!KTWorkflowUtil::actionEnabledForDocument($this->oDocument, $this->sName)) { return false; } + // be nasty in archive/delete status. + $status = $this->oDocument->getStatusID(); + if (($status == DELETED) || ($status == ARCHIVED)) { return false; } return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); } diff --git a/plugins/ktcore/admin/documentFields.php b/plugins/ktcore/admin/documentFields.php index cbf601e..80daa3c 100755 --- a/plugins/ktcore/admin/documentFields.php +++ b/plugins/ktcore/admin/documentFields.php @@ -300,6 +300,9 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { } foreach ($_REQUEST['metadata'] as $iMetaDataId) { $oMetaData =& MetaData::get($iMetaDataId); + if (PEAR::isError($oMetaData)) { + $this->errorRedirectTo('editField', _('Invalid lookup selected'), 'fFieldsetId=' . $oFieldset->getId() . '&fFieldId=' . $oField->getId()); + } $oMetaData->delete(); } $this->successRedirectTo('editField', _('Lookups removed'), 'fFieldsetId=' . $oFieldset->getId() . '&fFieldId=' . $oField->getId()); @@ -723,6 +726,9 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { function subact_unlinkKeyword(&$constructedTree, $keyword) { $oKW = MetaData::get($keyword); + if (PEAR::isError($oKW)) { + return true; + } $constructedTree->reparentKeyword($oKW->getId(), 0); return true; } diff --git a/view.php b/view.php index 7cd4992..6b775c8 100755 --- a/view.php +++ b/view.php @@ -37,6 +37,14 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { parent::KTStandardDispatcher(); } + + function check() { + if (!parent::check()) { return false; } + + + + return true; + } // FIXME identify the current location somehow. function addPortlets($currentaction = null) { @@ -69,10 +77,22 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { } if (!KTBrowseUtil::inAdminMode($this->oUser, $oDocument->getFolderId())) { - if (!Permission::userHasDocumentReadPermission($oDocument)) { + if ($oDocument->getStatusID() == ARCHIVED) { + $this->oPage->addError(_('This document has been archived. Please contact the system administrator to have it restored if it is still needed.')); + return $this->do_error(); + } else if ($oDocument->getStatusID() == DELETED) { + $this->oPage->addError(_('This document has been deleted. Please contact the system administrator to have it restored if it is still needed.')); + return $this->do_error(); + } else if (!Permission::userHasDocumentReadPermission($oDocument)) { $this->oPage->addError(_('You are not allowed to view this document')); return $this->do_error(); } + } + + if ($oDocument->getStatusID() == ARCHIVED) { + $this->oPage->addError(_('This document has been archived.')); + } else if ($oDocument->getStatusID() == DELETED) { + $this->oPage->addError(_('This document has been deleted.')); } $this->oPage->setSecondaryTitle($oDocument->getName());