Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LEAF-4427 (Code style discussion) Use return value #2481

Draft
wants to merge 1 commit into
base: cancellation-rules2
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions LEAF_Request_Portal/sources/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,52 +816,53 @@ public function cancelRecord(int $recordID, ?string $comment = ''): int|string
else if ($this->hasWriteAccess($recordID) || strtolower($res[0]['userID']) == strtolower($this->login->getUserID())) {
if($res[0]['submitted'] > 0 &&
($comment == null || trim($comment) == '')) {
return 'Please explain the reason for cancellation';
$return_value = 'Please explain the reason for cancellation';
}
else {
$vars = array(':recordID' => $recordID,
':time' => time());
$sql = 'UPDATE `records`
SET `deleted` = :time
WHERE `recordID` = :recordID';

$vars = array(':recordID' => $recordID,
':time' => time());
$sql = 'UPDATE `records`
SET `deleted` = :time
WHERE `recordID` = :recordID';
$this->db->prepared_query($sql, $vars);

$this->db->prepared_query($sql, $vars);
// actionID 4 = delete
$vars = array(':recordID' => $recordID,
':userID' => $this->login->getUserID(),
':dependencyID' => 0,
':actionType' => 'deleted',
':actionTypeID' => 4,
':time' => time(),
':comment' => XSSHelpers::xscrub($comment));
$sql = 'INSERT INTO `action_history`
(`recordID`, `userID`, `dependencyID`, `actionType`, `actionTypeID`, `time`, `comment`)
VALUES
(:recordID, :userID, :dependencyID, :actionType, :actionTypeID, :time, :comment)';

// actionID 4 = delete
$vars = array(':recordID' => $recordID,
':userID' => $this->login->getUserID(),
':dependencyID' => 0,
':actionType' => 'deleted',
':actionTypeID' => 4,
':time' => time(),
':comment' => XSSHelpers::xscrub($comment));
$sql = 'INSERT INTO `action_history`
(`recordID`, `userID`, `dependencyID`, `actionType`, `actionTypeID`, `time`, `comment`)
VALUES
(:recordID, :userID, :dependencyID, :actionType, :actionTypeID, :time, :comment)';

$this->db->prepared_query($sql, $vars);

// delete state
$vars = array(':recordID' => $recordID);
$sql = 'DELETE
FROM `records_workflow_state`
WHERE `recordID` = :recordID';
$this->db->prepared_query($sql, $vars);

$this->db->prepared_query($sql, $vars);
// delete state
$vars = array(':recordID' => $recordID);
$sql = 'DELETE
FROM `records_workflow_state`
WHERE `recordID` = :recordID';

// delete tags
$vars = array(':recordID' => $recordID);
$sql = 'DELETE
FROM `tags`
WHERE `recordID` = :recordID';
$this->db->prepared_query($sql, $vars);

// delete tags
$vars = array(':recordID' => $recordID);
$sql = 'DELETE
FROM `tags`
WHERE `recordID` = :recordID';

$this->db->prepared_query($sql, $vars);
$this->db->prepared_query($sql, $vars);

// need to send emails to everyone upstream from the currect step.
$this->notifyPriorSteps($recordID);
// need to send emails to everyone upstream from the currect step.
$this->notifyPriorSteps($recordID);

$return_value = 1;
$return_value = 1;
}
}

return $return_value;
Expand Down
Loading