function nf_testsuite_setvar1_posthandler($processid, $taskid, $userid, $projectid) { if ($processid > 0 and $taskid > 0) { $nfclass = new nexflow($processid, $userid); $nfclass->set_currentTaskid($taskid); $msg = $nfclass->get_taskOptionalParm(); $var1 = COM_applyFilter($_POST['var1'], true); $nfclass->set_processVariable('VAR1', $var1); $nfclass->complete_task($taskid); nf_changeLog("You set VAR1 to {$var1}. Verify the following messages line up!"); } }
function nf_formatEmailMessage($type, $tid, $qid, $user) { global $CONF_NF, $_TABLES, $_CONF; $sql = "SELECT taskname,prenotify_message,postnotify_message,reminder_message,prenotify_subject,postnotify_subject,reminder_subject FROM {$_TABLES['nf_templatedata']} WHERE id='{$tid}'"; list($taskname, $premessage, $postmessage, $remindermessage, $presubject, $postsubject, $remindersubject) = DB_fetchArray(DB_query($sql)); $message = ''; $subject = ''; switch ($type) { case 'prenotify': $message = trim($premessage) == '' ? $CONF_NF['prenotify_default_message'] : $premessage; $subject = trim($presubject) == '' ? $CONF_NF['prenotify_default_subject'] : $presubject; break; case 'postnotify': $message = trim($postmessage) == '' ? $CONF_NF['postnotify_default_message'] : $postmessage; $subject = trim($postsubject) == '' ? $CONF_NF['postnotify_default_subject'] : $postsubject; break; case 'reminder': $message = trim($remindermessage) == '' ? $CONF_NF['reminder_default_message'] : $remindermessage; $subject = trim($remindersubject) == '' ? $CONF_NF['reminder_default_subject'] : $remindersubject; break; case 'escalation': $message = $CONF_NF['escalation_message']; $subject = $CONF_NF['escalation_subject']; break; } $dateassigned = DB_getItem($_TABLES['nf_queue'], 'createdDate', "id='{$qid}'"); $processid = DB_getItem($_TABLES['nf_queue'], 'nf_processID', "id='{$qid}'"); if ($processid > 0) { $nfclass = new nexflow($processid); $pid = $nfclass->get_ProcessVariable('PID'); } if (!isset($pid) or $pid < 1) { $projectName = 'unknown'; $projectlink = 'N/A'; $pid = 0; } else { $projectName = DB_getItem($_TABLES['nf_projects'], 'description', "id={$pid}"); $projectlink = $CONF_NF['RequestDetailLink_URL'] . '?id=' . $pid . '?appmode='; } $taskowner_uids = nf_getAssignedUID($qid); $taskowner = ''; foreach ($taskowner_uids as $taskowner_uid) { $taskowner .= $taskowner == '' ? COM_getDisplayName($taskowner_uid) : ', ' . COM_getDisplayName($taskowner_uid); } $link = $CONF_NF['TaskConsole_URL']; $search = array('[taskname]', '[taskowner]', '[user]', '[dateassigned]', '[newline]', '[here]', '[project]', '[projectname]', '[projectlink]', '[siteurl]'); $replace = array($taskname, $taskowner, $user, $dateassigned, "\n", $link, $pid, $projectName, $projectlink, $_CONF['site_url']); $message = str_replace($search, $replace, $message); $subject = str_replace($search, $replace, $subject); // Make API call to add any workflow customized notification formatting if (function_exists('PLG_Nexflow_tasknotification')) { $parms = array('type' => $type, 'tid' => $tid, 'qid' => $qid, 'user' => $user); $apiRetval = PLG_Nexflow_tasknotification($parms, $subject, $message); if (!empty($apiRetval['subject'])) { $subject = $apiRetval['subject']; } if (!empty($apiRetval['message'])) { $message = $apiRetval['message']; } } if ($CONF_NF['debug']) { COM_errorLog("nf_formatEmailMessage => Type:{$type}, Subject:{$subject}, Message:{$message}"); } return array($subject, $message); }
$tracelink = '<a href="#"><img src="' . $imgset . '/trace.gif" border="0" TITLE="Launch WorkFlow Trace" '; $tracelink .= 'onClick="nfNewWindow(\'%s\');return false;"></a>'; $reassignlink = '<a href="#"><img src="' . $imgset . '/reassign.gif" border="0" TITLE="Re-Assign Task" '; $reassignlink .= 'onClick="toggle_taskrec(\'reassign\',%s);return false;"></a>'; $assignBackLink = '<a href="#"><img src="' . $imgset . '/assignback.gif" border="0" TITLE="Assign Task to Original Owner" '; $assignBackLink .= 'onClick="toggle_taskrec(\'assignBack\',%s);return false;"></a>'; $assignBackLinkOff = '<img src="' . $imgset . '/assignback-off.gif" border="0" TITLE="Assign Task to Original Owner">'; $holdLink = '<a href="#"><img src="' . $imgset . '/%s" border="0" TITLE="%s" '; $holdLink .= 'onClick="putTaskOnHOld(%s);return false;" id="onholdimg"></a>'; $notifylink = '<a href="#"><img src="' . $imgset . '/send_notification.gif" border="0" TITLE="Send Task Reminder" '; $notifylink .= 'onClick="toggle_taskrec(\'notify\',%s);return false;"></a>'; $deletelink = '<a href="' . $actionurl . '?op=deltask&taskid=%s&id=%s" onclick="return confirm(\'Delete this task?\');">'; $deletelink .= '<img src="' . $imgset . '/delete.gif" border="0" TITLE="Delete Task"></a>'; $i = 1; while ($A = DB_fetchArray($query, false)) { $nfclass = new nexflow(); $nfclass->_nfProcessId = $A['nf_processID']; $project_id = $nfclass->get_ProcessVariable('PID'); $project_status = DB_getItem($_TABLES['nf_projects'], 'status', "id='{$project_id}'"); $p->set_var('id', $i); $p->set_var('csscode', $i % 2 + 1); $p->set_var('taskid', $A['id']); $p->set_var('processid', $A['nf_processID']); $p->set_var('assignment_rec', $A['assignment_rec']); $p->set_var('taskname', $A['taskname']); $taskdate = explode(' ', $A['createdDate']); $p->set_var('date', $taskdate[0]); $templateName = DB_getItem($_TABLES['nf_template'], 'templateName', "id='{$A['nf_templateID']}'"); $project_name = DB_getItem($_TABLES['nf_projects'], 'description', "wf_process_id='{$A['nf_processID']}'"); $p->set_var('assigned_UID', $A['assigned_uid']); if ($project_name == '') {
if ($mode == 'draft' and !isset($_POST['custom_handler'])) { echo COM_refresh($form_return_url); } else { echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php' . $optReturnVars); } exit; } DB_query("INSERT INTO {$_TABLES['nf_projectforms']} (formtype,created_by_taskid) VALUES ('{$formtype}', '{$taskid}');"); $project_formid = DB_insertID(); if ($newform == 1) { nexform_dbupdate($form_id, $id); $result_id = $id; } else { $result_id = nexform_dbsave($form_id, $postUID); } $nfclass = new nexflow($processid, $postUID); /* Update the hit or results counter */ DB_query("UPDATE {$_TABLES['nxform_definitions']} SET responses = responses + 1 WHERE id='{$form_id}'"); $newproject = false; if ($processid > 0 and $taskid > 0) { $project_id = $nfclass->get_ProcessVariable('PID'); } // Create new project tracking record if project does not yet exist if ($project_id < 1 or DB_count($_TABLES['nf_projects'], 'id', $project_id) == 0) { $processid = intval($processid); DB_query("INSERT INTO {$_TABLES['nf_projects']} (originator_uid,wf_process_id,wf_task_id,status)\r\n VALUES ('{$postUID}','{$processid}','{$taskid}','1') "); $project_id = DB_insertID(); $nfclass->set_ProcessVariable('PID', $project_id); $newproject = true; if ($CONF_NF['debug']) { COM_errorLog("form_post_handler: Create new project_id: {$project_id}");
function display_mytasks() { global $CONF_NF, $_USER, $_CONF, $_POST, $_TABLES, $actionurl, $formstatus_options, $usermodeUID, $optLinkVars, $errmsg, $LANG_NF00; $nfclass = new nexflow(); $nfclass->_nfUserId = $usermodeUID; $nfclass->set_debug(false); $nfclass->getQueue(); $srchFilter = COM_applyFilter($_REQUEST['srchFilter']); $srchText = COM_applyFilter($_REQUEST['srchText']); $idForAppGroup = COM_applyFilter($_REQUEST['idAppGroup'], true); $searchString = COM_applyFilter($_REQUEST['srchText']); $srchStatus = COM_applyFilter($_REQUEST['srchStatus']); $doSearch = COM_applyFilter($_POST['dosearch']); $taskconsolefilter = COM_applyFilter($_POST['taskconsolefilter'], true); $taskSort = COM_applyFilter($_REQUEST['tasksort']); $sortDirection = COM_applyFilter($_REQUEST['sortorder']); if (empty($taskSort)) { $taskSort = 'cdate'; } if (empty($sortDirection)) { $sortDirection = 'desc'; } //RK included these items here for future filtering abilities $pagesize = COM_applyFilter($_REQUEST['$pagesize'], true); $filterdate = COM_applyFilter($_REQUEST['filterdate']); $page = COM_applyFilter($_REQUEST['$page'], true); $imgset = $_CONF['layout_url'] . '/nexflow/images'; $headingFilterOptions = '&taskuser='******'desc') { $headingFilterOptions .= '&sortorder=asc'; } else { $headingFilterOptions .= '&sortorder=desc'; } if (!empty($srchFilter)) { $headingFilterOptions .= "&srchFilter={$srchFilter}"; } if (!empty($srchText)) { $headingFilterOptions .= "&srchText={$srchText}"; } if (!empty($idForAppGroup)) { $headingFilterOptions .= "&idAppGroup={$idForAppGroup}"; } if (!empty($srchStatus)) { $headingFilterOptions .= "&srchStatus={$srchStatus}"; } $p = new Template($_CONF['path_layout'] . 'nexflow'); $p->set_file(array('report' => 'taskconsole/viewtasks.thtml', 'records' => 'taskconsole/viewtask_record.thtml', 'javascript' => 'taskconsole/javascript/taskconsole.thtml')); $p->set_var('layout_url', $_CONF['layout_url']); $p->set_var('site_url', $_CONF['site_url']); $p->set_var('imgset', $imgset); $p->set_var('actionurl', $actionurl); $p->set_var('taskuser', $usermodeUID); $p->set_var('show_awaystatus', 'none'); $heading1 = "<a href=\"{$actionurl}?tasksort=template{$headingFilterOptions}\">Flow Name</a>"; if ($taskSort == 'template') { if ($sortDirection == 'asc') { $heading1 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading1 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $p->set_var('heading1', $heading1); $heading2 = "<a href=\"{$actionurl}?tasksort=taskname{$headingFilterOptions}\">Task Name</a>"; if ($taskSort == 'taskname') { if ($sortDirection == 'asc') { $heading2 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading2 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $heading2 .= '<span style="padding-left:5px;font-weight:normal;font-size:9px;">[click on task name to perform]</span>'; $p->set_var('heading2', $heading2); $heading3 = "<a href=\"{$actionurl}?tasksort=cdate{$headingFilterOptions}\">Assigned</a>"; if ($taskSort == 'cdate') { if ($sortDirection == 'asc') { $heading3 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowdown.gif" border="0"></span>'; } else { $heading3 .= '<span style="padding-left:10px;"><img src="' . $imgset . '/bararrowup.gif" border="0"></span>'; } } $p->set_var('heading3', $heading3); $p->set_var('srchText', $LANG_NF00['srchText']); $p->set_var('srchFilter', $LANG_NF00['srchFilter']); $p->set_var('srchFilterTitle', $LANG_NF00['srchFilterTitle']); $p->set_var('srchFilterReqDesc', $LANG_NF00['srchFilterReqDesc']); $p->set_var('srchFilterPrjName', $LANG_NF00['srchFilterPrjName']); $p->set_var('srchDoSearch', $LANG_NF00['srchDoSearch']); //search/filter area setup $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup'); $p->set_var('show_selectappfield', 'none'); $p->set_var('show_searchtextfield', ''); switch (strtolower($srchFilter)) { case 'appgroup': $appGroupDDL = COM_optionList($_TABLES['nf_appgroups'], 'id,AppGroup', $idForAppGroup); $p->set_var('srchselappgroup', 'selected'); $p->set_var('show_selectappfield', ''); $p->set_var('show_searchtextfield', 'none'); case 'title': $p->set_var('srchseltitle', 'selected'); break; case 'desc': $p->set_var('srchselreqdesc', 'selected'); break; } $p->set_var('srchTextValue', $srchText); $p->set_var('srchApplicationGroups', $appGroupDDL); switch ($srchStatus) { case 1: $srchStatus = 0; //since the COM_applyfilter makes everything zero, we need to change this from 1 to 0 in code. $p->set_var('srchselactive', 'selected'); break; case 2: $p->set_var('srchselonhold', 'selected'); break; case 3: $p->set_var('srchselstarted', 'selected'); break; case 4: $p->set_var('srchselunstarted', 'selected'); break; case -1: $p->set_var('srchselany', 'selected'); break; } $sel_sort_options = ''; foreach ($CONF_NF['sortOptions'] as $value => $label) { if ($taskSort == $value) { $sel_sort_options .= '<option value="' . $value . '" SELECTED=SELECTED>' . $label . '</option>'; $p->set_var('selected_tasksort_option', $value); } else { $sel_sort_options .= '<option value="' . $value . '">' . $label . '</option>'; } } $p->set_var('sel_sort_options', $sel_sort_options); //end of search/filter area if (trim($errmsg) != '') { $p->set_var('error_message', $errmsg); } else { $p->set_var('show_message', 'none'); } // Test to see if we enable the ability to select taskconsole view for another user if (SEC_hasRights('nexflow.admin')) { $p->set_var('show_seltaskuser', ''); $p->set_var('sel_user_options', COM_optionList($_TABLES['users'], 'uid,username', $usermodeUID)); } else { $p->set_var('show_seltaskuser', 'none'); $p->set_var('sel_user_options', ''); } if ($_REQUEST['autoclose']) { $autoclose = '<script type="text/javascript">' . LB; $autoclose .= 'window.onload = function() { ' . LB; $autoclose .= ' self.close();' . LB; $autoclose .= ' return true;' . LB; $autoclose .= '}' . LB; $autoclose .= '</script>' . LB; $p->set_var('javascript_close_onload', $autoclose); } $LANG_CONFIRM = 'Please confirm that you want to delete this process and task records'; /* Clicking on Task Name triggers action and need to use icon in Actions Column to display project Details */ $newFormLink = $actionurl . '?op=edit&formid=%s&projectid=%s&taskid=%s' . $optLinkVars; $editFormLink = $actionurl . '?op=edit&formid=%s&result=%s&taskid=%s' . $optLinkVars; $onClick_action = 'OnClick="ajaxStartTask(%s);"'; /* @TODO: Commented out for now (Blaine) //$holdTaskLink = '<a href="#" onclick="ajaxPutOnHold(%s,%s);"><img src="' . $_CONF['layout_url'] . '/nexflow/images/onhold.png" border=0 alt="%s"></a>'; */ // Check if this user has any tasks that were reassigned $reassignedTaskCount = DB_count($_TABLES['nf_productionassignments'], 'assignBack_uid', $usermodeUID); if ($reassignedTaskCount > 0) { $reassignment_message .= '<div style="font-weight:normal;padding-left:20px;">'; if ($reassignedTaskCount == 1) { $reassignment_message .= "You have 1 task that has been re-assigned. Click "; } else { $reassignment_message .= "You have {$reassignedTaskCount} tasks that have been re-assigned. Click "; } $reassignment_message .= '<a href="' . $actionurl . '?op=reassignments' . $optLinkVars . '">here</a> to view them</div>'; $p->set_var('reassignment_message', $reassignment_message); } else { $p->set_var('show_reassignmentmessage', 'none'); } /* This delete feature is disabled for production use via a config option. It will delete all related records for the project this task is linked to */ $deleteLink = '<a href="' . $actionurl . '?op=delete&taskid=%s&project_id=%s' . $optLinkVars . '" onclick="return confirm(\'' . $LANG_CONFIRM . '\');">'; $deleteLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/delete.gif" border="0" TITLE="Delete Record"></a>'; $tasks = $nfclass->get_tasks(); if ($taskconsolefilter) { $p->set_var('lang_hidefilter', 'hide filter'); $sortedtasks = nf_getSortedTaskArray($tasks, $srchFilter, $taskSort, $srchText, $idForAppGroup, $srchStatus, $sortDirection); } elseif (!empty($taskSort)) { $p->set_var('hidefilter', 'none'); $p->set_var('lang_hidefilter', 'show filter'); $sortedtasks = nf_getSortedTaskArray($tasks, $srchFilter, $taskSort, $srchText, $idForAppGroup, $srchStatus, $sortDirection); } else { $p->set_var('hidefilter', 'none'); $p->set_var('lang_hidefilter', 'show filter'); if (is_array($tasks) and count($tasks) > 0) { arsort($tasks); // Show latest task first $sortedtasks = $tasks; } else { $sortedtasks = ''; } } if (is_array($sortedtasks) and count($sortedtasks) > 0) { $i = 1; $p->set_var('num_records', count($sortedtasks)); foreach ($sortedtasks as $taskrec) { $p->set_var('task_action_url', ''); $p->set_var('task_onclick', ''); $p->set_var('edit', '<span style="padding-left:2px;"> </span>'); $p->set_var('rowid', $i); $p->set_var('csscode', $i % 2 + 1); $p->set_var('class_newtask', ''); $startedDate = DB_getItem($_TABLES['nf_queue'], 'startedDate', "id='{$taskrec['id']}'"); $taskStatus = DB_getItem($_TABLES['nf_queue'], 'status', "id='{$taskrec['id']}'"); $p->set_var('on_hold_notice', ''); if ($taskStatus == 2) { $p->set_var('task_icon', 'onhold2.png'); $p->set_var('on_hold_notice', '<p style="margin-bottom:5px;color:red">This Task is ON HOLD. It cannot be executed until it is put back into active status.</p>'); } else { $p->set_var('task_icon', 'task.gif'); } if ($startedDate == NULL or $startedDate == 0) { $p->set_var('task_icon', 'new_task.gif'); $p->set_var('task_started_date', ",task not started"); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_started_date', ",started:{$startedDate}"); $p->set_var('task_onclick', ''); } $nfclass->_nfProcessId = $taskrec['processid']; $project_id = $nfclass->get_ProcessVariable('PID'); $project_id = NXCOM_filterInt($project_id); if ($project_id == 0) { //lets try to do a simple select in the nfprojects table to ensure no project exists. $sql = "SELECT id from {$_TABLES['nf_projects']} where wf_process_id='{$taskrec['processid']}'"; $res = DB_query($sql); list($project_id) = DB_fetchArray($res); $project_id = NXCOM_filterInt($project_id); } //at this point, if the project_id is still 0, then we have no project data to show //show a general task console line item for execution by the end user. $taskStatus = DB_getItem($_TABLES['nf_queue'], 'status', "id='{$taskrec['id']}'"); if (SEC_hasRights('nexflow.admin')) { if ($taskStatus == 2) { $p->set_var('hold', sprintf($holdTaskLink, $i, $taskrec['id'], 'Re-activate')); } else { $p->set_var('hold', sprintf($holdTaskLink, $i, $taskrec['id'], 'Toggle On-Hold')); } } if ($project_id > 0) { $p->set_var('hidetaskinfo', ''); $project_detailsLink = '<a href="#" onClick=\'ajaxViewProjectDetails(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Project Details"></a> '; $project_detailsLink .= '<a href="#" onClick=\'ajaxViewProjectComments(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/comment.gif" border="0" TITLE="View Project Comments"></a> '; // If task is for a project on hold or in a Recycled or Killed status then do not show it // There should never be any tasks appearing is status is Killed as that workflow should have been forced to complete state. $project_state = DB_getItem($_TABLES['nf_projects'], 'status', "id='{$project_id}'"); if ($project_state != 6 && $project_state != 7) { if ($nfclass->_debug) { $logmsg = "Row:{$i} -> Project ID:{$project_id},Task ID:{$taskrec['id']}. "; $logmsg .= "Processid:{$taskrec['processid']}, Task:{$taskrec['taskname']}, "; $logmsg .= "TaskID: {$taskrec['templateTaskid']}, TaskType: {$taskrec['stepType']}"; COM_errorLog($logmsg); } $p->set_var('task_id', $taskrec['id']); $p->set_var('project_id', $project_id); $p->set_var('project_details', sprintf($project_detailsLink, $i, $project_id, $usermodeUID, $taskrec['id'], $i, $project_id, $usermodeUID, $taskrec['id'])); // Determine if this task is for a regenerated workflow and we need to update the main project/request record $parentProcessID = DB_getItem($_TABLES['nf_process'], 'pid', "id='{$taskrec['processid']}'"); if ($parentProcessID > 0) { // Now check if this same template task id was executed in the previous process - if so then it is a recycled task // Don't show the re-generated attribute if in this instance of the process we proceed further and are executing new tasks if (DB_count($_TABLES['nf_queue'], array('nf_processID', 'nf_templateDataId'), array($parentProcessID, $taskrec['templateTaskid'])) > 0) { $taskrec['taskname'] = '<div style="color:red;padding-right:5px;display:inline;">[R]</div>' . $taskrec['taskname']; } } $pquery = DB_query("SELECT wf_process_id FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'"); list($wf_process_id) = DB_fetchArray($pquery); if ($wf_process_id > 0 and $wf_process_id == $parentProcessID) { if ($nfclass->_debug) { COM_errorLog("Taskconsole: Updated wf_process_id for project: {$project_id} from {$wf_process_id} to {$taskrec['processid']}"); } DB_query("UPDATE {$_TABLES['nf_projects']} SET wf_process_id='{$taskrec['processid']}' WHERE id='{$project_id}'"); } $p->set_var('project_number', $project_id); // Retrieve any Project Comments $comment_count = DB_count($_TABLES['nf_projectcomments'], 'project_id', $project_id); if ($comment_count > 0) { $csql = "SELECT timestamp, b.username FROM {$_TABLES['nf_projectcomments']} a "; $csql .= "LEFT JOIN {$_TABLES['users']} b on a.uid=b.uid WHERE project_id='{$project_id}' "; $csql .= "ORDER BY timestamp DESC LIMIT 1"; list($timestamp, $username) = DB_fetchArray(DB_query($csql)); $p->set_var('comments_note', "({$comment_count}) <b>Last by:</b> {$username}, " . strftime('%m/%d/%Y %H:%M', $timestamp)); } else { $p->set_var('comments_note', 'No Comments'); } // If this this is an interactive tasktype - Check and see if taskhistory record has a "started" timestamp set. if ($taskrec['stepType'] == 1 or $taskrec['stepType'] == 7 or $taskrec['stepType'] == 8) { $q1 = DB_query("SELECT project_id,date_started FROM {$_TABLES['nf_projecttaskhistory']} WHERE task_id='{$taskrec['id']}'"); if (DB_numRows($q1) == 0) { // No task history record yet $p->set_var('class_newtask', 'class="nexflowNewTask"'); $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); DB_query("INSERT INTO {$_TABLES['nf_projecttaskhistory']} (project_id,process_id,task_id,assigned_uid,date_assigned)\r\n VALUES ('{$project_id}','{$taskrec['processid']}','{$taskrec['id']}','{$usermodeUID}','{$date_assigned}') "); } else { list($xprj_id, $xdate_started) = DB_fetchArray($q1); if ($xprj_id == 0) { // Task history record - but missing project_id $p->set_var('class_newtask', 'class="nexflowNewTask"'); DB_query("UPDATE {$_TABLES['nf_projecttaskhistory']} SET project_id='{$project_id}' WHERE task_id='{$taskrec['id']}'"); } } } else { unset($xdate_started); } // Retrieve the project description for this task - used as Project Title $pquery = DB_query("SELECT description,originator_uid FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'"); list($description, $originator) = DB_fetchArray($pquery); $submitted_date = DB_getItem($_TABLES['nf_process'], 'initiatedDate', "id={$taskrec['processid']}"); $submitter_info = COM_getDisplayName($originator) . " / {$submitted_date}"; // Retrieve the flow name dynamic custom functions for appending to the display name to be used for the description $descSQL = "SELECT b.templateName, a.customFlowName FROM {$_TABLES['nf_process']} a "; $descSQL .= "INNER JOIN {$_TABLES['nf_template']} b on b.id=a.nf_templateId "; $descSQL .= "WHERE a.id={$taskrec['processid']} "; $descRes = DB_query($descSQL); list($templateName, $processCustomName) = DB_fetchArray($descRes); if (trim($description) != '') { $p->set_var('description', $description); } else { $p->set_var('description', $templateName); } if ($processCustomName != '') { $p->set_var('project_title', $processCustomName); } else { $p->set_var('project_title', $templateName); } $p->set_var('assigned_date', $taskrec['cdate']); $p->set_var('submitter_info', $submitter_info); if ($taskrec['stepType'] == 8) { // This is a nexform autotag handler $form_id = $taskrec['url']; // Check and see if the same form has been submitted for this task yet. $sql = "SELECT a.id,a.formtype,a.results_id,a.status,a.created_by_taskid, b.nf_templateDataID "; $sql .= "FROM {$_TABLES['nf_projectforms']} a "; $sql .= "LEFT JOIN {$_TABLES['nf_queue']} b on b.id=a.created_by_taskid "; $sql .= "WHERE project_id='{$project_id}' AND form_id='{$form_id}' "; $query = DB_query($sql); $newFormRecord = false; if (DB_numRows($query) >= 1) { $newFormRecord = true; while (list($prj_formid, $formtype, $result_id, $state, $created_by_taskid, $form_taskTemplateDataID) = DB_fetchArray($query)) { // Check if this is the same task editing, Rejected form so Task is a new queue ID but same templateDataID or Final Edit Task if ($taskrec['id'] == $created_by_taskid || $form_taskTemplateDataID == $taskrec['templateTaskid'] || in_array($taskrec['templateTaskid'], $CONF_NF['final_edit_tasks'])) { // Check and see if the created_by_taskid has been updated - since it will have the original task id if ($processPID != 0 and $created_by_taskid != $taskrec['id']) { DB_query("UPDATE {$_TABLES['nf_projectforms']} SET created_by_taskid='{$taskrec['id']}' WHERE id='{$prj_formid}'"); } $p->set_var('state', $formstatus_options[$state]); if ($state == 0 or $state == 2 or $state == 3 or $state == 6) { // Not final distributed version or rejected // Need to reset the process variable used to check the form approval result $nfclass->_nfProcessId = $taskrec['processid']; $nfclass->set_ProcessVariable('Review_Approval', 0); /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($editFormLink, $form_id, $result_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } } $sql = "SELECT timestamp FROM {$_TABLES['nf_projecttimestamps']} "; $sql .= "WHERE project_id={$project_id} ORDER BY timestamp DESC LIMIT 1"; $q = DB_query($sql); list($timestamp) = DB_fetchArray($q); if ($timestamp > 0) { $p->set_var('date', strftime("%Y-%m-%d", $timestamp)); } else { $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); $p->set_var('date', strftime("%Y-%m-%d", $date_assigned)); } $newFormRecord = false; } } } if (DB_numRows($query) == 0 or $newFormRecord) { // No record yet for this form and process - create mode $p->set_var('state', 'New Task'); $p->set_var('class_newtask', 'class="nexflowNewTask"'); /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($newFormLink, $form_id, $project_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } $q2 = DB_query("SELECT UNIX_TIMESTAMP(createdDate) FROM {$_TABLES['nf_queue']} WHERE id='{$taskrec['id']}' "); list($date_assigned) = DB_fetchArray($q2); $p->set_var('date', strftime("%Y-%m-%d", $date_assigned)); } $q = DB_QUERY("SELECT statusmsg FROM {$_TABLES['nf_projecttimestamps']} WHERE project_id = '{$project_id}' ORDER BY timestamp DESC LIMIT 1"); list($statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); $p->set_var('id', $project_id); $p->set_var('task_name', $taskrec['taskname']); $p->set_var('view', ''); $p->set_var('action_record', ''); } else { // Nexflow task - not a form, Check for interactive function or manualweb step type $p->set_var('id', $taskrec['id']); $p->set_var('process_id', $taskrec['processid']); /* Task date is in format yyyy-mm-dd hh:mm:ss -- only want to show date portion */ $showdate = explode(' ', $taskrec['cdate']); $p->set_var('date', $showdate[0]); $sql = "SELECT timestamp,statusmsg FROM {$_TABLES['nf_projecttimestamps']} "; $sql .= "WHERE project_id = '{$project_id}' ORDER BY timestamp DESC LIMIT 1"; $q = DB_query($sql); list($timestamp, $statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); /* @TODO: $xdate_started has not be set */ if (isset($xdate_started) and $xdate_started == 0) { // Task exists in the taskhistory table but no start_date yet $p->set_var('state', 'New Task'); } else { $p->set_var('state', 'Started'); } $p->set_var('task_name', $taskrec['taskname']); if (strrpos($taskrec['url'], '?') > 0) { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}&processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } else { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}?processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } $url .= $optLinkVars; /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', '#'); $p->set_var('task_onclick', "onClick=\"togglerec('action',{$i});ajaxStartTask({$taskrec['id']});\" "); } else { $p->set_var('task_action_url', '#'); $p->set_var('task_onclick', ""); } $p->set_var('chk_accept', ''); $p->set_var('chk_reject', ''); $p->set_var('project_id', $project_id); $p->set_var('project_id', $project_id); $p->set_var('form_id', $form_id); $p->set_var('taskuser', $usermodeUID); /* Check for any specific tasks that will then over-ride the action url link */ if ($taskrec['stepType'] == 7) { // Interactive Function $function = $taskrec['url']; if (function_exists($function)) { /* Call the interactive function passing * taskrec, template, rowid and current user if using the user-switch feature */ $function($taskrec, $p, $i, $usermodeUID); } } elseif ($taskrec['stepType'] == 8) { //nexform /* @TODO: What should we be doing in this case? */ } else { /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', $url); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); $p->set_var('task_onclick', ""); } $p->set_var('action_record', ''); } } if (!is_numeric($project_id)) { // Disable the icon to show the task/project detail $p->set_var('project_details', '<span style="padding-right:14px;"> </span>'); $p->set_var('project_detail', ''); } } } else { //there is no project ID to be found. //we'll display the non-project formatted item instead $project_detailsLink = '<a href="#" onClick=\'ajaxViewProjectDetails(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/details.png" border="0" TITLE="View Details"></a> '; $project_detailsLink .= '<a href="#" onClick=\'ajaxViewProjectComments(%s,%s,%s,%s);\'>'; $project_detailsLink .= '<img src="' . $_CONF['layout_url'] . '/nexflow/images/comment.gif" border="0" TITLE="View Project Comments"></a> '; $p->set_var('hidetaskinfo', 'none'); $p->set_var('task_id', $taskrec['id']); $p->set_var('project_id', $project_id); $p->set_var('project_details', sprintf($project_detailsLink, $i, $project_id, $usermodeUID, $taskrec['id'], $i, $project_id, $usermodeUID, $taskrec['id'])); $p->set_var('id', $taskrec['id']); $p->set_var('process_id', $taskrec['processid']); //get the template name here: $sql = "SELECT c.templateName, d.customFlowName FROM {$_TABLES['nf_queue']} a "; $sql .= "inner join {$_TABLES['nf_templatedata']} b on a.nf_templatedataid=b.id "; $sql .= "inner join {$_TABLES['nf_template']} c on b.nf_templateid=c.id "; $sql .= "inner join {$_TABLES['nf_process']} d on a.nf_processid=d.id "; $sql .= "WHERE a.id={$taskrec['id']}"; $res2 = DB_query($sql); list($tname, $customDisplay) = DB_fetchArray($res2); if ($customDisplay != '') { $tname .= $customDisplay; } $p->set_var('project_title', $tname); /* Task date is in format yyyy-mm-dd hh:mm:ss -- only want to show date portion */ $showdate = explode(' ', $taskrec['cdate']); $p->set_var('date', $showdate[0]); $q = DB_QUERY("SELECT timestamp,statusmsg FROM {$_TABLES['nf_projecttimestamps']} WHERE project_id={$project_id} ORDER BY timestamp DESC LIMIT 1"); list($timestamp, $statusmsg) = DB_fetchArray($q); $p->set_var('full_statusmsg', $statusmsg); $msglen = strpos($statusmsg, '.'); if ($msglen > 0 and $pos !== FALSE) { $statusmsg = substr($statusmsg, 0, $msglen); } $p->set_var('statusmsg', $statusmsg); if (isset($xdate_started) and $xdate_started == 0) { // Task exists in the taskhistory table but no start_date yet $p->set_var('state', 'New Task'); } else { $p->set_var('state', 'Started'); } $p->set_var('task_name', $taskrec['taskname']); if (strrpos($taskrec['url'], '?') > 0) { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}&processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } else { $url = "{$_CONF['site_url']}/nexflow/{$taskrec['url']}?processid={$taskrec['processid']}&taskid={$taskrec['id']}"; } $url .= $optLinkVars; /* Using Click on Task to trigger action method */ $p->set_var('task_action_url', '#'); if ($taskStatus != 2) { $p->set_var('task_onclick', "onClick=\"togglerec('action',{$i});ajaxStartTask({$taskrec['id']});\" "); } else { $p->set_var('task_onclick', ""); } $p->set_var('task_name', $taskrec['taskname']); $p->set_var('chk_accept', ''); $p->set_var('chk_reject', ''); $p->set_var('project_id', $project_id); $p->set_var('form_id', $form_id); $p->set_var('taskuser', $usermodeUID); /* Check for any specific tasks that will then over-ride the action url link */ if ($taskrec['stepType'] == 7) { // Interactive Function $function = $taskrec['url']; if (function_exists($function)) { /* Call the interactive function passing * taskrec, template, rowid and current user if using the user-switch feature */ $function($taskrec, $p, $i, $usermodeUID); } } elseif ($taskrec['stepType'] == 8) { // nexform Task $form_id = $taskrec['url']; /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', sprintf($newFormLink, $form_id, $project_id, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); } } else { /* Using Click on Task to trigger action method */ if ($taskStatus != 2) { $p->set_var('task_action_url', $url); $p->set_var('task_onclick', sprintf($onClick_action, $taskrec['id'])); } else { $p->set_var('task_action_url', "#"); $p->set_var('task_onclick', ""); } $p->set_var('action_record', ''); } $p->set_var('project_details', '<span style="padding-right:14px;"> </span>'); $p->set_var('project_detail', ''); } //end if - test for valid project_id $p->parse('view_records', 'records', true); $i++; } //end foreach } else { $p->set_var('num_records', 0); $p->set_var('view_records', '<tr><td colspan=5 style="padding-left:20px;">No Tasks</td></tr>'); } $p->parse('javascript_code', 'javascript'); $p->parse('output', 'report'); return $p->finish($p->get_var('output')); }
// | This program is free software; you can redistribute it and/or | // | modify it under the terms of the GNU General Public License | // | as published by the Free Software Foundation; either version 2 | // | of the License, or (at your option) any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // require_once '../../lib-common.php'; if (isset($_USER['uid'])) { $userid = $_USER['uid']; } else { $userid = 1; } $taskid = COM_applyFilter($_GET['taskid'], true); $taskuser = COM_applyFilter($_GET['taskuser'], true); $processid = COM_applyFilter($_GET['processid'], true); COM_errorLog("Auto Batch test - Process id: {$processid}, Task id: {$taskid}"); $nfclass = new nexflow($processid, $userid); $nfclass->complete_task($taskid); $nfclass->private_nfNextStep($taskid, $processid); echo COM_refresh("{$_CONF['site_url']}/nexflow/index.php?taskuser={$taskuser}"); exit;
// | as published by the Free Software Foundation; either version 2 | // | of the License, or (at your option) any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // require_once '../lib-common.php'; $nfclass = new nexflow(); $nfclass->set_debug(false); /* Query to get a list of all un-completed tasks for type 'IF, Batch and Batch Function' ** Loop while we have new tasks of these type so that we can complete all possible tasks */ $processlist = array(); $retval = nf_getListofUncompletedTasks(&$processlist); $taskcount = $retval['count']; $processlist = $retval['list']; $i = 1; do { if ($nfclass->_debug) { COM_errorLog("Orchestrator: Loop:{$i}, {$taskcount} un-completed tasks found"); } $nfclass->clean_queue(); $retval = nf_getListofUncompletedTasks(&$processlist);
DB_query("UPDATE {$_TABLES['nf_templatedata']} set isDynamicForm=0 where id='{$taskid}'"); } $retval = $mode; } elseif ($op == 'setDynamicName' and $taskid > 0) { if ($mode == 1) { DB_query("UPDATE {$_TABLES['nf_templatedata']} set isDynamicTaskName=1 where id='{$taskid}'"); } else { DB_query("UPDATE {$_TABLES['nf_templatedata']} set isDynamicTaskName=0 where id='{$taskid}'"); } $retval = $mode; } elseif ($op == 'setReminderNotifyVariable' and $taskid > 0) { DB_query("UPDATE {$_TABLES['nf_templatedata']} SET reminderInterval='0' WHERE id='{$taskid}'"); $retval = $parm1; } elseif ($op == 'onhold' and $taskid > 0) { $current = DB_getItem($_TABLES['nf_queue'], "status", "id='{$taskid}'"); $nf = new nexflow(); if ($current == 0) { $nf->hold_task($taskid, true); $retval = 'onhold'; } else { $nf->unhold_task($taskid, true); $retval = 'offhold'; } } header("Cache-Control: no-store, no-cache, must-revalidate"); header("content-type: text/xml"); $XML = "<result>"; $XML .= "<operation>{$op}</operation>"; $XML .= "<record>{$taskid}</record>"; $XML .= "<value1>{$retval}</value1>"; $XML .= "</result>";
$action = COM_applyFilter($_GET['action']); $taskid = COM_applyFilter($_GET['taskid'], true); $processid = COM_applyFilter($_GET['processid'], true); switch ($action) { case 'Accept': // Attach to workflow instance - pass in process to attach to and the complete the current task $nfclass = new nexflow($processid); $nfclass->complete_task($taskid); // Normal completion status - accept nf_changeLog("Manual Web Task, Process: {$processid}, Workflow Queue ID: {$taskid}. Accept Status Set"); echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php'); exit; break; case 'Reject': // Attach to workflow instance - pass in process to attach to and the complete the current task $nfclass = new nexflow($processid); $nfclass->cancel_task($taskid); // Cancel completion status - reject nf_changeLog("Manual Web Task, Process: {$processid}, Workflow Queue ID: {$taskid}. Reject Status Set"); echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php'); exit; break; } echo COM_siteHeader(); echo COM_startBlock('Test suite basic handler script'); echo '<div class="pluginInfo" style="padding:20px;border:1px solid #CCC;"><fieldset><legend>Test suite Handler Script</legend>'; echo '<div><p>Test of a script used as extenal workflow handler. A basic form prompts the user with a question with two choices<ul style="margin-bottom:5px;margin-top:5px;"><li>accept or reject</ul></p><p>The workflow will then execute a different series of steps depending on the button pressed.</p><p>The external handler script can be a basic script or a complex application that returns control upon completion to the workflow engine. The next task can be basic conditional task like in this workflow example or someother task type like a batch task that checks external information or database query to determine the next task path to perform</p><p>A trace of the execution and the workflow path followed is captured in the error.log file<center>'; echo '<form method="get" action="' . $_CONF['site_url'] . '/nexflow/testsuite/yes-no.php"><br><br> <input type="submit" name="action" value="Reject"> <input type="submit" name="action" value="Accept"> <input type="hidden" name="taskid" value="' . $taskid . '">
echo COM_endBlock(); echo COM_siteFooter(); exit; } // See if we have priveledges to use the Select Task User Feature $selectUser = COM_applyFilter($_REQUEST['taskuser'], true); $optLinkVars = ''; if ($selectUser > 0) { $usermodeUID = $selectUser; if (SEC_hasRights('nexflow.admin')) { $optLinkVars = "&taskuser={$usermodeUID}"; } } else { $usermodeUID = $_USER['uid'] > 1 ? $_USER['uid'] : 1; } $nfclass = new nexflow('', $usermodeUID); $retval = ''; echo COM_siteHeader('menu'); $username = COM_getDisplayName($usermodeUID); echo COM_startBlock("Workflow Task Console for: {$username}", '', 'blockheader.thtml'); echo taskconsoleShowNavbar('Start Process'); $p = new Template($_CONF['path_layout'] . 'nexflow/admin'); $p->set_file(array('page' => 'startprocesses.thtml', 'record' => 'process_record.thtml')); $p->set_var('site_url', $_CONF['site_url']); $p->set_var('optional_parms', $optLinkVars); $tquery = DB_query("SELECT id,templateName FROM {$_TABLES["nf_template"]} ORDER BY id"); $i = 1; while (list($templateId, $templateName) = DB_fetchArray($tquery)) { $p->set_var('template_id', $templateId); $p->set_var('template_name', $templateName); $p->set_var('csscode', $i % 2 + 1);
function nf_approveEditForm_posthandler($processid, $taskid, $userid, $projectid) { global $_CONF, $_TABLES, $_DB_table_prefix; $nfclass = new nexflow($processid); if ($projectid == '' or $projectid == 0) { $projectid = $nfclass->get_processVariable('PID'); } $actionopt = COM_applyFilter($_POST['actionopt']); $taskid = COM_applyFilter($_POST['taskid']); $formid = COM_applyFilter($_POST['formid']); $processid = COM_applyFilter($_POST['processid']); if ($projectid > 0) { $prj_formid = DB_getItem($_TABLES['nf_projectforms'], 'id', "project_id='{$projectid}' AND form_id='{$formid}'"); } $status = DB_getItem($_TABLES['nf_projectforms'], 'status', "id='{$prj_formid}'"); if (DB_count($_TABLES['nf_project_approvals'], array('uid', 'form_id', 'process_id'), array($userid, $prj_formid, $processid)) == 0) { DB_query("INSERT INTO {$_TABLES['nf_project_approvals']} (process_id,form_id,uid) VALUES ('{$processid}','{$prj_formid}','{$userid}')"); } if ($actionopt == 'accept') { DB_query("UPDATE {$_TABLES['nf_project_approvals']} SET status='3', date_updated=UNIX_TIMESTAMP() WHERE uid='{$userid}' AND form_id='{$prj_formid}'"); } elseif ($actionopt == 'reject') { DB_query("UPDATE {$_TABLES['nf_project_approvals']} SET status='6', date_updated=UNIX_TIMESTAMP() WHERE uid='{$userid}' AND form_id='{$prj_formid}'"); } if (trim($_POST['notes']) != '') { $notes = ppPrepareForDB($_POST['notes']); if (DB_count($_TABLES['nf_projectcomments'], array('project_id', 'task_id'), array($projectid, $taskid)) == 0) { $sql = "INSERT INTO {$_TABLES['nf_projectcomments']} (project_id, task_id, uid, timestamp, comment) "; $sql .= "VALUES ('{$projectid}','{$taskid}','{$userid}',UNIX_TIMESTAMP(),'{$notes}')"; } else { $sql = "UPDATE {$_TABLES['nf_projectcomments']} SET comment='{$notes}', timestamp=UNIX_TIMESTAMP() "; $sql .= "WHERE project_id='{$projectid}' AND task_id='{$taskid}' "; } DB_query($sql); } $formtype = DB_getItem($_TABLES['nf_projectforms'], 'formtype', "id='{$prj_formid}'"); if ($_POST['taskaction'] == 'Complete Task') { if ($processid > 0 and $taskid > 0) { $nfclass = new nexflow($processid, $userid); if ($actionopt == 'accept') { $statusmsg = "{$formtype} approved"; nf_updateStatusLog($projectid, $prj_formid, $statusmsg); $status = DB_getItem($_TABLES['nf_projectforms'], 'status', "id='{$prj_formid}'"); $nfclass = new nexflow($processid, $userid); // Set Process Variable to true which may be checked in the workflow $nfclass->set_ProcessVariable('Review_Approval', 0); $nfclass->complete_task($taskid); // If the form has not yet been rejected by another member then mark it accepted if ($status != 6) { DB_query("UPDATE {$_TABLES['nf_projectforms']} SET status='3' WHERE id='{$prj_formid}'"); } } elseif ($actionopt == 'reject') { DB_query("UPDATE {$_TABLES['nf_projectforms']} SET status='6' WHERE id='{$prj_formid}'"); $statusmsg = "{$formtype} Rejected"; nf_updateStatusLog($projectid, $prj_formid, $statusmsg); // Set Process Variable to false which may be checked in the workflow $nfclass->set_ProcessVariable('Review_Approval', 1); $nfclass->cancel_task($taskid); } else { return "Need to check 'Reject' or 'Accept' to complete the task"; } } } }
/** * Called from nf_formatEmailMessage in plugins/nexflow/library.php * to allow modification of the notification subject and/or message. * * The parameters passed include the workflow process id, queue record id and the template task id * which are sufficent to be able to look up template or process details and form results. * * @param array $parms array('pid' => $processId, 'tid' => $tid, 'qid' => $qid, 'user' => $user); * @param string $taskname current taskname * @return array containg the taskname * */ function PLG_Nexflow_taskname($parms, $taskname) { global $_TABLES, $_CONF, $NF_MYAPP; $retval = array('taskname' => $taskame); if ($parms['tid'] == $NF_MYAPP['tasks']['mytask']) { if ($parms['pid'] > 0) { $fasttrack = 0; $nfclass = new nexflow($parms['pid']); $project_id = $nfclass->get_processVariable('PID'); $request_result = DB_getItem($_TABLES['nf_projectforms'], 'results_id', "project_id='{$project_id}' AND form_id={$NF_COGECO['forms']['capital_request']}"); if ($request_result > 0) { $fasttrack = nf_getFormResultData($request_result, $NF_MYAPP['formfield']['fasttrack']); } if ($fasttrack == 1) { $retval['taskname'] = "{$taskname} (Fast Track)"; } COM_errorLog("project:{$project_id}, fasttrack:{$fasttrack}"); } } return $retval; }
// +---------------------------------------------------------------------------+ // | | // | This program is free software; you can redistribute it and/or | // | modify it under the terms of the GNU General Public License | // | as published by the Free Software Foundation; either version 2 | // | of the License, or (at your option) any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // require_once '../lib-common.php'; if (isset($_USER['uid'])) { $userid = $_USER['uid']; } else { $userid = 1; } $taskid = COM_applyFilter($_GET['taskid'], true); $processid = COM_applyFilter($_GET['processid'], true); nf_changeLog("Auto Batch test - Process id: {$processid}, Task id: {$taskid}"); $nfclass = new nexflow($processid, $userid); $nfclass->complete_task($taskid); echo COM_refresh($_CONF['site_url'] . '/nexflow/taskconsole.php'); exit;
function nf_sleep($taskid, $processid) { $nfclass = new nexflow($processid); $nfclass->set_currentTaskid($taskid); $wakeup_time = $nfclass->get_processVariable($nfclass->get_taskOptionalParm()); $current_time = time(); if ($current_time > $wakeup_time) { return true; } else { return false; } }
require_once '../lib-common.php'; $rowid = COM_applyFilter($_GET['id'], true); $taskid = COM_applyFilter($_GET['taskid'], true); $project_id = COM_applyFilter($_GET['project_id'], true); $op = COM_applyFilter($_GET['op']); $actionurl = $_CONF['site_url'] . '/nexflow/index.php'; $taskuser = COM_applyFilter($_GET['taskuser'], 0); $variableid = COM_applyFilter($_GET['variableid'], 0); // Used in the setowner function $cid = COM_applyFilter($_GET['cid'], true); if ($taskuser > 0 and SEC_hasRights('nexflow.admin')) { $usermodeUID = $taskuser; } else { $usermodeUID = $_USER['uid']; } $nfclass = new nexflow(); if ($CONF_NF['debug']) { COM_errorLog("op:{$op}, Project:{$project_id},taskuser:{$usermodeUID},row:{$rowid},cid:{$cid},taskid:{$taskid}"); } if ($op == 'starttask') { $startedDate = DB_getItem($_TABLES['nf_queue'], 'startedDate', "id='{$taskid}'"); if ($startedDate <= 0) { DB_query("UPDATE {$_TABLES['nf_queue']} SET startedDate = NOW() WHERE id='{$taskid}'"); } DB_query("UPDATE {$_TABLES['nf_projecttaskhistory']} SET date_started = UNIX_TIMESTAMP() WHERE task_id='{$taskid}'"); } elseif ($op == 'holdtask') { $status = DB_getItem($_TABLES['nf_queue'], 'status', "id='{$taskid}'"); $status = NXCOM_filterInt($status); if ($status != 2) { $nfclass->hold_task($taskid); } else {