Pending workflow task on Home Page [message #2439] |
Thu, 04 February 2010 23:04 |
ljkbrost
Messages: 59 Registered: April 2006
|
Member |
|
|
Just wondering if there is an easy way to change the way the workflow items show up on the Home Page. So instead of seeing:
Add Request Item where request_id='184c-c87a-3ea1e0c6aea9674'
Can it be changed to something more human friendly like:
Complete Service Request for John's client.
If so, where?
If not, where would be a good place to place hooks into the system?
Thanks!
|
|
|
Re: Pending workflow task on Home Page [message #2441 is a reply to message #2439] |
Fri, 05 February 2010 12:41 |
AJM
Messages: 2369 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
This is tricky, but can be done. It comes in two parts:
(1) I have modified 'menu.xsl' so that if it finds a column called 'link_text' it will use this instead of constructing the default '<task_desc> where <context>'.
(2) By default the output will not contain a column called 'link_text', but by customising the '_cm_post_getData()' method in the 'wf_workitem_role' and/or 'wf_workitem_user' classes you can construct whatever text you like.
Here is a example of the custom code which I used in the 'wf_workitem_role' class:
// insert custom text into LINK_TEXT
foreach ($rows as $rownum => $rowdata) {
switch ($rowdata['task_id']) {
case 'x_person_addr(add)':
ini_set('include_path', ini_get('include_path') .PATH_SEPARATOR .'../xample');
$dbobject =& singleton::getInstance('x_person');
$data = $dbobject->getData($rowdata['context']);
if (!empty($data)) {
$data = $data[0];
$link_text = $rowdata['task_desc'] .' for ' .$data['first_name'] .' ' .$data['last_name'];
$rowdata['link_text'] = $link_text;
} // if
default:
break;
} // switch
$rows[$rownum] = $rowdata;
} // foreach
As you can see it is not that simple. I have to identify the database table from which I need to extract the extra data, create a table instance, then read the data.
Be aware that this is a modification to the standard class, so any changes you make may be overwritten if you reload the standard files.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: Pending workflow task on Home Page [message #2442 is a reply to message #2441] |
Sat, 06 February 2010 06:21 |
AJM
Messages: 2369 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Here's a better implementation which does not involve changing the standard classes, so any customisations which you make will not get overwritten in a future release.
I have created a new directory called 'workflow/classes/custom-processing' which contains a file called 'example.zip'. This zip file contains some examples of how the standard classes can be customised. These custom classes have a prefix of 'cp_' so that they can be separated from the standard classes.
If you do not have any custom processing then do not place any class files in the 'custom-processing' directory.
I have modified the standard 'wf_workitem_role' and 'wf_workitem_user' classes so that when the '_cm_post_getData()' method is executed it will look in the 'custom-processing' directory for a 'cp_' class file. If one exists it will execute whatever code it finds in the '_cm_post_getData()' method. If a file cannot be found then the database data will not be altered.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|