diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php index 397d5a5af..35c120bab 100755 --- a/workflow/engine/methods/cases/ajaxListener.php +++ b/workflow/engine/methods/cases/ajaxListener.php @@ -1,242 +1,221 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -/** - * - * @author Erik Amaru Ortiz - * @date Jan 3th, 2010 - */ - -require_once 'classes/model/Application.php'; -require_once 'classes/model/Users.php'; -require_once 'classes/model/AppThread.php'; -require_once 'classes/model/AppDelay.php'; -require_once 'classes/model/Process.php'; -require_once 'classes/model/Task.php'; -G::LoadClass( 'case' ); - -$action = $_REQUEST['action']; -unset( $_REQUEST['action'] ); -$ajax = new Ajax(); -$ajax->$action( $_REQUEST ); - -class Ajax -{ - - function getCaseMenu ($params) - { - - G::LoadClass( "configuration" ); - G::LoadClass( "case" ); - global $G_TMP_MENU; - global $sStatus; - $sStatus = $params['app_status']; - $oCase = new Cases(); - $conf = new Configurations(); - $oMenu = new Menu(); - $oMenu->load( 'caseOptions' ); - - $menuOptions = Array (); - foreach ($oMenu->Options as $i => $action) { - $option = Array ('id' => $oMenu->Id[$i],'label' => $oMenu->Labels[$i],'action' => $action - ); - - switch ($option['id']) { - case 'STEPS': - $option['options'] = Array (); - break; - case 'ACTIONS': - $option['options'] = $this->getActionOptions(); - break; - case 'INFO': - $option['options'] = $this->getInformationOptions(); - break; - } - $menuOptions[] = $option; - } - - echo G::json_encode( $menuOptions ); - } - - function steps () - { - G::LoadClass( 'applications' ); - $applications = new Applications(); - - $proUid = isset( $_SESSION['PROCESS'] ) ? $_SESSION['PROCESS'] : ''; - $tasUid = isset( $_SESSION['TASK'] ) ? $_SESSION['TASK'] : ''; - $appUid = isset( $_SESSION['APPLICATION'] ) ? $_SESSION['APPLICATION'] : ''; - $index = isset( $_SESSION['INDEX'] ) ? $_SESSION['INDEX'] : ''; - $steps = $applications->getSteps( $appUid, $index, $tasUid, $proUid ); - $list = array (); - - foreach ($steps as $step) { - $item['id'] = $item['idtodraw'] = $step['id']; - $item['draggable'] = false; - $item['leaf'] = true; - $item['hrefTarget'] = 'casesSubFrame'; - $item['text'] = $step['title']; - $item['url'] = '../' . $step['url']; - - switch ($step['type']) { - case 'DYNAFORM': - $item['iconCls'] = 'ss_sprite ss_application_form'; - break; - case 'OUTPUT_DOCUMENT': - $item['iconCls'] = 'ss_sprite ss_application_put'; - break; - case 'INPUT_DOCUMENT': - $item['iconCls'] = 'ss_sprite ss_application_get'; - break; - case 'EXTERNAL': - $item['iconCls'] = 'ss_sprite ss_application_view_detail'; - break; - default: - $item['iconCls'] = 'ICON_ASSIGN_TASK'; - } - - $list[] = $item; - } - - echo G::json_encode( $list ); - } - - function getInformationOptions () - { - $options = Array (); - $options[] = Array ('text' => G::LoadTranslation( 'ID_PROCESS_MAP' ),'fn' => 'processMap' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_PROCESS_INFORMATION' ),'fn' => 'processInformation' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_TASK_INFORMATION' ),'fn' => 'taskInformation' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_CASE_HISTORY' ),'fn' => 'caseHistory' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_HISTORY_MESSAGE_CASE' ),'fn' => 'messageHistory' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_DYNAFORMS' ),'fn' => 'dynaformHistory' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_UPLOADED_DOCUMENTS' ),'fn' => 'uploadedDocuments' - ); - $options[] = Array ('text' => G::LoadTranslation( 'ID_GENERATED_DOCUMENTS' ),'fn' => 'generatedDocuments' - ); - - return $options; - } - - function getActionOptions () - { - $APP_UID = $_SESSION['APPLICATION']; - - $c = new Criteria( 'workflow' ); - $c->clearSelectColumns(); - $c->addSelectColumn( AppThreadPeer::APP_THREAD_PARENT ); - $c->add( AppThreadPeer::APP_UID, $APP_UID ); - $c->add( AppThreadPeer::APP_THREAD_STATUS, 'OPEN' ); - $cant = AppThreadPeer::doCount( $c ); - - $oCase = new Cases(); - $aFields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); - - GLOBAL $RBAC; - - $options = Array (); - - switch ($aFields['APP_STATUS']) { - case 'DRAFT': - if (! AppDelay::isPaused( $_SESSION['APPLICATION'], $_SESSION['INDEX'] )) { - $options[] = Array ('text' => G::LoadTranslation( 'ID_PAUSED_CASE' ),'fn' => 'setUnpauseCaseDate' - ); - } else { - $options[] = Array ('text' => G::LoadTranslation( 'ID_UNPAUSE' ),'fn' => 'unpauseCase' - ); - } - - $options[] = Array ('text' => G::LoadTranslation( 'ID_DELETE' ),'fn' => 'deleteCase' - ); - - if ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) { - $options[] = Array ('text' => G::LoadTranslation( 'ID_REASSIGN' ),'fn' => 'getUsersToReassign' - ); - } - break; - - case 'TO_DO': - if (! AppDelay::isPaused( $_SESSION['APPLICATION'], $_SESSION['INDEX'] )) { - $options[] = Array ('text' => G::LoadTranslation( 'ID_PAUSED_CASE' ),'fn' => 'setUnpauseCaseDate' - ); - if ($cant == 1) { - if ($RBAC->userCanAccess( 'PM_CANCELCASE' ) == 1) - $options[] = Array ('text' => G::LoadTranslation( 'ID_CANCEL' ),'fn' => 'cancelCase' - ); - else - $options[] = Array ('text' => G::LoadTranslation( 'ID_CANCEL' ),'fn' => 'cancelCase','hide' => 'hiden' - ); - } - } else { - $options[] = Array ('text' => G::LoadTranslation( 'ID_UNPAUSE' ),'fn' => 'unpauseCase' - ); - } - if ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) { - $options[] = Array ('text' => G::LoadTranslation( 'ID_REASSIGN' ),'fn' => 'getUsersToReassign' - ); - } - break; - - case 'CANCELLED': - $options[] = Array ('text' => G::LoadTranslation( 'ID_REACTIVATE' ),'fn' => 'reactivateCase' - ); - break; - } - - if ($_SESSION['TASK'] != '-1') { - $oTask = new Task(); - $aTask = $oTask->load( $_SESSION['TASK'] ); - if ($aTask['TAS_TYPE'] == 'ADHOC') { - $options[] = Array ('text' => G::LoadTranslation( 'ID_ADHOC_ASSIGNMENT' ),'fn' => 'adhocAssignmentUsers' - ); - } - } - return $options; - } - - function processMap () - { - global $G_PUBLISH; - global $G_CONTENT; - global $G_FORM; - global $G_TABLE; - global $RBAC; - - G::LoadClass( 'processMap' ); - - $oTemplatePower = new TemplatePower( PATH_TPL . 'processes/processes_Map.html' ); - $oTemplatePower->prepare(); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); - $oHeadPublisher = & headPublisher::getSingleton(); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * + * @author Erik Amaru Ortiz + * @date Jan 3th, 2010 + */ + +require_once 'classes/model/Application.php'; +require_once 'classes/model/Users.php'; +require_once 'classes/model/AppThread.php'; +require_once 'classes/model/AppDelay.php'; +require_once 'classes/model/Process.php'; +require_once 'classes/model/Task.php'; +G::LoadClass( 'case' ); + +$action = $_REQUEST['action']; +unset( $_REQUEST['action'] ); +$ajax = new Ajax(); +$ajax->$action( $_REQUEST ); + +class Ajax +{ + + public function getCaseMenu ($params) + { + + G::LoadClass( "configuration" ); + G::LoadClass( "case" ); + global $G_TMP_MENU; + global $sStatus; + $sStatus = $params['app_status']; + $oCase = new Cases(); + $conf = new Configurations(); + $oMenu = new Menu(); + $oMenu->load( 'caseOptions' ); + + $menuOptions = Array (); + foreach ($oMenu->Options as $i => $action) { + $option = Array ('id' => $oMenu->Id[$i],'label' => $oMenu->Labels[$i],'action' => $action); + + switch ($option['id']) { + case 'STEPS': + $option['options'] = Array (); + break; + case 'ACTIONS': + $option['options'] = $this->getActionOptions(); + break; + case 'INFO': + $option['options'] = $this->getInformationOptions(); + break; + } + $menuOptions[] = $option; + } + + echo G::json_encode( $menuOptions ); + } + + public function steps () + { + G::LoadClass( 'applications' ); + $applications = new Applications(); + + $proUid = isset( $_SESSION['PROCESS'] ) ? $_SESSION['PROCESS'] : ''; + $tasUid = isset( $_SESSION['TASK'] ) ? $_SESSION['TASK'] : ''; + $appUid = isset( $_SESSION['APPLICATION'] ) ? $_SESSION['APPLICATION'] : ''; + $index = isset( $_SESSION['INDEX'] ) ? $_SESSION['INDEX'] : ''; + $steps = $applications->getSteps( $appUid, $index, $tasUid, $proUid ); + $list = array (); + + foreach ($steps as $step) { + $item['id'] = $item['idtodraw'] = $step['id']; + $item['draggable'] = false; + $item['leaf'] = true; + $item['hrefTarget'] = 'casesSubFrame'; + $item['text'] = $step['title']; + $item['url'] = '../' . $step['url']; + + switch ($step['type']) { + case 'DYNAFORM': + $item['iconCls'] = 'ss_sprite ss_application_form'; + break; + case 'OUTPUT_DOCUMENT': + $item['iconCls'] = 'ss_sprite ss_application_put'; + break; + case 'INPUT_DOCUMENT': + $item['iconCls'] = 'ss_sprite ss_application_get'; + break; + case 'EXTERNAL': + $item['iconCls'] = 'ss_sprite ss_application_view_detail'; + break; + default: + $item['iconCls'] = 'ICON_ASSIGN_TASK'; + } + + $list[] = $item; + } + + echo G::json_encode( $list ); + } + + public function getInformationOptions () + { + $options = Array (); + $options[] = Array ('text' => G::LoadTranslation( 'ID_PROCESS_MAP' ),'fn' => 'processMap' ); + $options[] = Array ('text' => G::LoadTranslation( 'ID_PROCESS_INFORMATION' ),'fn' => 'processInformation'); + $options[] = Array ('text' => G::LoadTranslation( 'ID_TASK_INFORMATION' ),'fn' => 'taskInformation'); + $options[] = Array ('text' => G::LoadTranslation( 'ID_CASE_HISTORY' ),'fn' => 'caseHistory'); + $options[] = Array ('text' => G::LoadTranslation( 'ID_HISTORY_MESSAGE_CASE' ),'fn' => 'messageHistory'); + $options[] = Array ('text' => G::LoadTranslation( 'ID_DYNAFORMS' ),'fn' => 'dynaformHistory' ); + $options[] = Array ('text' => G::LoadTranslation( 'ID_UPLOADED_DOCUMENTS' ),'fn' => 'uploadedDocuments'); + $options[] = Array ('text' => G::LoadTranslation( 'ID_GENERATED_DOCUMENTS' ),'fn' => 'generatedDocuments'); + + return $options; + } + + public function getActionOptions () + { + $APP_UID = $_SESSION['APPLICATION']; + + $c = new Criteria( 'workflow' ); + $c->clearSelectColumns(); + $c->addSelectColumn( AppThreadPeer::APP_THREAD_PARENT ); + $c->add( AppThreadPeer::APP_UID, $APP_UID ); + $c->add( AppThreadPeer::APP_THREAD_STATUS, 'OPEN' ); + $cant = AppThreadPeer::doCount( $c ); + + $oCase = new Cases(); + $aFields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); + + GLOBAL $RBAC; + + $options = Array (); + + switch ($aFields['APP_STATUS']) { + case 'DRAFT': + if (! AppDelay::isPaused( $_SESSION['APPLICATION'], $_SESSION['INDEX'] )) { + $options[] = Array ('text' => G::LoadTranslation( 'ID_PAUSED_CASE' ),'fn' => 'setUnpauseCaseDate'); + } else { + $options[] = Array ('text' => G::LoadTranslation( 'ID_UNPAUSE' ),'fn' => 'unpauseCase'); + } + + $options[] = Array ('text' => G::LoadTranslation( 'ID_DELETE' ),'fn' => 'deleteCase'); + + if ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) { + $options[] = Array ('text' => G::LoadTranslation( 'ID_REASSIGN' ),'fn' => 'getUsersToReassign'); + } + break; + case 'TO_DO': + if (! AppDelay::isPaused( $_SESSION['APPLICATION'], $_SESSION['INDEX'] )) { + $options[] = Array ('text' => G::LoadTranslation( 'ID_PAUSED_CASE' ),'fn' => 'setUnpauseCaseDate'); + if ($cant == 1) { + if ($RBAC->userCanAccess( 'PM_CANCELCASE' ) == 1) { + $options[] = Array ('text' => G::LoadTranslation( 'ID_CANCEL' ),'fn' => 'cancelCase'); + } else { + $options[] = Array ('text' => G::LoadTranslation( 'ID_CANCEL' ),'fn' => 'cancelCase','hide' => 'hiden'); + } + } + } else { + $options[] = Array ('text' => G::LoadTranslation( 'ID_UNPAUSE' ),'fn' => 'unpauseCase'); + } + if ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) { + $options[] = Array ('text' => G::LoadTranslation( 'ID_REASSIGN' ),'fn' => 'getUsersToReassign'); + } + break; + case 'CANCELLED': + $options[] = Array ('text' => G::LoadTranslation( 'ID_REACTIVATE' ),'fn' => 'reactivateCase'); + break; + } + + if ($_SESSION['TASK'] != '-1') { + $oTask = new Task(); + $aTask = $oTask->load( $_SESSION['TASK'] ); + if ($aTask['TAS_TYPE'] == 'ADHOC') { + $options[] = Array ('text' => G::LoadTranslation( 'ID_ADHOC_ASSIGNMENT' ),'fn' => 'adhocAssignmentUsers'); + } + } + return $options; + } + + public function processMap () + { + global $G_PUBLISH; + global $G_CONTENT; + global $G_FORM; + global $G_TABLE; + global $RBAC; + + G::LoadClass( 'processMap' ); + + $oTemplatePower = new TemplatePower( PATH_TPL . 'processes/processes_Map.html' ); + $oTemplatePower->prepare(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + $oHeadPublisher = & headPublisher::getSingleton(); + //$oHeadPublisher->addScriptfile('/jscore/processmap/core/processmap.js'); $oHeadPublisher->addScriptCode( ' var maximunX = ' . processMap::getMaximunTaskX( $_SESSION['PROCESS'] ) . '; @@ -317,362 +296,368 @@ class Ajax oLeyendsPanel.addContent(rpc.xmlhttp.responseText); }.extend(this); oRPC.make(); - }' ); - - G::RenderPage( 'publish', 'blank' ); - } - - function getProcessInformation () - { - $process = new Process(); - $processData = $process->load( $_SESSION['PROCESS'] ); - require_once 'classes/model/Users.php'; - $user = new Users(); - try { - $userData = $user->load( $processData['PRO_CREATE_USER'] ); - $processData['PRO_AUTHOR'] = $userData['USR_FIRSTNAME'] . ' ' . $userData['USR_LASTNAME']; - } catch (Exception $oError) { - $processData['PRO_AUTHOR'] = '(USER DELETED)'; - } - - $processData['PRO_CREATE_DATE'] = date( 'F j, Y', strtotime( $processData['PRO_CREATE_DATE'] ) ); - - print (G::json_encode( $processData )) ; - } - - function getTaskInformation () - { - $task = new Task(); - if ($_SESSION['TASK'] == '-1') - $_SESSION['TASK'] = $_SESSION['CURRENT_TASK']; - $taskData = $task->getDelegatedTaskData( $_SESSION['TASK'], $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); - - print (G::json_encode( $taskData )) ; - } - - function caseHistory () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); + }' ); + + G::RenderPage( 'publish', 'blank' ); + } + + public function getProcessInformation () + { + $process = new Process(); + $processData = $process->load( $_SESSION['PROCESS'] ); + require_once 'classes/model/Users.php'; + $user = new Users(); + try { + $userData = $user->load( $processData['PRO_CREATE_USER'] ); + $processData['PRO_AUTHOR'] = $userData['USR_FIRSTNAME'] . ' ' . $userData['USR_LASTNAME']; + } catch (Exception $oError) { + $processData['PRO_AUTHOR'] = '(USER DELETED)'; + } + + $processData['PRO_CREATE_DATE'] = date( 'F j, Y', strtotime( $processData['PRO_CREATE_DATE'] ) ); + + print (G::json_encode( $processData )) ; + } + + public function getTaskInformation () + { + $task = new Task(); + if ($_SESSION['TASK'] == '-1') { + $_SESSION['TASK'] = $_SESSION['CURRENT_TASK']; + } + $taskData = $task->getDelegatedTaskData( $_SESSION['TASK'], $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); + + print (G::json_encode( $taskData )) ; + } + + public function caseHistory () + { + global $G_PUBLISH; + G::loadClass( 'configuration' ); + + $oHeadPublisher = & headPublisher::getSingleton(); + $conf = new Configurations(); $oHeadPublisher->addExtJsScript( 'cases/caseHistory', true ); //adding a javascript file .js $oHeadPublisher->addContent( 'cases/caseHistory' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function messageHistory () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); + $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); + G::RenderPage( 'publish', 'extJs' ); + } + + public function messageHistory () + { + global $G_PUBLISH; + G::loadClass( 'configuration' ); + + $oHeadPublisher = & headPublisher::getSingleton(); + $conf = new Configurations(); $oHeadPublisher->addExtJsScript( 'cases/caseMessageHistory', true ); //adding a javascript file .js $oHeadPublisher->addContent( 'cases/caseMessageHistory' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function dynaformHistory () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); + $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); + G::RenderPage( 'publish', 'extJs' ); + } + + public function dynaformHistory () + { + global $G_PUBLISH; + G::loadClass( 'configuration' ); + + $oHeadPublisher = & headPublisher::getSingleton(); + $conf = new Configurations(); $oHeadPublisher->addExtJsScript( 'cases/caseHistoryDynaformPage', true ); //adding a javascript file .js $oHeadPublisher->addContent( 'cases/caseHistoryDynaformPage' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function uploadedDocuments () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); - $oHeadPublisher->addExtJsScript( 'cases/casesUploadedDocumentsPage', true ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesUploadedDocumentsPage' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function uploadedDocumentsSummary () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); - $oHeadPublisher->addExtJsScript( 'cases/casesUploadedDocumentsPage', true ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesUploadedDocumentsPage' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function generatedDocuments () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); - $oHeadPublisher->addExtJsScript( 'cases/casesGenerateDocumentPage', true ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesGenerateDocumentPage' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function generatedDocumentsSummary () - { - global $G_PUBLISH; - G::loadClass( 'configuration' ); - - $oHeadPublisher = & headPublisher::getSingleton(); - $conf = new Configurations(); - $oHeadPublisher->addExtJsScript( 'cases/casesGenerateDocumentPage', true ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesGenerateDocumentPage' ); //adding a html file .html. - $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); - G::RenderPage( 'publish', 'extJs' ); - } - - function cancelCase () - { - $oCase = new Cases(); - $multiple = false; - - if (isset( $_POST['APP_UID'] ) && isset( $_POST['DEL_INDEX'] )) { - $APP_UID = $_POST['APP_UID']; - $DEL_INDEX = $_POST['DEL_INDEX']; - - $appUids = explode( ',', $APP_UID ); - $delIndexes = explode( ',', $DEL_INDEX ); - if (count( $appUids ) > 1 && count( $delIndexes ) > 1) - $multiple = true; - } else if (isset( $_POST['sApplicationUID'] ) && isset( $_POST['iIndex'] )) { - $APP_UID = $_POST['sApplicationUID']; - $DEL_INDEX = $_POST['iIndex']; - } else { - $APP_UID = $_SESSION['APPLICATION']; - $DEL_INDEX = $_SESSION['INDEX']; - } - - // Save the note pause reason - if ($_POST['NOTE_REASON'] != '') { - require_once ("classes/model/AppNotes.php"); - $appNotes = new AppNotes(); - $noteContent = addslashes( $_POST['NOTE_REASON'] ); - $appNotes->postNewNote( $APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE'] ); - } - // End save - - - if ($multiple) { - foreach ($appUids as $i => $appUid) - $oCase->cancelCase( $appUid, $delIndexes[$i], $_SESSION['USER_LOGGED'] ); - } else - $oCase->cancelCase( $APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'] ); - } - - function getUsersToReassign () - { - $case = new Cases(); - $result->data = $case->getUsersToReassign( $_SESSION['TASK'], $_SESSION['USER_LOGGED'] ); - - print G::json_encode( $result ); - - } - - function reassignCase () - { - $cases = new Cases(); - $user = new Users(); - $app = new Application(); - - $TO_USR_UID = $_POST['USR_UID']; - try { - $cases->reassignCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID ); - $caseData = $app->load( $_SESSION['APPLICATION'] ); - $userData = $user->load( $TO_USR_UID ); - //print_r($caseData); - $data['APP_NUMBER'] = $caseData['APP_NUMBER']; - $data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME']; //TODO change with the farmated username from environment conf - $result->status = 0; - $result->msg = G::LoadTranslation( 'ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data ); - } catch (Exception $e) { - $result->status = 1; - $result->msg = $e->getMessage(); - } - - print G::json_encode( $result ); - } - - function pauseCase () - { - try { - $unpauseDate = $_REQUEST['unpauseDate']; - $oCase = new Cases(); - if (isset( $_POST['APP_UID'] ) && isset( $_POST['DEL_INDEX'] )) { - $APP_UID = $_POST['APP_UID']; - $DEL_INDEX = $_POST['DEL_INDEX']; - } else if (isset( $_POST['sApplicationUID'] ) && isset( $_POST['iIndex'] )) { - $APP_UID = $_POST['sApplicationUID']; - $DEL_INDEX = $_POST['iIndex']; - } else { - $APP_UID = $_SESSION['APPLICATION']; - $DEL_INDEX = $_SESSION['INDEX']; - } - - // Save the note pause reason - if ($_REQUEST['NOTE_REASON'] != '') { - require_once ("classes/model/AppNotes.php"); - $appNotes = new AppNotes(); - $noteContent = addslashes( $_REQUEST['NOTE_REASON'] ); - $appNotes->postNewNote( $APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE'] ); - } - // End save - - - $oCase->pauseCase( $APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate ); - $app = new Application(); - $caseData = $app->load( $APP_UID ); - $data['APP_NUMBER'] = $caseData['APP_NUMBER']; - $data['UNPAUSE_DATE'] = $unpauseDate; - - $result->success = true; - $result->msg = G::LoadTranslation( 'ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data ); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } - echo G::json_encode( $result ); - } - - function unpauseCase () - { - try { - $applicationUID = (isset( $_POST['APP_UID'] )) ? $_POST['APP_UID'] : $_SESSION['APPLICATION']; - $delIndex = (isset( $_POST['DEL_INDEX'] )) ? $_POST['DEL_INDEX'] : $_SESSION['INDEX']; - $oCase = new Cases(); - $oCase->unpauseCase( $applicationUID, $delIndex, $_SESSION['USER_LOGGED'] ); - - $app = new Application(); - $caseData = $app->load( $applicationUID ); - $data['APP_NUMBER'] = $caseData['APP_NUMBER']; - - $result->success = true; - $result->msg = G::LoadTranslation( 'ID_CASE_UNPAUSED_SUCCESSFULLY', SYS_LANG, $data ); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } - - print G::json_encode( $result ); - } - - function deleteCase () - { - try { - $applicationUID = (isset( $_POST['APP_UID'] )) ? $_POST['APP_UID'] : $_SESSION['APPLICATION']; - $app = new Application(); - $caseData = $app->load( $applicationUID ); - $data['APP_NUMBER'] = $caseData['APP_NUMBER']; - - $oCase = new Cases(); - $oCase->removeCase( $applicationUID ); - - $result->success = true; - $result->msg = G::LoadTranslation( 'ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data ); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } - print G::json_encode( $result ); - } - - function reactivateCase () - { - try { - $applicationUID = (isset( $_POST['APP_UID'] )) ? $_POST['APP_UID'] : $_SESSION['APPLICATION']; - $delIndex = (isset( $_POST['DEL_INDEX'] )) ? $_POST['DEL_INDEX'] : $_SESSION['INDEX']; - $app = new Application(); - $caseData = $app->load( $applicationUID ); - $data['APP_NUMBER'] = $caseData['APP_NUMBER']; - - $oCase = new Cases(); - $oCase->reactivateCase( $applicationUID, $delIndex, $_SESSION['USER_LOGGED'] ); - - $result->success = true; - $result->msg = G::LoadTranslation( 'ID_CASE_REACTIVATED_SUCCESSFULLY', SYS_LANG, $data ); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } - - print G::json_encode( $result ); - } - - function changeLogTab () - { - try { - global $G_PUBLISH; - require_once 'classes/model/AppHistory.php'; - - //!dataInput - $idHistory = $_REQUEST["idHistory"]; - //!dataInput - - - //!dataSytem - $idHistoryArray = explode( "_", $idHistory ); - $_REQUEST["PRO_UID"] = $idHistoryArray[0]; - $_REQUEST["APP_UID"] = $idHistoryArray[1]; - $_REQUEST["TAS_UID"] = $idHistoryArray[2]; - $_REQUEST["DYN_UID"] = ""; - - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'view', 'cases/cases_DynaformHistory' ); - ?> - - - + success = true; + $result->msg = G::LoadTranslation( 'ID_CASE_REACTIVATED_SUCCESSFULLY', SYS_LANG, "success" ); + } catch (Exception $e) { + $result->success = false; + $result->msg = $e->getMessage(); + } + } + + public function dynaformViewFromHistory () + { + ?> + + + -success = true; - $result->msg = G::LoadTranslation( 'ID_CASE_REACTIVATED_SUCCESSFULLY', SYS_LANG, "success" ); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } - } - - function dynaformViewFromHistory () - { - ?> - + - //!Code that simulated reload library javascript maborak - var leimnud = {}; - leimnud.exec = ""; - leimnud.fix = {}; - leimnud.fix.memoryLeak = ""; - leimnud.browser = {}; - leimnud.browser.isIphone = ""; - leimnud.iphone = {}; - leimnud.iphone.make = function () {}; - function ajax_function(ajax_server, funcion, parameters, method) - { - } - //! - + $_POST["HISTORY_ID"] = $_REQUEST["HISTORY_ID"]; + $_POST["DYN_UID"] = $_REQUEST["DYN_UID"]; -AddContent( "dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_POST["DYN_UID"], "", $Fields["APP_DATA"], "", "", "view" ); + $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP_LABEL"] = ""; + $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP_LABEL"] = ""; + $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP"] = "#"; + $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_ACTION"] = "return false;"; + $G_PUBLISH->AddContent( "dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_POST["DYN_UID"], "", $Fields["APP_DATA"], "", "", "view" ); ?> - + + + + + + + + - - - - - - - -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; - -if ($actionAjax == 'historyGridList_JXP') { - - G::LoadClass( 'case' ); - G::LoadClass( "BasePeer" ); - - global $G_PUBLISH; - $c = Cases::getTransferHistoryCriteria( $_SESSION['APPLICATION'] ); - - $result = new stdClass(); - $aProcesses = Array (); - - $rs = GulliverBasePeer::doSelectRs( $c ); - $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $rs->next(); - for ($j = 0; $j < $rs->getRecordCount(); $j ++) { - $result = $rs->getRow(); - $result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"]; - $aProcesses[] = $result; - $rs->next(); - } - - $newDir = '/tmp/test/directory'; - $r = G::verifyPath( $newDir ); - $r->data = $aProcesses; - $r->totalCount = 2; - - echo G::json_encode( $r ); -} - -if ($actionAjax == 'historyGridListChangeLogPanelBody_JXP') { - //!dataInput - $idHistory = $_REQUEST["idHistory"]; - //!dataInput - - - //!dataSytem - $idHistoryArray = explode( "*", $idHistory ); - $_REQUEST["PRO_UID"] = $idHistoryArray[0]; - $_REQUEST["APP_UID"] = $idHistoryArray[1]; - $_REQUEST["TAS_UID"] = $idHistoryArray[2]; - $_REQUEST["DYN_UID"] = ""; - - ?> - - - - - - - - -
-
- -AddContent( 'view', 'cases/cases_DynaformHistory' ); - G::RenderPage( 'publish', 'raw' ); - ?> - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - -
  
  - -  
  
-
-getNewCriterion( ContentPeer::CON_ID, $idDin ); - $c1 = $c->getNewCriterion( ContentPeer::CON_CATEGORY, 'DYN_TITLE' ); - $c0->addAnd( $c1 ); - $c->add( $c0 ); - $contentObjeto = ContentPeer::doSelectOne( $c ); - - if (is_object( $contentObjeto )) { - $dynTitle = $contentObjeto->getConValue(); - } - - $md5Hash = md5( $idDin . $dynDate ); - - //assign task - $result = new stdClass(); - $result->dynTitle = $dynTitle; - $result->md5Hash = $md5Hash; - - echo G::json_encode( $result ); - -} - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; + +if ($actionAjax == 'historyGridList_JXP') { + + G::LoadClass( 'case' ); + G::LoadClass( "BasePeer" ); + + global $G_PUBLISH; + $c = Cases::getTransferHistoryCriteria( $_SESSION['APPLICATION'] ); + + $result = new stdClass(); + $aProcesses = Array (); + + $rs = GulliverBasePeer::doSelectRs( $c ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + for ($j = 0; $j < $rs->getRecordCount(); $j ++) { + $result = $rs->getRow(); + $result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"]; + $aProcesses[] = $result; + $rs->next(); + } + + $newDir = '/tmp/test/directory'; + $r = G::verifyPath( $newDir ); + $r->data = $aProcesses; + $r->totalCount = 2; + + echo G::json_encode( $r ); +} + +if ($actionAjax == 'historyGridListChangeLogPanelBody_JXP') { + //!dataInput + $idHistory = $_REQUEST["idHistory"]; + //!dataInput + + + //!dataSytem + $idHistoryArray = explode( "*", $idHistory ); + $_REQUEST["PRO_UID"] = $idHistoryArray[0]; + $_REQUEST["APP_UID"] = $idHistoryArray[1]; + $_REQUEST["TAS_UID"] = $idHistoryArray[2]; + $_REQUEST["DYN_UID"] = ""; + + ?> + + + + + + + + +
+
+ AddContent( 'view', 'cases/cases_DynaformHistory' ); + G::RenderPage( 'publish', 'raw' ); + ?> +
+
+ + + + + + + + + + + + + + + + + + + +
  
  + +  
  
+
+ getNewCriterion( ContentPeer::CON_ID, $idDin ); + $c1 = $c->getNewCriterion( ContentPeer::CON_CATEGORY, 'DYN_TITLE' ); + $c0->addAnd( $c1 ); + $c->add( $c0 ); + $contentObjeto = ContentPeer::doSelectOne( $c ); + + if (is_object( $contentObjeto )) { + $dynTitle = $contentObjeto->getConValue(); + } + + $md5Hash = md5( $idDin . $dynDate ); + + //assign task + $result = new stdClass(); + $result->dynTitle = $dynTitle; + $result->md5Hash = $md5Hash; + + echo G::json_encode( $result ); + +} + diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index 18502b24a..e1d0aa199 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -1,175 +1,175 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; - -if ($actionAjax == 'messageHistoryGridList_JXP') { - - G::LoadClass( 'case' ); - G::LoadClass( "BasePeer" ); - - global $G_PUBLISH; - $oCase = new Cases(); - - $appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'] ); - - $result = new stdClass(); - $aProcesses = Array (); - - $totalCount = 0; - foreach ($appMessageArray as $index => $value) { - $appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID']; - $aProcesses[] = $appMessageArray[$index]; - $totalCount ++; - } - - $newDir = '/tmp/test/directory'; - $r = G::verifyPath( $newDir ); - $r->data = $aProcesses; - $r->totalCount = $totalCount; - - echo G::json_encode( $r ); -} -if ($actionAjax == 'showHistoryMessage') { - - ?> - - - -AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) ); - - ?> - -getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ); - //print_r($data); - - - $oConfiguration = new Configuration(); - $sDelimiter = DBAdapter::getStringDelimiter(); - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' ); - $oCriteria->add( ConfigurationPeer::OBJ_UID, '' ); - $oCriteria->add( ConfigurationPeer::PRO_UID, '' ); - $oCriteria->add( ConfigurationPeer::USR_UID, '' ); - $oCriteria->add( ConfigurationPeer::APP_UID, '' ); - if (ConfigurationPeer::doCount( $oCriteria ) == 0) { - $oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '' - ) ); - $aConfiguration = array (); - } else { - $aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' ); - if ($aConfiguration['CFG_VALUE'] != '') { - $aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] ); - } else { - $aConfiguration = array (); - } - } - $passwd = $aConfiguration['MESS_PASSWORD']; - $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); - $auxPass = explode( 'hash:', $passwdDec ); - if (count( $auxPass ) > 1) { - if (count( $auxPass ) == 2) { - $passwd = $auxPass[1]; - } else { - array_shift( $auxPass ); - $passwd = implode( '', $auxPass ); - } - } - $aConfiguration['MESS_PASSWORD'] = $passwd; - - $oSpool = new spoolRun(); - $oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $passwd,'SMTPAuth' => $aConfiguration['MESS_RAUTH'] - ) ); - - $oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending' - ) ); - $oSpool->sendMail(); - - } catch (Exception $e) { - - $errorMessage = $e->getMessage(); - } - - echo $errorMessage; - -} - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; + +if ($actionAjax == 'messageHistoryGridList_JXP') { + + G::LoadClass( 'case' ); + G::LoadClass( "BasePeer" ); + + global $G_PUBLISH; + $oCase = new Cases(); + + $appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'] ); + + $result = new stdClass(); + $aProcesses = Array (); + + $totalCount = 0; + foreach ($appMessageArray as $index => $value) { + $appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID']; + $aProcesses[] = $appMessageArray[$index]; + $totalCount ++; + } + + $newDir = '/tmp/test/directory'; + $r = G::verifyPath( $newDir ); + $r->data = $aProcesses; + $r->totalCount = $totalCount; + + echo G::json_encode( $r ); +} +if ($actionAjax == 'showHistoryMessage') { + + ?> + + + + AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) ); + + ?> + + getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ); + //print_r($data); + + + $oConfiguration = new Configuration(); + $sDelimiter = DBAdapter::getStringDelimiter(); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' ); + $oCriteria->add( ConfigurationPeer::OBJ_UID, '' ); + $oCriteria->add( ConfigurationPeer::PRO_UID, '' ); + $oCriteria->add( ConfigurationPeer::USR_UID, '' ); + $oCriteria->add( ConfigurationPeer::APP_UID, '' ); + if (ConfigurationPeer::doCount( $oCriteria ) == 0) { + $oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '' + ) ); + $aConfiguration = array (); + } else { + $aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' ); + if ($aConfiguration['CFG_VALUE'] != '') { + $aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] ); + } else { + $aConfiguration = array (); + } + } + $passwd = $aConfiguration['MESS_PASSWORD']; + $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); + $auxPass = explode( 'hash:', $passwdDec ); + if (count( $auxPass ) > 1) { + if (count( $auxPass ) == 2) { + $passwd = $auxPass[1]; + } else { + array_shift( $auxPass ); + $passwd = implode( '', $auxPass ); + } + } + $aConfiguration['MESS_PASSWORD'] = $passwd; + + $oSpool = new spoolRun(); + $oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $passwd,'SMTPAuth' => $aConfiguration['MESS_RAUTH'] + ) ); + + $oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending' + ) ); + $oSpool->sendMail(); + + } catch (Exception $e) { + + $errorMessage = $e->getMessage(); + } + + echo $errorMessage; + +} + diff --git a/workflow/engine/methods/cases/caseNotesAjax.php b/workflow/engine/methods/cases/caseNotesAjax.php index 37cc4cdef..bc87c49a1 100755 --- a/workflow/engine/methods/cases/caseNotesAjax.php +++ b/workflow/engine/methods/cases/caseNotesAjax.php @@ -1,76 +1,76 @@ - '','dir' => 'DESC','sort' => '','start' => 0,'limit' => 25,'filter' => '','search' => '','action' => '','xaction' => '','data' => '','status' => '','query' => '','fields' => "" - ); - $result = array (); - foreach ($validParams as $paramName => $paramDefault) { - $result[$paramName] = isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : $paramDefault; - } - return $result; -} - -function sendJsonResultGeneric ($response, $callback) -{ - header( "Content-Type: application/json" ); - $finalResponse = G::json_encode( $response ); - if ($callback != '') { - print $callback . "($finalResponse);"; - } else { - print $finalResponse; - } -} - -function getNotesList () -{ - extract( getExtJSParams() ); - require_once ("classes/model/AppNotes.php"); - if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) { - $appUid = $_REQUEST['appUid']; - } else { - $appUid = $_SESSION['APPLICATION']; - } - $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : ""; - $appNotes = new AppNotes(); - $response = $appNotes->getNotesList( $appUid, '', $start, $limit ); - sendJsonResultGeneric( $response['array'], $callback ); -} - -function postNote () -{ - extract( getExtJSParams() ); - if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) { - $appUid = $_REQUEST['appUid']; - } else { - $appUid = $_SESSION['APPLICATION']; - } - $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : ""; - require_once ("classes/model/AppNotes.php"); - - $noteContent = addslashes( $_POST['noteText'] ); - - $appNotes = new AppNotes(); - $response = $appNotes->postNewNote( $appUid, $usrUid, $noteContent ); - - sendJsonResultGeneric( $response, $callback ); -} - + '','dir' => 'DESC','sort' => '','start' => 0,'limit' => 25,'filter' => '','search' => '','action' => '','xaction' => '','data' => '','status' => '','query' => '','fields' => ""); + $result = array (); + foreach ($validParams as $paramName => $paramDefault) { + $result[$paramName] = isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : $paramDefault; + } + return $result; +} + +function sendJsonResultGeneric ($response, $callback) +{ + header( "Content-Type: application/json" ); + $finalResponse = G::json_encode( $response ); + if ($callback != '') { + print $callback . "($finalResponse);"; + } else { + print $finalResponse; + } +} + +function getNotesList () +{ + extract( getExtJSParams() ); + require_once ("classes/model/AppNotes.php"); + if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) { + $appUid = $_REQUEST['appUid']; + } else { + $appUid = $_SESSION['APPLICATION']; + } + $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : ""; + $appNotes = new AppNotes(); + $response = $appNotes->getNotesList( $appUid, '', $start, $limit ); + + sendJsonResultGeneric( $response['array'], $callback ); +} + +function postNote () +{ + extract( getExtJSParams() ); + if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) { + $appUid = $_REQUEST['appUid']; + } else { + $appUid = $_SESSION['APPLICATION']; + } + $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : ""; + require_once ("classes/model/AppNotes.php"); + + $noteContent = addslashes( $_POST['noteText'] ); + + $appNotes = new AppNotes(); + $response = $appNotes->postNewNote( $appUid, $usrUid, $noteContent ); + + sendJsonResultGeneric( $response, $callback ); +} + diff --git a/workflow/engine/methods/cases/cases_advancedSearch.php b/workflow/engine/methods/cases/cases_advancedSearch.php index 5f2c64da2..8cfe7ef90 100755 --- a/workflow/engine/methods/cases/cases_advancedSearch.php +++ b/workflow/engine/methods/cases/cases_advancedSearch.php @@ -1,81 +1,82 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * by The Answer - */ - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_ADVANCEDSEARCH'; -$G_PUBLISH = new Publisher(); - -global $RBAC; -$permisse = $RBAC->userCanAccess( 'PM_ALLCASES' ); -$userlogged = $_SESSION['USER_LOGGED']; - -require_once ("classes/model/ProcessUser.php"); -$oCriteria = new Criteria( 'workflow' ); -$oCriteria->addSelectColumn( ProcessUserPeer::PU_UID ); -$oCriteria->addSelectColumn( ProcessUserPeer::PRO_UID ); -$oCriteria->add( ProcessUserPeer::USR_UID, $userlogged ); -$oCriteria->add( ProcessUserPeer::PU_TYPE, "SUPERVISOR" ); - -$oDataset = ProcessUserPeer::doSelectRS( $oCriteria ); -$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); -$oDataset->next(); - -$aSupervisor = array (); -while ($aRow = $oDataset->getRow()) { - $aSupervisor[] = $aRow['PRO_UID']; - $oDataset->next(); -} - -G::LoadClass( 'case' ); -$oCases = new Cases(); - -if (isset( $_POST['form'] )) { - $fields['CASE_NUMBER'] = $_POST['form']['CASE_NUMBER']; - $fields['PROCESS'] = $_POST['form']['PROCESS']; - $fields['TASKS'] = $_POST['form']['TASKS']; - $fields['CURRENT_USER'] = $_POST['form']['CURRENT_USER']; - $fields['SENT_BY'] = $_POST['form']['SENT_BY']; - $fields['LAST_MODIFICATION_F'] = $_POST['form']['LAST_MODIFICATION_F']; - $fields['LAST_MODIFICATION_T'] = $_POST['form']['LAST_MODIFICATION_T']; - $fields['APP_STATUS'] = $_POST['form']['APP_STATUS']; - - $Criteria = $oCases->getAdvancedSearch( $fields['CASE_NUMBER'], $fields['PROCESS'], $fields['TASKS'], $fields['CURRENT_USER'], $fields['SENT_BY'], $fields['LAST_MODIFICATION_F'], $fields['LAST_MODIFICATION_T'], $fields['APP_STATUS'], $permisse, $userlogged, $aSupervisor ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter', '', $fields ); -} else { - //list($Criteria,$xmlform) = $oCases->getConditionCasesList('gral'); - $Criteria = $oCases->getAdvancedSearch( '', '', '', '', '', '', '', '', $permisse, $userlogged, $aSupervisor ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter' ); -} -$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_advancedSearch', $Criteria ); - -G::RenderPage( 'publish', 'blank' ); -?> - - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * by The Answer + */ + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_ADVANCEDSEARCH'; +$G_PUBLISH = new Publisher(); + +global $RBAC; +$permisse = $RBAC->userCanAccess( 'PM_ALLCASES' ); +$userlogged = $_SESSION['USER_LOGGED']; + +require_once ("classes/model/ProcessUser.php"); +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->addSelectColumn( ProcessUserPeer::PU_UID ); +$oCriteria->addSelectColumn( ProcessUserPeer::PRO_UID ); +$oCriteria->add( ProcessUserPeer::USR_UID, $userlogged ); +$oCriteria->add( ProcessUserPeer::PU_TYPE, "SUPERVISOR" ); + +$oDataset = ProcessUserPeer::doSelectRS( $oCriteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); +$oDataset->next(); + +$aSupervisor = array (); +while ($aRow = $oDataset->getRow()) { + $aSupervisor[] = $aRow['PRO_UID']; + $oDataset->next(); +} + +G::LoadClass( 'case' ); +$oCases = new Cases(); + +if (isset( $_POST['form'] )) { + $fields['CASE_NUMBER'] = $_POST['form']['CASE_NUMBER']; + $fields['PROCESS'] = $_POST['form']['PROCESS']; + $fields['TASKS'] = $_POST['form']['TASKS']; + $fields['CURRENT_USER'] = $_POST['form']['CURRENT_USER']; + $fields['SENT_BY'] = $_POST['form']['SENT_BY']; + $fields['LAST_MODIFICATION_F'] = $_POST['form']['LAST_MODIFICATION_F']; + $fields['LAST_MODIFICATION_T'] = $_POST['form']['LAST_MODIFICATION_T']; + $fields['APP_STATUS'] = $_POST['form']['APP_STATUS']; + + $Criteria = $oCases->getAdvancedSearch( $fields['CASE_NUMBER'], $fields['PROCESS'], $fields['TASKS'], $fields['CURRENT_USER'], $fields['SENT_BY'], $fields['LAST_MODIFICATION_F'], $fields['LAST_MODIFICATION_T'], $fields['APP_STATUS'], $permisse, $userlogged, $aSupervisor ); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter', '', $fields ); +} else { + //list($Criteria,$xmlform) = $oCases->getConditionCasesList('gral'); + $Criteria = $oCases->getAdvancedSearch( '', '', '', '', '', '', '', '', $permisse, $userlogged, $aSupervisor ); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter' ); +} +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_advancedSearch', $Criteria ); + +G::RenderPage( 'publish', 'blank' ); +?> + +