hello want to seek some help on you guys i created an extension to cancel the request and update the approvalScheme below is my method. basically if user want to cancel their request i want to update also the approvalscheme table to avoid apearing in list of approval but the status is closed
public function cancelot()
{
$otCancelValue = $this->Get('ot_cancel');
$sOQL = "SELECT ApprovalScheme WHERE obj_key = :id";
$oApprovalRequestCancel = new DBObjectSet(
DBObjectSearch::FromOQL($sOQL),
array('id' => $this->Get('id'))
);
while ($oRequest = $oApprovalRequestCancel->Fetch()) {
if ($otCancelValue === 'yes') {
$this->Set('parent_request_id',null);$this->Set('status',"closed");$this->Set('close_date',time());$this->Set('public_log',"Cancelled");$oRequest->Set('current_step',"1");$oRequest->Set('status',"rejected");$oRequest->Set('abort_comment',"Cancelled by user");$oRequest->DBUpdate();}
}
}
got an ERROR:
2023-12-28 15:44:29 | Error | 71 | Wrong direction in ORDER BY spec, found '59' and expecting a boolean value | CoreException |||
Just a guess: I think your DBObjectSearch is missing a parameter. Any chance the id is 59? Second parameter is likely the order (default: asc). You might need to specify an empty array as second argument; then the one with the ID placeholder becomes the third argument.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello want to seek some help on you guys i created an extension to cancel the request and update the approvalScheme below is my method. basically if user want to cancel their request i want to update also the approvalscheme table to avoid apearing in list of approval but the status is closed
{
$otCancelValue = $this->Get('ot_cancel');
$sOQL = "SELECT ApprovalScheme WHERE obj_key = :id";
$oApprovalRequestCancel = new DBObjectSet(
DBObjectSearch::FromOQL($sOQL),
array('id' => $this->Get('id'))
);
while ($oRequest = $oApprovalRequestCancel->Fetch()) {
if ($otCancelValue === 'yes') {
}
}
got an ERROR:
array (
'exception class' => 'CoreException',
'file' => 'C:\xampp\htdocs\test\core\dbsearch.class.php',
'line' => 1017,
'origin' => 'Combodo\iTop\Portal\Form\ObjectFormManager::Combodo\iTop\Portal\Form\ObjectFormManager::OnSubmit',
'obj_class' => 'UserRequest',
'obj_key' => '59',
hoping you guys can help me
Just a guess: I think your DBObjectSearch is missing a parameter. Any chance the id is 59? Second parameter is likely the order (default: asc). You might need to specify an empty array as second argument; then the one with the ID placeholder becomes the third argument.
oh so thats what i'm missing thank you very much here is the part that i updated
$oApprovalRequestCancel = new DBObjectSet(
DBObjectSearch::FromOQL($sOQL),
array(),
array('id' => $this->Get('id'))
);