Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Typo in workitem(timeout).php
Typo in workitem(timeout).php [message #2480] Sun, 04 April 2010 23:46 Go to next message
ljkbrost is currently offline  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

<?php

Re: Typo in workitem(timeout).php [message #2482 is a reply to message #2480] Mon, 05 April 2010 04:30 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Thanks for spotting that. I will put the fix in the next release.

Re: Typo in workitem(timeout).php [message #2485 is a reply to message #2482] Mon, 05 April 2010 10:54 Go to previous messageGo to next message
ljkbrost is currently offline  ljkbrost
Messages: 59
Registered: April 2006
Member
There is also a problem when you try to execute this code when using rdcaccount_id's. When you run the script as the batch user you don't get any workflow items that have rdcaccount_id != 1. You can overload the $_SESSION['rdcaccount_id'] and it will pull in the workitems for that rdcaccount_id, but you would have to do this for all of the different rdcaccount_id's.

I coded a change so that a rdcaccount_id of '9119' was special in that anyone who had that number was able to edit all records regardless of the rdcaccount_id of that record. Similar to the rdcaccount_id=1 effect.

Also, since I'm on this thread. It would make more sense for the transition timeout to be recordable in the level of minutes versus hours. It offers more flexibility and the change is not significant to make this happen.

Cheers,


Kyle Brost
----
www.softelephant.com
Re: Typo in workitem(timeout).php [message #2486 is a reply to message #2485] Mon, 05 April 2010 11:19 Go to previous messageGo to next message
AJM is currently offline  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?


Re: Typo in workitem(timeout).php [message #2487 is a reply to message #2486] Tue, 06 April 2010 10:21 Go to previous messageGo to next message
AJM is currently offline  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.


Re: Typo in workitem(timeout).php [message #2488 is a reply to message #2486] Wed, 07 April 2010 09:56 Go to previous messageGo to next message
ljkbrost is currently offline  ljkbrost
Messages: 59
Registered: April 2006
Member
There are instances where I have workflows that need to be completed within minutes. For example, there is a support ticketing process that sends an email message when a URGENT request is raised. If that request is not acknowledged within 15 minutes a text message is initiated and at the 30 minute mark the Manager's are notified.

There are also instances where I interface with external batching systems where I need to query the outcome of an external event within 5-10 minutes. If we wait an hour the system appears slow and unresponsive even though it is not.

Looking at the code base it is a simple date/time field that has the offset applied to it. So having an hourly or a full time field HH:MM to be applied to it is just a matter of changing the input screen accordingly. I can make the changes to my copy of the framework and just replicate those changes when I d/l the latest version. But that become a maintenance issue when handling upgrades.

I just think the power of the framework is part of it's flexibility and enforcing artificial restrictions takes away some of that flexibility.

Cheers,


Kyle Brost
----
www.softelephant.com
Re: Typo in workitem(timeout).php [message #2489 is a reply to message #2488] Wed, 07 April 2010 12:04 Go to previous messageGo to next message
AJM is currently offline  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)


[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 Go to previous messageGo to next message
ljkbrost is currently offline  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

Re: Typo in workitem(timeout).php [message #2491 is a reply to message #2490] Sun, 11 April 2010 03:45 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Whoops! Embarassed

Revised code is attached.

This also contains the updated version of 'include.library.inc'


Previous Topic: workflow security issue.
Next Topic: FAQ - Error
Goto Forum:
  


Current Time: Sun Nov 03 12:58:06 EST 2024

Total time taken to generate the page: 0.01367 seconds