From 0c1c829cca07eea3f28bb72f61736107a49f0156 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 27 Sep 2013 08:23:11 +0200 Subject: [PATCH 01/10] fix description of some methods (no code change) --- SeedDMS_Core/Core/inc.ClassDocument.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 67785cdce..590c1794d 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -2512,7 +2512,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ * reviewers. In that case -4 will be returned. * If the given review status has been set by the user before, it cannot * be set again and 0 will be returned. Іf the review could be succesfully - * added the review log id will be returned. + * added, the review log id will be returned. * * @see SeedDMS_Core_DocumentContent::setApprovalByInd() * @param object $user user doing the review @@ -2731,10 +2731,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ /** * Sets approval status of a document content for a user + * * This function can be used to approve or reject a document content, or - * to reset its approval state. The user initiating the approval may - * not be the user filled in as an approver of the document content. - * In most cases this will be but an admin may set the approval for + * to reset its approval state. In most cases this function will be + * called by an user, but an admin may set the approval for * somebody else. * It is first checked if the user is in the list of approvers at all. * Then it is check if the approval status is already -2. In both cases From 9a6772b59a7c8d727dc692e45f359691e2c3472c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 27 Sep 2013 08:24:09 +0200 Subject: [PATCH 02/10] use defines S_DRAFT_APP and S_RELEASE instead of numbers --- op/op.ApproveDocument.php | 2 +- op/op.ReviewDocument.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index b82df63bb..f73b50db7 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -231,7 +231,7 @@ if ($_POST["approvalStatus"]==-1){ // count of the approvals required for this document. if ($approvalCT == $approvalTotal) { // Change the status to released. - $newStatus=2; + $newStatus=S_RELEASED; if($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) { // Send notification to subscribers. if($notifier) { diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index 3c0f747a3..5d60c8b5c 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -256,11 +256,11 @@ if ($_POST["reviewStatus"]==-1){ // If the approvals received is less than the approvals total, then // change status to pending approval. if ($approvalCT<$approvalTotal) { - $newStatus=1; + $newStatus=S_DRAFT_APP; } else { // Otherwise, change the status to released. - $newStatus=2; + $newStatus=S_RELEASED; } if ($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) { // Send notification to subscribers. From 544cc2669fca329d4d51504f21175c2fd76b2f48 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 27 Sep 2013 08:25:37 +0200 Subject: [PATCH 03/10] allow members of a group to approve a document if user is owner only if enableOwnerRevApp is set in the settings --- views/bootstrap/class.ViewDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index d2d3d6d7c..a6dc0acf1 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -552,7 +552,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { else { $reqName = "".htmlspecialchars($required->getName()).""; } - if($required->isMember($user) && ($user->getId() != $owner->getId())) + if($required->isMember($user) && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)) $is_approver = true; break; } From 902cae280433f15b1d2b5c08a5bc47a634cfb284 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 27 Sep 2013 15:01:45 +0200 Subject: [PATCH 04/10] no more errors if url parameters are missing --- op/op.AddMultiDocument.php | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/op/op.AddMultiDocument.php b/op/op.AddMultiDocument.php index 561f80ef9..b469ed590 100644 --- a/op/op.AddMultiDocument.php +++ b/op/op.AddMultiDocument.php @@ -71,15 +71,27 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) { else $keywords = ''; - $reqversion = (int)$_POST["reqversion"]; - if ($reqversion<1) $reqversion=1; + if(isset($_POST["reqversion"])) { + $reqversion = (int)$_POST["reqversion"]; + if ($reqversion<1) $reqversion=1; + } else { + $reqversion = 1; + } - $sequence = $_POST["sequence"]; - if (!is_numeric($sequence)) { + if(isset($_POST['sequence'])) { + $sequence = $_POST["sequence"]; + if (!is_numeric($sequence)) { + $sequence = 1; + } + } else { $sequence = 1; } - $expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false; + if(isset($_POST["expires"])) { + $expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false; + } else { + $expires = false; + } // Get the list of reviewers and approvers for this document. $reviewers = array(); @@ -162,17 +174,19 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) { if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = "."; else $fileType = substr($userfilename, $lastDotIndex); - if($_POST["name"] != "") + if(isset($_POST["name"]) && $_POST["name"] != "") $name = $_POST["name"]; else $name = basename($userfilename); - $categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]); $cats = array(); - if($categories) { - $catids = explode(',', $categories); - foreach($catids as $catid) { - $cats[] = $dms->getDocumentCategory($catid); + if(isset($_POST["categoryids"])) { + $categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]); + if($categories) { + $catids = explode(',', $categories); + foreach($catids as $catid) { + $cats[] = $dms->getDocumentCategory($catid); + } } } $res = $folder->addDocument($name, $comment, $expires, $user, $keywords, From 63d8fa4314b167048c56e616e09675da446c9e73 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 30 Sep 2013 09:11:58 +0200 Subject: [PATCH 05/10] make jumploader work with java 1.7 --- views/bootstrap/class.Bootstrap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 3afe6e579..02585e96c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1201,8 +1201,8 @@ mayscript> /** * applet initialized notification */ - function appletInitialized( ) { - var uploader = document.jumpLoaderApplet.getUploader(); + function appletInitialized(applet) { + var uploader = applet.getUploader(); var attrSet = uploader.getAttributeSet(); var attr; Date: Mon, 30 Sep 2013 11:08:05 +0200 Subject: [PATCH 06/10] turning of the language selector will no longer turn of user substitution --- views/bootstrap/class.Bootstrap.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 02585e96c..04dd233ed 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -199,10 +199,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);; } echo " \n"; echo " \n"; - if($this->params['user']->isAdmin()) - echo "
  • ".getMLText("substitute_user")."
  • \n"; - echo "
  • \n"; } + if($this->params['user']->isAdmin()) + echo "
  • ".getMLText("substitute_user")."
  • \n"; + echo "
  • \n"; if($this->params['session']->getSu()) { echo "
  • ".getMLText("sign_out_user")."
  • \n"; } else { From fcffe34047a4d1dfc2be776a4f86f0b4ca0ed08a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 6 Oct 2013 08:08:41 +0200 Subject: [PATCH 07/10] list all approval/review logs if admin --- views/bootstrap/class.ViewDocument.php | 109 ++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index a6dc0acf1..557a2cfd8 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -125,8 +125,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { $status = $latestContent->getStatus(); $reviewStatus = $latestContent->getReviewStatus(); - $approvalStatus = $latestContent->getApprovalStatus(); - + $approvalStatus = $latestContent->getApprovalStatus(10); ?>
    @@ -581,8 +580,112 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { } print "\n"; - $this->contentContainerEnd(); + if($user->isAdmin()) { + $this->contentContainerEnd(); ?> +
    +
    + + +getReviewStatus(10); + foreach($reviewStatusList as $rec) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } +?> +
    /
    "; + switch ($rec["type"]) { + case 0: // Approver is an individual. + $required = $dms->getUser($rec["required"]); + if (!is_object($required)) { + $reqName = getMLText("unknown_user")." '".$rec["required"]."'"; + } + else { + $reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); + } + break; + case 1: // Approver is a group. + $required = $dms->getGroup($rec["required"]); + if (!is_object($required)) { + $reqName = getMLText("unknown_group")." '".$rec["required"]."'"; + } + else { + $reqName = "".htmlspecialchars($required->getName()).""; + } + break; + } + echo $reqName; + echo ""; + echo "".$rec['date']." - "; + $updateuser = $dms->getUser($rec["userID"]); + if(!is_object($required)) + echo getMLText("unknown_user"); + else + echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")"); + echo ""; + if($rec['comment']) + echo "
    ".htmlspecialchars($rec['comment']); + echo "
    "; + echo getApprovalStatusText($rec["status"]); + echo "
    +
    +
    + + +getApprovalStatus(10); + foreach($approvalStatusList as $rec) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } +?> +
    /
    "; + switch ($rec["type"]) { + case 0: // Approver is an individual. + $required = $dms->getUser($rec["required"]); + if (!is_object($required)) { + $reqName = getMLText("unknown_user")." '".$rec["required"]."'"; + } + else { + $reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); + } + break; + case 1: // Approver is a group. + $required = $dms->getGroup($rec["required"]); + if (!is_object($required)) { + $reqName = getMLText("unknown_group")." '".$rec["required"]."'"; + } + else { + $reqName = "".htmlspecialchars($required->getName()).""; + } + break; + } + echo $reqName; + echo ""; + echo "".$rec['date']." - "; + $updateuser = $dms->getUser($rec["userID"]); + if(!is_object($required)) + echo getMLText("unknown_user"); + else + echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")"); + echo ""; + if($rec['comment']) + echo "
    ".htmlspecialchars($rec['comment']); + echo "
    "; + echo getApprovalStatusText($rec["status"]); + echo "
    +
    + +
    Date: Sun, 6 Oct 2013 08:09:37 +0200 Subject: [PATCH 08/10] add some more docu, turn of caching in getApprovalStatus() see FIXME comment --- SeedDMS_Core/Core/inc.ClassDocument.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 590c1794d..1acfa6551 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -2291,7 +2291,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ /** * Get the current review status of the document content - * The review status is a list of reviewers and its current status + * The review status is a list of reviews and its current status * * @param integer $limit the number of recent status changes per reviewer * @return array list of review status @@ -2303,7 +2303,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ // Retrieve the current status of each assigned reviewer for the content // represented by this object. - if (!isset($this->_reviewStatus)) { + // FIXME: caching was turned off to make list of review log in ViewDocument + // possible + if (1 || !isset($this->_reviewStatus)) { /* First get a list of all reviews for this document content */ $queryStr= "SELECT reviewID FROM tblDocumentReviewers WHERE `version`='".$this->_version @@ -2337,6 +2339,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return $this->_reviewStatus; } /* }}} */ + /** + * Get the current approval status of the document content + * The approval status is a list of approvals and its current status + * + * @param integer $limit the number of recent status changes per approver + * @return array list of approval status + */ function getApprovalStatus($limit=1) { /* {{{ */ $db = $this->_document->_dms->getDB(); @@ -2344,7 +2353,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ // Retrieve the current status of each assigned approver for the content // represented by this object. - if (!isset($this->_approvalStatus)) { + // FIXME: caching was turned off to make list of approval log in ViewDocument + // possible + if (1 || !isset($this->_approvalStatus)) { /* First get a list of all approvals for this document content */ $queryStr= "SELECT approveID FROM tblDocumentApprovers WHERE `version`='".$this->_version From 05d51c05bd616be54990ed95289c8636275fe212 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 21 Oct 2013 12:14:37 +0200 Subject: [PATCH 09/10] use PATH_SEPARATOR and DIRECTORY_SEPARATOR --- inc/inc.ClassSettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 0e116e2eb..8f65b743c 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -818,10 +818,10 @@ class Settings { /* {{{ */ * @return string path where file was found */ function findInIncPath($file) { /* {{{ */ - $incarr = explode(':', ini_get('include_path')); + $incarr = explode(PATH_SEPARATOR, ini_get('include_path')); $found = ''; foreach($incarr as $path) { - if(file_exists($path.'/'.$file)) { + if(file_exists($path.DIRECTORY_SEPARATOR.$file)) { $found = $path; } } From 76701aed03c1daa5d5f01acab78927d67460f6e3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 24 Nov 2013 18:19:42 +0100 Subject: [PATCH 10/10] remove echo statement when delete document from fulltext index --- op/op.RemoveFolder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/op/op.RemoveFolder.php b/op/op.RemoveFolder.php index 3d92cee43..9e2f3a64b 100644 --- a/op/op.RemoveFolder.php +++ b/op/op.RemoveFolder.php @@ -63,7 +63,6 @@ if($settings->_enableFullSearch) { function removeFromIndex($index, $document) { if($hits = $index->find('document_id:'.$document->getId())) { $hit = $hits[0]; - echo $hit->id; $index->delete($hit->id); $index->commit(); }