return false not -1 if sql fails

This commit is contained in:
Uwe Steinmann 2021-09-29 17:23:03 +02:00
parent b9fb7e2585
commit 989572e069

View File

@ -3855,7 +3855,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Check to see if the user has already been added to the review list. // Check to see if the user has already been added to the review list.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
if (is_bool($reviewStatus) && !$reviewStatus) { if (is_bool($reviewStatus) && !$reviewStatus) {
return -1; return false;
} }
$indstatus = false; $indstatus = false;
if (count($reviewStatus["indstatus"]) > 0) { if (count($reviewStatus["indstatus"]) > 0) {
@ -3872,7 +3872,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')"; "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
$reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID'); $reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID');
} }
@ -3931,8 +3931,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Check to see if the group has already been added to the review list. // Check to see if the group has already been added to the review list.
$reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version); $reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version);
if (is_bool($reviewStatus) && !$reviewStatus) { if (is_bool($reviewStatus) && !$reviewStatus) {
return -1; return false;
} }
if (count($reviewStatus) > 0 && $reviewStatus[0]["status"]!=-2) { if (count($reviewStatus) > 0 && $reviewStatus[0]["status"]!=-2) {
// Group is already on the list of reviewers; return an error. // Group is already on the list of reviewers; return an error.
@ -4024,7 +4024,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$requestUser->getID() ."')"; $requestUser->getID() ."')";
$res=$db->getResult($queryStr); $res=$db->getResult($queryStr);
if (is_bool($res) && !$res) if (is_bool($res) && !$res)
return -1; return false;
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID'); $reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
if($file) { if($file) {
@ -4056,7 +4056,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Check to see if the user can be removed from the review list. // Check to see if the user can be removed from the review list.
$reviews = $this->getReviewStatus(); $reviews = $this->getReviewStatus();
if (is_bool($reviews) && !$reviews) { if (is_bool($reviews) && !$reviews) {
return -1; return false;
} }
$reviewStatus = null; $reviewStatus = null;
foreach($reviews as $review) { foreach($reviews as $review) {
@ -4076,12 +4076,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
`comment`, `date`, `userID`) ". `comment`, `date`, `userID`) ".
"VALUES ('". $reviewStatus["reviewID"] ."', '0', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '". "VALUES ('". $reviewStatus["reviewID"] ."', '0', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
$requestUser->getID() ."')"; $requestUser->getID() ."')";
//$queryStr = "DELETE FROM `tblDocumentReviewLog` WHERE `reviewLogID` = ".$reviewStatus['reviewLogID'];
$res=$db->getResult($queryStr); $res=$db->getResult($queryStr);
if (is_bool($res) && !$res) if (is_bool($res) && !$res)
return -1; return false;
return 0; return true;
} /* }}} */ } /* }}} */
/** /**
@ -4170,10 +4169,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return -2; return -2;
} }
// Check to see if the user has already been added to the approvers list. // Check if the user has already been added to the approvers list.
$approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version); $approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version);
if (is_bool($approvalStatus) && !$approvalStatus) { if (is_bool($approvalStatus) && !$approvalStatus) {
return -1; return false;
} }
$indstatus = false; $indstatus = false;
if (count($approvalStatus["indstatus"]) > 0) { if (count($approvalStatus["indstatus"]) > 0) {
@ -4190,7 +4189,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')"; "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID'); $approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
} }
@ -4247,10 +4246,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return -2; return -2;
} }
// Check to see if the group has already been added to the approver list. // Check if the group has already been added to the approver list.
$approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version); $approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version);
if (is_bool($approvalStatus) && !$approvalStatus) { if (is_bool($approvalStatus) && !$approvalStatus) {
return -1; return false;
} }
if (count($approvalStatus) > 0 && $approvalStatus[0]["status"]!=-2) { if (count($approvalStatus) > 0 && $approvalStatus[0]["status"]!=-2) {
// Group is already on the list of approvers; return an error. // Group is already on the list of approvers; return an error.
@ -4263,7 +4262,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '1', '". $groupID ."')"; "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '1', '". $groupID ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID'); $approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
} }
@ -4346,7 +4345,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$requestUser->getID() ."')"; $requestUser->getID() ."')";
$res=$db->getResult($queryStr); $res=$db->getResult($queryStr);
if (is_bool($res) && !$res) if (is_bool($res) && !$res)
return -1; return false;
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
if($file) { if($file) {
@ -4378,7 +4377,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Check to see if the user can be removed from the approval list. // Check to see if the user can be removed from the approval list.
$approvals = $this->getApprovalStatus(); $approvals = $this->getApprovalStatus();
if (is_bool($approvals) && !$approvals) { if (is_bool($approvals) && !$approvals) {
return -1; return false;
} }
$approvalStatus = null; $approvalStatus = null;
foreach($approvals as $approval) { foreach($approvals as $approval) {
@ -4447,7 +4446,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$requestUser->getID() ."')"; $requestUser->getID() ."')";
$res=$db->getResult($queryStr); $res=$db->getResult($queryStr);
if (is_bool($res) && !$res) if (is_bool($res) && !$res)
return -1; return false;
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID'); $approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
if($file) { if($file) {
@ -4483,7 +4482,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $indstatus["reviewID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; "VALUES ('". $indstatus["reviewID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
return 0; return 0;
@ -4517,7 +4516,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $reviewStatus[0]["reviewID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; "VALUES ('". $reviewStatus[0]["reviewID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
return 0; return 0;
@ -4552,7 +4551,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $indstatus["approveID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; "VALUES ('". $indstatus["approveID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
return 0; return 0;
@ -4586,7 +4585,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
"VALUES ('". $approvalStatus[0]["approveID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; "VALUES ('". $approvalStatus[0]["approveID"] ."', '".S_LOG_USER_REMOVED."', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')";
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
return -1; return false;
} }
return 0; return 0;