ProcessMaker: Automated Cron Task


<?php
echo 'Automated cron task to evaluate form information and pass it on';
$dbuser="root";
$dbpass="";
$dbname="wf_workflow"; //the name of the database
$chandle = mysql_connect("127.0.0.1", $dbuser, $dbpass)
 or die("Connection Failure to Database");
mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser);
$qty=5;

//These keys need to be retrived from teh content table of the created task.

//automated user id who the waiting task is assigned to
$AUTO_USER_ID = '9859924314d367fe0450f37051224667';
$PRO_UID = '2045593264d367e54325200075086262';
$TAS_WAITING_UID = '2568359374d367e62073f48030834145';
//next task
$TASK_FINSHED_UID = '8718566894d367e65ab0561057703743';
$TASK_FINSHED_NEXT_USER = '00000000000000000000000000000001';

//query out the current task in waiting.

$query = "SELECT app.*, del.* FROM APPLICATION as app inner join APP_DELEGATION as del on (app.APP_UID = del.APP_UID) WHERE app.PRO_UID='".$PRO_UID."' and USR_UID='".$AUTO_USER_ID."' and app.APP_STATUS='TO_DO' and del.TAS_UID='".$TAS_WAITING_UID."' and del.DEL_THREAD_STATUS='OPEN'";

//echo '<br>'.$query.'<br><br>';
 $result = mysql_query($query,$chandle);
 while(($APP = mysql_fetch_array($result)))
 {
 //echo $APP['APP_UID'].'<br>';
 //echo print_r($APP);

$AppData[] = unserialize($APP['APP_DATA']);
 echo print_r($AppData);
 //echo '<br><br><br>';

//update the fact that the script has run
 $query = "update IGNORE APP_DELEGATION SET DEL_INIT_DATE=NOW() where APP_UID='".$APP['APP_UID']."' and TAS_UID ='".$APP['TAS_UID']."' and USR_UID='".$AUTO_USER_ID."' and DEL_THREAD_STATUS='OPEN'";
 //echo $query;
 $result = mysql_query($query,$chandle);
 //echo '<br><br><br>';

if($_GET['complete']=='on')
 {
 //atempt to close the ticket by updating the delegation table
 $query = "update IGNORE APP_DELEGATION SET DEL_THREAD_STATUS='CLOSED',DEL_FINISH_DATE=NOW() where APP_UID='".$APP['APP_UID']."' and TAS_UID ='".$APP['TAS_UID']."' and USR_UID='".$AUTO_USER_ID."' and DEL_THREAD_STATUS='OPEN'";
 //echo $query;
 $result = mysql_query($query,$chandle);

//now insert the new ticket for the next user
 $query="Insert INTO APP_DELEGATION SET APP_UID ='".$APP['APP_UID']."' ,DEL_INDEX ='".($APP['DEL_INDEX']+1)."' ,DEL_PREVIOUS ='".$APP['DEL_INDEX']."' ,PRO_UID ='".$APP['PRO_UID']."' ,TAS_UID='".$TASK_FINSHED_UID."' ,USR_UID='".$TASK_FINSHED_NEXT_USER."' ,DEL_TYPE ='".$APP['DEL_TYPE']."' ,DEL_THREAD='".$APP['DEL_THREAD']."' ,DEL_THREAD_STATUS ='OPEN' ,DEL_PRIORITY ='".$APP['DEL_PRIORITY']."' ,DEL_DELEGATE_DATE ='".$APP['DEL_DELEGATE_DATE']."' ,DEL_INIT_DATE='NULL' ,DEL_TASK_DUE_DATE=DATE_ADD(NOW(),INTERVAL 1 HOUR) ,DEL_FINISH_DATE=NULL, DEL_DURATION ='".$APP['DEL_DURATION']."' ,DEL_QUEUE_DURATION ='".$APP['DEL_QUEUE_DURATION']."' ,DEL_DELAY_DURATION='".$APP['DEL_DELAY_DURATION']."' ,DEL_STARTED='".$APP['DEL_STARTED']."' ,DEL_FINISHED ='".$APP['DEL_FINISHED']."' ,DEL_DELAYED='".$APP['DEL_DELAYED']."' ,DEL_DATA='".$APP['DEL_DATA']."' ,APP_OVERDUE_PERCENTAGE='".$APP['APP_OVERDUE_PERCENTAGE']."'";
 //echo '<br><br><br>'.$query;
 $result = mysql_query($query,$chandle);

//now update the relavent reflection to the right task.
 $query="update APP_THREAD set DEL_INDEX='".($APP['DEL_INDEX']+1)."' WHERE APP_UID='".$APP['APP_UID']."'";
 //echo '<br><br><br>'.$query;
 $result = mysql_query($query,$chandle);
 }
 }

mysql_close($chandle);

?>

Advertisements

ProcessMaker – Business Process Management Tool

2013-05-30_062222

ProcessMaker – with business processes governing more complex relationships and interacting with many different business systems, companies need an easy way to manage and improve their processes. Several factors make it difficult to manage these processes in human resources, finance, compliance, and other business functions.

  • Paper-based processes and business system silos prevent information and approvals from passing across departments easily
  • Limited IT (internal or outsourced) resources burdened by complex system installations that require too much time and trouble-shooting and by an ongoing assault of help desk requests.
  • Difficult-to-define business problems. When different stakeholders have different views of a problem and the description and scope of the problem often changes, finding a solution through a traditional linear process may not be possible.

2013-05-30_062346

For workers in organizations that must process and manage a heavy workload of requests as part of their job, workflow software helps them handle those requests more efficiently and quickly.

  • Improved communication and resolution of requests with and from other departments and customers. Web-based, form-driven processes and graphical drag-and-drop workflow maps automate processes and radically reduce paperwork, so business users can easily and quickly complete their tasks.
  • IT staff can be used more efficiently. Simple deployment and development means that technology managers can quickly get the software up and running without spending a lot of time with complex and unreliable installations. Business managers can create and modify established workflows, so changes can be completed more quickly with minimal IT involvement.
  • Continuous improvement of business processes. Designed for an adaptive approach, where technology and business managers work together to target problem processes for improvement in the larger stream of business activities. Workflows automated with ProcessMaker become consistent, repeatable, and measurable, so processes can be continuously refined and adapted to new conditions.