Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By amform
#793326
Hi,
I had an older version of PM version 1.6, now we are using 2.5.
In the older version we have a reset button to reset tasks. I don't have it in this new version.
How can I have that feature or how can I reset a task?
Thanks
Regards
User avatar
By amosbatto
#793327
You can simply delete the task and then create a new task on the process map, which will be set to the default settings. Before you delete a task, you need to unassign all the assigned users to the task and complete all cases which are currently in that task.
By amform
#793329
Thanks amosbatto,
There is no other way to reset it? In the older version I had a plugin that make the reset button available
User avatar
By amosbatto
#793331
No way that I know, although it isn't that hard to change a task's properties back to its default values. It is just one dialog box of properties.
User avatar
By amosbatto
#793339
Create a new task. Then copy its values in the TASK table (except for fields like TAS_UID, TAS_ID, TAS_TITLE, TAS_DESCRIPTION). Then write those values to the task that you want to reset.
By amform
#793354
My issue is that I don't want to affect the overall flow.
Let me explain, the flow is use by several users so before in the old version it was an option to reset a task for a particular case or an individual flow.
For example flow is A to B and 30 users create cases for that flow, so how to go from B to A for only one of the users.
So I want to know how can I do it through the DB, what I need to delete,insert, update and in which database (wf_workflow, etc)
Thanks
Regards
User avatar
By amosbatto
#793403
Oh, you aren't talking about changing the definition of a task. Instead, you are talking about routing a case from any task to any other task in the process. You just have to close the present task in the APP_DELEGATION and APP_CACHE_VIEW tables and create new records for the task in those same tables for the task where you want the case to go.

The code would be something like this:
Code: Select all
$processId = 'XXXXXXXXXXXXXXXXXXXXXXXX'; //set to ID of process
$caseId = 'XXXXXXXXXXXXXXXXXXXXXXXX'; //set to the ID of the case
$currentIndex = 2; //set to the current delegation index of the case 
$nextTaskId = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'; //set to ID of task where the case will be redirected
$nextUserId = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'; //set to the ID of a user who is in the task's assignment pool
$now = date("Y-m-d  H:i:s");
$t = new Task();
$aTask = $t->Load($nextTaskId);
$duration = $aTask['TAS_DURATION'];
$timeUnits = $aTask['TAS_TIMEUNIT'];
$taskType = $aTask['TAS_TYPE'];
$taskTitle = $aTask[["TAS_TITLE"]:

G::LoadClass('dates');
$d = new dates();
$ret = $d->calculateDate($now, $duration, $timeUnits, 2, $nextUserId, $processId, $taskId);
$dueDate = $ret['DUE_DATE'];

executeQuery("UPDATE APP_DELEGATION SET DEL_THREAD_STATUS='CLOSED', DEL_FINISH_DATE='$now' 
   WHERE APP_UID='$caseId' AND DEL_INDEX=$currentIndex");
executeQuery("UPDATE APP_CACHE_VIEW SET DEL_THREAD_STATUS='CLOSED', DEL_FINISH_DATE='$now' 
   WHERE APP_UID='$caseId' AND DEL_INDEX=$currentIndex");
executeQuery("UPDATE APPLICATION SET APP_STATUS='TO_DO' WHERE APP_UID='$caseId' ");

$aCase = executeQuery("SELECT * FROM APP_CACHE_VIEW WHERE APP_UID='$caseId' AND DEL_INDEX=$currentIndex");
$nextDelegationId = $aCase[1]['DELEGATION_ID'] + 1;
$caseNo = $aCase[1]['APP_NUMBER'];
$nextIndex = $currentIndex + 1;
$thread = $aCase[1]['DEL_THREAD'];
$lastUserId = $aCase[1]['USR_UID'];
$caseTitle = $aCase[1]['APP_TITLE'];
$processTitle = $aCase[1]['APP_PRO_TITLE'];
$lastUserName = $aCase[1]['APP_CURRENT_USER'];
$aUser = userInfo($nextUserId);
$nextUserName = $aUser['firstname'] .' '. $aUser['lastname'];
$caseStarted = $aCase[1]['APP_CREATE_DATE'];

$sql = "INSERT INTO APP_DELEGATION 
   (APP_UID, DEL_INDEX, DELEGATION_ID, APP_NUMBER, DEL_PREVIOUS, DEL_LAST_INDEX, PRO_UID, 
   TAS_UID, USR_UID, DEL_TYPE, DEL_THREAD, DEL_THREAD_STATUS, DEL_PRIORITY, 
   DEL_DELEGATE_DATE, DEL_INIT_DATE, DEL_FINISH_DATE, DEL_TASK_DUE_DATE, 
   DEL_RISK_DATE, DEL_DURATION, DEL_QUEUE_DURATION, DEL_DELAY_DURATION, 
   DEL_STARTED, DEL_FINISHED, DEL_DELAYED, DEL_DATA, APP_OVERDUE_PERCENTAGE, 
   USR_ID, PRO_ID, TAS_ID) 
   VALUES ('$caseId', $nextIndex, $nextDelegationId, $caseNo, $currentIndex, $currentIndex, '$processId',
   '$nextTaskId', '$nextUserId', '$taskType', $thread, 'OPEN', 3, 
   '$now', '$now', NULL, '$dueDate', 
   '$dueDate', 0, 0, 0, 
   1, 0, 0, '', 0, 
   0, 0, 0)";
executeQuery($sql);
executeQuery("UPDATE APPLICATION SET APP_STATUS='TO_DO' WHERE APP_UID='$caseId' ");

$sql = "INSERT INTO APP_CACHE_VIEW 
    (APP_UID, DEL_INDEX, DEL_LAST_INDEX, APP_NUMBER, APP_STATUS, USR_UID, 
    PREVIOUS_USR_UID, TAS_UID, PRO_UID, 
    DEL_DELEGATE_DATE, DEL_INIT_DATE, DEL_FINISH_DATE, DEL_TASK_DUE_DATE, DEL_RISK_DATE, 
    DEL_THREAD_STATUS, APP_THREAD_STATUS, APP_TITLE, APP_PRO_TITLE, APP_TAS_TITLE, 
    APP_CURRENT_USER, APP_DEL_PREVIOUS_USER, DEL_PRIORITY, DEL_DURATION, 
    DEL_QUEUE_DURATION, DEL_DELAY_DURATION, DEL_STARTED, DEL_FINISHED, DEL_DELAYED, 
    APP_CREATE_DATE, APP_FINISH_DATE, APP_UPDATE_DATE, APP_OVERDUE_PERCENTAGE) 
    VALUES 
    ('$caseId', $nextIndex, $currentIndex, $caseNo, 'TO_DO', '$nextUserId',
    '$lastUserId', '$nextTaskId', '$processId',
    '$now', '$now', NULL, '$dueDate', '$dueDate', 
    'OPEN', 'OPEN', '$caseTitle','$processTitle', '$taskTitle',
    '$nextUserName', '$lastUserName', 3, 0,
    0, 0, 0, 0, 0, 
    '$caseStarted', NULL, '$now', 0)";
executeQuery($sql);
At least this is the code for version 3.2. You will have to adapt it for your version of PM.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]