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.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
if (is_bool($reviewStatus) && !$reviewStatus) {
return -1;
return false;
}
$indstatus = false;
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 ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
$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.
$reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version);
if (is_bool($reviewStatus) && !$reviewStatus) {
return -1;
if (is_bool($reviewStatus) && !$reviewStatus) {
return false;
}
if (count($reviewStatus) > 0 && $reviewStatus[0]["status"]!=-2) {
// 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() ."')";
$res=$db->getResult($queryStr);
if (is_bool($res) && !$res)
return -1;
return false;
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
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.
$reviews = $this->getReviewStatus();
if (is_bool($reviews) && !$reviews) {
return -1;
return false;
}
$reviewStatus = null;
foreach($reviews as $review) {
@ -4076,12 +4076,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
`comment`, `date`, `userID`) ".
"VALUES ('". $reviewStatus["reviewID"] ."', '0', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
$requestUser->getID() ."')";
//$queryStr = "DELETE FROM `tblDocumentReviewLog` WHERE `reviewLogID` = ".$reviewStatus['reviewLogID'];
$res=$db->getResult($queryStr);
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;
}
// 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);
if (is_bool($approvalStatus) && !$approvalStatus) {
return -1;
return false;
}
$indstatus = false;
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 ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
}
@ -4247,10 +4246,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
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);
if (is_bool($approvalStatus) && !$approvalStatus) {
return -1;
return false;
}
if (count($approvalStatus) > 0 && $approvalStatus[0]["status"]!=-2) {
// 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 ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
$approveID = $db->getInsertID('tblDocumentApprovers', 'approveID');
}
@ -4346,7 +4345,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$requestUser->getID() ."')";
$res=$db->getResult($queryStr);
if (is_bool($res) && !$res)
return -1;
return false;
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
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.
$approvals = $this->getApprovalStatus();
if (is_bool($approvals) && !$approvals) {
return -1;
return false;
}
$approvalStatus = null;
foreach($approvals as $approval) {
@ -4447,7 +4446,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$requestUser->getID() ."')";
$res=$db->getResult($queryStr);
if (is_bool($res) && !$res)
return -1;
return false;
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
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() ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
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() ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
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() ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
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() ."')";
$res = $db->getResult($queryStr);
if (is_bool($res) && !$res) {
return -1;
return false;
}
return 0;