Typo in workitem(timeout).php [message #2480] |
Sun, 04 April 2010 23:46 |
ljkbrost
Messages: 59 Registered: April 2006
|
Member |
|
|
The start of the script is missing the script identifier. When you run the script with php, the system just outputs the text.
Should become
|
|
|
|
|
Re: Typo in workitem(timeout).php [message #2486 is a reply to message #2485] |
Mon, 05 April 2010 11:19 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
There is no logon process with batch jobs, therefore if you are using multiple accounts there is no facility for selecting which account you want to use. Is is therefore correct that you would have to define this manually within the batch job. It is also correct that you would require a separate batch job for each account - after all, each account is supposed to operate independently of the others.
As for the time limit, I disagree that it should be reduced to minutes instead of hours. It was designed to work in scenarios where an outside entity, such as a customer, is supposed to respond within a time limit. In the workflow documentation there is an example where the order is cancelled if the customer does not make payment, and I'm sure the customer would prefer a limit in hours rather than in minutes. What is wrong with a minimum time limit of 1 hour?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: Typo in workitem(timeout).php [message #2487 is a reply to message #2486] |
Tue, 06 April 2010 10:21 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I have played around with the 'workitem(timeout).php' script after creating a few timed events using different values of 'rdcaccount_id'. In order to make it work properly I have changed it so that it reads the contents of the MNU_ACCOUNT table, then for each rdcaccount_id it looks for corresponding records on the WF_WORKITEM table which need processing.
This means that this single batch job will be able to process outstanding workitems for all accounts, thus removing the need for a separate batch job for each account.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Typo in workitem(timeout).php [message #2489 is a reply to message #2488] |
Wed, 07 April 2010 12:04 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Interesting point. I've changed my code to allow the time_limit to be specified in hours and minutes instead of just hours. It will allow values between '0:01' and '999:59'. In order to do this there is a small database update which changes the 'time_limit' column from 'smallint' to 'int'. The changes are in the attached zip file. Let me know if this does what you want.
(attachment deleted, revised in later post)
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
[Updated on: Sun, 11 April 2010 03:46] Report message to a moderator
|
|
|
Re: Typo in workitem(timeout).php [message #2490 is a reply to message #2489] |
Sun, 11 April 2010 01:29 |
ljkbrost
Messages: 59 Registered: April 2006
|
Member |
|
|
I was having a horrible time testing this change. I kept getting errors about incomplete arcs and I constantly changed the workflow trying to get it to work and had no luck.
Stepping through the code, I found that fireTimedEvent(...) was being called with an incomplete wf_workitem record. The transition_id was not being copied into the wf_workitem record. I traced the problem back to the following code inside wf_workitem.class.inc:
function _cm_pre_getData ($where, $where_array, $fieldarray=null)
// perform custom processing before database record(s) are retrieved.
// (WHERE is supplied in two formats - string and array)
// $fieldarray may contain full details of the current record in the parent
// class, not just its primary key.
{
global $dbprefix;
// only do this if sql_select is empty
if (empty($this->sql_select)) {
// include columns from foreign table
$this->sql_select = 'user_id, role_id, wf_workitem.workflow_id, case_id, workitem_id, wf_workitem.task_id, transition_trigger, workitem_status, enabled_date, cancelled_date, finished_date, deadline, context, workflow_name, task_desc, rdcaccount_id
';
$this->sql_from = 'wf_workitem '
. 'LEFT JOIN wf_workflow ON (wf_workflow.workflow_id=wf_workitem.workflow_id) '
. 'LEFT JOIN ' . $dbprefix . 'menu.mnu_task ON (mnu_task.task_id=wf_workitem.task_id) ';
} // if
return $where;
} // _cm_pre_getData
The sql_select is missing 'transition_id'. When I add it to the sql_select things work again.
Can you please make another patch with this fix and the updated library include file? I want to reset my development instance, apply your patch, and re-test for the time granularity change.
Thanks,
Kyle Brost
----
[Updated on: Sun, 11 April 2010 01:30] Report message to a moderator
|
|
|
|