From 2cb0b136d1163985c3c93eaadfb714c8273c6c30 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Thu, 18 Oct 2012 15:42:36 +0000 Subject: [PATCH 1/5] CODE STYLE Formating workflow/engine/methods/cases Change format files in workflow/engine/methods/cases --- .../methods/cases/cases_CatchExecute.php | 144 +++-- .../methods/cases/cases_CatchSelfService.php | 184 +++--- .../engine/methods/cases/cases_Delete.php | 113 ++-- .../methods/cases/cases_DeleteDocument.php | 116 ++-- .../cases/cases_DeleteDocumentToRevise.php | 95 ++-- .../engine/methods/cases/cases_Derivate.php | 372 ++++++------ workflow/engine/methods/cases/cases_List.php | 306 +++++----- workflow/engine/methods/cases/cases_New.php | 310 +++++----- .../engine/methods/cases/cases_NextStep.php | 64 +-- workflow/engine/methods/cases/cases_Open.php | 404 +++++++------ .../methods/cases/cases_OpenToRevise.php | 154 +++-- .../engine/methods/cases/cases_PrintView.php | 196 +++---- .../engine/methods/cases/cases_Reassign.php | 241 ++++---- .../methods/cases/cases_ReassignByUser.php | 314 +++++----- .../methods/cases/cases_Reassign_save.php | 154 +++-- .../engine/methods/cases/cases_Redirect.php | 26 +- .../engine/methods/cases/cases_Resume.php | 205 ++++--- workflow/engine/methods/cases/cases_Save.php | 152 ++--- .../engine/methods/cases/cases_SaveData.php | 518 ++++++++--------- .../cases/cases_SaveDataSupervisor.php | 110 ++-- .../methods/cases/cases_SaveDocument.php | 532 ++++++++--------- .../cases/cases_SchedulerGetPlugins.php | 146 ++--- .../cases/cases_SchedulerGetProcesses.php | 65 +-- .../methods/cases/cases_SchedulerGetTasks.php | 28 +- .../cases/cases_SchedulerValidateUser.php | 141 +++-- .../cases/cases_Scheduler_ChangeStatus.php | 64 +-- .../methods/cases/cases_Scheduler_Delete.php | 30 +- .../methods/cases/cases_Scheduler_Edit.php | 247 ++++---- .../methods/cases/cases_Scheduler_List.php | 236 +++----- .../methods/cases/cases_Scheduler_Log.php | 87 ++- .../cases/cases_Scheduler_Log_Detail.php | 127 ++--- .../methods/cases/cases_Scheduler_New.php | 139 +++-- .../methods/cases/cases_Scheduler_Save.php | 512 +++++++++-------- .../methods/cases/cases_Scheduler_Update.php | 537 +++++++++--------- .../methods/cases/cases_ShowDocument.php | 178 +++--- .../methods/cases/cases_generatePMTable.php | 188 +++--- 36 files changed, 3579 insertions(+), 3856 deletions(-) diff --git a/workflow/engine/methods/cases/cases_CatchExecute.php b/workflow/engine/methods/cases/cases_CatchExecute.php index 6458b1e4d..2deba8920 100755 --- a/workflow/engine/methods/cases/cases_CatchExecute.php +++ b/workflow/engine/methods/cases/cases_CatchExecute.php @@ -1,82 +1,74 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - - -if (isset($_POST['form']['BTN_CANCEL'])) { - header ( "Location: ../cases/main"); - die; -} - -/* Includes */ -G::LoadClass('case'); - -$oCase = new Cases(); -$sAppUid = $_SESSION['APPLICATION']; -$iDelIndex = $_SESSION['INDEX']; - -$oAppDelegation = new AppDelegation(); -$aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if (isset( $_POST['form']['BTN_CANCEL'] )) { + header( "Location: ../cases/main" ); + die(); +} + +/* Includes */ +G::LoadClass( 'case' ); + +$oCase = new Cases(); +$sAppUid = $_SESSION['APPLICATION']; +$iDelIndex = $_SESSION['INDEX']; + +$oAppDelegation = new AppDelegation(); +$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); + //if there are no user in the delegation row, this case is still in selfservice -if ( $aDelegation['USR_UID'] == "" ) { - $oCase->setCatchUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'] ); -} else { - G::SendMessageText(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), 'error'); -} - -$validation = (SYS_SKIN != 'uxs')? 'true' : 'false'; - -die('' -); - + ' ); + diff --git a/workflow/engine/methods/cases/cases_CatchSelfService.php b/workflow/engine/methods/cases/cases_CatchSelfService.php index f6efaf06d..29e6df412 100755 --- a/workflow/engine/methods/cases/cases_CatchSelfService.php +++ b/workflow/engine/methods/cases/cases_CatchSelfService.php @@ -1,95 +1,91 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -G::LoadClass('case'); - -$oCase = new Cases(); -$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); - - -/* Render page */ -require_once 'classes/model/Process.php'; -require_once 'classes/model/Task.php'; - -$objProc = new Process(); -$aProc = $objProc->load($Fields['PRO_UID' ] ); -$Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; - -$objTask = new Task(); -$aTask = $objTask->load($Fields['TAS_UID' ] ); -$Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; - -$Fields['STATUS'] .= ' ( '. G::LoadTranslation('ID_UNASSIGNED') . ' )'; - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); + +/* Render page */ +require_once 'classes/model/Process.php'; +require_once 'classes/model/Task.php'; + +$objProc = new Process(); +$aProc = $objProc->load( $Fields['PRO_UID'] ); +$Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; + +$objTask = new Task(); +$aTask = $objTask->load( $Fields['TAS_UID'] ); +$Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; + +$Fields['STATUS'] .= ' ( ' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ' )'; + //now getting information about the PREVIOUS task. If is the first task then no preious, use 1 -$oAppDel = new AppDelegation(); -$oAppDel->Load($Fields['APP_UID'], ($Fields['DEL_PREVIOUS']==0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS']) ); - -$aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME); -try { - $oCurUser = new Users(); - $oCurUser->load($aAppDel['USR_UID']); - $Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); -} -catch (Exception $oError) { - $Fields['PREVIOUS_USER'] = ''; -} - -$objTask = new Task(); -$aTask = $objTask->load($aAppDel['TAS_UID' ] ); -$Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE']; - +$oAppDel = new AppDelegation(); +$oAppDel->Load( $Fields['APP_UID'], ($Fields['DEL_PREVIOUS'] == 0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS']) ); + +$aAppDel = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME ); +try { + $oCurUser = new Users(); + $oCurUser->load( $aAppDel['USR_UID'] ); + $Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); +} catch (Exception $oError) { + $Fields['PREVIOUS_USER'] = ''; +} + +$objTask = new Task(); +$aTask = $objTask->load( $aAppDel['TAS_UID'] ); +$Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE']; + //To enable information (dynaforms, steps) before claim a case -$_SESSION['bNoShowSteps'] = true; -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'caseOptions'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = '_'; -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addScriptCode(" +$_SESSION['bNoShowSteps'] = true; +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'caseOptions'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = '_'; +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); } -}"); -$oHeadPublisher->addScriptCode(' +}" ); +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -100,11 +96,11 @@ $oHeadPublisher->addScriptCode(' leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"}); leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); - '); -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addScriptFile('/jscore/cases/core/cases_Step.js'); - - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute'); -G::RenderPage( 'publish', 'blank'); + ' ); +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptFile( '/jscore/cases/core/cases_Step.js' ); + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute' ); +G::RenderPage( 'publish', 'blank' ); + diff --git a/workflow/engine/methods/cases/cases_Delete.php b/workflow/engine/methods/cases/cases_Delete.php index 68cfa3dd7..29d0bc3ef 100755 --- a/workflow/engine/methods/cases/cases_Delete.php +++ b/workflow/engine/methods/cases/cases_Delete.php @@ -1,60 +1,57 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* Process the info */ +try { + $oCase = new Cases(); + if (isset( $_POST['APP_UIDS'] )) { + $ids = explode( ',', $_POST['APP_UIDS'] ); + foreach ($ids as $id) + $oCase->removeCase( $id ); + + if (count( $_POST['APP_UIDS'] ) > 1) + echo 'The Case was deleted successfully'; + else + echo 'All Cases were deleted successfully'; + } +} catch (Exception $e) { + echo $e->getMessage(); } -/* Includes */ -G::LoadClass('case'); - -/* Process the info */ -try{ - $oCase = new Cases(); - if( isset($_POST['APP_UIDS']) ){ - $ids = explode(',', $_POST['APP_UIDS']); - foreach($ids as $id) - $oCase->removeCase($id); - - if( count($_POST['APP_UIDS']) > 1) - echo 'The Case was deleted successfully'; - else - echo 'All Cases were deleted successfully'; - } -} catch(Exception $e){ - echo $e->getMessage(); -} - - diff --git a/workflow/engine/methods/cases/cases_DeleteDocument.php b/workflow/engine/methods/cases/cases_DeleteDocument.php index 980f79da6..90e77b7c5 100755 --- a/workflow/engine/methods/cases/cases_DeleteDocument.php +++ b/workflow/engine/methods/cases/cases_DeleteDocument.php @@ -1,63 +1,59 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -require_once ( "classes/model/AppDocumentPeer.php" ); -G::LoadClass('case'); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +require_once ("classes/model/AppDocumentPeer.php"); +G::LoadClass( 'case' ); + /* GET , POST & $_SESSION Vars */ /* Process the info */ -$oAppDocument = new AppDocument(); -$oAppDocument->remove($_GET['DOC']); -$oCase = new Cases(); -$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); -if ($_GET['TYPE'] == 'INPUT') -{ - $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1); -} -if ($_GET['TYPE'] == 'OUTPUT') -{ - $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); -} -$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; - -/* Redirect */ -G::header('location: ' . $aNextStep['PAGE']); -?> \ No newline at end of file +$oAppDocument = new AppDocument(); +$oAppDocument->remove( $_GET['DOC'] ); +$oCase = new Cases(); +$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' ); +if ($_GET['TYPE'] == 'INPUT') { + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 ); +} +if ($_GET['TYPE'] == 'OUTPUT') { + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); +} +$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; + +/* Redirect */ +G::header( 'location: ' . $aNextStep['PAGE'] ); + diff --git a/workflow/engine/methods/cases/cases_DeleteDocumentToRevise.php b/workflow/engine/methods/cases/cases_DeleteDocumentToRevise.php index c0ca8a6eb..5569d6595 100644 --- a/workflow/engine/methods/cases/cases_DeleteDocumentToRevise.php +++ b/workflow/engine/methods/cases/cases_DeleteDocumentToRevise.php @@ -1,51 +1,50 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -require_once ( "classes/model/AppDocumentPeer.php" ); -G::LoadClass('case'); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +require_once ("classes/model/AppDocumentPeer.php"); +G::LoadClass( 'case' ); + /* GET , POST & $_SESSION Vars */ /* Process the info */ -$oAppDocument = new AppDocument(); -$oAppDocument->remove($_GET['DOC']); - -/* Redirect */ -G::header('location: ' . $_SERVER['HTTP_REFERER']); +$oAppDocument = new AppDocument(); +$oAppDocument->remove( $_GET['DOC'] ); + +/* Redirect */ +G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + diff --git a/workflow/engine/methods/cases/cases_Derivate.php b/workflow/engine/methods/cases/cases_Derivate.php index 14afed35d..369baa1ff 100755 --- a/workflow/engine/methods/cases/cases_Derivate.php +++ b/workflow/engine/methods/cases/cases_Derivate.php @@ -1,193 +1,185 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - -/* Permissions */ -switch ($RBAC->userCanAccess('PM_CASES')) -{ - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -G::LoadClass('pmScript'); -G::LoadClass('case'); -G::LoadClass('derivation'); - -require_once 'classes/model/Event.php'; - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'pmScript' ); +G::LoadClass( 'case' ); +G::LoadClass( 'derivation' ); + +require_once 'classes/model/Event.php'; + /* GET , POST & $_SESSION Vars */ /* Process the info */ -$sStatus = 'TO_DO'; -foreach ($_POST['form']['TASKS'] as $aValues){ -} - -try { - //load data - $oCase = new Cases (); - //warning: we are not using the result value of function thisIsTheCurrentUser, so I'm commenting to optimize speed. - //$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); - $appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); - $appFields['APP_DATA'] = array_merge($appFields['APP_DATA'], G::getSystemConstants()); - //cleaning debug variables - $_SESSION['TRIGGER_DEBUG']['DATA'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array(); - - $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE'); - - //if there are some triggers to execute - if( sizeof($triggers) > 0) { - //Execute triggers before derivation - $appFields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE', $appFields['APP_DATA'] ); - - //save trigger variables for debugger - $_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof($triggers); - $_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = 'BEFORE'; - $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); - $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers; - } - - $appFields['DEL_INDEX'] = $_SESSION['INDEX']; - $appFields['TAS_UID'] = $_SESSION['TASK']; - - $oCase->updateCase ( $_SESSION['APPLICATION'], $appFields); //Save data - - //derivate case - $oDerivation = new Derivation(); - $aCurrentDerivation = array( - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'APP_STATUS' => $sStatus, - 'TAS_UID' => $_SESSION['TASK'], - 'ROU_TYPE' => $_POST['form']['ROU_TYPE'] - ); - - $oDerivation->derivate( $aCurrentDerivation, $_POST['form']['TASKS'] ); - - $appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); //refresh appFields, because in derivations should change some values - $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER'); //load the triggers after derivation - if( sizeof($triggers) > 0 ) { - $appFields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER', $appFields['APP_DATA'] ); //Execute triggers after derivation - - $_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof($triggers); - $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = 'AFTER'; - $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); - $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers; - } - $oCase->updateCase ( $_SESSION['APPLICATION'], $appFields); - - // Send notifications - Start - $oUser = new Users(); - $aUser = $oUser->load($_SESSION['USER_LOGGED']); - if (trim($aUser['USR_EMAIL'])=='') { - $aUser['USR_EMAIL'] = 'info@'.$_SERVER['HTTP_HOST']; - } - $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <'.$aUser['USR_EMAIL'].'>'; - try { - $oCase->sendNotifications($_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName); - } catch(Exception $e){ - G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR').' - '. $e->getMessage(), 'warning', 'string', null, '100%'); - } - // Send notifications - End - - // Events - Start - $oEvent = new Event(); - - $oEvent->closeAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']); - $oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX']+1 ); - $multipleDelegation = false; - // check if there are multiple derivations - if( count($_POST['form']['TASKS'] ) >1 ) { - $multipleDelegation = true; - } - // If the case has been delegated - if ( isset($oCurrentAppDel) ) { - // if there is just a single derivation the TASK_UID can be set by the delegation data - if ( !$multipleDelegation ){ - $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME); - $oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID']); - } - else { - // else we need to check every task and create the events if it have any - foreach ( $_POST['form']['TASKS'] as $taskDelegated ){ - $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME); - $oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID']); - } - } - } - //Events - End - $debuggerAvailable = true; - - if (isset($_SESSION['user_experience'])) { - $aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience']; - $debuggerAvailable = false; - } - else { - $aNextStep['PAGE'] = 'casesListExtJsRedirector'; - } - - if (isset($_SESSION['PMDEBUGGER']) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) { - $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; - $loc = 'cases_Step?' .'breakpoint=triggerdebug'; - } - else { - $loc = $aNextStep['PAGE']; - } +$sStatus = 'TO_DO'; +foreach ($_POST['form']['TASKS'] as $aValues) { +} + +try { + //load data + $oCase = new Cases(); + //warning: we are not using the result value of function thisIsTheCurrentUser, so I'm commenting to optimize speed. + //$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); + $appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + $appFields['APP_DATA'] = array_merge( $appFields['APP_DATA'], G::getSystemConstants() ); + //cleaning debug variables + $_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); + + $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE' ); + + //if there are some triggers to execute + if (sizeof( $triggers ) > 0) { + //Execute triggers before derivation + $appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE', $appFields['APP_DATA'] ); + + //save trigger variables for debugger + $_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = 'BEFORE'; + $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers; + } + + $appFields['DEL_INDEX'] = $_SESSION['INDEX']; + $appFields['TAS_UID'] = $_SESSION['TASK']; + + $oCase->updateCase( $_SESSION['APPLICATION'], $appFields ); //Save data + + + //derivate case + $oDerivation = new Derivation(); + $aCurrentDerivation = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'APP_STATUS' => $sStatus,'TAS_UID' => $_SESSION['TASK'],'ROU_TYPE' => $_POST['form']['ROU_TYPE'] + ); + + $oDerivation->derivate( $aCurrentDerivation, $_POST['form']['TASKS'] ); + + $appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); //refresh appFields, because in derivations should change some values + $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER' ); //load the triggers after derivation + if (sizeof( $triggers ) > 0) { + $appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER', $appFields['APP_DATA'] ); //Execute triggers after derivation + + + $_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = 'AFTER'; + $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers; + } + $oCase->updateCase( $_SESSION['APPLICATION'], $appFields ); + + // Send notifications - Start + $oUser = new Users(); + $aUser = $oUser->load( $_SESSION['USER_LOGGED'] ); + if (trim( $aUser['USR_EMAIL'] ) == '') { + $aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST']; + } + $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>'; + try { + $oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName ); + } catch (Exception $e) { + G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' ); + } + // Send notifications - End + + + // Events - Start + $oEvent = new Event(); + + $oEvent->closeAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] ); + $oCurrentAppDel = AppDelegationPeer::retrieveByPk( $_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1 ); + $multipleDelegation = false; + // check if there are multiple derivations + if (count( $_POST['form']['TASKS'] ) > 1) { + $multipleDelegation = true; + } + // If the case has been delegated + if (isset( $oCurrentAppDel )) { + // if there is just a single derivation the TASK_UID can be set by the delegation data + if (! $multipleDelegation) { + $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME ); + $oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID'] ); + } else { + // else we need to check every task and create the events if it have any + foreach ($_POST['form']['TASKS'] as $taskDelegated) { + $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME ); + $oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID'] ); + } + } + } + //Events - End + $debuggerAvailable = true; + + if (isset( $_SESSION['user_experience'] )) { + $aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience']; + $debuggerAvailable = false; + } else { + $aNextStep['PAGE'] = 'casesListExtJsRedirector'; + } + + if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + $loc = 'cases_Step?' . 'breakpoint=triggerdebug'; + } else { + $loc = $aNextStep['PAGE']; + } //Triggers After - if (isset($_SESSION['TRIGGER_DEBUG']['ISSET'])) { - if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1 ) { - $oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); - $oTemplatePower->prepare(); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); - $_POST['NextStep'] = $loc; - $G_PUBLISH->AddContent('view', 'cases/showDebugFrameLoader'); - $G_PUBLISH->AddContent('view', 'cases/showDebugFrameBreaker'); - $_SESSION['TRIGGER_DEBUG']['ISSET'] == 0; - G::RenderPage('publish', 'blank'); - exit(); - } else { - unset($_SESSION['TRIGGER_DEBUG']); - } - } - - G::header("location: $loc"); -} -catch ( Exception $e ) { - $aMessage = array(); - $aMessage['MESSAGE'] = $e->getMessage() . '
'.$e->getTraceAsString(); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank'); -} + if (isset( $_SESSION['TRIGGER_DEBUG']['ISSET'] )) { + if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1) { + $oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); + $oTemplatePower->prepare(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + $_POST['NextStep'] = $loc; + $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' ); + $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameBreaker' ); + $_SESSION['TRIGGER_DEBUG']['ISSET'] == 0; + G::RenderPage( 'publish', 'blank' ); + exit(); + } else { + unset( $_SESSION['TRIGGER_DEBUG'] ); + } + } + + G::header( "location: $loc" ); +} catch (Exception $e) { + $aMessage = array (); + $aMessage['MESSAGE'] = $e->getMessage() . '
' . $e->getTraceAsString(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); +} + diff --git a/workflow/engine/methods/cases/cases_List.php b/workflow/engine/methods/cases/cases_List.php index 2c24d1ece..dba1e1488 100755 --- a/workflow/engine/methods/cases/cases_List.php +++ b/workflow/engine/methods/cases/cases_List.php @@ -1,113 +1,111 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * Cases list (Refactored) - * By Erik A. O. - */ - -/* Permissions */ -if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response; - -/* Includes */ -G::LoadClass('case'); -G::LoadClass('configuration'); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * Cases list (Refactored) + * By Erik A. + * O. + */ + +/* Permissions */ +if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) + return $RBAC_Response; + + /* Includes */ +G::LoadClass( 'case' ); +G::LoadClass( 'configuration' ); + // $_GET['l'] has the type of cases list like todo,pause,cancel, all - -$conf = new Configurations(); -if (!isset($_GET['l'])) { - $confCasesList = $conf->loadObject('ProcessMaker','cases_List','',$_SESSION['USER_LOGGED'],''); - if (is_array($confCasesList)) { - $sTypeList = $confCasesList['sTypeList']; - } - else { - $sTypeList = 'to_do'; - } -} -else { - $sTypeList = $_GET['l']; - $confCasesList=array('sTypeList'=>$sTypeList); - $conf->saveObject($confCasesList,'ProcessMaker','cases_List','',$_SESSION['USER_LOGGED'],''); -} - -$sUIDUserLogged = $_SESSION['USER_LOGGED']; -$_SESSION['CASES_MENU_OPTION'] = $sTypeList; - -$oCases = new Cases(); - -/** here we verify if there is a any case with a unpause on this day*/ -if( $sTypeList === 'to_do' or $sTypeList === 'draft' or $sTypeList === 'paused') { - $oCases->ThrowUnpauseDaemon(date('Y-m-d')); -} - + + +$conf = new Configurations(); +if (! isset( $_GET['l'] )) { + $confCasesList = $conf->loadObject( 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' ); + if (is_array( $confCasesList )) { + $sTypeList = $confCasesList['sTypeList']; + } else { + $sTypeList = 'to_do'; + } +} else { + $sTypeList = $_GET['l']; + $confCasesList = array ('sTypeList' => $sTypeList + ); + $conf->saveObject( $confCasesList, 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' ); +} + +$sUIDUserLogged = $_SESSION['USER_LOGGED']; +$_SESSION['CASES_MENU_OPTION'] = $sTypeList; + +$oCases = new Cases(); + +/** + * here we verify if there is a any case with a unpause on this day + */ +if ($sTypeList === 'to_do' or $sTypeList === 'draft' or $sTypeList === 'paused') { + $oCases->ThrowUnpauseDaemon( date( 'Y-m-d' ) ); +} + /* * * Prepare the addtional filters before to show * By Erik - */ - -$aAdditionalFilter = Array(); - - -if( isset($_GET['PROCESS_UID']) and $_GET['PROCESS_UID'] != "0" && $_GET['PROCESS_UID'] != ""){ - $PRO_UID = $_GET['PROCESS_UID']; - $aAdditionalFilter['PRO_UID'] = $PRO_UID; -} else { - $PRO_UID = "0"; -} -if( isset($_GET['READ']) and $_GET['READ'] == "1" ){ - $aAdditionalFilter['READ'] = $_GET['READ']; -} -if( isset($_GET['UNREAD']) and $_GET['UNREAD'] == "1" ){ - $aAdditionalFilter['UNREAD'] = $_GET['UNREAD']; -} - -if( isset($_GET['APP_STATUS_FILTER']) and $_GET['APP_STATUS_FILTER'] != "ALL" ){ - $aAdditionalFilter['APP_STATUS_FILTER'] = $_GET['APP_STATUS_FILTER']; -} - -if( isset($_GET['MINE']) and $_GET['MINE'] == "1" ){ - $aAdditionalFilter['MINE'] = $_GET['MINE']; -} - - - - -switch ( $sTypeList ) { - case 'to_do' : - if ( defined( 'ENABLE_CASE_LIST_OPTIMIZATION' ) ) { - $aCriteria = $oCases->prepareCriteriaForToDo($sUIDUserLogged); - $xmlfile = 'cases/cases_ListTodoNew'; - } - else - list($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter); - break; - default : - list($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter); -} - + */ + +$aAdditionalFilter = Array (); + +if (isset( $_GET['PROCESS_UID'] ) and $_GET['PROCESS_UID'] != "0" && $_GET['PROCESS_UID'] != "") { + $PRO_UID = $_GET['PROCESS_UID']; + $aAdditionalFilter['PRO_UID'] = $PRO_UID; +} else { + $PRO_UID = "0"; +} +if (isset( $_GET['READ'] ) and $_GET['READ'] == "1") { + $aAdditionalFilter['READ'] = $_GET['READ']; +} +if (isset( $_GET['UNREAD'] ) and $_GET['UNREAD'] == "1") { + $aAdditionalFilter['UNREAD'] = $_GET['UNREAD']; +} + +if (isset( $_GET['APP_STATUS_FILTER'] ) and $_GET['APP_STATUS_FILTER'] != "ALL") { + $aAdditionalFilter['APP_STATUS_FILTER'] = $_GET['APP_STATUS_FILTER']; +} + +if (isset( $_GET['MINE'] ) and $_GET['MINE'] == "1") { + $aAdditionalFilter['MINE'] = $_GET['MINE']; +} + +switch ($sTypeList) { + case 'to_do': + if (defined( 'ENABLE_CASE_LIST_OPTIMIZATION' )) { + $aCriteria = $oCases->prepareCriteriaForToDo( $sUIDUserLogged ); + $xmlfile = 'cases/cases_ListTodoNew'; + } else + list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter ); + break; + default: + list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter ); +} + /* $rs = ApplicationPeer::doSelectRS($aCriteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -120,54 +118,50 @@ $rs = ApplicationPeer::doSelectRS($aCriteria); g::pr($aRows1);die;*/ /* GET , POST & $_SESSION Vars */ -if( !isset($_GET['PROCESS_UID']) ) { - $oCase = new Cases(); - $rs = ApplicationPeer::doSelectRS($aCriteria); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $aProcess = Array(); - while($rs->next()) { - $aRow = $rs->getRow(); +if (! isset( $_GET['PROCESS_UID'] )) { + $oCase = new Cases(); + $rs = ApplicationPeer::doSelectRS( $aCriteria ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + $aProcess = Array (); + while ($rs->next()) { + $aRow = $rs->getRow(); //g::pr($aRow); die; - if( !InAssocArray($aRow, 'PRO_UID', $aRow['PRO_UID']) ){ - array_push($aProcess, Array('PRO_UID'=>$aRow['PRO_UID'], 'PRO_TITLE'=>$aRow['APP_PRO_TITLE'])); - } - } - - $_DBArray['_PROCESSES'] = array_merge(Array(Array('PRO_UID'=>'char', 'PRO_TITLE'=>'char')), $aProcess); - $_SESSION['_DBArray'] = $_DBArray; -} else { - $_DBArray = $_SESSION['_DBArray']; -} - - -/* Render page */ -$G_PUBLISH = new Publisher; -$G_PUBLISH->ROWS_PER_PAGE = 12; - -if ($sTypeList == 'to_reassign') { - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', array('REASSIGN_BY' => 1)); -} - -$aData = Array( - 'PROCESS_FILTER'=>$PRO_UID, - 'APP_STATUS_FILTER'=>(isset($_GET['APP_STATUS_FILTER'])?$_GET['APP_STATUS_FILTER']:'0') -); - -$G_PUBLISH->AddContent('propeltable', 'paged-table', $xmlfile, $aCriteria, $aData); - -G::RenderPage('publish', 'blank'); - - - -function InAssocArray($a, $k, $v){ - foreach($a as $item){ - if( isset($item[$k]) && $v == $item[$k]) return true; - } - return false; -} - - + if (! InAssocArray( $aRow, 'PRO_UID', $aRow['PRO_UID'] )) { + array_push( $aProcess, Array ('PRO_UID' => $aRow['PRO_UID'],'PRO_TITLE' => $aRow['APP_PRO_TITLE'] ) ); + } + } + + $_DBArray['_PROCESSES'] = array_merge( Array (Array ('PRO_UID' => 'char','PRO_TITLE' => 'char' ) ), $aProcess ); + $_SESSION['_DBArray'] = $_DBArray; +} else { + $_DBArray = $_SESSION['_DBArray']; +} + +/* Render page */ +$G_PUBLISH = new Publisher(); +$G_PUBLISH->ROWS_PER_PAGE = 12; + +if ($sTypeList == 'to_reassign') { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', array ('REASSIGN_BY' => 1 ) ); +} + +$aData = Array ('PROCESS_FILTER' => $PRO_UID,'APP_STATUS_FILTER' => (isset( $_GET['APP_STATUS_FILTER'] ) ? $_GET['APP_STATUS_FILTER'] : '0') +); + +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', $xmlfile, $aCriteria, $aData ); + +G::RenderPage( 'publish', 'blank' ); + +function InAssocArray ($a, $k, $v) +{ + foreach ($a as $item) { + if (isset( $item[$k] ) && $v == $item[$k]) + return true; + } + return false; +} + ?> - - + + diff --git a/workflow/engine/methods/cases/cases_New.php b/workflow/engine/methods/cases/cases_New.php index ea1987596..8f0271c9f 100755 --- a/workflow/engine/methods/cases/cases_New.php +++ b/workflow/engine/methods/cases/cases_New.php @@ -1,162 +1,162 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - //we're looking for the type of view - function putTypeView(){ - require_once 'classes/model/Configuration.php'; - $oConfiguration = new Configuration(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(ConfigurationPeer::CFG_UID, 'StartNewCase'); - $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']); - - if(ConfigurationPeer::doCount($oCriteria)) { - $conf = ConfigurationPeer::doSelect($oCriteria); - return $conf[0]->getCfgValue(); - } else { - return 'dropdown'; - } - } - -$_GET['change']=(isset($_GET['change']))?$_GET['change']:putTypeView(); - - /* Permissions */ - switch ($RBAC->userCanAccess('PM_CASES')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - /* Includes */ - G::LoadClass('case'); - - /* GET , POST & $_SESSION Vars */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//we're looking for the type of view +function putTypeView () +{ + require_once 'classes/model/Configuration.php'; + $oConfiguration = new Configuration(); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); + $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); + + if (ConfigurationPeer::doCount( $oCriteria )) { + $conf = ConfigurationPeer::doSelect( $oCriteria ); + return $conf[0]->getCfgValue(); + } else { + return 'dropdown'; + } +} + +$_GET['change'] = (isset( $_GET['change'] )) ? $_GET['change'] : putTypeView(); + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* GET , POST & $_SESSION Vars */ /* Menues */ - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_DRAFT'; - - /* Prepare page before to show */ - $aFields = array(); - $oCase = new Cases(); - $bCanStart = $oCase->canStartCase( $_SESSION['USER_LOGGED'] ); - if ($bCanStart) - { - $aFields['LANG'] = SYS_LANG; - $aFields['USER'] = $_SESSION['USER_LOGGED']; - $sXmlForm = 'cases/cases_New.xml'; + $G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_DRAFT'; + +/* Prepare page before to show */ +$aFields = array (); +$oCase = new Cases(); +$bCanStart = $oCase->canStartCase( $_SESSION['USER_LOGGED'] ); +if ($bCanStart) { + $aFields['LANG'] = SYS_LANG; + $aFields['USER'] = $_SESSION['USER_LOGGED']; + $sXmlForm = 'cases/cases_New.xml'; //$_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] ); - $_DBArray['NewCase'] = $oCase->getStartCasesPerType( $_SESSION['USER_LOGGED'], $_GET['change'] ); - - } - else { - $sXmlForm = 'cases/cases_CannotInitiateCase.xml'; - } - - if ( isset( $_SESSION['G_MESSAGE']) && strlen($_SESSION['G_MESSAGE']) > 0 ) { - $aMessage = array(); - $aMessage['MESSAGE'] = $_SESSION['G_MESSAGE']; - //$_SESSION['G_MESSAGE_TYPE']; - unset($_SESSION['G_MESSAGE']); - unset($_SESSION['G_MESSAGE_TYPE']); - } - - //get the config parameter to show in dropdown or list - require_once 'classes/model/Configuration.php'; - $oConfiguration = new Configuration(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(ConfigurationPeer::CFG_UID, 'StartNewCase'); - $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']); - - if( ConfigurationPeer::doCount($oCriteria) == 0) { - $aData['CFG_UID'] = 'StartNewCase'; - $aData['OBJ_UID'] = ''; - $aData['CFG_VALUE'] = 'dropdown'; - $aData['PRO_UID'] = ''; - $aData['USR_UID'] = $_SESSION['USER_LOGGED']; - $aData['APP_UID'] = ''; - - $oConfig = new Configuration(); - $oConfig->create($aData); - $listType = 'dropdown'; - } - else { - $oConfiguration = new Configuration(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(ConfigurationPeer::CFG_UID, 'StartNewCase'); - $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']); - $conf = ConfigurationPeer::doSelect($oCriteria); - - $listType = $conf[0]->getCfgValue(); - } - if ( isset($_GET['change'] ) ) { - $listType= $_GET['change']; - $aData['CFG_UID'] = 'StartNewCase'; - $aData['OBJ_UID'] = ''; - $aData['CFG_VALUE'] = $listType; - $aData['PRO_UID'] = ''; - $aData['USR_UID'] = $_SESSION['USER_LOGGED']; - $aData['APP_UID'] = ''; - - $oConfig = new Configuration(); - $oConfig->update($aData); - } - - /* Render page */ - $G_PUBLISH = new Publisher; - $aFields['CHANGE_LINK'] = G::LoadTranslation( 'ID_CHANGE_VIEW' ); - - if ( isset ( $aMessage ) ) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - } - if ( $listType == 'dropdown' ) - $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save'); - - if ( $listType == 'link' ) { - if ($bCanStart) $sXmlForm = 'cases/cases_NewRadioGroup.xml'; - $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save'); - } - - if ( $listType == 'category' ) { - if ($bCanStart) $sXmlForm = 'cases/cases_NewCategory.xml'; - $G_PUBLISH->AddContent('view', 'cases/cases_NewCategory'); - } - - G::RenderPage( 'publish', 'blank' ); - + $_DBArray['NewCase'] = $oCase->getStartCasesPerType( $_SESSION['USER_LOGGED'], $_GET['change'] ); + +} else { + $sXmlForm = 'cases/cases_CannotInitiateCase.xml'; +} + +if (isset( $_SESSION['G_MESSAGE'] ) && strlen( $_SESSION['G_MESSAGE'] ) > 0) { + $aMessage = array (); + $aMessage['MESSAGE'] = $_SESSION['G_MESSAGE']; + //$_SESSION['G_MESSAGE_TYPE']; + unset( $_SESSION['G_MESSAGE'] ); + unset( $_SESSION['G_MESSAGE_TYPE'] ); +} + +//get the config parameter to show in dropdown or list +require_once 'classes/model/Configuration.php'; +$oConfiguration = new Configuration(); +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); +$oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); + +if (ConfigurationPeer::doCount( $oCriteria ) == 0) { + $aData['CFG_UID'] = 'StartNewCase'; + $aData['OBJ_UID'] = ''; + $aData['CFG_VALUE'] = 'dropdown'; + $aData['PRO_UID'] = ''; + $aData['USR_UID'] = $_SESSION['USER_LOGGED']; + $aData['APP_UID'] = ''; + + $oConfig = new Configuration(); + $oConfig->create( $aData ); + $listType = 'dropdown'; +} else { + $oConfiguration = new Configuration(); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); + $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); + $conf = ConfigurationPeer::doSelect( $oCriteria ); + + $listType = $conf[0]->getCfgValue(); +} +if (isset( $_GET['change'] )) { + $listType = $_GET['change']; + $aData['CFG_UID'] = 'StartNewCase'; + $aData['OBJ_UID'] = ''; + $aData['CFG_VALUE'] = $listType; + $aData['PRO_UID'] = ''; + $aData['USR_UID'] = $_SESSION['USER_LOGGED']; + $aData['APP_UID'] = ''; + + $oConfig = new Configuration(); + $oConfig->update( $aData ); +} + +/* Render page */ +$G_PUBLISH = new Publisher(); +$aFields['CHANGE_LINK'] = G::LoadTranslation( 'ID_CHANGE_VIEW' ); + +if (isset( $aMessage )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); +} +if ($listType == 'dropdown') + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' ); + +if ($listType == 'link') { + if ($bCanStart) + $sXmlForm = 'cases/cases_NewRadioGroup.xml'; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' ); +} + +if ($listType == 'category') { + if ($bCanStart) + $sXmlForm = 'cases/cases_NewCategory.xml'; + $G_PUBLISH->AddContent( 'view', 'cases/cases_NewCategory' ); +} + +G::RenderPage( 'publish', 'blank' ); + ?> \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_NextStep.php b/workflow/engine/methods/cases/cases_NextStep.php index b11738ce5..868905b57 100755 --- a/workflow/engine/methods/cases/cases_NextStep.php +++ b/workflow/engine/methods/cases/cases_NextStep.php @@ -1,32 +1,32 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response; -//go to the next step -G::LoadClass('case'); -$oCase = new Cases(); -$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); -$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; -G::header('location: ' . $aNextStep['PAGE']); -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) + return $RBAC_Response; + //go to the next step +G::LoadClass( 'case' ); +$oCase = new Cases(); +$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); +$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; +G::header( 'location: ' . $aNextStep['PAGE'] ); + diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 48490449a..5e244c744 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -1,205 +1,203 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/* Permissions */ -if( $RBAC->userCanAccess('PM_CASES') != 1 ) { - switch( $RBAC->userCanAccess('PM_CASES') ) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - break; - case - 1: - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - break; - } -} - -/* Includes */ -require_once 'classes/model/AppDelay.php'; -G::LoadClass('case'); - -$oCase = new Cases(); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) { + switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + break; + case - 1: + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + break; + } +} + +/* Includes */ +require_once 'classes/model/AppDelay.php'; +G::LoadClass( 'case' ); + +$oCase = new Cases(); + //cleaning the case session data -Cases::clearCaseSessionData(); - -try { - //Loading data for a Jump request - if( ! isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER']) ) { - $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']); - $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); - - //if the application doesn't exist - if( is_null($_GET['APP_UID']) ) { - G::SendMessageText(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'), 'info'); - G::header('location: casesListExtJs'); - exit; - } - - //if the application exists but the - if( is_null($_GET['DEL_INDEX']) ) { - G::SendMessageText(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'), 'info'); - G::header('location: casesListExtJs'); - exit; - } - //wrong implemented, need refactored - //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ??????? - } - - $sAppUid = $_GET['APP_UID']; - $iDelIndex = $_GET['DEL_INDEX']; - $_action = isset($_GET['action'])? $_GET['action']: ''; - - //loading application data - $aFields = $oCase->loadCase($sAppUid, $iDelIndex); -// g::pr($aFields); -// die; - - switch($aFields['APP_STATUS']){ - case 'DRAFT': - case 'TO_DO': - //check if the case is in pause, check a valid record in table APP_DELAY - if( AppDelay::isPaused($sAppUid, $iDelIndex) ) { - //the case is paused show only the resume - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = -1; - $_SESSION['STEP_POSITION'] = 0; - - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); - exit; - } - - /** - * these routine is to verify if the case was acceded from advaced search list - */ - if( $_action == 'search' ) { - //verify if the case is with teh current user - $c = new Criteria('workflow'); - $c->add(AppDelegationPeer::APP_UID, $sAppUid); - $c->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX); - $oDataset = AppDelegationPeer::doSelectRs($c); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - $aData = $oDataset->getRow(); - - - if ( $aData['USR_UID'] != $_SESSION['USER_LOGGED'] && - $aData['USR_UID'] != "" //distinct "" for selfservice - ) { - //so we show just the resume - $_SESSION['alreadyDerivated'] = true; - //the case is paused show only the resume - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = -1; - $_SESSION['STEP_POSITION'] = 0; - - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); - exit; - } - } - - - //proceed and try to open the case - $oAppDelegation = new AppDelegation(); - $aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex); - - //if there are no user in the delegation row, this case is in selfservice - if( $aDelegation['USR_UID'] == "" /*&& $aDelegation['DEL_THREAD_STATUS'] == 'SELFSERVICE'*/ ) { - - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = -1; - $_SESSION['STEP_POSITION'] = 0; - $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; - - //if the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume - if( $oCase->isSelfService($_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid) ) { - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); - } else { - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); - } - - exit; - } - - //if the current users is in the AppDelegation row, then open the case - if( ($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent' ) { - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - - if( is_null($aFields['DEL_INIT_DATE']) ) { - $oCase->setDelInitDate($sAppUid, $iDelIndex); - $aFields = $oCase->loadCase($sAppUid, $iDelIndex); - } - - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = $aFields['TAS_UID']; - $_SESSION['STEP_POSITION'] = 0; - - /* Redirect to next step */ - unset($_SESSION['bNoShowSteps']); - $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); - $sPage = $aNextStep['PAGE']; - G::header('location: ' . $sPage); - - - } else { - //when the case have another user or current user doesnt have rights to this selfservice, - //just view the case Resume - - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = -1; - $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); - $_SESSION['CURRENT_TASK'] = $Fields['TAS_UID']; - $_SESSION['STEP_POSITION'] = 0; - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); - } - break; - - default: //APP_STATUS <> DRAFT and TO_DO - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex != "" ? $iDelIndex : $oCase->getCurrentDelegationCase($_GET['APP_UID']); - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = -1; - $_SESSION['STEP_POSITION'] = 0; - - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); - } -} catch( Exception $e ) { - $aMessage = array (); - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); - G::RenderPage('publishBlank', 'blank'); +Cases::clearCaseSessionData(); + +try { + //Loading data for a Jump request + if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) { + $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] ); + $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); + + //if the application doesn't exist + if (is_null( $_GET['APP_UID'] )) { + G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' ); + G::header( 'location: casesListExtJs' ); + exit(); + } + + //if the application exists but the + if (is_null( $_GET['DEL_INDEX'] )) { + G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' ); + G::header( 'location: casesListExtJs' ); + exit(); + } + //wrong implemented, need refactored + //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ??????? + } + + $sAppUid = $_GET['APP_UID']; + $iDelIndex = $_GET['DEL_INDEX']; + $_action = isset( $_GET['action'] ) ? $_GET['action'] : ''; + + //loading application data + $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); + // g::pr($aFields); + // die; + + + switch ($aFields['APP_STATUS']) { + case 'DRAFT': + case 'TO_DO': + //check if the case is in pause, check a valid record in table APP_DELAY + if (AppDelay::isPaused( $sAppUid, $iDelIndex )) { + //the case is paused show only the resume + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex; + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = - 1; + $_SESSION['STEP_POSITION'] = 0; + + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + exit(); + } + + /** + * these routine is to verify if the case was acceded from advaced search list + */ + if ($_action == 'search') { + //verify if the case is with teh current user + $c = new Criteria( 'workflow' ); + $c->add( AppDelegationPeer::APP_UID, $sAppUid ); + $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $oDataset = AppDelegationPeer::doSelectRs( $c ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aData = $oDataset->getRow(); + + if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") //distinct "" for selfservice +{ + //so we show just the resume + $_SESSION['alreadyDerivated'] = true; + //the case is paused show only the resume + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex; + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = - 1; + $_SESSION['STEP_POSITION'] = 0; + + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + exit(); + } + } + + //proceed and try to open the case + $oAppDelegation = new AppDelegation(); + $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); + + //if there are no user in the delegation row, this case is in selfservice + if ($aDelegation['USR_UID'] == "" /*&& $aDelegation['DEL_THREAD_STATUS'] == 'SELFSERVICE'*/ ) { + + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex; + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = - 1; + $_SESSION['STEP_POSITION'] = 0; + $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + + //if the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume + if ($oCase->isSelfService( $_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid )) { + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); + } else { + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + } + + exit(); + } + + //if the current users is in the AppDelegation row, then open the case + if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') { + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex; + + if (is_null( $aFields['DEL_INIT_DATE'] )) { + $oCase->setDelInitDate( $sAppUid, $iDelIndex ); + $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); + } + + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = $aFields['TAS_UID']; + $_SESSION['STEP_POSITION'] = 0; + + /* Redirect to next step */ + unset( $_SESSION['bNoShowSteps'] ); + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + $sPage = $aNextStep['PAGE']; + G::header( 'location: ' . $sPage ); + + } else { + //when the case have another user or current user doesnt have rights to this selfservice, + //just view the case Resume + + + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex; + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = - 1; + $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); + $_SESSION['CURRENT_TASK'] = $Fields['TAS_UID']; + $_SESSION['STEP_POSITION'] = 0; + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + } + break; + + default: //APP_STATUS <> DRAFT and TO_DO + $_SESSION['APPLICATION'] = $sAppUid; + $_SESSION['INDEX'] = $iDelIndex != "" ? $iDelIndex : $oCase->getCurrentDelegationCase( $_GET['APP_UID'] ); + $_SESSION['PROCESS'] = $aFields['PRO_UID']; + $_SESSION['TASK'] = - 1; + $_SESSION['STEP_POSITION'] = 0; + + require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + } +} catch (Exception $e) { + $aMessage = array (); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publishBlank', 'blank' ); } + diff --git a/workflow/engine/methods/cases/cases_OpenToRevise.php b/workflow/engine/methods/cases/cases_OpenToRevise.php index 6de2d8a62..6b7f49276 100755 --- a/workflow/engine/methods/cases/cases_OpenToRevise.php +++ b/workflow/engine/methods/cases/cases_OpenToRevise.php @@ -1,79 +1,75 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/* Permissions */ - -if( $RBAC->userCanAccess('PM_SUPERVISOR') != 1 ) - switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -G::LoadClass('case'); - -/* GET , POST & $_SESSION Vars */ -if (isset($_SESSION['APPLICATION'])) { - unset($_SESSION['APPLICATION']); -} -if (isset($_SESSION['PROCESS'])) { - unset($_SESSION['PROCESS']); -} -if (isset($_SESSION['INDEX'])) { - unset($_SESSION['INDEX']); -} -if (isset($_SESSION['STEP_POSITION'])) { - unset($_SESSION['STEP_POSITION']); -} - -/* Process the info */ -$oCase = new Cases(); -$sAppUid = $_GET['APP_UID']; -$iDelIndex = $_GET['DEL_INDEX']; - - -$_SESSION['APPLICATION'] = $_GET['APP_UID']; -$_SESSION['INDEX'] = $_GET['DEL_INDEX']; - -$aFields = $oCase->loadCase($sAppUid, $iDelIndex); - -$_SESSION['PROCESS'] = $aFields['PRO_UID']; -$_SESSION['TASK'] = $aFields['TAS_UID']; -$_SESSION['STEP_POSITION'] = 0; - -/* Redirect to next step */ -$aNextStep = $oCase->getNextSupervisorStep($_SESSION['PROCESS'],0); -$sPage = "cases_StepToRevise?type=DYNAFORM&PRO_UID=".$aFields['PRO_UID']."&DYN_UID=".$aNextStep['UID']."&APP_UID=$sAppUid&DEL_INDEX=$iDelIndex&position=1";//$aNextStep['PAGE']; -G::header('location: ' . $sPage); - - -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ + +if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1) + switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + /* Includes */ +G::LoadClass( 'case' ); + +/* GET , POST & $_SESSION Vars */ +if (isset( $_SESSION['APPLICATION'] )) { + unset( $_SESSION['APPLICATION'] ); +} +if (isset( $_SESSION['PROCESS'] )) { + unset( $_SESSION['PROCESS'] ); +} +if (isset( $_SESSION['INDEX'] )) { + unset( $_SESSION['INDEX'] ); +} +if (isset( $_SESSION['STEP_POSITION'] )) { + unset( $_SESSION['STEP_POSITION'] ); +} + +/* Process the info */ +$oCase = new Cases(); +$sAppUid = $_GET['APP_UID']; +$iDelIndex = $_GET['DEL_INDEX']; + +$_SESSION['APPLICATION'] = $_GET['APP_UID']; +$_SESSION['INDEX'] = $_GET['DEL_INDEX']; + +$aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); + +$_SESSION['PROCESS'] = $aFields['PRO_UID']; +$_SESSION['TASK'] = $aFields['TAS_UID']; +$_SESSION['STEP_POSITION'] = 0; + +/* Redirect to next step */ +$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], 0 ); +$sPage = "cases_StepToRevise?type=DYNAFORM&PRO_UID=" . $aFields['PRO_UID'] . "&DYN_UID=" . $aNextStep['UID'] . "&APP_UID=$sAppUid&DEL_INDEX=$iDelIndex&position=1"; //$aNextStep['PAGE']; +G::header( 'location: ' . $sPage ); + diff --git a/workflow/engine/methods/cases/cases_PrintView.php b/workflow/engine/methods/cases/cases_PrintView.php index 42fc53372..51779daad 100755 --- a/workflow/engine/methods/cases/cases_PrintView.php +++ b/workflow/engine/methods/cases/cases_PrintView.php @@ -1,104 +1,96 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - - require_once 'classes/model/Dynaform.php'; - require_once 'classes/model/Process.php'; - - $currentDynUid = ''; - if (isset($_GET['DYNUIDPRINT']) && $_GET['DYNUIDPRINT'] != '') { - $currentDynUid = $_GET['DYNUIDPRINT']; - } elseif (isset($_SESSION['DYN_UID_PRINT'])) { - $currentDynUid = $_SESSION['DYN_UID_PRINT']; - } elseif (isset($_SESSION['CURRENT_DYN_UID'])) { - $currentDynUid = $_SESSION['CURRENT_DYN_UID']; - } - - $oDynaform = new Dynaform(); - $aDyn = $oDynaform->load($currentDynUid); - - G::LoadClass('case'); - $oCase = new Cases(); - - if (isset($_SESSION['APPLICATION'])) { - $Fields = $oCase->loadCase($_SESSION['APPLICATION']); - $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); - } else { - $Fields['APP_DATA'] = Array(); - } - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'USERS'; - $G_PUBLISH = new Publisher; - - $idProcess = (isset($Fields['APP_DATA']['PROCESS'])) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS']; - $oProcess = new Process(); - $aProcessFieds = $oProcess->load($idProcess); - $sProcess = $oProcess->getProTitle(); - - $noShowTitle = 0; - if (isset($aProcessFieds['PRO_SHOW_MESSAGE'])) { - $noShowTitle = $aProcessFieds['PRO_SHOW_MESSAGE']; - } +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + + require_once 'classes/model/Dynaform.php'; + require_once 'classes/model/Process.php'; + + $currentDynUid = ''; + if (isset( $_GET['DYNUIDPRINT'] ) && $_GET['DYNUIDPRINT'] != '') { + $currentDynUid = $_GET['DYNUIDPRINT']; + } elseif (isset( $_SESSION['DYN_UID_PRINT'] )) { + $currentDynUid = $_SESSION['DYN_UID_PRINT']; + } elseif (isset( $_SESSION['CURRENT_DYN_UID'] )) { + $currentDynUid = $_SESSION['CURRENT_DYN_UID']; + } + + $oDynaform = new Dynaform(); + $aDyn = $oDynaform->load( $currentDynUid ); + + G::LoadClass( 'case' ); + $oCase = new Cases(); + + if (isset( $_SESSION['APPLICATION'] )) { + $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); + } else { + $Fields['APP_DATA'] = Array (); + } + + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'USERS'; + $G_PUBLISH = new Publisher(); + + $idProcess = (isset( $Fields['APP_DATA']['PROCESS'] )) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS']; + $oProcess = new Process(); + $aProcessFieds = $oProcess->load( $idProcess ); + $sProcess = $oProcess->getProTitle(); + + $noShowTitle = 0; + if (isset( $aProcessFieds['PRO_SHOW_MESSAGE'] )) { + $noShowTitle = $aProcessFieds['PRO_SHOW_MESSAGE']; + } //Add content content step - Start - if (isset($_SESSION['APPLICATION'])) { - $array['CASE'] = G::LoadTranslation('ID_CASE'); - $array['USER'] = G::LoadTranslation('ID_USER'); - $array['WORKSPACE'] = G::LoadTranslation('ID_WORKSPACE'); - $array['APP_NUMBER'] = $Fields['APP_NUMBER']; - $array['APP_TITLE'] = $Fields['TITLE']; - $array['USR_USERNAME'] = $Fields['APP_DATA']['USR_USERNAME']; - $array['USER_ENV'] = $Fields['APP_DATA']['SYS_SYS']; - $array['DATEPRINT'] = date('Y-m-d H:m:s'); - } - $array['APP_PROCESS'] = $sProcess; - - if (isset($Fields['TITLE']) && strlen($Fields['TITLE']) > 0) { - $array['TITLE'] = G::LoadTranslation('ID_TITLE'); - } else { - $array['TITLE'] = ''; - } - $array['PROCESS'] = G::LoadTranslation('ID_PROCESS'); - $array['DATELABEL'] = G::LoadTranslation('DATE_LABEL'); - - $aDyn['DYN_UID'] = $currentDynUid; - if ($noShowTitle == 0) { - $G_PUBLISH->AddContent('smarty', 'cases/cases_PrintViewTitle', '', '', $array); - } - $G_PUBLISH->AddContent('dynaform', - 'xmlform', - $aDyn['PRO_UID'] . '/' . $aDyn['DYN_UID'], - '', - $Fields['APP_DATA'], - '', - '', - 'view'); - G::RenderPage('publish', 'blank'); -} catch (Exception $oException) { - die($oException->getMessage()); -} + if (isset( $_SESSION['APPLICATION'] )) { + $array['CASE'] = G::LoadTranslation( 'ID_CASE' ); + $array['USER'] = G::LoadTranslation( 'ID_USER' ); + $array['WORKSPACE'] = G::LoadTranslation( 'ID_WORKSPACE' ); + $array['APP_NUMBER'] = $Fields['APP_NUMBER']; + $array['APP_TITLE'] = $Fields['TITLE']; + $array['USR_USERNAME'] = $Fields['APP_DATA']['USR_USERNAME']; + $array['USER_ENV'] = $Fields['APP_DATA']['SYS_SYS']; + $array['DATEPRINT'] = date( 'Y-m-d H:m:s' ); + } + $array['APP_PROCESS'] = $sProcess; + + if (isset( $Fields['TITLE'] ) && strlen( $Fields['TITLE'] ) > 0) { + $array['TITLE'] = G::LoadTranslation( 'ID_TITLE' ); + } else { + $array['TITLE'] = ''; + } + $array['PROCESS'] = G::LoadTranslation( 'ID_PROCESS' ); + $array['DATELABEL'] = G::LoadTranslation( 'DATE_LABEL' ); + + $aDyn['DYN_UID'] = $currentDynUid; + if ($noShowTitle == 0) { + $G_PUBLISH->AddContent( 'smarty', 'cases/cases_PrintViewTitle', '', '', $array ); + } + $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $aDyn['PRO_UID'] . '/' . $aDyn['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' ); + G::RenderPage( 'publish', 'blank' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); +} ?> - + + diff --git a/workflow/engine/methods/cases/cases_Reassign.php b/workflow/engine/methods/cases/cases_Reassign.php index e1df7dfe2..942f624c1 100755 --- a/workflow/engine/methods/cases/cases_Reassign.php +++ b/workflow/engine/methods/cases/cases_Reassign.php @@ -1,121 +1,120 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - -G::LoadSystem('templatePower'); -$tpl = new TemplatePower(PATH_TPL ."cases/cases_Reassign.html"); -$tpl->prepare(); - -require_once 'classes/model/AppDelegation.php'; -$oCriteria = new Criteria('workflow'); -$oCriteria->add(AppDelegationPeer::APP_UID, $_GET['APP_UID']); -$oCriteria->add(AppDelegationPeer::DEL_INDEX, $_GET['DEL_INDEX']); -$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null); -$oDataset = AppDelegationPeer::doSelectRS($oCriteria); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$oDataset->next(); -$c=0; -G::LoadClass('tasks'); -$oTasks=new Tasks(); -G::LoadClass('groups'); -$oGroups = new Groups(); -require_once 'classes/model/Users.php'; -$oUser = new Users(); -$name = ''; - while ($aRow = $oDataset->getRow()) { - $c++; - - $aUsr=array(); - $aUsrUid=array(); - $aAux1 = $oTasks->getGroupsOfTask($aRow['TAS_UID'], 1); - foreach ($aAux1 as $value1) { - $aAux2 = $oGroups->getUsersOfGroup($value1['GRP_UID']); - foreach ($aAux2 as $value2) { - if($aRow['USR_UID']!=$value2['USR_UID']) { - if(!in_array($value2['USR_UID'], $aUsrUid)) {//var_dump($aRow['USR_UID'], $value2['USR_UID']);echo '

'; - $aAux = $oUser->load($value2['USR_UID']); - $aUsr[$aAux['USR_FIRSTNAME'] . ' ' . $aAux['USR_LASTNAME']] = $aAux; - $aUsrUid[]=$value2['USR_UID']; - } - } - } - } - - $aUsers=$oTasks->getUsersOfTask($aRow['TAS_UID'], 1); - foreach($aUsers as $key => $value) - { - if($aRow['USR_UID']!=$value['USR_UID']) - { if(!in_array($value['USR_UID'], $aUsrUid)) - $aUsr[$value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME']]=$value; - } - } - ksort($aUsr); - //$users=''; - //$users=''; - - //$tpl->assign( "USERS", $users ); - - $oDataset->next(); - } - $tpl->gotoBlock('_ROOT'); - $tpl->assign( "US", $name ); - $tpl->assign( "ID_NO_REASSIGN", '-'); - $tpl->assign( "APP_UID", $_GET['APP_UID']); - $tpl->assign( "DEL_INDEX", $_GET['DEL_INDEX']); - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('template', '', '', '', $tpl); - G::RenderPage('publish', 'blank'); - -} -catch (Exception $oException) { - die($oException->getMessage()); -} -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + G::LoadSystem( 'templatePower' ); + $tpl = new TemplatePower( PATH_TPL . "cases/cases_Reassign.html" ); + $tpl->prepare(); + + require_once 'classes/model/AppDelegation.php'; + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( AppDelegationPeer::APP_UID, $_GET['APP_UID'] ); + $oCriteria->add( AppDelegationPeer::DEL_INDEX, $_GET['DEL_INDEX'] ); + $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null ); + $oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $c = 0; + G::LoadClass( 'tasks' ); + $oTasks = new Tasks(); + G::LoadClass( 'groups' ); + $oGroups = new Groups(); + require_once 'classes/model/Users.php'; + $oUser = new Users(); + $name = ''; + while ($aRow = $oDataset->getRow()) { + $c ++; + + $aUsr = array (); + $aUsrUid = array (); + $aAux1 = $oTasks->getGroupsOfTask( $aRow['TAS_UID'], 1 ); + foreach ($aAux1 as $value1) { + $aAux2 = $oGroups->getUsersOfGroup( $value1['GRP_UID'] ); + foreach ($aAux2 as $value2) { + if ($aRow['USR_UID'] != $value2['USR_UID']) { + if (! in_array( $value2['USR_UID'], $aUsrUid )) { //var_dump($aRow['USR_UID'], $value2['USR_UID']);echo '

'; + $aAux = $oUser->load( $value2['USR_UID'] ); + $aUsr[$aAux['USR_FIRSTNAME'] . ' ' . $aAux['USR_LASTNAME']] = $aAux; + $aUsrUid[] = $value2['USR_UID']; + } + } + } + } + + $aUsers = $oTasks->getUsersOfTask( $aRow['TAS_UID'], 1 ); + foreach ($aUsers as $key => $value) { + if ($aRow['USR_UID'] != $value['USR_UID']) { + if (! in_array( $value['USR_UID'], $aUsrUid )) + $aUsr[$value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME']] = $value; + } + } + ksort( $aUsr ); + //$users=''; + //$users=''; + + + //$tpl->assign( "USERS", $users ); + + + $oDataset->next(); + } + $tpl->gotoBlock( '_ROOT' ); + $tpl->assign( "US", $name ); + $tpl->assign( "ID_NO_REASSIGN", '-' ); + $tpl->assign( "APP_UID", $_GET['APP_UID'] ); + $tpl->assign( "DEL_INDEX", $_GET['DEL_INDEX'] ); + + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'cases'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'template', '', '', '', $tpl ); + G::RenderPage( 'publish', 'blank' ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_ReassignByUser.php b/workflow/engine/methods/cases/cases_ReassignByUser.php index 537df26da..f1f13df61 100755 --- a/workflow/engine/methods/cases/cases_ReassignByUser.php +++ b/workflow/engine/methods/cases/cases_ReassignByUser.php @@ -1,166 +1,150 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * Reassign ByUser routines - * Author Erik Amaru Ortiz - */ - -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - if (!isset($_GET['REASSIGN_USER'])) { - $_GET['REASSIGN_USER'] = ''; - } - $_GET['REASSIGN_BY'] = 2; - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; - ////////////////// - ///SELECT USR_UID, CONCAT(USR_FIRSTNAME, ' ', USR_LASTNAME, ' (', USR_USERNAME, ')') AS USER_FULLNAME FROM USERS WHERE USR_STATUS <> 'CLOSED'////// - require_once 'classes/model/Users.php'; - $oCriteria=new Criteria(); - $oCriteria->addSelectColumn(UsersPeer::USR_UID); - $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); - $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); - $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); - $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); - $oCriteria->add(UsersPeer::USR_STATUS,'', Criteria::NOT_EQUAL); - $oDataset=UsersPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - /////////////////////// - G::loadClass('configuration'); - $oConf = new Configurations; - $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS',''); - - $defaultOption = isset($oConf->aConfig['format'])? $oConf->aConfig['format']: ''; - $aUserInfo = array(); - $aUserInfo[] = array('USR_UID' => 'char','USER_FULLNAME' => 'char'); - while( $oDataset->next()){ - $aRow1 = $oDataset->getRow(); - $infoUser = G::getFormatUserList($defaultOption,$aRow1); - $aUserInfo[]=array( - 'USR_UID' => $aRow1['USR_UID'], - 'USER_FULLNAME' => $infoUser - ); - } - global $_DBArray; - $_DBArray['aUserInfo'] = $aUserInfo; - $_SESSION['_DBArray'] = $_DBArray; - ////////////////// - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', $_GET); - - $sUserToReassign = trim($_GET['REASSIGN_USER']); - - if ($_GET['REASSIGN_USER'] != '') { - - G::LoadClass('tasks'); - G::LoadClass('groups'); - $oTasks = new Tasks(); - $oGroups = new Groups(); - $oUser = new Users(); - G::LoadClass('case'); - $oCases = new Cases(); - - list($oCriteriaToDo,$sXMLFile) = $oCases->getConditionCasesList('to_do', $sUserToReassign); - list($oCriteriaDraft,$sXMLFile) = $oCases->getConditionCasesList('draft', $sUserToReassign); - - $aCasesList = Array(); - - $oDataset = ApplicationPeer::doSelectRS($oCriteriaToDo); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while ( $oDataset->next() ) { - array_push($aCasesList, $oDataset->getRow()); - } - - $oDataset = ApplicationPeer::doSelectRS($oCriteriaDraft); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while ( $oDataset->next() ) { - array_push($aCasesList, $oDataset->getRow()); - } - - $filedNames = Array ( - "APP_UID", - "APP_NUMBER", - "APP_UPDATE_DATE", - "DEL_PRIORITY", - "DEL_INDEX", - "TAS_UID", - "DEL_INIT_DATE", - "DEL_FINISH_DATE", - "USR_UID", - "APP_STATUS", - "DEL_TASK_DUE_DATE", - "APP_CURRENT_USER", - "APP_TITLE", - "APP_PRO_TITLE", - "APP_TAS_TITLE", - "APP_DEL_PREVIOUS_USER", - ); - - $aCasesList = array_merge(Array($filedNames), $aCasesList); - - // G::pr($aCasesList); die; - - - require_once ( 'classes/class.xmlfield_InputPM.php' ); - - global $_DBArray; - $_DBArray['reassign_byuser'] = $aCasesList; - $_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('ArrayPeer'); - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('reassign_byuser'); - - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile ( '/jscore/cases/reassignByUser.js' ); - $G_PUBLISH->ROWS_PER_PAGE = 12; - $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-reassigByUser', 'cases/cases_ToReassignByUserList', $oCriteria, Array('FROM_USR_UID'=>$sUserToReassign)); - - } - - G::RenderPage('publish', 'blank'); -} -catch (Exception $oException) { - die($oException->getMessage()); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * Reassign ByUser routines + * Author Erik Amaru Ortiz + */ + +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + + if (! isset( $_GET['REASSIGN_USER'] )) { + $_GET['REASSIGN_USER'] = ''; + } + $_GET['REASSIGN_BY'] = 2; + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'cases'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; + ////////////////// + ///SELECT USR_UID, CONCAT(USR_FIRSTNAME, ' ', USR_LASTNAME, ' (', USR_USERNAME, ')') AS USER_FULLNAME FROM USERS WHERE USR_STATUS <> 'CLOSED'////// + require_once 'classes/model/Users.php'; + $oCriteria = new Criteria(); + $oCriteria->addSelectColumn( UsersPeer::USR_UID ); + $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME ); + $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); + $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME ); + $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL ); + $oCriteria->add( UsersPeer::USR_STATUS, '', Criteria::NOT_EQUAL ); + $oDataset = UsersPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + /////////////////////// + G::loadClass( 'configuration' ); + $oConf = new Configurations(); + $oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); + + $defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : ''; + $aUserInfo = array (); + $aUserInfo[] = array ('USR_UID' => 'char','USER_FULLNAME' => 'char' + ); + while ($oDataset->next()) { + $aRow1 = $oDataset->getRow(); + $infoUser = G::getFormatUserList( $defaultOption, $aRow1 ); + $aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser + ); + } + global $_DBArray; + $_DBArray['aUserInfo'] = $aUserInfo; + $_SESSION['_DBArray'] = $_DBArray; + ////////////////// + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', $_GET ); + + $sUserToReassign = trim( $_GET['REASSIGN_USER'] ); + + if ($_GET['REASSIGN_USER'] != '') { + + G::LoadClass( 'tasks' ); + G::LoadClass( 'groups' ); + $oTasks = new Tasks(); + $oGroups = new Groups(); + $oUser = new Users(); + G::LoadClass( 'case' ); + $oCases = new Cases(); + + list ($oCriteriaToDo, $sXMLFile) = $oCases->getConditionCasesList( 'to_do', $sUserToReassign ); + list ($oCriteriaDraft, $sXMLFile) = $oCases->getConditionCasesList( 'draft', $sUserToReassign ); + + $aCasesList = Array (); + + $oDataset = ApplicationPeer::doSelectRS( $oCriteriaToDo ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + while ($oDataset->next()) { + array_push( $aCasesList, $oDataset->getRow() ); + } + + $oDataset = ApplicationPeer::doSelectRS( $oCriteriaDraft ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + while ($oDataset->next()) { + array_push( $aCasesList, $oDataset->getRow() ); + } + + $filedNames = Array ("APP_UID","APP_NUMBER","APP_UPDATE_DATE","DEL_PRIORITY","DEL_INDEX","TAS_UID","DEL_INIT_DATE","DEL_FINISH_DATE","USR_UID","APP_STATUS","DEL_TASK_DUE_DATE","APP_CURRENT_USER","APP_TITLE","APP_PRO_TITLE","APP_TAS_TITLE","APP_DEL_PREVIOUS_USER" + ); + + $aCasesList = array_merge( Array ($filedNames + ), $aCasesList ); + + // G::pr($aCasesList); die; + + + require_once ('classes/class.xmlfield_InputPM.php'); + + global $_DBArray; + $_DBArray['reassign_byuser'] = $aCasesList; + $_SESSION['_DBArray'] = $_DBArray; + G::LoadClass( 'ArrayPeer' ); + $oCriteria = new Criteria( 'dbarray' ); + $oCriteria->setDBArrayTable( 'reassign_byuser' ); + + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile( '/jscore/cases/reassignByUser.js' ); + $G_PUBLISH->ROWS_PER_PAGE = 12; + $G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-reassigByUser', 'cases/cases_ToReassignByUserList', $oCriteria, Array ('FROM_USR_UID' => $sUserToReassign + ) ); + + } + + G::RenderPage( 'publish', 'blank' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); +} ?> - \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_Reassign_save.php b/workflow/engine/methods/cases/cases_Reassign_save.php index 949e99c00..0b6620654 100755 --- a/workflow/engine/methods/cases/cases_Reassign_save.php +++ b/workflow/engine/methods/cases/cases_Reassign_save.php @@ -1,79 +1,75 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - //print_r($_POST); die; - G::LoadClass('case'); - $oCase = new Cases(); - - if ($_POST['USERS'] != '') { - $oCase->reassignCase($_POST['APP_UID'], $_POST['DEL_INDEX'], $_SESSION['USER_LOGGED'], $_POST['USERS']); - - } - - require_once 'classes/model/Users.php'; - $oUser = new Users(); - $aUser = $oUser->load($_POST['USERS']); - - $Fields=array(); - - $Fields['USERS'] = $aUser['USR_FIRSTNAME'].' '.$aUser['USR_LASTNAME'].' ('.$aUser['USR_USERNAME'].')'; - - - - G::LoadClass('case'); - $oCases=new Cases(); - $aCases=$oCases->loadCase($_POST['APP_UID'], $_POST['DEL_INDEX'] ); - - $Fields['APP_NUMBER']=$aCases['APP_NUMBER']; - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Reassign.xml', '', $Fields, ''); - G::RenderPage( 'publish', 'blank' ); - //G::SendMessageText(G::LoadTranslation('ID_FINISHED'), 'info'); - //G::header('Location: cases_List'); - -} -catch (Exception $oException) { - die($oException->getMessage()); -} - -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + //print_r($_POST); die; + G::LoadClass( 'case' ); + $oCase = new Cases(); + + if ($_POST['USERS'] != '') { + $oCase->reassignCase( $_POST['APP_UID'], $_POST['DEL_INDEX'], $_SESSION['USER_LOGGED'], $_POST['USERS'] ); + + } + + require_once 'classes/model/Users.php'; + $oUser = new Users(); + $aUser = $oUser->load( $_POST['USERS'] ); + + $Fields = array (); + + $Fields['USERS'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')'; + + G::LoadClass( 'case' ); + $oCases = new Cases(); + $aCases = $oCases->loadCase( $_POST['APP_UID'], $_POST['DEL_INDEX'] ); + + $Fields['APP_NUMBER'] = $aCases['APP_NUMBER']; + + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'cases'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Reassign.xml', '', $Fields, '' ); + G::RenderPage( 'publish', 'blank' ); + //G::SendMessageText(G::LoadTranslation('ID_FINISHED'), 'info'); + //G::header('Location: cases_List'); + + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_Redirect.php b/workflow/engine/methods/cases/cases_Redirect.php index c18ecc45c..908ac3db8 100755 --- a/workflow/engine/methods/cases/cases_Redirect.php +++ b/workflow/engine/methods/cases/cases_Redirect.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ /* * Created on 19-03-2009 @@ -29,13 +28,12 @@ */ require_once 'classes/model/AppDocument.php'; $oAppDocument = new AppDocument(); -$aFields = $oAppDocument->load($_GET['a']); +$aFields = $oAppDocument->load( $_GET['a'] ); require_once 'classes/model/OutputDocument.php'; $oOutputDocument = new OutputDocument(); -$aOD = $oOutputDocument->load($aFields['DOC_UID']); -$a = $_GET['a']; -$ext = strtolower($aOD['OUT_DOC_GENERATE']); +$aOD = $oOutputDocument->load( $aFields['DOC_UID'] ); +$a = $_GET['a']; +$ext = strtolower( $aOD['OUT_DOC_GENERATE'] ); +G::header( 'location: cases_ShowOutputDocument?a=' . $a . '&ext=' . $ext ); -G::header('location: cases_ShowOutputDocument?a='.$a.'&ext='.$ext ); -?> \ No newline at end of file diff --git a/workflow/engine/methods/cases/cases_Resume.php b/workflow/engine/methods/cases/cases_Resume.php index b075450ee..e34ad352a 100755 --- a/workflow/engine/methods/cases/cases_Resume.php +++ b/workflow/engine/methods/cases/cases_Resume.php @@ -1,97 +1,95 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - /* Permissions */ - switch ($RBAC->userCanAccess('PM_CASES')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* GET , POST & $_SESSION Vars */ - /* Includes */ - G::LoadClass('case'); - - /* GET , POST & $_SESSION Vars */ - - /* Menues */ - $_SESSION['bNoShowSteps'] = true; - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'caseOptions'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = '_'; - - /* Prepare page before to show */ - $oCase = new Cases(); - $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); - $participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); - - if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $participated == 0) { +/* Menues */ +$_SESSION['bNoShowSteps'] = true; +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'caseOptions'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = '_'; + +/* Prepare page before to show */ +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); +$participated = $oCase->userParticipatedInCase( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); + +if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) { /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') { $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE'); - }*/ - $aMessage['MESSAGE'] = G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED'); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); - G::RenderPage('publishBlank', 'blank'); - die; - } - if (isset($aRow['APP_TYPE'])) { - switch ($aRow['APP_TYPE']) { - case 'PAUSE': - $Fields['STATUS'] = ucfirst(strtolower(G::LoadTranslation('ID_PAUSED'))); - break; - case 'CANCEL': - $Fields['STATUS'] = ucfirst(strtolower(G::LoadTranslation('ID_CANCELLED'))); - break; - } - + }*/ + $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publishBlank', 'blank' ); + die(); +} +if (isset( $aRow['APP_TYPE'] )) { + switch ($aRow['APP_TYPE']) { + case 'PAUSE': + $Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_PAUSED' ) ) ); + break; + case 'CANCEL': + $Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_CANCELLED' ) ) ); + break; + } + //$Fields['STATUS'] = $aRow['APP_TYPE']; - } - - $actions = 'false'; - if( $_GET['action'] == 'paused') - $actions = 'true'; - - /* Render page */ - $oHeadPublisher =& headPublisher::getSingleton(); - - $oHeadPublisher->addScriptCode(" +} + +$actions = 'false'; +if ($_GET['action'] == 'paused') + $actions = 'true'; + + /* Render page */ +$oHeadPublisher = & headPublisher::getSingleton(); + +$oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); } - }"); - - $oHeadPublisher->addScriptCode(' + }" ); + +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -102,20 +100,21 @@ leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"}); leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); - '); - - require_once 'classes/model/Process.php'; - - $objProc = new Process(); - $aProc = $objProc->load($Fields['PRO_UID' ] ); - $Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; - - $objTask = new Task(); - $aTask = $objTask->load($Fields['TAS_UID' ] ); - $Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; - - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile('/jscore/cases/core/cases_Step.js'); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, ''); - G::RenderPage( 'publish', 'blank'); + ' ); + +require_once 'classes/model/Process.php'; + +$objProc = new Process(); +$aProc = $objProc->load( $Fields['PRO_UID'] ); +$Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; + +$objTask = new Task(); +$aTask = $objTask->load( $Fields['TAS_UID'] ); +$Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptFile( '/jscore/cases/core/cases_Step.js' ); +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' ); +G::RenderPage( 'publish', 'blank' ); + diff --git a/workflow/engine/methods/cases/cases_Save.php b/workflow/engine/methods/cases/cases_Save.php index 59326afad..7150134a7 100755 --- a/workflow/engine/methods/cases/cases_Save.php +++ b/workflow/engine/methods/cases/cases_Save.php @@ -1,76 +1,78 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - /* Permissions */ - switch ($RBAC->userCanAccess('PM_CASES')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* GET , POST & $_SESSION Vars */ - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - /* Includes */ - G::LoadClass('case'); - - /* GET , POST & $_SESSION Vars */ - - /* unset any variable, because we are starting a new case */ - if (isset($_SESSION['APPLICATION'])) unset($_SESSION['APPLICATION']); - if (isset($_SESSION['PROCESS'])) unset($_SESSION['PROCESS']); - if (isset($_SESSION['TASK'])) unset($_SESSION['TASK']); - if (isset($_SESSION['INDEX'])) unset($_SESSION['INDEX']); - if (isset($_SESSION['STEP_POSITION'])) unset($_SESSION['STEP_POSITION']); - - /* Process */ - try { - $oCase = new Cases(); - $aData = $oCase->startCase( $_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED'] ); - $_SESSION['APPLICATION'] = $aData['APPLICATION']; - $_SESSION['INDEX'] = $aData['INDEX']; - $_SESSION['PROCESS'] = $aData['PROCESS']; - $_SESSION['TASK'] = $_POST['form']['TAS_UID']; - $_SESSION['STEP_POSITION'] = 0; - - $_SESSION['CASES_REFRESH'] = true; - - $oCase = new Cases(); - $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); - $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; - - G::header('location: ' . $aNextStep['PAGE']); - } - catch ( Exception $e ) { - $_SESSION['G_MESSAGE'] = $e->getMessage(); - $_SESSION['G_MESSAGE_TYPE'] = 'error'; - G::header('location: cases_New' ); - } -?> +/* unset any variable, because we are starting a new case */ +if (isset( $_SESSION['APPLICATION'] )) + unset( $_SESSION['APPLICATION'] ); +if (isset( $_SESSION['PROCESS'] )) + unset( $_SESSION['PROCESS'] ); +if (isset( $_SESSION['TASK'] )) + unset( $_SESSION['TASK'] ); +if (isset( $_SESSION['INDEX'] )) + unset( $_SESSION['INDEX'] ); +if (isset( $_SESSION['STEP_POSITION'] )) + unset( $_SESSION['STEP_POSITION'] ); + + /* Process */ +try { + $oCase = new Cases(); + $aData = $oCase->startCase( $_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED'] ); + $_SESSION['APPLICATION'] = $aData['APPLICATION']; + $_SESSION['INDEX'] = $aData['INDEX']; + $_SESSION['PROCESS'] = $aData['PROCESS']; + $_SESSION['TASK'] = $_POST['form']['TAS_UID']; + $_SESSION['STEP_POSITION'] = 0; + + $_SESSION['CASES_REFRESH'] = true; + + $oCase = new Cases(); + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; + + G::header( 'location: ' . $aNextStep['PAGE'] ); +} catch (Exception $e) { + $_SESSION['G_MESSAGE'] = $e->getMessage(); + $_SESSION['G_MESSAGE_TYPE'] = 'error'; + G::header( 'location: cases_New' ); +} + diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index d8a7315dd..e09482d7d 100755 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -12,337 +12,309 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ //validate the data post + try { - if ($_GET['APP_UID'] !== $_SESSION ['APPLICATION']) { - throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', array('{1}', G::LoadTranslation('ID_REOPEN')))); - } + if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { + throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('{1}',G::LoadTranslation( 'ID_REOPEN' ) + ) ) ); + } - $oForm = new Form($_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM); - $oForm->validatePost(); + $oForm = new Form( $_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM ); + $oForm->validatePost(); - //Includes - G::LoadClass("case"); + //Includes + G::LoadClass( "case" ); - //Load the variables - $oCase = new Cases(); - $oCase->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "cases_List"); - $Fields = $oCase->loadCase($_SESSION["APPLICATION"]); + //Load the variables + $oCase = new Cases(); + $oCase->thisIsTheCurrentUser( $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "cases_List" ); + $Fields = $oCase->loadCase( $_SESSION["APPLICATION"] ); - $Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], G::getSystemConstants()); - $Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], $_POST["form"]); + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], G::getSystemConstants() ); + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] ); - #here we must verify if is a debug session - $trigger_debug_session = $_SESSION ['TRIGGER_DEBUG'] ['ISSET']; #here we must verify if is a debugg session + #here we must verify if is a debug session + $trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session + #trigger debug routines... - #trigger debug routines... + //cleaning debug variables + $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); + $_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); + $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER' ); - //cleaning debug variables - $_SESSION ['TRIGGER_DEBUG'] ['ERRORS'] = Array (); - $_SESSION ['TRIGGER_DEBUG'] ['DATA'] = Array (); - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = Array (); - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = Array (); + $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; + if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; + } - $triggers = $oCase->loadTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER' ); + if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + //Execute after triggers - Start + $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); + //Execute after triggers - End + } - $_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] = count ( $triggers ); - $_SESSION ['TRIGGER_DEBUG'] ['TIME'] = 'AFTER'; - if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) { - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = $oCase->getTriggerNames ( $triggers ); - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = $triggers; - } - - if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) { - //Execute after triggers - Start - $Fields ['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER', $Fields ['APP_DATA'] ); - //Execute after triggers - End - } - - //save data in PM Tables if necessary - $newValues = array (); - foreach ( $_POST ['form'] as $sField => $sAux ) { - if (isset ( $oForm->fields [$sField]->pmconnection ) && isset ( $oForm->fields [$sField]->pmfield )) { - if (($oForm->fields [$sField]->pmconnection != '') && ($oForm->fields [$sField]->pmfield != '')) { - if (isset ( $oForm->fields [$oForm->fields [$sField]->pmconnection] )) { - require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php'; - $oAdditionalTables = new AdditionalTables ( ); - try { - $aData = $oAdditionalTables->load ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, true ); - } catch ( Exception $oError ) { - $aData = array ('FIELDS' => array () ); - } - $aKeys = array (); - $aAux = explode ( '|', $oForm->fields [$oForm->fields [$sField]->pmconnection]->keys ); - $i = 0; - $aValues = array (); - foreach ( $aData ['FIELDS'] as $aField ) { - if ($aField ['FLD_KEY'] == '1') { - $aKeys [$aField ['FLD_NAME']] = (isset ( $aAux [$i] ) ? G::replaceDataField ( $aAux [$i], $Fields ['APP_DATA'] ) : ''); - $i ++; - } - if ($aField ['FLD_NAME'] == $oForm->fields [$sField]->pmfield) { - $aValues [$aField ['FLD_NAME']] = $Fields ['APP_DATA'] [$sField]; - } else { - $aValues [$aField ['FLD_NAME']] = ''; - } - } - try { - $aRow = $oAdditionalTables->getDataTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aKeys ); - } catch ( Exception $oError ) { - $aRow = false; - } - if ($aRow) { - foreach ( $aValues as $sKey => $sValue ) { - if ($sKey != $oForm->fields [$sField]->pmfield) { - $aValues [$sKey] = $aRow [$sKey]; - } - } - try { - $oAdditionalTables->updateDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues ); - } catch ( Exception $oError ) { - //Nothing - } - } - else { - try { - // assembling the field list in order to save the data ina new record of a pm table - if (empty($newValues)){ - $newValues = $aValues; - } - else { - foreach ($aValues as $aValueKey=>$aValueCont) { - if (trim($newValues[$aValueKey])==''){ - $newValues[$aValueKey] = $aValueCont; - } + //save data in PM Tables if necessary + $newValues = array (); + foreach ($_POST['form'] as $sField => $sAux) { + if (isset( $oForm->fields[$sField]->pmconnection ) && isset( $oForm->fields[$sField]->pmfield )) { + if (($oForm->fields[$sField]->pmconnection != '') && ($oForm->fields[$sField]->pmfield != '')) { + if (isset( $oForm->fields[$oForm->fields[$sField]->pmconnection] )) { + require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php'; + $oAdditionalTables = new AdditionalTables(); + try { + $aData = $oAdditionalTables->load( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, true ); + } catch (Exception $oError) { + $aData = array ('FIELDS' => array () + ); + } + $aKeys = array (); + $aAux = explode( '|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys ); + $i = 0; + $aValues = array (); + foreach ($aData['FIELDS'] as $aField) { + if ($aField['FLD_KEY'] == '1') { + $aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : ''); + $i ++; + } + if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) { + $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField]; + } else { + $aValues[$aField['FLD_NAME']] = ''; + } + } + try { + $aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys ); + } catch (Exception $oError) { + $aRow = false; + } + if ($aRow) { + foreach ($aValues as $sKey => $sValue) { + if ($sKey != $oForm->fields[$sField]->pmfield) { + $aValues[$sKey] = $aRow[$sKey]; + } + } + try { + $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aValues ); + } catch (Exception $oError) { + //Nothing + } + } else { + try { + // assembling the field list in order to save the data ina new record of a pm table + if (empty( $newValues )) { + $newValues = $aValues; + } else { + foreach ($aValues as $aValueKey => $aValueCont) { + if (trim( $newValues[$aValueKey] ) == '') { + $newValues[$aValueKey] = $aValueCont; + } + } + } + //$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues ); + } catch (Exception $oError) { + //Nothing + } + } } - } - //$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues ); - } catch ( Exception $oError ) { - //Nothing } - } } - } } - } - //save data - $aData = array (); - $aData ['APP_NUMBER'] = $Fields ['APP_NUMBER']; - $aData ['APP_PROC_STATUS'] = $Fields ['APP_PROC_STATUS']; - $aData ['APP_DATA'] = $Fields ['APP_DATA']; - $aData ['DEL_INDEX'] = $_SESSION ['INDEX']; - $aData ['TAS_UID'] = $_SESSION ['TASK']; - $aData ['CURRENT_DYNAFORM'] = $_GET ['UID']; - $aData ['USER_UID'] = $_SESSION ['USER_LOGGED']; - $aData ['APP_STATUS'] = $Fields ['APP_STATUS']; - $aData ['PRO_UID'] = $_SESSION ['PROCESS']; + //save data + $aData = array (); + $aData['APP_NUMBER'] = $Fields['APP_NUMBER']; + $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; + $aData['APP_DATA'] = $Fields['APP_DATA']; + $aData['DEL_INDEX'] = $_SESSION['INDEX']; + $aData['TAS_UID'] = $_SESSION['TASK']; + $aData['CURRENT_DYNAFORM'] = $_GET['UID']; + $aData['USER_UID'] = $_SESSION['USER_LOGGED']; + $aData['APP_STATUS'] = $Fields['APP_STATUS']; + $aData['PRO_UID'] = $_SESSION['PROCESS']; - $oCase->updateCase ( $_SESSION ['APPLICATION'], $aData ); + $oCase->updateCase( $_SESSION['APPLICATION'], $aData ); - // saving the data ina pm table in case that is a new record - if (!empty($newValues)) { - $id = key($newValues); - if (! $oAdditionalTables->updateDataInTable( $oForm->fields [$oForm->fields[$id]->pmconnection]->pmtable, $newValues) ) {//<--This is to know if it is a new registry on the PM Table - $oAdditionalTables->saveDataInTable( $oForm->fields [$oForm->fields[$id]->pmconnection]->pmtable, $newValues); + // saving the data ina pm table in case that is a new record + if (! empty( $newValues )) { + $id = key( $newValues ); + if (! $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues )) { //<--This is to know if it is a new registry on the PM Table + $oAdditionalTables->saveDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues ); + } } - } - //Save files - require_once ("classes/model/AppDocument.php"); + //Save files + require_once ("classes/model/AppDocument.php"); - if (isset($_FILES["form"]["name"]) && count($_FILES["form"]["name"]) > 0) { - $arrayField = array(); - $arrayFileName = array(); - $arrayFileTmpName = array(); - $arrayFileError = array(); - $i = 0; + if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { + $arrayField = array (); + $arrayFileName = array (); + $arrayFileTmpName = array (); + $arrayFileError = array (); + $i = 0; - foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) { - if (is_array($fieldValue)) { - foreach ($fieldValue as $index => $value) { - if (is_array($value)) { - foreach ($value as $grdFieldIndex => $grdFieldValue) { - $arrayField[$i]["grdName"] = $fieldIndex; - $arrayField[$i]["grdFieldName"] = $grdFieldIndex; - $arrayField[$i]["index"] = $index; + foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) { + if (is_array( $fieldValue )) { + foreach ($fieldValue as $index => $value) { + if (is_array( $value )) { + foreach ($value as $grdFieldIndex => $grdFieldValue) { + $arrayField[$i]["grdName"] = $fieldIndex; + $arrayField[$i]["grdFieldName"] = $grdFieldIndex; + $arrayField[$i]["index"] = $index; - $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex]; - $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex]; - $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex]; - $i = $i + 1; - } - } - } - } else { - $arrayField[$i] = $fieldIndex; + $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex]; + $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex]; + $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex]; + $i = $i + 1; + } + } + } + } else { + $arrayField[$i] = $fieldIndex; - $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex]; - $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex]; - $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex]; - $i = $i + 1; - } - } + $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex]; + $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex]; + $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex]; + $i = $i + 1; + } + } - if (count($arrayField) > 0) { - for ($i = 0; $i <= count($arrayField) - 1; $i++) { - if ($arrayFileError[$i] == 0) { - $indocUid = null; - $fieldName = null; + if (count( $arrayField ) > 0) { + for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) { + if ($arrayFileError[$i] == 0) { + $indocUid = null; + $fieldName = null; - if (is_array($arrayField[$i])) { - if (isset($_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]) && - !empty($_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]) - ) { - $indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]; - } + if (is_array( $arrayField[$i] )) { + if (isset( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] )) { + $indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]; + } - $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"]; - } else { - if (isset($_POST["INPUTS"][$arrayField[$i]]) && - !empty($_POST["INPUTS"][$arrayField[$i]]) - ) { - $indocUid = $_POST["INPUTS"][$arrayField[$i]]; - } + $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"]; + } else { + if (isset( $_POST["INPUTS"][$arrayField[$i]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]] )) { + $indocUid = $_POST["INPUTS"][$arrayField[$i]]; + } - $fieldName = $arrayField[$i]; - } + $fieldName = $arrayField[$i]; + } - if ($indocUid != null) { - require_once ("classes/model/AppFolder.php"); - require_once ("classes/model/InputDocument.php"); + if ($indocUid != null) { + require_once ("classes/model/AppFolder.php"); + require_once ("classes/model/InputDocument.php"); - $oInputDocument = new InputDocument(); - $aID = $oInputDocument->load($indocUid); + $oInputDocument = new InputDocument(); + $aID = $oInputDocument->load( $indocUid ); - //Get the Custom Folder ID (create if necessary) - $oFolder = new AppFolder(); + //Get the Custom Folder ID (create if necessary) + $oFolder = new AppFolder(); - $aFields = array ( - "APP_UID" => $_SESSION["APPLICATION"], - "DEL_INDEX" => $_SESSION["INDEX"], - "USR_UID" => $_SESSION["USER_LOGGED"], - "DOC_UID" => $indocUid, - "APP_DOC_TYPE" => "INPUT", - "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), - "APP_DOC_COMMENT" => "", - "APP_DOC_TITLE" => "", - "APP_DOC_FILENAME" => $arrayFileName[$i], - "FOLDER_UID" => $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"]), - "APP_DOC_TAGS" => $oFolder->parseTags($aID["INP_DOC_TAGS"]), - "APP_DOC_FIELDNAME" => $fieldName - ); - } else { - $aFields = array ( - "APP_UID" => $_SESSION["APPLICATION"], - "DEL_INDEX" => $_SESSION["INDEX"], - "USR_UID" => $_SESSION["USER_LOGGED"], - "DOC_UID" => -1, - "APP_DOC_TYPE" => "ATTACHED", - "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), - "APP_DOC_COMMENT" => "", - "APP_DOC_TITLE" => "", - "APP_DOC_FILENAME" => $arrayFileName[$i], - "APP_DOC_FIELDNAME" => $fieldName - ); - } + $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName + ); + } else { + $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName + ); + } - $oAppDocument = new AppDocument(); - $oAppDocument->create($aFields); + $oAppDocument = new AppDocument(); + $oAppDocument->create( $aFields ); - $iDocVersion = $oAppDocument->getDocVersion(); - $sAppDocUid = $oAppDocument->getAppDocUid(); - $aInfo = pathinfo($oAppDocument->getAppDocFilename()); - $sExtension = ((isset($aInfo["extension"]))? $aInfo["extension"] : ""); - $sPathName = PATH_DOCUMENT . $_SESSION ["APPLICATION"] . PATH_SEP; - $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension; + $iDocVersion = $oAppDocument->getDocVersion(); + $sAppDocUid = $oAppDocument->getAppDocUid(); + $aInfo = pathinfo( $oAppDocument->getAppDocFilename() ); + $sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : ""); + $sPathName = PATH_DOCUMENT . $_SESSION["APPLICATION"] . PATH_SEP; + $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension; - G::uploadFile($arrayFileTmpName[$i], $sPathName, $sFileName); + G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName ); - //Plugin Hook PM_UPLOAD_DOCUMENT for upload document - $oPluginRegistry = &PMPluginRegistry::getSingleton(); + //Plugin Hook PM_UPLOAD_DOCUMENT for upload document + $oPluginRegistry = &PMPluginRegistry::getSingleton(); - if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) { - $triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT); - $documentData = new uploadDocumentData($_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion); - $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData); + if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) { + $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); + $documentData = new uploadDocumentData( $_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion ); + $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); - if ($uploadReturn) { - $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace; + if ($uploadReturn) { + $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace; - if (!isset($aFields["APP_DOC_UID"])) { - $aFields["APP_DOC_UID"] = $sAppDocUid; - } + if (! isset( $aFields["APP_DOC_UID"] )) { + $aFields["APP_DOC_UID"] = $sAppDocUid; + } - if (!isset($aFields["DOC_VERSION"])) { - $aFields["DOC_VERSION"] = $iDocVersion; - } + if (! isset( $aFields["DOC_VERSION"] )) { + $aFields["DOC_VERSION"] = $iDocVersion; + } - $oAppDocument->update($aFields); + $oAppDocument->update( $aFields ); - unlink($sPathName . $sFileName); - } - } - } - } - } - } + unlink( $sPathName . $sFileName ); + } + } + } + } + } + } - //Go to the next step - $aNextStep = $oCase->getNextStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] ); - if (isset ( $_GET ['_REFRESH_'] )) { - G::header ( 'location: ' . $_SERVER ['HTTP_REFERER'] ); - die (); - } + //Go to the next step + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + if (isset( $_GET['_REFRESH_'] )) { + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); + } - $_SESSION ['STEP_POSITION'] = $aNextStep ['POSITION']; - $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep ['PAGE']; - $debuggerAvailable = true; + $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; + $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep['PAGE']; + $debuggerAvailable = true; - if (isset($_SESSION['current_ux']) && $_SESSION['current_ux'] == 'SIMPLIFIED') { - $debuggerAvailable = false; - } + if (isset( $_SESSION['current_ux'] ) && $_SESSION['current_ux'] == 'SIMPLIFIED') { + $debuggerAvailable = false; + } - if ($trigger_debug_session && $debuggerAvailable) { - $_SESSION ['TRIGGER_DEBUG'] ['BREAKPAGE'] = $aNextStep ['PAGE']; - $aNextStep ['PAGE'] = $aNextStep ['PAGE'] . '&breakpoint=triggerdebug'; - } + if ($trigger_debug_session && $debuggerAvailable) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug'; + } - $oForm->validatePost (); - $oJSON = new Services_JSON ( ); - $_POST ['__notValidateThisFields__'] = (isset($_POST ['__notValidateThisFields__']) && $_POST ['__notValidateThisFields__']!='')?$_POST ['__notValidateThisFields__']:$_POST ['DynaformRequiredFields']; - if ($missing_req_values = $oForm->validateRequiredFields ( $_POST ['form'], $oJSON->decode ( stripslashes ( $_POST ['__notValidateThisFields__'] ) ) )) { - $_POST ['next_step'] = $aNextStep; - $_POST ['previous_step'] = $oCase->getPreviousStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] ); - $_POST ['req_val'] = $missing_req_values; - $G_PUBLISH = new Publisher ( ); - $G_PUBLISH->AddContent ( 'view', 'cases/missRequiredFields' ); - G::RenderPage ( 'publish', 'blank' ); - exit ( 0 ); - } + $oForm->validatePost(); + $oJSON = new Services_JSON(); + $_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields']; + if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], $oJSON->decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) { + $_POST['next_step'] = $aNextStep; + $_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + $_POST['req_val'] = $missing_req_values; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' ); + G::RenderPage( 'publish', 'blank' ); + exit( 0 ); + } - G::header ( 'location: ' . $aNextStep ['PAGE'] ); + G::header( 'location: ' . $aNextStep['PAGE'] ); +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage = array (); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); + die(); } -catch (Exception $e) { - $G_PUBLISH = new Publisher; - $aMessage = array(); - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - die; -} \ No newline at end of file + diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php index 9a759b179..0ee4d00eb 100755 --- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php +++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php @@ -1,57 +1,55 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - //validate the data post - $oForm = new Form($_SESSION['PROCESS']. '/' . $_GET['UID'], PATH_DYNAFORM); - $oForm->validatePost(); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//validate the data post +$oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM ); +$oForm->validatePost(); + +/* Includes */ +G::LoadClass( 'case' ); + +//load the variables +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); +$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] ); + +//save data +$aData = array (); +$aData['APP_NUMBER'] = $Fields['APP_NUMBER']; +$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; +$aData['APP_DATA'] = $Fields['APP_DATA']; +$aData['DEL_INDEX'] = $_SESSION['INDEX']; +$aData['TAS_UID'] = $_SESSION['TASK']; +$aData['CURRENT_DYNAFORM'] = $_GET['UID']; +$aData['PRO_UID'] = $Fields['PRO_UID']; +$aData['USER_UID'] = $_SESSION['USER_LOGGED']; +$aData['APP_STATUS'] = $Fields['APP_STATUS']; + +//$aData = $oCase->loadCase( $_SESSION['APPLICATION'] ); +$oCase->updateCase( $_SESSION['APPLICATION'], $aData ); + +//go to the next step +$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] ); +$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; +G::header( 'location: cases_StepToRevise?DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] ); - /* Includes */ - G::LoadClass('case'); - - //load the variables - $oCase = new Cases(); - $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); - $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form']); - - //save data - $aData = array(); - $aData['APP_NUMBER'] = $Fields['APP_NUMBER']; - $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; - $aData['APP_DATA'] = $Fields['APP_DATA']; - $aData['DEL_INDEX'] = $_SESSION['INDEX']; - $aData['TAS_UID'] = $_SESSION['TASK']; - $aData['CURRENT_DYNAFORM'] = $_GET['UID']; - $aData['PRO_UID'] = $Fields['PRO_UID']; - $aData['USER_UID'] = $_SESSION['USER_LOGGED']; - $aData['APP_STATUS'] = $Fields['APP_STATUS']; - - //$aData = $oCase->loadCase( $_SESSION['APPLICATION'] ); - $oCase->updateCase( $_SESSION['APPLICATION'], $aData ); - - //go to the next step - $aNextStep = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION']); - $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; - G::header('location: cases_StepToRevise?DYN_UID='.$aNextStep['UID'].'&APP_UID='.$_SESSION['APPLICATION'].'&DEL_INDEX='.$_SESSION['INDEX']); - - \ No newline at end of file diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php index 26024ec7b..8a4f43c9e 100755 --- a/workflow/engine/methods/cases/cases_SaveDocument.php +++ b/workflow/engine/methods/cases/cases_SaveDocument.php @@ -1,297 +1,251 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - //try { - - //First review if there is no error with the uploaded document - if ((isset($_FILES['form']))&&($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) { - $code=$_FILES['form']['error']['APP_DOC_FILENAME']; - switch ($code) { - case UPLOAD_ERR_INI_SIZE: - $message = G::LoadTranslation('ID_UPLOAD_ERR_INI_SIZE'); - break; - case UPLOAD_ERR_FORM_SIZE: - $message = G::LoadTranslation('ID_UPLOAD_ERR_FORM_SIZE'); - break; - case UPLOAD_ERR_PARTIAL: - $message = G::LoadTranslation('ID_UPLOAD_ERR_PARTIAL'); - break; - case UPLOAD_ERR_NO_FILE: - $message = G::LoadTranslation('ID_UPLOAD_ERR_NO_FILE'); - break; - case UPLOAD_ERR_NO_TMP_DIR: - $message = G::LoadTranslation('ID_UPLOAD_ERR_NO_TMP_DIR'); - break; - case UPLOAD_ERR_CANT_WRITE: - $message = G::LoadTranslation('ID_UPLOAD_ERR_CANT_WRITE'); - break; - case UPLOAD_ERR_EXTENSION: - $message = G::LoadTranslation('ID_UPLOAD_ERR_EXTENSION'); - break; - - default: - $message = G::LoadTranslation('ID_UPLOAD_ERR_UNKNOWN'); - break; - } - G::SendMessageText($message, "ERROR"); - $backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']); - G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]); - die; - } - - - $docUid=$_POST['form']['DOC_UID']; - $appDocUid=$_POST['form']['APP_DOC_UID']; - $docVersion=$_POST['form']['docVersion']; - $actionType=$_POST['form']['actionType']; - - - //load the variables - G::LoadClass('case'); - $oCase = new Cases(); - $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); - $Fields = $oCase->loadCase($_SESSION['APPLICATION']); - $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); - - #trigger debug routines... - - //cleaning debug variables - $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array(); - $_SESSION['TRIGGER_DEBUG']['DATA'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array(); - - $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER'); - - $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count($triggers); - $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; - if($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0){ - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; - } - - if( $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0 ) { - //Execute after triggers - Start - $Fields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//try { + + +//First review if there is no error with the uploaded document +if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) { + $code = $_FILES['form']['error']['APP_DOC_FILENAME']; + switch ($code) { + case UPLOAD_ERR_INI_SIZE: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' ); + break; + case UPLOAD_ERR_FORM_SIZE: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' ); + break; + case UPLOAD_ERR_PARTIAL: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' ); + break; + case UPLOAD_ERR_NO_FILE: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' ); + break; + case UPLOAD_ERR_NO_TMP_DIR: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' ); + break; + case UPLOAD_ERR_CANT_WRITE: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' ); + break; + case UPLOAD_ERR_EXTENSION: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' ); + break; + + default: + $message = G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' ); + break; + } + G::SendMessageText( $message, "ERROR" ); + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); +} + +$docUid = $_POST['form']['DOC_UID']; +$appDocUid = $_POST['form']['APP_DOC_UID']; +$docVersion = $_POST['form']['docVersion']; +$actionType = $_POST['form']['actionType']; + +//load the variables +G::LoadClass( 'case' ); +$oCase = new Cases(); +$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' ); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); +$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); + +#trigger debug routines... + + +//cleaning debug variables +$_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); +$_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); +$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); +$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); + +$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER' ); + +$_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); +$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; +if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; +} + +if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + //Execute after triggers - Start + $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); //Execute after triggers - End - } - - - //save data - $aData = array(); - $aData['APP_NUMBER'] = $Fields['APP_NUMBER']; - $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; - $aData['APP_DATA'] = $Fields['APP_DATA']; - $aData['DEL_INDEX'] = $_SESSION['INDEX']; - $aData['TAS_UID'] = $_SESSION['TASK']; - //$aData = $oCase->loadCase($_SESSION['APPLICATION']); - $oCase->updateCase( $_SESSION['APPLICATION'], $aData ); - - //save info - - require_once ( "classes/model/AppDocument.php" ); - require_once ('classes/model/AppFolder.php'); - require_once ('classes/model/InputDocument.php'); - - $oInputDocument = new InputDocument(); - $aID = $oInputDocument->load($_GET['UID']); - - - $oAppDocument = new AppDocument(); - - - //Get the Custom Folder ID (create if necessary) - $oFolder=new AppFolder(); - $folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH']); - - //Tags - $fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS']); - - switch($actionType){ - case "R": //replace - $aFields = array('APP_DOC_UID' => $appDocUid, - 'APP_UID' => $_SESSION['APPLICATION'], - 'DOC_VERSION' => $docVersion, - 'DEL_INDEX' => $_SESSION['INDEX'], - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - - - $oAppDocument->update($aFields); - break; - case "NV": //New Version - - - $aFields = array('APP_DOC_UID' => $appDocUid, - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - - $oAppDocument->create($aFields); - break; - default: //New - $aFields = array( - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - - - $oAppDocument->create($aFields); - break; - } - - - $sAppDocUid = $oAppDocument->getAppDocUid(); - $iDocVersion = $oAppDocument->getDocVersion(); - $info = pathinfo( $oAppDocument->getAppDocFilename() ); - $ext = (isset($info['extension']) ? $info['extension'] : ''); - - //save the file - if (!empty($_FILES['form'])) { - if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { - $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP; - $sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext; - G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); - +} + +//save data +$aData = array (); +$aData['APP_NUMBER'] = $Fields['APP_NUMBER']; +$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; +$aData['APP_DATA'] = $Fields['APP_DATA']; +$aData['DEL_INDEX'] = $_SESSION['INDEX']; +$aData['TAS_UID'] = $_SESSION['TASK']; +//$aData = $oCase->loadCase($_SESSION['APPLICATION']); +$oCase->updateCase( $_SESSION['APPLICATION'], $aData ); + +//save info + + +require_once ("classes/model/AppDocument.php"); +require_once ('classes/model/AppFolder.php'); +require_once ('classes/model/InputDocument.php'); + +$oInputDocument = new InputDocument(); +$aID = $oInputDocument->load( $_GET['UID'] ); + +$oAppDocument = new AppDocument(); + +//Get the Custom Folder ID (create if necessary) +$oFolder = new AppFolder(); +$folderId = $oFolder->createFromPath( $aID['INP_DOC_DESTINATION_PATH'] ); + +//Tags +$fileTags = $oFolder->parseTags( $aID['INP_DOC_TAGS'] ); + +switch ($actionType) { + case "R": //replace + $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DOC_VERSION' => $docVersion,'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags + ); + + $oAppDocument->update( $aFields ); + break; + case "NV": //New Version + + + $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags + ); + + $oAppDocument->create( $aFields ); + break; + default: //New + $aFields = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags + ); + + $oAppDocument->create( $aFields ); + break; +} + +$sAppDocUid = $oAppDocument->getAppDocUid(); +$iDocVersion = $oAppDocument->getDocVersion(); +$info = pathinfo( $oAppDocument->getAppDocFilename() ); +$ext = (isset( $info['extension'] ) ? $info['extension'] : ''); + +//save the file +if (! empty( $_FILES['form'] )) { + if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { + $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP; + $sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext; + G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); + //Plugin Hook PM_UPLOAD_DOCUMENT for upload document - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) { - $triggerDetail=$oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); - $oData['APP_UID'] = $_SESSION['APPLICATION']; - $documentData = new uploadDocumentData ( - $_SESSION['APPLICATION'], - $_SESSION['USER_LOGGED'], - $sPathName . $sFileName, - $aFields['APP_DOC_FILENAME'], - $sAppDocUid, - $iDocVersion - ); - - $uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - if($uploadReturn){ - $aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace; - if(!isset($aFields['APP_DOC_UID'])){ - $aFields['APP_DOC_UID']=$sAppDocUid; - } - if(!isset($aFields['DOC_VERSION'])){ - $aFields['DOC_VERSION']=$iDocVersion; - } - //$oAppDocument1 = new AppDocument(); - //G::pr($aFields);die; - $oAppDocument->update($aFields); - unlink ( $sPathName . $sFileName ); - } - } - //end plugin - } - } - - //go to the next step - //if (!isset($_POST['form']['MORE'])) { - if (false) { - $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); - $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; - - if($_SESSION['TRIGGER_DEBUG']['ISSET']){ - $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; - G::header('location: ' . $aNextStep['PAGE'].'&breakpoint=triggerdebug'); - die; - } - - G::header('location: ' . $aNextStep['PAGE']); - die; - } - else { - if (isset($_SERVER['HTTP_REFERER'])) { - if ($_SERVER['HTTP_REFERER'] != '') { - - if($_SESSION['TRIGGER_DEBUG']['ISSET']){ - $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $_SERVER['HTTP_REFERER']; - G::header('location: ' . $_SERVER['HTTP_REFERER'].'&breakpoint=triggerdebug'); - die; - } - - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; - } - else { - $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1); - $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; - - if($_SESSION['TRIGGER_DEBUG']['ISSET']){ - $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; - G::header('location: ' . $aNextStep['PAGE'].'&breakpoint=triggerdebug'); - die; - } - - G::header('location: ' . $aNextStep['PAGE']); - die; - } - } - else { - $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1); - $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; - - if($_SESSION['TRIGGER_DEBUG']['ISSET']){ - $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; - G::header('location: ' . $aNextStep['PAGE'].'&breakpoint=triggerdebug'); - die; - } - - G::header('location: ' . $aNextStep['PAGE']); - die; - } - } - $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) { + $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); + $oData['APP_UID'] = $_SESSION['APPLICATION']; + $documentData = new uploadDocumentData( $_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid, $iDocVersion ); + + $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); + if ($uploadReturn) { + $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace; + if (! isset( $aFields['APP_DOC_UID'] )) { + $aFields['APP_DOC_UID'] = $sAppDocUid; + } + if (! isset( $aFields['DOC_VERSION'] )) { + $aFields['DOC_VERSION'] = $iDocVersion; + } + //$oAppDocument1 = new AppDocument(); + //G::pr($aFields);die; + $oAppDocument->update( $aFields ); + unlink( $sPathName . $sFileName ); + } + } + //end plugin + } +} + +//go to the next step +//if (!isset($_POST['form']['MORE'])) { +if (false) { + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; + + if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); + die(); + } + + G::header( 'location: ' . $aNextStep['PAGE'] ); + die(); +} else { + if (isset( $_SERVER['HTTP_REFERER'] )) { + if ($_SERVER['HTTP_REFERER'] != '') { + + if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $_SERVER['HTTP_REFERER']; + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] . '&breakpoint=triggerdebug' ); + die(); + } + + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); + } else { + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 ); + $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; + + if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); + die(); + } + + G::header( 'location: ' . $aNextStep['PAGE'] ); + die(); + } + } else { + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 ); + $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; + + if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); + die(); + } + + G::header( 'location: ' . $aNextStep['PAGE'] ); + die(); + } +} +$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; /* } catch ( Exception $e ) { - + $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher; $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage( 'publish' ); - }*/ \ No newline at end of file + }*/ + diff --git a/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php b/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php index 015504f20..2fdefdadf 100755 --- a/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php +++ b/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php @@ -1,71 +1,77 @@ -getCaseSchedulerPlugins(); -$selectedPlugin=""; -if((isset($_REQUEST['plg_uid']))&&($_REQUEST['plg_uid']!="")) $selectedPlugin=$_REQUEST['plg_uid']; -if(!empty($activePluginsForCaseScheduler)){ - echo ''; - //G::pr($activePlugnsForCaseScheduler); -} -} -function pluginCaseSchedulerForm(){ - if(!isset($_REQUEST ['selectedOption'])) die; - $G_PUBLISH = new Publisher; - $params=explode("--",$_REQUEST ['selectedOption']); - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $activePluginsForCaseScheduler=$oPluginRegistry->getCaseSchedulerPlugins(); - - foreach($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail){ - if(($caseSchedulerPluginDetail->sNamespace==$params[0])&&($caseSchedulerPluginDetail->sActionId==$params[1])){ - $caseSchedulerSelected=$caseSchedulerPluginDetail; - } - } - if((isset($caseSchedulerSelected))&&(is_object($caseSchedulerSelected))){ - //Render the form - if((isset($_REQUEST['sch_uid']))&&($_REQUEST['sch_uid']!="")){ - //$oData=$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionGetFields, array("SCH_UID"=>$_REQUEST['sch_uid']) ); - $oData=array("SCH_UID"=>$_REQUEST['sch_uid'],"PRO_UID"=>$_REQUEST['pro_uid']); - }else{ - $oData=array("PRO_UID"=>$_REQUEST['pro_uid']); - } - - $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData ); - } - -} -?> \ No newline at end of file +$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array (); +$functionName( $functionParams ); + +function searchSavedJob ($schUid) +{ + +} + +function pluginsList () +{ + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); + $selectedPlugin = ""; + if ((isset( $_REQUEST['plg_uid'] )) && ($_REQUEST['plg_uid'] != "")) + $selectedPlugin = $_REQUEST['plg_uid']; + if (! empty( $activePluginsForCaseScheduler )) { + echo ''; + //G::pr($activePlugnsForCaseScheduler); + } +} + +function pluginCaseSchedulerForm () +{ + if (! isset( $_REQUEST['selectedOption'] )) + die(); + $G_PUBLISH = new Publisher(); + $params = explode( "--", $_REQUEST['selectedOption'] ); + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); + + foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { + if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { + $caseSchedulerSelected = $caseSchedulerPluginDetail; + } + } + if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { + //Render the form + if ((isset( $_REQUEST['sch_uid'] )) && ($_REQUEST['sch_uid'] != "")) { + //$oData=$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionGetFields, array("SCH_UID"=>$_REQUEST['sch_uid']) ); + $oData = array ("SCH_UID" => $_REQUEST['sch_uid'],"PRO_UID" => $_REQUEST['pro_uid'] + ); + } else { + $oData = array ("PRO_UID" => $_REQUEST['pro_uid'] + ); + } + $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData ); + } +} + diff --git a/workflow/engine/methods/cases/cases_SchedulerGetProcesses.php b/workflow/engine/methods/cases/cases_SchedulerGetProcesses.php index 41841a8f2..e83de4f19 100755 --- a/workflow/engine/methods/cases/cases_SchedulerGetProcesses.php +++ b/workflow/engine/methods/cases/cases_SchedulerGetProcesses.php @@ -1,38 +1,33 @@ - -'; - -require_once ("classes/model/TaskPeer.php"); -require_once ("classes/model/ProcessPeer.php"); -require_once ("classes/model/TaskUserPeer.php"); -G::LoadClass ( 'Content' ); - - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(ProcessPeer::PRO_UID); - $oCriteria->setDistinct(); - $oCriteria->addSelectColumn(ContentPeer::CON_VALUE); - $oCriteria->addJoin(ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN); - $oCriteria->addJoin(ProcessPeer::PRO_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN); - $oCriteria->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); - $oCriteria->add(TaskUserPeer::USR_UID, $oUserId); - $oCriteria->add(TaskPeer::TAS_START, 'true'); - $oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); - $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG); - $oCriteria->addAnd(ProcessPeer::PRO_UID, $process); - - $resultSet = TaskUserPeer::doSelectRS($oCriteria); - while ($resultSet->next()){ - $row = $resultSet->getRow(); - - echo $row[1]; - echo ""; +require_once ("classes/model/TaskPeer.php"); +require_once ("classes/model/ProcessPeer.php"); +require_once ("classes/model/TaskUserPeer.php"); +G::LoadClass( 'Content' ); + +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->addSelectColumn( ProcessPeer::PRO_UID ); +$oCriteria->setDistinct(); +$oCriteria->addSelectColumn( ContentPeer::CON_VALUE ); +$oCriteria->addJoin( ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN ); +$oCriteria->addJoin( ProcessPeer::PRO_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN ); +$oCriteria->addJoin( TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN ); +$oCriteria->add( TaskUserPeer::USR_UID, $oUserId ); +$oCriteria->add( TaskPeer::TAS_START, 'true' ); +$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); +$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG ); +$oCriteria->addAnd( ProcessPeer::PRO_UID, $process ); + +$resultSet = TaskUserPeer::doSelectRS( $oCriteria ); +while ($resultSet->next()) { + $row = $resultSet->getRow(); + + echo $row[1]; + echo ""; //var_dump($row); - } - -//echo ""; -?> - - +} +//echo ""; + diff --git a/workflow/engine/methods/cases/cases_SchedulerGetTasks.php b/workflow/engine/methods/cases/cases_SchedulerGetTasks.php index 43f43717b..135aa6139 100755 --- a/workflow/engine/methods/cases/cases_SchedulerGetTasks.php +++ b/workflow/engine/methods/cases/cases_SchedulerGetTasks.php @@ -1,25 +1,23 @@ - \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php index 146c805f9..322710d6c 100755 --- a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php +++ b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php @@ -1,71 +1,70 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - -/** - * process_SchedulerValidate_User - * validates if the username and password are valid data and if the user assigned - * to the process and task has the rights and persmissions required to create a cron task - */ - - -$sWS_USER = trim($_REQUEST['USERNAME']); -$sWS_PASS = trim($_REQUEST['PASSWORD']); - -if (G::is_https ()) - $http = 'https://'; - else - $http = 'http://'; - -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; -@$client = new SoapClient ( $endpoint ); - -$user = $sWS_USER; -$pass = $sWS_PASS; - -$params = array('userid' => $user, 'password' => $pass); -$result = $client->__SoapCall('login', array($params)); - -if ($result->status_code == 0) { - if (!class_exists('Users')) { - require ("classes/model/UsersPeer.php"); - } - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn('USR_UID'); - $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); - $resultSet = UsersPeer::doSelectRS($oCriteria); - $resultSet->next(); - $user_id = $resultSet->getRow(); - $result->message = $user_id[0]; - - G::LoadClass('case'); - $caseInstance = new Cases(); - if (!$caseInstance->canStartCase($result->message, $_REQUEST['PRO_UID'])) { - $result->status_code = -1000; - $result->message = G::LoadTranslation('ID_USER_CASES_NOT_START'); - } -} - -die(G::json_encode($result)); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/** + * process_SchedulerValidate_User + * validates if the username and password are valid data and if the user assigned + * to the process and task has the rights and persmissions required to create a cron task + */ + +$sWS_USER = trim( $_REQUEST['USERNAME'] ); +$sWS_PASS = trim( $_REQUEST['PASSWORD'] ); + +if (G::is_https()) { + $http = 'https://'; +} else { + $http = 'http://'; +} + +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +@$client = new SoapClient( $endpoint ); + +$user = $sWS_USER; +$pass = $sWS_PASS; + +$params = array ('userid' => $user,'password' => $pass); +$result = $client->__SoapCall( 'login', array ($params) ); + +if ($result->status_code == 0) { + if (! class_exists( 'Users' )) { + require ("classes/model/UsersPeer.php"); + } + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( 'USR_UID' ); + $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); + $resultSet = UsersPeer::doSelectRS( $oCriteria ); + $resultSet->next(); + $user_id = $resultSet->getRow(); + $result->message = $user_id[0]; + + G::LoadClass( 'case' ); + $caseInstance = new Cases(); + if (! $caseInstance->canStartCase( $result->message, $_REQUEST['PRO_UID'] )) { + $result->status_code = - 1000; + $result->message = G::LoadTranslation( 'ID_USER_CASES_NOT_START' ); + } +} + +die( G::json_encode( $result ) ); + diff --git a/workflow/engine/methods/cases/cases_Scheduler_ChangeStatus.php b/workflow/engine/methods/cases/cases_Scheduler_ChangeStatus.php index a4774d3a3..aa506828d 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_ChangeStatus.php +++ b/workflow/engine/methods/cases/cases_Scheduler_ChangeStatus.php @@ -1,28 +1,27 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; /* switch ($RBAC->userCanAccess('PM_FACTORY')) { @@ -37,20 +36,19 @@ switch ($RBAC->userCanAccess('PM_FACTORY')) die; break; } - + */ -/* +/* G::LoadClass('cases_Scheduler'); $oCases_Scheduler= new Cases_Scheduler(); $oCases_Scheduler->changeStatus ( $_GET['SCH_UID'] ); G::header('location: ' . $_SERVER['HTTP_REFERER']); */ - require_once 'classes/model/CaseScheduler.php'; - +require_once 'classes/model/CaseScheduler.php'; + // G::LoadClass('CaseScheduler'); - $oCaseScheduler= new CaseScheduler(); - $oCaseScheduler->changeStatus ( $_GET['SCH_UID'] ); - G::header('location: ' . $_SERVER['HTTP_REFERER']); +$oCaseScheduler = new CaseScheduler(); +$oCaseScheduler->changeStatus( $_GET['SCH_UID'] ); +G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); - \ No newline at end of file diff --git a/workflow/engine/methods/cases/cases_Scheduler_Delete.php b/workflow/engine/methods/cases/cases_Scheduler_Delete.php index 9fdfde099..be1b66c8b 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Delete.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Delete.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * + * */ /* Permissions */ @@ -39,15 +39,13 @@ switch ($RBAC->userCanAccess('PM_CASES')) break; } */ +// print_r($_GET); print_r($_POST); die; - // print_r($_GET); print_r($_POST); die; - - - require_once 'classes/model/CaseScheduler.php'; - $oCaseScheduler = new CaseScheduler(); - if ( !isset($_GET['SCH_UID'] ) ) return; - $oCaseScheduler->remove($_GET['SCH_UID']); - - +require_once 'classes/model/CaseScheduler.php'; +$oCaseScheduler = new CaseScheduler(); +if ( !isset($_GET['SCH_UID'] ) ) { + return; +} +$oCaseScheduler->remove($_GET['SCH_UID']); /* Redirect */ -?> \ No newline at end of file + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Edit.php b/workflow/engine/methods/cases/cases_Scheduler_Edit.php index 244eba7a2..e1c07c7d3 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Edit.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Edit.php @@ -1,31 +1,30 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - -/* +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + +/* switch ($RBAC->userCanAccess('PM_FACTORY')) { case -2: @@ -39,100 +38,98 @@ try { die; break; } -*/ - - require_once 'classes/model/CaseScheduler.php'; - require_once 'classes/model/Process.php'; - require_once 'classes/model/Task.php'; - -// $G_MAIN_MENU = 'processmaker'; -// $G_ID_MENU_SELECTED = 'CASES'; - $G_PUBLISH = new Publisher; - - G::LoadClass('case'); - - /* Prepare page before to show */ - - - $oCaseScheduler = new CaseScheduler(); - $aFields = $oCaseScheduler->load($_GET['SCH_UID']); - - - $aFields['UID_SCHEDULER'] ="scheduler" ; - - // load according the scheduler option selected daily/weekly/monthly/one time - $nOpt = $aFields['SCH_OPTION']; - switch($nOpt){ - case 1 : $aStartDay = explode('|', $aFields['SCH_DAYS_PERFORM_TASK']); - if($aStartDay[0] != 3) { - $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; - } else { - $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; - $aFields['SCH_DAYS_PERFORM_TASK_OPT_3'] = $aStartDay[1]; - } - - break; - case 2 : - $aFields['SCH_WEEK_DAYS_2'] = $aFields['SCH_WEEK_DAYS']; - break; - case 3 : // $nStartDay = $aFields['SCH_START_DAY']; - $aStartDay = explode('|', $aFields['SCH_START_DAY']); - if($aStartDay[0] == 1){ - $aFields['SCH_START_DAY_OPT_1'] = $aStartDay[1]; - } else { - $aFields['SCH_START_DAY_OPT_2_WEEKS'] = $aStartDay[1]; - $aFields['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $aStartDay[2]; - } - $aFields['SCH_START_DAY'] = $aStartDay[0]; - $aFields['SCH_MONTHS_2'] = $aFields['SCH_MONTHS']; - $aFields['SCH_MONTHS_3'] = $aFields['SCH_MONTHS']; - break; - case 4 : - - break; - } - - $aFields['SCH_START_TIME'] = date('H:i' , strtotime($aFields['SCH_START_TIME'])); - $aFields['PREV_SCH_START_TIME'] = $aFields['SCH_START_TIME']; - - $aFields['SCH_START_DATE'] = date('Y-m-d', strtotime($aFields['SCH_START_DATE'])); - $aFields['PREV_SCH_START_DATE'] = $aFields['SCH_START_DATE']; - - if(!empty($aFields['SCH_END_DATE'])){ - $aFields['SCH_END_DATE'] = date('Y-m-d', strtotime($aFields['SCH_END_DATE'])); - $aFields['PREV_SCH_END_DATE'] = date('Y-m-d', strtotime($aFields['SCH_END_DATE'])); - } - if($aFields['SCH_REPEAT_STOP_IF_RUNNING']==0 || $aFields['SCH_REPEAT_STOP_IF_RUNNING']==null){ - $aFields['SCH_REPEAT_STOP_IF_RUNNING']=null; - }else { - $aFields['SCH_REPEAT_STOP_IF_RUNNING']='On'; - } - - $aFields['SCH_USER_NAME'] = $aFields['SCH_DEL_USER_NAME']; - $aFields['SCH_USER_PASSWORD'] = 'DefaultPM'; - $aFields['SCH_USER_UID'] = $aFields['SCH_DEL_USER_UID']; - $aFields['SCH_START_DATE'] = date ("Y-m-d",strtotime($aFields['SCH_START_DATE'])); - - // validating if any of the advanced fields is non empty -// var_dump($aFields['SCH_END_DATE']); -// var_dump($aFields['SCH_REPEAT_EVERY']); -// die(); - if ($aFields['SCH_END_DATE']!=NULL||trim($aFields['SCH_REPEAT_EVERY'])!=''){ - $aFields['SCH_ADVANCED'] = 'true'; - } else { - $aFields['SCH_ADVANCED'] = 'false'; - } - - $aFields['PRO_UID_TMP'] = isset($_GET['PRO_UID'])?$_GET['PRO_UID']:$_SESSION['PROCESS']; - $aFields['PHP_START_DATE'] = date('Y-m-d'); - $aFields['PHP_END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Scheduler_Edit.xml', '', $aFields, 'cases_Scheduler_Update'); - - G::RenderPage('publishBlank','blank'); - -} catch (Exception $oException) { - die($oException->getMessage()); -} - -?> \ No newline at end of file +*/ + + require_once 'classes/model/CaseScheduler.php'; + require_once 'classes/model/Process.php'; + require_once 'classes/model/Task.php'; + + // $G_MAIN_MENU = 'processmaker'; + // $G_ID_MENU_SELECTED = 'CASES'; + $G_PUBLISH = new Publisher(); + + G::LoadClass( 'case' ); + + /* Prepare page before to show */ + + $oCaseScheduler = new CaseScheduler(); + $aFields = $oCaseScheduler->load( $_GET['SCH_UID'] ); + + $aFields['UID_SCHEDULER'] = "scheduler"; + + // load according the scheduler option selected daily/weekly/monthly/one time + $nOpt = $aFields['SCH_OPTION']; + switch ($nOpt) { + case 1: + $aStartDay = explode( '|', $aFields['SCH_DAYS_PERFORM_TASK'] ); + if ($aStartDay[0] != 3) { + $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; + } else { + $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; + $aFields['SCH_DAYS_PERFORM_TASK_OPT_3'] = $aStartDay[1]; + } + + break; + case 2: + $aFields['SCH_WEEK_DAYS_2'] = $aFields['SCH_WEEK_DAYS']; + break; + case 3: // $nStartDay = $aFields['SCH_START_DAY']; + $aStartDay = explode( '|', $aFields['SCH_START_DAY'] ); + if ($aStartDay[0] == 1) { + $aFields['SCH_START_DAY_OPT_1'] = $aStartDay[1]; + } else { + $aFields['SCH_START_DAY_OPT_2_WEEKS'] = $aStartDay[1]; + $aFields['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $aStartDay[2]; + } + $aFields['SCH_START_DAY'] = $aStartDay[0]; + $aFields['SCH_MONTHS_2'] = $aFields['SCH_MONTHS']; + $aFields['SCH_MONTHS_3'] = $aFields['SCH_MONTHS']; + break; + case 4: + + break; + } + + $aFields['SCH_START_TIME'] = date( 'H:i', strtotime( $aFields['SCH_START_TIME'] ) ); + $aFields['PREV_SCH_START_TIME'] = $aFields['SCH_START_TIME']; + + $aFields['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_START_DATE'] ) ); + $aFields['PREV_SCH_START_DATE'] = $aFields['SCH_START_DATE']; + + if (! empty( $aFields['SCH_END_DATE'] )) { + $aFields['SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) ); + $aFields['PREV_SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) ); + } + if ($aFields['SCH_REPEAT_STOP_IF_RUNNING'] == 0 || $aFields['SCH_REPEAT_STOP_IF_RUNNING'] == null) { + $aFields['SCH_REPEAT_STOP_IF_RUNNING'] = null; + } else { + $aFields['SCH_REPEAT_STOP_IF_RUNNING'] = 'On'; + } + + $aFields['SCH_USER_NAME'] = $aFields['SCH_DEL_USER_NAME']; + $aFields['SCH_USER_PASSWORD'] = 'DefaultPM'; + $aFields['SCH_USER_UID'] = $aFields['SCH_DEL_USER_UID']; + $aFields['SCH_START_DATE'] = date( "Y-m-d", strtotime( $aFields['SCH_START_DATE'] ) ); + + // validating if any of the advanced fields is non empty + // var_dump($aFields['SCH_END_DATE']); + // var_dump($aFields['SCH_REPEAT_EVERY']); + // die(); + if ($aFields['SCH_END_DATE'] != NULL || trim( $aFields['SCH_REPEAT_EVERY'] ) != '') { + $aFields['SCH_ADVANCED'] = 'true'; + } else { + $aFields['SCH_ADVANCED'] = 'false'; + } + + $aFields['PRO_UID_TMP'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS']; + $aFields['PHP_START_DATE'] = date( 'Y-m-d' ); + $aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) ); + + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Edit.xml', '', $aFields, 'cases_Scheduler_Update' ); + + G::RenderPage( 'publishBlank', 'blank' ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_Scheduler_List.php b/workflow/engine/methods/cases/cases_Scheduler_List.php index 66011c9be..e92074fb4 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_List.php +++ b/workflow/engine/methods/cases/cases_Scheduler_List.php @@ -1,30 +1,31 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; -global $RBAC; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) { + return $RBAC_Response; +} +global $RBAC; /*switch ($RBAC->userCanAccess('PM_USERS')) { case -2: @@ -37,140 +38,57 @@ global $RBAC; G::header('location: ../login/login'); die; break; -}*/ - - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; - -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER'; -require_once 'classes/model/CaseScheduler.php'; -$process = isset($_GET['PRO_UID'])?$_GET['PRO_UID']:$_SESSION['PROCESS']; -$sDelimiter = DBAdapter::getStringDelimiter(); - - $oCaseScheduler = new CaseScheduler(); - $aRows = $oCaseScheduler->getAllByProcess($process); - - //$oCaseScheduler->caseSchedulerCron(); - // g::pr($aRows); die; - -$fieldNames = Array( - 'SCH_UID' => 'char', - 'SCH_NAME' => 'char', - 'PRO_UID' => 'char', - 'TAS_UID' => 'char', - 'SCH_TIME_NEXT_RUN' => 'char', - 'SCH_LAST_RUN_TIME' => 'char', - 'SCH_STATE' => 'char', - 'SCH_LAST_STATE' => 'char', - 'USR_UID' => 'char', - 'SCH_OPTION' => 'char', - 'SCH_START_TIME' => 'char', - 'SCH_START_DATE' => 'char', - 'SCH_DAYS_PERFORM_TASK' => 'char', - 'SCH_EVERY_DAYS' => 'char', - 'SCH_WEEK_DAYS' => 'char', - 'SCH_START_DAY' => 'char', - 'SCH_MONTHS' => 'char', - 'SCH_END_DATE' => 'char', - 'SCH_REPEAT_EVERY' => 'char', - 'SCH_REPEAT_UNTIL' => 'char', - 'SCH_REPEAT_STOP_IF_RUNNING' => 'char', - 'PRO_PARENT' => 'char', - 'PRO_TIME' => 'char', - 'PRO_TIMEUNIT' => 'char', - 'PRO_STATUS' => 'char', - 'PRO_TYPE_DAY' => 'char', - 'PRO_TYPE' => 'char', - 'PRO_ASSIGNMENT' => 'char', - 'PRO_SHOW_MAP' => 'char', - 'PRO_SHOW_MESSAGE' => 'char', - 'PRO_SUBPROCESS' => 'char', - 'PRO_TRI_DELETED' => 'char', - 'PRO_TRI_CANCELED' => 'char', - 'PRO_TRI_PAUSED' => 'char', - 'PRO_TRI_REASSIGNED' => 'char', - 'PRO_SHOW_DELEGATE' => 'char', - 'PRO_SHOW_DYNAFORM' => 'char', - 'PRO_CATEGORY' => 'char', - 'PRO_SUB_CATEGORY' => 'char', - 'PRO_INDUSTRY' => 'char', - 'PRO_UPDATE_DATE' => 'char', - 'PRO_CREATE_DATE' => 'char', - 'PRO_CREATE_USER' => 'char', - 'PRO_HEIGHT' => 'char', - 'PRO_WIDTH' => 'char', - 'PRO_TITLE_X' => 'char', - 'PRO_TITLE_Y' => 'char', - 'PRO_DEBUG' => 'char', - 'PRO_TITLE' => 'char', - 'PRO_DESCRIPTION' => 'char', - 'TAS_TYPE' => 'char', - 'TAS_DURATION' => 'char', - 'TAS_DELAY_TYPE' => 'char', - 'TAS_TEMPORIZER' => 'char', - 'TAS_TYPE_DAY' => 'char', - 'TAS_TIMEUNIT' => 'char', - 'TAS_ALERT' => 'char', - 'TAS_PRIORITY_VARIABLE' => 'char', - 'TAS_ASSIGN_TYPE' => 'char', - 'TAS_ASSIGN_VARIABLE' => 'char', - 'TAS_ASSIGN_LOCATION' => 'char', - 'TAS_ASSIGN_LOCATION_ADHOC' => 'char', - 'TAS_TRANSFER_FLY' => 'char', - 'TAS_LAST_ASSIGNED' => 'char', - 'TAS_USER' => 'char', - 'TAS_CAN_UPLOAD' => 'char', - 'TAS_VIEW_UPLOAD' => 'char', - 'TAS_VIEW_ADDITIONAL_DOCUMENTATION' => 'char', - 'TAS_CAN_CANCEL' => 'char', - 'TAS_OWNER_APP' => 'char', - 'STG_UID' => 'char', - 'TAS_CAN_PAUSE' => 'char', - 'TAS_CAN_SEND_MESSAGE' => 'char', - 'TAS_CAN_DELETE_DOCS' => 'char', - 'TAS_SELF_SERVICE' => 'char', - 'TAS_START' => 'char', - 'TAS_TO_LAST_USER' => 'char', - 'TAS_SEND_LAST_EMAIL' => 'char', - 'TAS_DERIVATION' => 'char', - 'TAS_POSX' => 'char', - 'TAS_POSY' => 'char', - 'TAS_COLOR' => 'char', - 'TAS_TITLE' => 'char', - 'TAS_DESCRIPTION' => 'char', - 'TAS_DEF_TITLE' => 'char', - 'TAS_DEF_DESCRIPTION' => 'char', - 'TAS_DEF_PROC_CODE' => 'char', - 'TAS_DEF_MESSAGE' => 'char' -); - - -$aRows = array_merge(Array($fieldNames), $aRows); -//krumo ($aRows); -for($j=0;$jgetAllByProcess( $process ); + +//$oCaseScheduler->caseSchedulerCron(); // g::pr($aRows); die; - -global $_DBArray; -$_DBArray['cases_scheduler'] = $aRows; -$_SESSION['_DBArray'] = $_DBArray; -G::LoadClass('ArrayPeer'); -$oCriteria = new Criteria('dbarray'); -$oCriteria->setDBArrayTable('cases_scheduler'); + + +$fieldNames = Array ('SCH_UID' => 'char','SCH_NAME' => 'char','PRO_UID' => 'char','TAS_UID' => 'char','SCH_TIME_NEXT_RUN' => 'char','SCH_LAST_RUN_TIME' => 'char','SCH_STATE' => 'char','SCH_LAST_STATE' => 'char','USR_UID' => 'char','SCH_OPTION' => 'char','SCH_START_TIME' => 'char','SCH_START_DATE' => 'char','SCH_DAYS_PERFORM_TASK' => 'char','SCH_EVERY_DAYS' => 'char','SCH_WEEK_DAYS' => 'char','SCH_START_DAY' => 'char','SCH_MONTHS' => 'char','SCH_END_DATE' => 'char','SCH_REPEAT_EVERY' => 'char','SCH_REPEAT_UNTIL' => 'char','SCH_REPEAT_STOP_IF_RUNNING' => 'char','PRO_PARENT' => 'char','PRO_TIME' => 'char','PRO_TIMEUNIT' => 'char','PRO_STATUS' => 'char','PRO_TYPE_DAY' => 'char','PRO_TYPE' => 'char','PRO_ASSIGNMENT' => 'char','PRO_SHOW_MAP' => 'char','PRO_SHOW_MESSAGE' => 'char', + 'PRO_SUBPROCESS' => 'char','PRO_TRI_DELETED' => 'char','PRO_TRI_CANCELED' => 'char','PRO_TRI_PAUSED' => 'char','PRO_TRI_REASSIGNED' => 'char','PRO_SHOW_DELEGATE' => 'char','PRO_SHOW_DYNAFORM' => 'char','PRO_CATEGORY' => 'char','PRO_SUB_CATEGORY' => 'char','PRO_INDUSTRY' => 'char','PRO_UPDATE_DATE' => 'char','PRO_CREATE_DATE' => 'char','PRO_CREATE_USER' => 'char','PRO_HEIGHT' => 'char','PRO_WIDTH' => 'char','PRO_TITLE_X' => 'char','PRO_TITLE_Y' => 'char','PRO_DEBUG' => 'char','PRO_TITLE' => 'char','PRO_DESCRIPTION' => 'char','TAS_TYPE' => 'char','TAS_DURATION' => 'char','TAS_DELAY_TYPE' => 'char','TAS_TEMPORIZER' => 'char','TAS_TYPE_DAY' => 'char','TAS_TIMEUNIT' => 'char','TAS_ALERT' => 'char','TAS_PRIORITY_VARIABLE' => 'char','TAS_ASSIGN_TYPE' => 'char', + 'TAS_ASSIGN_VARIABLE' => 'char','TAS_ASSIGN_LOCATION' => 'char','TAS_ASSIGN_LOCATION_ADHOC' => 'char','TAS_TRANSFER_FLY' => 'char','TAS_LAST_ASSIGNED' => 'char','TAS_USER' => 'char','TAS_CAN_UPLOAD' => 'char','TAS_VIEW_UPLOAD' => 'char','TAS_VIEW_ADDITIONAL_DOCUMENTATION' => 'char','TAS_CAN_CANCEL' => 'char','TAS_OWNER_APP' => 'char','STG_UID' => 'char','TAS_CAN_PAUSE' => 'char','TAS_CAN_SEND_MESSAGE' => 'char','TAS_CAN_DELETE_DOCS' => 'char','TAS_SELF_SERVICE' => 'char','TAS_START' => 'char','TAS_TO_LAST_USER' => 'char','TAS_SEND_LAST_EMAIL' => 'char','TAS_DERIVATION' => 'char','TAS_POSX' => 'char','TAS_POSY' => 'char','TAS_COLOR' => 'char','TAS_TITLE' => 'char','TAS_DESCRIPTION' => 'char','TAS_DEF_TITLE' => 'char','TAS_DEF_DESCRIPTION' => 'char', + 'TAS_DEF_PROC_CODE' => 'char','TAS_DEF_MESSAGE' => 'char' +); + +$aRows = array_merge( Array ($fieldNames +), $aRows ); +//krumo ($aRows); +for ($j = 0; $j < count( $aRows ); $j ++) { + if ($aRows[$j]['SCH_STATE'] == 'PROCESSED') { + $aRows[$j]['SCH_TIME_NEXT_RUN'] = ''; + } +} +// g::pr($aRows); die; + + +global $_DBArray; +$_DBArray['cases_scheduler'] = $aRows; +$_SESSION['_DBArray'] = $_DBArray; +G::LoadClass( 'ArrayPeer' ); +$oCriteria = new Criteria( 'dbarray' ); +$oCriteria->setDBArrayTable( 'cases_scheduler' ); //krumo ($oCriteria); //var_dump ($oCriteria); //$oCriteria->add('PRO_UID', $_SESSION['PROCESS']); //krumo($_SESSION); - - -$G_PUBLISH = new Publisher; -$G_PUBLISH->ROWS_PER_PAGE = 10; -$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_Scheduler_List', $oCriteria, array('CONFIRM' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); -$G_PUBLISH->oPropelTable->rowsPerPage = 10; -G::RenderPage('publishBlank', 'blank'); - + + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->ROWS_PER_PAGE = 10; +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_Scheduler_List', $oCriteria, array ('CONFIRM' => G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER' ) +) ); +$G_PUBLISH->oPropelTable->rowsPerPage = 10; +G::RenderPage( 'publishBlank', 'blank' ); + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Log.php b/workflow/engine/methods/cases/cases_Scheduler_Log.php index 15a9da6a7..316c3a012 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Log.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Log.php @@ -1,44 +1,43 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response; - -$G_PUBLISH = new Publisher; -G::LoadClass('configuration'); -$c = new Configurations(); -$configPage = $c->getConfiguration('casesSchedulerLogList', 'pageSize','',$_SESSION['USER_LOGGED']); -$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; - -$oHeadPublisher =& headPublisher::getSingleton(); - -$oHeadPublisher->addExtJsScript('cases/casesSchedulerLog', false); //adding a javascript file .js -$oHeadPublisher->addContent('cases/casesSchedulerLog'); //adding a html file .html. - -$oHeadPublisher->assign('CONFIG', $Config); - - -G::RenderPage('publish', 'extJs'); - -?> +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) + return $RBAC_Response; + +$G_PUBLISH = new Publisher(); +G::LoadClass( 'configuration' ); +$c = new Configurations(); +$configPage = $c->getConfiguration( 'casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); +$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20; + +$oHeadPublisher = & headPublisher::getSingleton(); + +$oHeadPublisher->addExtJsScript( 'cases/casesSchedulerLog', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'cases/casesSchedulerLog' ); //adding a html file .html. + + +$oHeadPublisher->assign( 'CONFIG', $Config ); + +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php b/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php index ae8162b3d..05b20cdf0 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php @@ -1,31 +1,30 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - -/* +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + + /* switch ($RBAC->userCanAccess('PM_FACTORY')) { case -2: @@ -39,9 +38,9 @@ try { die; break; } -*/ +*/ -/* +/* $aFields['MESSAGE0'] = str_replace("\r\n","
",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; $aFields['MESSAGE1'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); $aFields['MESSAGE2'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); @@ -54,39 +53,35 @@ try { $aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); $aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); */ - if (!class_exists('LogCasesSchedulerPeer')){ - require_once('classes/model/LogCasesScheduler.php'); - } - - $G_PUBLISH = new Publisher; - - $oCriteria = new Criteria ('workflow'); -// var_dump(htmlspecialchars($_GET['WS_ROUTE'])); -// var_dump(htmlentities($_GET['WS_ROUTE'])); - - $oCriteria->add(LogCasesSchedulerPeer::LOG_CASE_UID,$_REQUEST['LOG_CASE_UID']); - - $result = LogCasesSchedulerPeer::doSelectRS($oCriteria); - $result->next(); - $row = $result->getRow(); - $aFields['PRO_UID'] = $row[1]; - $aFields['TAS_UID'] = $row[2]; - $aFields['SCH_UID'] = $row[7]; - $aFields['USR_NAME'] = $row[3]; - $aFields['EXEC_DATE'] = $row[4]; - $aFields['EXEC_HOUR'] = $row[5]; - $aFields['RESULT'] = $row[6]; - $aFields['WS_CREATE_CASE_STATUS'] = $row[8]; - $aFields['WS_ROUTE_CASE_STATUS'] = htmlentities($row[9]); -//var_dump($aFields); -//$aFields = $_GET; - - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Scheduler_Log_Detail.xml', '', $aFields, ''); - G::RenderPage('publishBlank', 'blank'); - -} -catch (Exception $oException) { - die($oException->getMessage()); -} -?> \ No newline at end of file + if (! class_exists( 'LogCasesSchedulerPeer' )) { + require_once ('classes/model/LogCasesScheduler.php'); + } + + $G_PUBLISH = new Publisher(); + $oCriteria = new Criteria( 'workflow' ); + // var_dump(htmlspecialchars($_GET['WS_ROUTE'])); + // var_dump(htmlentities($_GET['WS_ROUTE'])); + + + $oCriteria->add( LogCasesSchedulerPeer::LOG_CASE_UID, $_REQUEST['LOG_CASE_UID'] ); + $result = LogCasesSchedulerPeer::doSelectRS( $oCriteria ); + $result->next(); + $row = $result->getRow(); + $aFields['PRO_UID'] = $row[1]; + $aFields['TAS_UID'] = $row[2]; + $aFields['SCH_UID'] = $row[7]; + $aFields['USR_NAME'] = $row[3]; + $aFields['EXEC_DATE'] = $row[4]; + $aFields['EXEC_HOUR'] = $row[5]; + $aFields['RESULT'] = $row[6]; + $aFields['WS_CREATE_CASE_STATUS'] = $row[8]; + $aFields['WS_ROUTE_CASE_STATUS'] = htmlentities( $row[9] ); + //var_dump($aFields); + //$aFields = $_GET; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Log_Detail.xml', '', $aFields, '' ); + G::RenderPage( 'publishBlank', 'blank' ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_Scheduler_New.php b/workflow/engine/methods/cases/cases_Scheduler_New.php index 35395fe43..602b651b4 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_New.php +++ b/workflow/engine/methods/cases/cases_Scheduler_New.php @@ -1,31 +1,30 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - -/* +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + + /* switch ($RBAC->userCanAccess('PM_FACTORY')) { case -2: @@ -39,9 +38,9 @@ try { die; break; } -*/ +*/ -/* +/* $aFields['MESSAGE0'] = str_replace("\r\n","
",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; $aFields['MESSAGE1'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); $aFields['MESSAGE2'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); @@ -55,47 +54,43 @@ try { $aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); */ - require_once 'classes/model/CaseScheduler.php'; - require_once 'classes/model/Process.php'; - require_once 'classes/model/Task.php'; + require_once 'classes/model/CaseScheduler.php'; + require_once 'classes/model/Process.php'; + require_once 'classes/model/Task.php'; + + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'cases'; + + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER'; + + $G_PUBLISH = new Publisher(); + + G::LoadClass( 'case' ); + $aFields['PHP_START_DATE'] = date( 'Y-m-d' ); + $aFields['PRO_UID'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS']; + $aFields['PHP_CURRENT_DATE'] = $aFields['PHP_START_DATE']; + $aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) ); + + /* Prepare page before to show */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; + /*-- Base + $aFields = array(); + $oCase = new Cases(); + $_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] ); + */ -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER'; - - $G_PUBLISH = new Publisher; - - G::LoadClass('case'); - $aFields['PHP_START_DATE'] = date('Y-m-d'); - $aFields['PRO_UID'] = isset($_GET['PRO_UID'])?$_GET['PRO_UID']:$_SESSION['PROCESS']; - $aFields['PHP_CURRENT_DATE'] = $aFields['PHP_START_DATE']; - $aFields['PHP_END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); - - /* Prepare page before to show */ - - /*-- Base - $aFields = array(); - $oCase = new Cases(); - $_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] ); - */ - - - $oCaseScheduler = new CaseScheduler(); - //$_DBArray['NewProcess'] = $oCaseScheduler->getProcessDescription(); - //$_DBArray['NewTask'] = $oCaseScheduler->getTaskDescription(); - - // var_dump($oCaseScheduler->getAllProcess()); die; - - $aFields['UID_SCHEDULER'] ="scheduler" ; - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Scheduler_New.xml', '', $aFields, 'cases_Scheduler_Save'); - G::RenderPage('publishBlank', 'blank'); - - -} -catch (Exception $oException) { - die($oException->getMessage()); -} -?> \ No newline at end of file + $oCaseScheduler = new CaseScheduler(); + //$_DBArray['NewProcess'] = $oCaseScheduler->getProcessDescription(); + //$_DBArray['NewTask'] = $oCaseScheduler->getTaskDescription(); + // var_dump($oCaseScheduler->getAllProcess()); die; + + $aFields['UID_SCHEDULER'] = "scheduler"; + + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_New.xml', '', $aFields, 'cases_Scheduler_Save' ); + G::RenderPage( 'publishBlank', 'blank' ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Save.php b/workflow/engine/methods/cases/cases_Scheduler_Save.php index 7435a1b1b..69027cbd2 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Save.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Save.php @@ -1,29 +1,28 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - /* +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + /* global $RBAC; switch ($RBAC->userCanAccess('PM_FACTORY')) { @@ -38,238 +37,233 @@ try { die; break; } - */ - - - require_once 'classes/model/CaseScheduler.php'; - $oCaseScheduler = new CaseScheduler(); - - if (empty($_POST)) { - die('The information sended is empty!'); - } - - $aData['SCH_UID'] = G::generateUniqueID(); - $aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; - $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; - $aData['SCH_DEL_USER_PASS'] = md5($_POST['form']['SCH_USER_PASSWORD']); - $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; - $aData['PRO_UID'] = $_POST['form']['PRO_UID']; - $aData['TAS_UID'] = $_POST['form']['TAS_UID']; - - $aData['SCH_STATE'] = 'ACTIVE'; - $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; - $aData['USR_UID'] = $_SESSION['USER_LOGGED']; - - $sOption = $_POST['form']['SCH_OPTION']; - $aData['SCH_OPTION'] = $sOption; - - - - if ($_POST['form']['SCH_START_DATE']!=''){ - $sDateTmp = $_POST['form']['SCH_START_DATE']; - } else { - $sDateTmp = date('Y-m-d'); - } - $sTimeTmp = $_POST['form']['SCH_START_TIME']; - $aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); - $aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); - + */ + + require_once 'classes/model/CaseScheduler.php'; + $oCaseScheduler = new CaseScheduler(); + + if (empty( $_POST )) { + die( 'The information sended is empty!' ); + } + + $aData['SCH_UID'] = G::generateUniqueID(); + $aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; + $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; + $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); + $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; + $aData['PRO_UID'] = $_POST['form']['PRO_UID']; + $aData['TAS_UID'] = $_POST['form']['TAS_UID']; + + $aData['SCH_STATE'] = 'ACTIVE'; + $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; + $aData['USR_UID'] = $_SESSION['USER_LOGGED']; + + $sOption = $_POST['form']['SCH_OPTION']; + $aData['SCH_OPTION'] = $sOption; + + if ($_POST['form']['SCH_START_DATE'] != '') { + $sDateTmp = $_POST['form']['SCH_START_DATE']; + } else { + $sDateTmp = date( 'Y-m-d' ); + } + $sTimeTmp = $_POST['form']['SCH_START_TIME']; + $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $nActualTime = $_POST['form']['SCH_START_TIME']; // time(); // $nActualDate = date("Y-m-d H:i:s", $nActualTime); - - $sValue = ''; - $sDaysPerformTask = ''; - $sWeeks = ''; - $sMonths = ''; - $sMonths = ''; - $sStartDay = ''; - $nSW = 0; - $aData['SCH_START_DAY'] = ''; - $aData['SCH_REPEAT_EVERY'] = ''; - $aData['SCH_REPEAT_UNTIL'] = ''; - $aData['SCH_DAYS_PERFORM_TASK'] = ''; - switch($sOption){ - case '1' : // Option 1 - $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; - switch($sValue){ - case '1' : $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; - break; - case '2' : - $aData['SCH_OPTION'] = '2'; - $aData['SCH_EVERY_DAYS'] = '1'; - $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; - break; - case '3' : // Every [n] Days - $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; - $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; - break; - } - break; - - case '2' : // If the option is zero, set by default 1 - if(empty($_POST['form']['SCH_EVERY_DAYS'])) - $nEveryDays = 1; - else - $nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; - $aData['SCH_EVERY_DAYS'] = $nEveryDays; - $sWeeks = ''; - if(!empty($_POST['form']['SCH_WEEK_DAYS'])){ - $aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; - foreach($aWeekDays as $value) { - $sWeeks = $sWeeks . $value . '|'; - } - } - if(!empty($_POST['form']['SCH_WEEK_DAYS_2'])){ - $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; - foreach($aWeekDays2 as $value) { - $sWeeks = $sWeeks . $value . '|'; - } - } - $sStartTime = $_POST['form']['SCH_START_TIME']; - $aData['SCH_WEEK_DAYS'] = $sWeeks; - - break; - case '3' : - $nStartDay = $_POST['form']['SCH_START_DAY']; - if($nStartDay == 1){ - $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; - } else { - $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; - } - - $sMonths = ''; - if(!empty($_POST['form']['SCH_MONTHS'])){ - $aMonths = $_POST['form']['SCH_MONTHS']; - foreach($aMonths as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - if(!empty($_POST['form']['SCH_MONTHS_2'])){ - $aMonths2 = $_POST['form']['SCH_MONTHS_2']; - foreach($aMonths2 as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - if(!empty($_POST['form']['SCH_MONTHS_3'])){ - $aMonths3 = $_POST['form']['SCH_MONTHS_3']; - foreach($aMonths3 as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - $aData['SCH_MONTHS'] = $sMonths; - $sStartDay = $aData['SCH_START_DAY']; - $sValue = $nStartDay; - break; - - - } - echo "
sOption: ".$sOption; - if(($sOption!='1') && ($sOption!='4') && ($sOption!='5') ) { - if ($sStartDay==''){ - $sStartDay = date('Y-m-d'); - } - // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; - $dCurrentDay = date("d"); - $dCurrentMonth = date("m"); - $aStartDay = explode( "|" , $aData['SCH_START_DAY'] ); - if($sOption=='3'&&$aStartDay[0]=='1'){ - $monthsArray = explode("|",$sMonths); - foreach ($monthsArray as $row){ - if ( $dCurrentMonth == $row && $dCurrentDay<$aStartDay[1] ){ - $startTime = $_POST['form']['SCH_START_TIME'].":00"; - $aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; - break; - } else { - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); - } - } - } else { - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); - } - // print_r ($aData['SCH_TIME_NEXT_RUN']); - // die; - } else { - if ($sOption=='4'){ - $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; - } - $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; - if ($sOption == 5) { - $aData['SCH_START_TIME'] = time(); - $aData['SCH_START_DATE'] = $aData['SCH_START_TIME']; - $nextRun = $_POST['form']['SCH_REPEAT_EVERY']*60*60; - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; - $date = $aData['SCH_START_TIME']; - $date += $nextRun; - $date = date("Y-m-d H:i", $date ); - $aData['SCH_TIME_NEXT_RUN'] = $date; - } - } - if(trim($_POST['form']['SCH_END_DATE'])!=''){ - $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; - } - - if(!empty($_POST['form']['SCH_REPEAT_TASK_CHK'])){ - $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; - if($nOptEvery ==2) - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; - else - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; - - - } - - if((isset($_POST['form']['CASE_SH_PLUGIN_UID']))&&($_POST['form']['CASE_SH_PLUGIN_UID']!="")){ - $aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID']; - } - //$aData['SCH_END_DATE'] = "2020-12-30"; - $oCaseScheduler->create($aData); - $sch_uid = $oCaseScheduler->getSchUid(); - - if((isset($_POST['form']['CASE_SH_PLUGIN_UID']))&&($_POST['form']['CASE_SH_PLUGIN_UID']!="")){ - $params=explode("--",$_REQUEST ['form']['CASE_SH_PLUGIN_UID']); - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $activePluginsForCaseScheduler=$oPluginRegistry->getCaseSchedulerPlugins(); - - foreach($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail){ - if(($caseSchedulerPluginDetail->sNamespace==$params[0])&&($caseSchedulerPluginDetail->sActionId==$params[1])){ - $caseSchedulerSelected=$caseSchedulerPluginDetail; - - } - } - if((isset($caseSchedulerSelected))&&(is_object($caseSchedulerSelected))){ - //Save the form - $oData=$_POST['pluginFields']; - $oData['SCH_UID'] =$aData['SCH_UID']; - $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); - } - } - -// //Added by Qennix -// //Update Start Time Event in BPMN -// -// echo $_POST['form']['TAS_UID']."<<----"; -// if (isset($_POST['form']['TAS_UID'])){ -// require_once 'classes/model/Event.php'; -// require_once 'classes/model/Task.php'; -// echo $_POST['form']['TAS_UID']."<<----"; -// -// $oTask = new Task(); -// $oTask->load($_POST['form']['TAS_UID']); -// $evn_uid = $oTask->getStartingEvent(); -// $event = new Event(); -// $editEvent = array(); -// $editEvent['EVN_UID'] = $evn_uid; -// $editEvent['EVN_ACTION'] = $sch_uid; -// $event->update($editEvent); -// //End Adding -// } - - G::header('location: cases_Scheduler_List?PRO_UID='.$_POST['form']['PRO_UID']); - - -} -catch (Exception $oException) { - die($oException->getMessage()); -} - -?> \ No newline at end of file + + + $sValue = ''; + $sDaysPerformTask = ''; + $sWeeks = ''; + $sMonths = ''; + $sMonths = ''; + $sStartDay = ''; + $nSW = 0; + $aData['SCH_START_DAY'] = ''; + $aData['SCH_REPEAT_EVERY'] = ''; + $aData['SCH_REPEAT_UNTIL'] = ''; + $aData['SCH_DAYS_PERFORM_TASK'] = ''; + switch ($sOption) { + case '1': // Option 1 + $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; + switch ($sValue) { + case '1': + $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; + break; + case '2': + $aData['SCH_OPTION'] = '2'; + $aData['SCH_EVERY_DAYS'] = '1'; + $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; + break; + case '3': // Every [n] Days + $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; + $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; + break; + } + break; + + case '2': // If the option is zero, set by default 1 + if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) + $nEveryDays = 1; + else + $nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; + $aData['SCH_EVERY_DAYS'] = $nEveryDays; + $sWeeks = ''; + if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) { + $aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; + foreach ($aWeekDays as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) { + $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; + foreach ($aWeekDays2 as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + $sStartTime = $_POST['form']['SCH_START_TIME']; + $aData['SCH_WEEK_DAYS'] = $sWeeks; + + break; + case '3': + $nStartDay = $_POST['form']['SCH_START_DAY']; + if ($nStartDay == 1) { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; + } else { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; + } + + $sMonths = ''; + if (! empty( $_POST['form']['SCH_MONTHS'] )) { + $aMonths = $_POST['form']['SCH_MONTHS']; + foreach ($aMonths as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_MONTHS_2'] )) { + $aMonths2 = $_POST['form']['SCH_MONTHS_2']; + foreach ($aMonths2 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_MONTHS_3'] )) { + $aMonths3 = $_POST['form']['SCH_MONTHS_3']; + foreach ($aMonths3 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + $aData['SCH_MONTHS'] = $sMonths; + $sStartDay = $aData['SCH_START_DAY']; + $sValue = $nStartDay; + break; + + } + echo "
sOption: " . $sOption; + if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { + if ($sStartDay == '') { + $sStartDay = date( 'Y-m-d' ); + } + // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; + $dCurrentDay = date( "d" ); + $dCurrentMonth = date( "m" ); + $aStartDay = explode( "|", $aData['SCH_START_DAY'] ); + if ($sOption == '3' && $aStartDay[0] == '1') { + $monthsArray = explode( "|", $sMonths ); + foreach ($monthsArray as $row) { + if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { + $startTime = $_POST['form']['SCH_START_TIME'] . ":00"; + $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; + break; + } else { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } + } + } else { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } + // print_r ($aData['SCH_TIME_NEXT_RUN']); + // die; + } else { + if ($sOption == '4') { + $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; + } + $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; + if ($sOption == 5) { + $aData['SCH_START_TIME'] = time(); + $aData['SCH_START_DATE'] = $aData['SCH_START_TIME']; + $nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60; + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; + $date = $aData['SCH_START_TIME']; + $date += $nextRun; + $date = date( "Y-m-d H:i", $date ); + $aData['SCH_TIME_NEXT_RUN'] = $date; + } + } + if (trim( $_POST['form']['SCH_END_DATE'] ) != '') { + $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; + } + + if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) { + $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; + if ($nOptEvery == 2) + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; + else + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; + + } + + if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) { + $aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID']; + } + //$aData['SCH_END_DATE'] = "2020-12-30"; + $oCaseScheduler->create( $aData ); + $sch_uid = $oCaseScheduler->getSchUid(); + + if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) { + $params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] ); + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); + + foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { + if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { + $caseSchedulerSelected = $caseSchedulerPluginDetail; + + } + } + if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { + //Save the form + $oData = $_POST['pluginFields']; + $oData['SCH_UID'] = $aData['SCH_UID']; + $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); + } + } + + // //Added by Qennix + // //Update Start Time Event in BPMN + // + // echo $_POST['form']['TAS_UID']."<<----"; + // if (isset($_POST['form']['TAS_UID'])){ + // require_once 'classes/model/Event.php'; + // require_once 'classes/model/Task.php'; + // echo $_POST['form']['TAS_UID']."<<----"; + // + // $oTask = new Task(); + // $oTask->load($_POST['form']['TAS_UID']); + // $evn_uid = $oTask->getStartingEvent(); + // $event = new Event(); + // $editEvent = array(); + // $editEvent['EVN_UID'] = $evn_uid; + // $editEvent['EVN_ACTION'] = $sch_uid; + // $event->update($editEvent); + // //End Adding + // } + + + G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Update.php b/workflow/engine/methods/cases/cases_Scheduler_Update.php index ef3f7cbb7..2d5d0918b 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Update.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Update.php @@ -1,29 +1,28 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { -/* +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + /* global $RBAC; switch ($RBAC->userCanAccess('PM_FACTORY')) { @@ -38,247 +37,245 @@ try { die; break; } - */ - - require_once 'classes/model/CaseScheduler.php'; - - - if (empty($_POST)) { - die('The information sended is empty!'); - } - $aData['SCH_UID'] = $_POST['form']['SCH_UID']; - $aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; - $aData['PRO_UID'] = $_POST['form']['PRO_UID']; - $aData['TAS_UID'] = $_POST['form']['TAS_UID']; - - $oCaseScheduler = new CaseScheduler(); - $oCaseScheduler->Load($aData['SCH_UID']); - - $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; - if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM'){ - $aData['SCH_DEL_USER_PASS'] = md5($_POST['form']['SCH_USER_PASSWORD']); - } - $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; - -// $aData['SCH_TIME_NEXT_RUN'] = time(); - //$aData['SCH_LAST_RUN_TIME'] = time(); -// $aData['SCH_STATE'] = 'ACTIVE'; -// $aData['SCH_LAST_STATE'] = 'ACTIVE'; - $aData['USR_UID'] = $_SESSION['USER_LOGGED']; - - $sOption = $_POST['form']['SCH_OPTION']; - $aData['SCH_OPTION'] = $sOption; - - $sDateTmp = $_POST['form']['SCH_START_DATE']; - $sTimeTmp = $_POST['form']['SCH_START_TIME']; - $aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); - $aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); - $previousStartTime = date('Y-m-d', strtotime($_POST['form']['PREV_SCH_START_DATE'])) . ' ' . date('H:i:s', strtotime($_POST['form']['PREV_SCH_START_TIME'])); - $previousStartDate = date('Y-m-d', strtotime($_POST['form']['PREV_SCH_START_DATE'])) . ' ' . date('H:i:s', strtotime($_POST['form']['PREV_SCH_START_TIME'])); - - $sValue = ''; - $sDaysPerformTask = ''; - $sWeeks = ''; - $sMonths = ''; - $sMonths = ''; - $sStartDay = ''; - $nSW = 0; - - switch($sOption){ - case '1' : // Option 1 - $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; - switch($sValue){ - case '1' : $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; - break; - case '2' : - $aData['SCH_OPTION'] = '2'; - $aData['SCH_EVERY_DAYS'] = '1'; - $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; - break; - case '3' : // Every [n] Days - $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; - $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; - break; - } - break; - case '2' : // If the option is zero, set by default 1 - if(empty($_POST['form']['SCH_EVERY_DAYS'])) - $nEveryDays = 1; - else - $nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; - $aData['SCH_EVERY_DAYS'] = $nEveryDays; - $sWeeks = ''; - if(!empty($_POST['form']['SCH_WEEK_DAYS'])){ - $aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; - foreach($aWeekDays as $value) { - $sWeeks = $sWeeks . $value . '|'; - } - } - if(!empty($_POST['form']['SCH_WEEK_DAYS_2'])){ - $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; - foreach($aWeekDays2 as $value) { - $sWeeks = $sWeeks . $value . '|'; - } - } - $sStartTime = $_POST['form']['SCH_START_TIME']; - $aData['SCH_WEEK_DAYS'] = $sWeeks; - break; - - case '3' : - $nStartDay = $_POST['form']['SCH_START_DAY']; - if($nStartDay == 1){ - $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; - } else { - $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; - } - - $sMonths = ''; - if(!empty($_POST['form']['SCH_MONTHS'])){ - $aMonths = $_POST['form']['SCH_MONTHS']; - foreach($aMonths as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - if(!empty($_POST['form']['SCH_MONTHS_2'])){ - $aMonths2 = $_POST['form']['SCH_MONTHS_2']; - foreach($aMonths2 as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - if(!empty($_POST['form']['SCH_MONTHS_3'])){ - $aMonths3 = $_POST['form']['SCH_MONTHS_3']; - foreach($aMonths3 as $value) { - $sMonths = $sMonths . $value . '|' ; - } - } - $aData['SCH_MONTHS'] = $sMonths; - $sStartDay = $aData['SCH_START_DAY']; - $sValue = $nStartDay; - break; - - } - if(trim($_POST['form']['SCH_END_DATE'])!=''){ - $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; - } -// if the start date has changed then recalculate the next run time - if ($_POST['form']['SCH_START_DATE']==$_POST['form']['PREV_SCH_START_DATE']) { - $recalculateDate = false; - } else { - $recalculateDate = true; - } - if (date('H:i:s', strtotime($_POST['form']['SCH_START_TIME']))==date('H:i:s', strtotime($_POST['form']['PREV_SCH_START_TIME']))){ - $recalculateTime = false; - } else { - $recalculateTime = true; - } -// if the start date has changed then recalculate the next run time - -// var_dump($recalculateTime); -// die(); - $nActualTime = $_POST['form']['SCH_START_TIME']; - if(($sOption!='1') && ($sOption!='4') && ($sOption!='5')) { - if ($sStartDay==''){ - $sStartDay = date('Y-m-d'); - } -// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; - $dCurrentDay = date("d"); - $dCurrentMonth = date("m"); - $aStartDay = explode( "|" , $aData['SCH_START_DAY'] ); - if($sOption=='3'&&$aStartDay[0]=='1'){ - $monthsArray = explode("|",$sMonths); - foreach ($monthsArray as $row){ - if ( $dCurrentMonth == $row && $dCurrentDay<$aStartDay[1] ){ - $startTime = $_POST['form']['SCH_START_TIME'].":00"; - if ($recalculateDate) { - $aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; - } else if ($recalculateTime){ - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun("Y-m-d"). " " . $_POST['form']['SCH_START_TIME'] . ":00"; - } - break; - } else { - if ($recalculateDate) { - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); - } else if ($recalculateTime){ - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun("Y-m-d"). " " . $_POST['form']['SCH_START_TIME'] . ":00"; - } - } - } - } else { - if ($recalculateDate) { - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); - } else if ($recalculateTime){ - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun("Y-m-d"). " " . $_POST['form']['SCH_START_TIME'] . ":00"; - } - } -// print_r ($aData['SCH_TIME_NEXT_RUN']); -// die; - } else { - if ($sOption=='4'){ - $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; - } - if ($recalculateDate) { - $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; - } else if ($recalculateTime){ - -// $Fields = $oCaseScheduler->Load($aData['SCH_UID']); -// $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE']; -// $Fields['SCH_STATE'] = 'PROCESSED'; -// $this->Update($Fields); - $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun("Y-m-d"). " " . $_POST['form']['SCH_START_TIME'] . ":00"; - } -// var_dump($recalculateTime); -// var_dump($aData['SCH_TIME_NEXT_RUN']); -// die; - if ($sOption=='5') { - $date = $oCaseScheduler->getSchLastRunTime(); - if ($date == null) { - $date = $oCaseScheduler->getSchStartTime(); - } - $date = strtotime($date); - $nextRun = $_POST['form']['SCH_REPEAT_EVERY']*60*60; - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; - $date += $nextRun; - $date = date("Y-m-d H:i", $date ); - $aData['SCH_TIME_NEXT_RUN'] = $date; - } - } - - if(!empty($_POST['form']['SCH_REPEAT_TASK_CHK'])){ - $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; - if($nOptEvery ==2) - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; - else - $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; - - - } -// var_dump ($aData['SCH_TIME_NEXT_RUN']); -// die; - $oCaseScheduler ->Update($aData); - if((isset($_POST['form']['CASE_SH_PLUGIN_UID']))&&($_POST['form']['CASE_SH_PLUGIN_UID']!="")){ - $params=explode("--",$_REQUEST ['form']['CASE_SH_PLUGIN_UID']); - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - $activePluginsForCaseScheduler=$oPluginRegistry->getCaseSchedulerPlugins(); - - foreach($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail){ - if(($caseSchedulerPluginDetail->sNamespace==$params[0])&&($caseSchedulerPluginDetail->sActionId==$params[1])){ - $caseSchedulerSelected=$caseSchedulerPluginDetail; - - } - } - if((isset($caseSchedulerSelected))&&(is_object($caseSchedulerSelected))){ - //Save the form - $oData=$_POST['pluginFields']; - $oData['SCH_UID'] =$aData['SCH_UID']; - $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); - } - } - - G::header('location: cases_Scheduler_List?PRO_UID='.$_POST['form']['PRO_UID']); - - -} -catch (Exception $oException) { - die($oException->getMessage()); -} -?> \ No newline at end of file + */ + + require_once 'classes/model/CaseScheduler.php'; + + if (empty( $_POST )) { + die( 'The information sended is empty!' ); + } + $aData['SCH_UID'] = $_POST['form']['SCH_UID']; + $aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; + $aData['PRO_UID'] = $_POST['form']['PRO_UID']; + $aData['TAS_UID'] = $_POST['form']['TAS_UID']; + + $oCaseScheduler = new CaseScheduler(); + $oCaseScheduler->Load( $aData['SCH_UID'] ); + + $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; + if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM') { + $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); + } + $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; + + // $aData['SCH_TIME_NEXT_RUN'] = time(); + //$aData['SCH_LAST_RUN_TIME'] = time(); + // $aData['SCH_STATE'] = 'ACTIVE'; + // $aData['SCH_LAST_STATE'] = 'ACTIVE'; + $aData['USR_UID'] = $_SESSION['USER_LOGGED']; + + $sOption = $_POST['form']['SCH_OPTION']; + $aData['SCH_OPTION'] = $sOption; + + $sDateTmp = $_POST['form']['SCH_START_DATE']; + $sTimeTmp = $_POST['form']['SCH_START_TIME']; + $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $previousStartTime = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) ); + $previousStartDate = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) ); + + $sValue = ''; + $sDaysPerformTask = ''; + $sWeeks = ''; + $sMonths = ''; + $sMonths = ''; + $sStartDay = ''; + $nSW = 0; + + switch ($sOption) { + case '1': // Option 1 + $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; + switch ($sValue) { + case '1': + $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; + break; + case '2': + $aData['SCH_OPTION'] = '2'; + $aData['SCH_EVERY_DAYS'] = '1'; + $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; + break; + case '3': // Every [n] Days + $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; + $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; + break; + } + break; + case '2': // If the option is zero, set by default 1 + if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) + $nEveryDays = 1; + else + $nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; + $aData['SCH_EVERY_DAYS'] = $nEveryDays; + $sWeeks = ''; + if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) { + $aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; + foreach ($aWeekDays as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) { + $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; + foreach ($aWeekDays2 as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + $sStartTime = $_POST['form']['SCH_START_TIME']; + $aData['SCH_WEEK_DAYS'] = $sWeeks; + break; + + case '3': + $nStartDay = $_POST['form']['SCH_START_DAY']; + if ($nStartDay == 1) { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; + } else { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; + } + + $sMonths = ''; + if (! empty( $_POST['form']['SCH_MONTHS'] )) { + $aMonths = $_POST['form']['SCH_MONTHS']; + foreach ($aMonths as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_MONTHS_2'] )) { + $aMonths2 = $_POST['form']['SCH_MONTHS_2']; + foreach ($aMonths2 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $_POST['form']['SCH_MONTHS_3'] )) { + $aMonths3 = $_POST['form']['SCH_MONTHS_3']; + foreach ($aMonths3 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + $aData['SCH_MONTHS'] = $sMonths; + $sStartDay = $aData['SCH_START_DAY']; + $sValue = $nStartDay; + break; + + } + if (trim( $_POST['form']['SCH_END_DATE'] ) != '') { + $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; + } + // if the start date has changed then recalculate the next run time + if ($_POST['form']['SCH_START_DATE'] == $_POST['form']['PREV_SCH_START_DATE']) { + $recalculateDate = false; + } else { + $recalculateDate = true; + } + if (date( 'H:i:s', strtotime( $_POST['form']['SCH_START_TIME'] ) ) == date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) )) { + $recalculateTime = false; + } else { + $recalculateTime = true; + } + // if the start date has changed then recalculate the next run time + + + // var_dump($recalculateTime); + // die(); + $nActualTime = $_POST['form']['SCH_START_TIME']; + if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { + if ($sStartDay == '') { + $sStartDay = date( 'Y-m-d' ); + } + // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; + $dCurrentDay = date( "d" ); + $dCurrentMonth = date( "m" ); + $aStartDay = explode( "|", $aData['SCH_START_DAY'] ); + if ($sOption == '3' && $aStartDay[0] == '1') { + $monthsArray = explode( "|", $sMonths ); + foreach ($monthsArray as $row) { + if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { + $startTime = $_POST['form']['SCH_START_TIME'] . ":00"; + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; + } else if ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + break; + } else { + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } else if ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + } + } + } else { + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } else if ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + } + // print_r ($aData['SCH_TIME_NEXT_RUN']); + // die; + } else { + if ($sOption == '4') { + $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; + } + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; + } else if ($recalculateTime) { + + // $Fields = $oCaseScheduler->Load($aData['SCH_UID']); + // $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE']; + // $Fields['SCH_STATE'] = 'PROCESSED'; + // $this->Update($Fields); + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + // var_dump($recalculateTime); + // var_dump($aData['SCH_TIME_NEXT_RUN']); + // die; + if ($sOption == '5') { + $date = $oCaseScheduler->getSchLastRunTime(); + if ($date == null) { + $date = $oCaseScheduler->getSchStartTime(); + } + $date = strtotime( $date ); + $nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60; + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; + $date += $nextRun; + $date = date( "Y-m-d H:i", $date ); + $aData['SCH_TIME_NEXT_RUN'] = $date; + } + } + + if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) { + $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; + if ($nOptEvery == 2) + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; + else + $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; + + } + // var_dump ($aData['SCH_TIME_NEXT_RUN']); + // die; + $oCaseScheduler->Update( $aData ); + if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) { + $params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] ); + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); + + foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { + if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { + $caseSchedulerSelected = $caseSchedulerPluginDetail; + + } + } + if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { + //Save the form + $oData = $_POST['pluginFields']; + $oData['SCH_UID'] = $aData['SCH_UID']; + $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); + } + } + + G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] ); + +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_ShowDocument.php b/workflow/engine/methods/cases/cases_ShowDocument.php index 010e1eb02..a77a39470 100755 --- a/workflow/engine/methods/cases/cases_ShowDocument.php +++ b/workflow/engine/methods/cases/cases_ShowDocument.php @@ -1,97 +1,89 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ /* * Created on 13-02-2008 * * @author David Callizaya - */ - -require_once ( "classes/model/AppDocumentPeer.php" ); - -$oAppDocument = new AppDocument(); -if(!isset($_GET['v'])){//Load last version of the document - $docVersion=$oAppDocument->getLastAppDocVersion($_GET['a']); -}else{ - $docVersion=$_GET['v']; -} -$oAppDocument->Fields = $oAppDocument->load($_GET['a'],$docVersion); - -$sAppDocUid = $oAppDocument->getAppDocUid(); -$iDocVersion = $oAppDocument->getDocVersion(); -$info = pathinfo( $oAppDocument->getAppDocFilename() ); -$ext = $info['extension']; - -if (isset($_GET['b'])) { - if ($_GET['b'] == '0') { - $bDownload = false; - } - else { - $bDownload = true; - } -} -else { - $bDownload = true; -} - - -$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid .'_'.$iDocVersion . '.' . $ext ; -$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '.' . $ext ; -$sw_file_exists=false; -if(file_exists($realPath)){ - $sw_file_exists=true; -}elseif(file_exists($realPath1)){ - $sw_file_exists=true; - $realPath=$realPath1; -} - -if(!$sw_file_exists){ - $error_message="'".$oAppDocument->Fields['APP_DOC_FILENAME']. "' ".G::LoadTranslation('ID_ERROR_STREAMING_FILE'); - if((isset($_POST['request']))&&($_POST['request']==true)){ - $res ['success'] = 'failure'; - $res ['message'] = $error_message; - print G::json_encode ( $res ); - }else{ - G::SendMessageText($error_message, "ERROR"); - $backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']); - G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]); - die; - } - -}else{ - if((isset($_POST['request']))&&($_POST['request']==true)){ - $res ['success'] = 'success'; - $res ['message'] = $oAppDocument->Fields['APP_DOC_FILENAME']; - print G::json_encode ( $res ); - }else{ - G::streamFile ( $realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME'] ); - } -} - - - - - - -?> \ No newline at end of file + */ + +require_once ("classes/model/AppDocumentPeer.php"); + +$oAppDocument = new AppDocument(); +if (! isset( $_GET['v'] )) { + //Load last version of the document + $docVersion = $oAppDocument->getLastAppDocVersion( $_GET['a'] ); +} else { + $docVersion = $_GET['v']; +} + +$oAppDocument->Fields = $oAppDocument->load( $_GET['a'], $docVersion ); + +$sAppDocUid = $oAppDocument->getAppDocUid(); +$iDocVersion = $oAppDocument->getDocVersion(); +$info = pathinfo( $oAppDocument->getAppDocFilename() ); +$ext = $info['extension']; + +if (isset( $_GET['b'] )) { + if ($_GET['b'] == '0') { + $bDownload = false; + } else { + $bDownload = true; + } +} else { + $bDownload = true; +} + +$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext; +$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '.' . $ext; +$sw_file_exists = false; +if (file_exists( $realPath )) { + $sw_file_exists = true; +} elseif (file_exists( $realPath1 )) { + $sw_file_exists = true; + $realPath = $realPath1; +} + +if (! $sw_file_exists) { + $error_message = "'" . $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation( 'ID_ERROR_STREAMING_FILE' ); + if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) { + $res['success'] = 'failure'; + $res['message'] = $error_message; + print G::json_encode( $res ); + } else { + G::SendMessageText( $error_message, "ERROR" ); + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + +} else { + if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) { + $res['success'] = 'success'; + $res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME']; + print G::json_encode( $res ); + } else { + G::streamFile( $realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME'] ); + } +} + diff --git a/workflow/engine/methods/cases/cases_generatePMTable.php b/workflow/engine/methods/cases/cases_generatePMTable.php index c1dd246b6..8385b8ff7 100755 --- a/workflow/engine/methods/cases/cases_generatePMTable.php +++ b/workflow/engine/methods/cases/cases_generatePMTable.php @@ -1,110 +1,100 @@ -'APP_UID'),array('FLD_NAME'=>'CON_NAME'),array('FLD_NAME'=>'CON_ADDR'),array('FLD_NAME'=>'_cedula')); - +$pmTableFields = array (array ('FLD_NAME' => 'APP_UID' +),array ('FLD_NAME' => 'CON_NAME' +),array ('FLD_NAME' => 'CON_ADDR' +),array ('FLD_NAME' => '_cedula' +) +); + // setting the data to assemble the table -$aData = array(); -$aData['ADD_TAB_NAME'] = $pmTableName; +$aData = array (); +$aData['ADD_TAB_NAME'] = $pmTableName; // creating the objects to create the table and records -$oFields = new Fields(); -$oAdditionalTables = new AdditionalTables(); - -$sAddTabUid = $oAdditionalTables->create($aData, $pmTableFields); - -foreach ($pmTableFields as $iRow => $aRow) { - $pmTableFields[$iRow]['FLD_NAME'] = strtoupper($aRow['FLD_NAME']); - $pmTableFields[$iRow]['FLD_DESCRIPTION'] = isset($aRow['FLD_DESCRIPTION']) ? $aRow['FLD_DESCRIPTION'] : $aRow['FLD_NAME']; - $pmTableFields[$iRow]['FLD_TYPE'] = isset($aRow['FLD_TYPE']) ? $aRow['FLD_TYPE'] : 'VARCHAR'; - $pmTableFields[$iRow]['FLD_SIZE'] = isset($aRow['FLD_SIZE']) ? $aRow['FLD_SIZE'] : '32'; - $pmTableFields[$iRow]['FLD_NULL'] = isset($aRow['FLD_NULL']) ? $aRow['FLD_NULL'] : 'off'; - $pmTableFields[$iRow]['FLD_AUTO_INCREMENT'] = isset($aRow['FLD_AUTO_INCREMENT']) ? $aRow['FLD_AUTO_INCREMENT'] : 'off'; - $pmTableFields[$iRow]['FLD_KEY'] = isset($aRow['FLD_KEY']) ? $aRow['FLD_KEY'] : 'off'; - $pmTableFields[$iRow]['FLD_FOREIGN_KEY'] = isset($aRow['FLD_FOREIGN_KEY']) ? $aRow['FLD_FOREIGN_KEY'] : 'off'; - $pmTableFields[$iRow]['FLD_FOREIGN_KEY_TABLE'] = isset($aRow['FLD_FOREIGN_KEY_TABLE']) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : ''; -} - -foreach ($pmTableFields as $iRow => $aRow) { - - $oFields->create(array('FLD_INDEX' => $iRow+1, - 'ADD_TAB_UID' => $sAddTabUid, - 'FLD_NAME' => $aRow['FLD_NAME'], - 'FLD_DESCRIPTION' => isset($aRow['FLD_DESCRIPTION']) ? $aRow['FLD_DESCRIPTION'] : '', - 'FLD_TYPE' => isset($aRow['FLD_TYPE']) ? $aRow['FLD_TYPE'] : 'VARCHAR', - 'FLD_SIZE' => isset($aRow['FLD_SIZE']) ? $aRow['FLD_SIZE'] : '32', - 'FLD_NULL' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0), - 'FLD_AUTO_INCREMENT' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0), - 'FLD_KEY' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0), - 'FLD_FOREIGN_KEY' => ($aRow['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0), - 'FLD_FOREIGN_KEY_TABLE' => isset($aRow['FLD_FOREIGN_KEY_TABLE']) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : '')); - - $aFields[] = array('sType' => isset($aRow['FLD_TYPE']) ? $aRow['FLD_TYPE'] : 'VARCHAR', - 'iSize' => isset($aRow['FLD_SIZE']) ? $aRow['FLD_SIZE'] : '32', - 'sFieldName' => $aRow['FLD_NAME'], - 'bNull' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0), - 'bAI' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0), - 'bPrimaryKey' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0)); -} - -$oAdditionalTables->createTable(strtoupper($pmTableName), 'wf', $aFields); -$oAdditionalTables->createPropelClasses(strtoupper($pmTableName), $pmTableName, $pmTableFields, $sAddTabUid); - -require_once ( "classes/model/Application.php" ); -require_once ( "classes/model/AdditionalTables.php" ); -require_once ( "classes/model/Fields.php" ); - - -$Criteria = new Criteria('workflow'); -$Criteria->addSelectColumn (ApplicationPeer::APP_UID); -$Criteria->addSelectColumn (ApplicationPeer::APP_DATA); - +$oFields = new Fields(); +$oAdditionalTables = new AdditionalTables(); + +$sAddTabUid = $oAdditionalTables->create( $aData, $pmTableFields ); + +foreach ($pmTableFields as $iRow => $aRow) { + $pmTableFields[$iRow]['FLD_NAME'] = strtoupper( $aRow['FLD_NAME'] ); + $pmTableFields[$iRow]['FLD_DESCRIPTION'] = isset( $aRow['FLD_DESCRIPTION'] ) ? $aRow['FLD_DESCRIPTION'] : $aRow['FLD_NAME']; + $pmTableFields[$iRow]['FLD_TYPE'] = isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR'; + $pmTableFields[$iRow]['FLD_SIZE'] = isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32'; + $pmTableFields[$iRow]['FLD_NULL'] = isset( $aRow['FLD_NULL'] ) ? $aRow['FLD_NULL'] : 'off'; + $pmTableFields[$iRow]['FLD_AUTO_INCREMENT'] = isset( $aRow['FLD_AUTO_INCREMENT'] ) ? $aRow['FLD_AUTO_INCREMENT'] : 'off'; + $pmTableFields[$iRow]['FLD_KEY'] = isset( $aRow['FLD_KEY'] ) ? $aRow['FLD_KEY'] : 'off'; + $pmTableFields[$iRow]['FLD_FOREIGN_KEY'] = isset( $aRow['FLD_FOREIGN_KEY'] ) ? $aRow['FLD_FOREIGN_KEY'] : 'off'; + $pmTableFields[$iRow]['FLD_FOREIGN_KEY_TABLE'] = isset( $aRow['FLD_FOREIGN_KEY_TABLE'] ) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : ''; +} + +foreach ($pmTableFields as $iRow => $aRow) { + + $oFields->create( array ('FLD_INDEX' => $iRow + 1,'ADD_TAB_UID' => $sAddTabUid,'FLD_NAME' => $aRow['FLD_NAME'],'FLD_DESCRIPTION' => isset( $aRow['FLD_DESCRIPTION'] ) ? $aRow['FLD_DESCRIPTION'] : '','FLD_TYPE' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','FLD_SIZE' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','FLD_NULL' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'FLD_AUTO_INCREMENT' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'FLD_KEY' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY' => ($aRow['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY_TABLE' => isset( $aRow['FLD_FOREIGN_KEY_TABLE'] ) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : '' + ) ); + + $aFields[] = array ('sType' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','iSize' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','sFieldName' => $aRow['FLD_NAME'],'bNull' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'bAI' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'bPrimaryKey' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0) + ); +} + +$oAdditionalTables->createTable( strtoupper( $pmTableName ), 'wf', $aFields ); +$oAdditionalTables->createPropelClasses( strtoupper( $pmTableName ), $pmTableName, $pmTableFields, $sAddTabUid ); + +require_once ("classes/model/Application.php"); +require_once ("classes/model/AdditionalTables.php"); +require_once ("classes/model/Fields.php"); + +$Criteria = new Criteria( 'workflow' ); +$Criteria->addSelectColumn( ApplicationPeer::APP_UID ); +$Criteria->addSelectColumn( ApplicationPeer::APP_DATA ); + // $Criteria->add (AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN'); -$oDataset = ApplicationPeer::doSelectRS($Criteria); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$oDataset->next(); -$aProcesses = array(); -$i = 0; -while ($aRow = $oDataset->getRow()) { - $appuid = $aRow['APP_UID']; - $data = unserialize ( $aRow['APP_DATA'] ); -$cedula = '234'. rand (1000,999999); -$nombre = 'nombre '. rand (1000,999999); -$direccion = 'direccion '. rand (1000,999999); - if ( isset ( $data['_cedula'] ) ) { - $cedula = $data['_cedula']; - $nombre = isset($data['_nombre']) ? $data['_nombre'] : ''; - $direccion = isset($data['_direccion']) ? $data['_direccion'] : ''; - print "$i $appuid $cedula
"; - } -// print_r ( $aRow); - $sql = "insert CONTENDERS VALUES ( '$appuid', '$nombre', '$direccion', '$cedula' )"; - - $con = Propel::getConnection('workflow'); - $stmt = $con->createStatement(); - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); - - $i++; -// if ( $i == 100 ) die; -/* if ( strpos ( $aRow['APP_DATA'], 'cedula' ) !== false ) { +$oDataset = ApplicationPeer::doSelectRS( $Criteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); +$oDataset->next(); +$aProcesses = array (); +$i = 0; +while ($aRow = $oDataset->getRow()) { + $appuid = $aRow['APP_UID']; + $data = unserialize( $aRow['APP_DATA'] ); + $cedula = '234' . rand( 1000, 999999 ); + $nombre = 'nombre ' . rand( 1000, 999999 ); + $direccion = 'direccion ' . rand( 1000, 999999 ); + if (isset( $data['_cedula'] )) { + $cedula = $data['_cedula']; + $nombre = isset( $data['_nombre'] ) ? $data['_nombre'] : ''; + $direccion = isset( $data['_direccion'] ) ? $data['_direccion'] : ''; + print "$i $appuid $cedula
"; + } + // print_r ( $aRow); + $sql = "insert CONTENDERS VALUES ( '$appuid', '$nombre', '$direccion', '$cedula' )"; + + $con = Propel::getConnection( 'workflow' ); + $stmt = $con->createStatement(); + $rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC ); + + $i ++; + // if ( $i == 100 ) die; + /* if ( strpos ( $aRow['APP_DATA'], 'cedula' ) !== false ) { print_r ( $aRow ); print "
"; $i++; if ( $i == 10 ) die; } -*/ - $oDataset->next(); -} -print "--$i--"; - -?> +*/ + $oDataset->next(); +} +print "--$i--"; + From 17631d0082864af488cbe4eb6cd9ba08e2abc639 Mon Sep 17 00:00:00 2001 From: Ralph Asendeteufrer Date: Thu, 18 Oct 2012 11:53:05 -0400 Subject: [PATCH 2/5] CODE STYLE files modified: conditionalShowHide.php conditionalShowHide_Ajax.php datemask.php dynaform_Fields.php dynaforms_Ajax.php dynaforms_AssignVariables.php dynaforms_ChoseType.php dynaforms_Delete.php dynaforms_Edit.php dynaforms_FlatEditor.php dynaforms_List.php dynaforms_NewPlugin.php dynaforms_PagedTableAjax.php dynaforms_Preview.php dynaforms_Save.php dynaforms_SaveProperties.php dynaforms_Save_as.php dynaforms_Saveas.php dynaforms_ToolbarAjax.php dynaforms_checkDependentFields.php fieldsGetterAjax.php fieldsHandler.php fieldsHandlerAjax.php fieldsHandlerViewer.php fields_Ajax.php fields_Delete.php fields_Edit.php fields_List.php fields_Order.php test.php --- .../methods/dynaforms/conditionalShowHide.php | 132 ++++----- .../dynaforms/conditionalShowHide_Ajax.php | 189 +++++------- .../engine/methods/dynaforms/datemask.php | 33 +-- .../methods/dynaforms/dynaform_Fields.php | 73 ++--- .../methods/dynaforms/dynaforms_Ajax.php | 15 +- .../dynaforms/dynaforms_AssignVariables.php | 23 +- .../methods/dynaforms/dynaforms_ChoseType.php | 2 +- .../methods/dynaforms/dynaforms_Delete.php | 270 +++++++++--------- .../methods/dynaforms/dynaforms_Edit.php | 93 +++--- .../dynaforms/dynaforms_FlatEditor.php | 267 ++++++++--------- .../methods/dynaforms/dynaforms_List.php | 53 ++-- .../methods/dynaforms/dynaforms_NewPlugin.php | 81 +++--- .../dynaforms/dynaforms_PagedTableAjax.php | 223 ++++++++------- .../methods/dynaforms/dynaforms_Preview.php | 79 +++-- .../methods/dynaforms/dynaforms_Save.php | 148 +++++----- .../dynaforms/dynaforms_SaveProperties.php | 81 +++--- .../methods/dynaforms/dynaforms_Save_as.php | 215 +++++++------- .../methods/dynaforms/dynaforms_Saveas.php | 91 +++--- .../dynaforms/dynaforms_ToolbarAjax.php | 38 +-- .../dynaforms_checkDependentFields.php | 186 ++++++------ .../methods/dynaforms/fieldsGetterAjax.php | 168 ++++++----- .../methods/dynaforms/fieldsHandler.php | 30 +- .../methods/dynaforms/fieldsHandlerAjax.php | 179 ++++++------ .../methods/dynaforms/fieldsHandlerViewer.php | 30 +- .../engine/methods/dynaforms/fields_Ajax.php | 167 ++++++----- .../methods/dynaforms/fields_Delete.php | 68 ++--- .../engine/methods/dynaforms/fields_Edit.php | 259 ++++++++--------- .../engine/methods/dynaforms/fields_List.php | 47 ++- .../engine/methods/dynaforms/fields_Order.php | 134 ++++----- workflow/engine/methods/dynaforms/test.php | 76 ++--- 30 files changed, 1683 insertions(+), 1767 deletions(-) diff --git a/workflow/engine/methods/dynaforms/conditionalShowHide.php b/workflow/engine/methods/dynaforms/conditionalShowHide.php index 49a56d2c5..996b63102 100755 --- a/workflow/engine/methods/dynaforms/conditionalShowHide.php +++ b/workflow/engine/methods/dynaforms/conditionalShowHide.php @@ -1,8 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * 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 Aug 26th, 2009 + * @Date Aug 26th, 2009 */ - require_once "classes/model/FieldCondition.php"; - G::LoadClass('ArrayPeer'); - - $G_PUBLISH = new Publisher; - $oHeadPublisher =& headPublisher::getSingleton(); - $DISPLAY_MAX_SIZE = 25; - global $_DBArray; - - $oFieldCondition = new FieldCondition; - $DYN_UID = $_SESSION['Current_Dynafom']['Parameters']['DYN_UID']; - $aRows = $oFieldCondition->getAllByDynUid($DYN_UID); - - $aFieldNames = Array( - 'FCD_NRO', - 'FCD_UID', - 'FCD_FUNCTION', - 'FCD_FIELDS', - 'FCD_CONDITION', - 'FCD_EVENTS', - 'FCD_EVENT_OWNERS', - 'FCD_STATUS', - 'FCD_DYN_UID' - ); - - //Routines to limit the show in list max size for some fields that can have large size - $inndex = 0; - $aRowsTmp = Array(); - foreach($aRows as $aRow){ - $aRow['FCD_NRO'] = ++$inndex; - if( strlen($aRow['FCD_FIELDS']) > $DISPLAY_MAX_SIZE ){ - $aRow['FCD_FIELDS'] = substr($aRow['FCD_FIELDS'], 0, $DISPLAY_MAX_SIZE) . '...'; - } - - if( $aRow['FCD_FUNCTION'] == 'showAll' || $aRow['FCD_FUNCTION'] == 'hideAll' ){ - $aRow['FCD_FIELDS'] = 'ALL'; - } - - if( strlen($aRow['FCD_CONDITION']) > $DISPLAY_MAX_SIZE ){ - $aRow['FCD_CONDITION'] = substr($aRow['FCD_CONDITION'], 0, $DISPLAY_MAX_SIZE) . '...'; - } - if( strlen($aRow['FCD_EVENT_OWNERS']) > $DISPLAY_MAX_SIZE ){ - $aRow['FCD_EVENT_OWNERS'] = substr($aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE) . '...'; - } - array_push($aRowsTmp, $aRow); - } - - $aRows = array_merge(Array($aFieldNames), $aRowsTmp); - - $_DBArray['virtual_pmtable'] = $aRows; - $_SESSION['_DBArray'] = $_DBArray; - - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('virtual_pmtable'); - - $oHeadPublisher->addScriptFile('/jscore/dynaforms/dynaforms_conditionalShowHide.js'); - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ConditionalShowHideList', $oCriteria, Array('DYN_UID'=>$DYN_UID), ''); - G::RenderPage('publish', 'raw'); +require_once "classes/model/FieldCondition.php"; +G::LoadClass( 'ArrayPeer' ); +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); +$DISPLAY_MAX_SIZE = 25; +global $_DBArray; + +$oFieldCondition = new FieldCondition(); +$DYN_UID = $_SESSION['Current_Dynafom']['Parameters']['DYN_UID']; +$aRows = $oFieldCondition->getAllByDynUid( $DYN_UID ); + +$aFieldNames = Array ('FCD_NRO','FCD_UID','FCD_FUNCTION','FCD_FIELDS','FCD_CONDITION','FCD_EVENTS','FCD_EVENT_OWNERS','FCD_STATUS','FCD_DYN_UID' ); + +//Routines to limit the show in list max size for some fields that can have large size +$inndex = 0; +$aRowsTmp = Array (); +foreach ($aRows as $aRow) { + $aRow['FCD_NRO'] = ++ $inndex; + if (strlen( $aRow['FCD_FIELDS'] ) > $DISPLAY_MAX_SIZE) { + $aRow['FCD_FIELDS'] = substr( $aRow['FCD_FIELDS'], 0, $DISPLAY_MAX_SIZE ) . '...'; + } + + if ($aRow['FCD_FUNCTION'] == 'showAll' || $aRow['FCD_FUNCTION'] == 'hideAll') { + $aRow['FCD_FIELDS'] = 'ALL'; + } + + if (strlen( $aRow['FCD_CONDITION'] ) > $DISPLAY_MAX_SIZE) { + $aRow['FCD_CONDITION'] = substr( $aRow['FCD_CONDITION'], 0, $DISPLAY_MAX_SIZE ) . '...'; + } + if (strlen( $aRow['FCD_EVENT_OWNERS'] ) > $DISPLAY_MAX_SIZE) { + $aRow['FCD_EVENT_OWNERS'] = substr( $aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE ) . '...'; + } + array_push( $aRowsTmp, $aRow ); +} + +$aRows = array_merge( Array ($aFieldNames), $aRowsTmp ); + +$_DBArray['virtual_pmtable'] = $aRows; +$_SESSION['_DBArray'] = $_DBArray; + +$oCriteria = new Criteria( 'dbarray' ); +$oCriteria->setDBArrayTable( 'virtual_pmtable' ); + +$oHeadPublisher->addScriptFile( '/jscore/dynaforms/dynaforms_conditionalShowHide.js' ); +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dynaforms/dynaforms_ConditionalShowHideList', $oCriteria, Array ('DYN_UID' => $DYN_UID), '' ); +G::RenderPage( 'publish', 'raw' ); - - - - - - - - - - \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php index bed35c137..e566da925 100755 --- a/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php +++ b/workflow/engine/methods/dynaforms/conditionalShowHide_Ajax.php @@ -1,8 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ /* @@ -26,141 +25,111 @@ * @Date Feb 12th, 2010 */ try { - if(!isset($_POST['request'])) { - throw new Exception('No request set'); + if (! isset( $_POST['request'] )) { + throw new Exception( 'No request set' ); } $request = $_POST['request']; $G_PUBLISH = new Publisher(); - switch($request) { + switch ($request) { case 'new': - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', ''); - G::RenderPage('publish', 'raw'); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', '' ); + G::RenderPage( 'publish', 'raw' ); break; - case 'edit': require_once 'classes/model/FieldCondition.php'; $oFieldCondition = new FieldCondition(); - $aRow = $oFieldCondition->get($_POST['FCD_UID']); - $aData = Array(); + $aRow = $oFieldCondition->get( $_POST['FCD_UID'] ); + $aData = Array (); $aData['condition'] = 'neyek'; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', $aRow); - G::RenderPage('publish', 'raw'); - + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', $aRow ); + G::RenderPage( 'publish', 'raw' ); //echo ''; break; - case 'getDynaFieds': - G::LoadThirdParty('pear/json', 'class.json'); - G::LoadSystem('dynaformhandler'); - + G::LoadThirdParty( 'pear/json', 'class.json' ); + G::LoadSystem( 'dynaformhandler' ); + $_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE']; - $sFilter = isset($_POST['filter']) ? $_POST['filter'] : ''; - + $sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : ''; + $oJSON = new Services_JSON(); - $oDynaformHandler = new dynaFormHandler(PATH_DYNAFORM . $_DYN_FILENAME . '.xml'); - - $aFilter = explode(',', $sFilter); - - $aAvailableFields = $oDynaformHandler->getFieldNames($aFilter); - - print($oJSON->encode($aAvailableFields)); + $oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' ); + + $aFilter = explode( ',', $sFilter ); + + $aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter ); + + print ($oJSON->encode( $aAvailableFields )) ; break; - case 'showDynavars': - G::LoadSystem('dynaformhandler'); - + G::LoadSystem( 'dynaformhandler' ); + $_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE']; - $sFilter = isset($_POST['filter']) ? $_POST['filter'] : ''; - - $oDynaformHandler = new dynaFormHandler(PATH_DYNAFORM . $_DYN_FILENAME . '.xml'); - $aFilter = explode(',', $sFilter); - $aAvailableFields = $oDynaformHandler->getFieldNames($aFilter); - - $aFieldNames = Array( - 'id' => 'char', - 'name' => 'char' - ); - - $aRows = Array(); - foreach( $aAvailableFields as $sFieldname ) { - array_push($aRows, Array( - 'id' => $sFieldname, - 'name' => $sFieldname - )); + $sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : ''; + + $oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' ); + $aFilter = explode( ',', $sFilter ); + $aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter ); + + $aFieldNames = Array ('id' => 'char','name' => 'char' ); + + $aRows = Array (); + foreach ($aAvailableFields as $sFieldname) { + array_push( $aRows, Array ('id' => $sFieldname,'name' => $sFieldname) ); } - - $rows = array_merge(Array( - $aFieldNames - ), $aRows); - + + $rows = array_merge( Array ($aFieldNames), $aRows ); + global $_DBArray; $_DBArray['DYNAFIELDS'] = $rows; $_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('ArrayPeer'); - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('DYNAFIELDS'); - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_vars', '', ''); - G::RenderPage('publish', 'raw'); - + G::LoadClass( 'ArrayPeer' ); + $oCriteria = new Criteria( 'dbarray' ); + $oCriteria->setDBArrayTable( 'DYNAFIELDS' ); + + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_vars', '', '' ); + G::RenderPage( 'publish', 'raw' ); break; - case 'testSetup': $sFields = $_POST['sFields']; - $aFields = Array(); - $aFieldsTmp = ($sFields == '') ? Array() : explode(',', $sFields); - + $aFields = Array (); + $aFieldsTmp = ($sFields == '') ? Array () : explode( ',', $sFields ); + $i = 1; - foreach( $aFieldsTmp as $aField ) { - $aFields['gFields'][$i ++] = Array( - 'dynaid' => $aField, - 'dynafield' => $aField, - 'dynavalue' => '' + foreach ($aFieldsTmp as $aField) { + $aFields['gFields'][$i ++] = Array ('dynaid' => $aField,'dynafield' => $aField,'dynavalue' => '' ); } - - if(sizeof($aFields) > 0) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHideTest', '', $aFields); - G::RenderPage('publish', 'raw'); + + if (sizeof( $aFields ) > 0) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHideTest', '', $aFields ); + G::RenderPage( 'publish', 'raw' ); } else { - print('false'); + print ('false') ; } break; - case 'save': require_once 'classes/model/FieldCondition.php'; $oFieldCondition = new FieldCondition(); $aDYN = $_SESSION['Current_Dynafom']['Parameters']; - $_POST['FCD_UID'] = ($_POST['FCD_UID']=='0') ? '' : $_POST['FCD_UID']; - $aData = Array( - 'FCD_UID' => Isset($_POST['FCD_UID'])?$_POST['FCD_UID']:'', - 'FCD_FUNCTION' => $_POST['function'], - 'FCD_FIELDS' => $_POST['fields_selected'], - 'FCD_CONDITION' => $_POST['condition'], - 'FCD_EVENTS' => $_POST['events'], - 'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'], - 'FCD_STATUS' => $_POST['enabled'], - 'FCD_DYN_UID' => $aDYN['DYN_UID'] - ); - - $oFieldCondition->quickSave($aData); + $_POST['FCD_UID'] = ($_POST['FCD_UID'] == '0') ? '' : $_POST['FCD_UID']; + $aData = Array ('FCD_UID' => Isset( $_POST['FCD_UID'] ) ? $_POST['FCD_UID'] : '','FCD_FUNCTION' => $_POST['function'],'FCD_FIELDS' => $_POST['fields_selected'],'FCD_CONDITION' => $_POST['condition'],'FCD_EVENTS' => $_POST['events'],'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'],'FCD_STATUS' => $_POST['enabled'],'FCD_DYN_UID' => $aDYN['DYN_UID']); + $oFieldCondition->quickSave( $aData ); break; - case 'delete': require_once 'classes/model/FieldCondition.php'; - $oFieldCondition = FieldConditionPeer::retrieveByPk($_POST['FCD_UID']); - if( is_object($oFieldCondition) ){ + $oFieldCondition = FieldConditionPeer::retrieveByPk( $_POST['FCD_UID'] ); + if (is_object( $oFieldCondition )) { $oFieldCondition->delete(); } break; - } -} catch( Exception $e) { - print($e->getMessage()); +} catch (Exception $e) { + print ($e->getMessage()) ; } -/* +/* *
Array
 (
     [request] => save
@@ -182,24 +151,4 @@ try {
 )
 
*/ - - - - - - - - - - - - - - - - - - - - - + diff --git a/workflow/engine/methods/dynaforms/datemask.php b/workflow/engine/methods/dynaforms/datemask.php index ef824c352..72f72d26b 100755 --- a/workflow/engine/methods/dynaforms/datemask.php +++ b/workflow/engine/methods/dynaforms/datemask.php @@ -1,4 +1,4 @@ -. + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ //if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('dynaFormField'); - - // if (!(isset($_GET['A']) && $_GET['A']!=='')) return; - - // $file = G::decrypt( $_GET['A'] , URL_KEY ); - $file='datemask'; +//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/datemask','',''); - //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax'); - G::RenderPage( "publish" , "raw" ); -?> \ No newline at end of file +G::LoadClass( 'dynaFormField' ); + +// if (!(isset($_GET['A']) && $_GET['A']!=='')) return; + + +// $file = G::decrypt( $_GET['A'] , URL_KEY ); +$file = 'datemask'; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/datemask', '', '' ); +//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax'); +G::RenderPage( "publish", "raw" ); + diff --git a/workflow/engine/methods/dynaforms/dynaform_Fields.php b/workflow/engine/methods/dynaforms/dynaform_Fields.php index a85bbbc51..e5a1b1e00 100755 --- a/workflow/engine/methods/dynaforms/dynaform_Fields.php +++ b/workflow/engine/methods/dynaforms/dynaform_Fields.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('xmlDb'); - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'processes'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = 'DYNAFORMS'; - $dbc = new DBConnection(); - $ses = new DBSession($dbc); +G::LoadClass( 'xmlDb' ); - $xdbc = new DBConnection( PATH_XMLFORM . 'dynaforms/dynaform_Fields.xml' ,'','','','myxml' ); - $xses = new DBSession($xdbc); +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'processes'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS'; - $res = $xses->execute('SELECT * FROM dynaForm'); - for($r=0 ; $r < $res->count() ; $r ++ ){ +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); + +$xdbc = new DBConnection( PATH_XMLFORM . 'dynaforms/dynaform_Fields.xml', '', '', '', 'myxml' ); +$xses = new DBSession( $xdbc ); + +$res = $xses->execute( 'SELECT * FROM dynaForm' ); +for ($r = 0; $r < $res->count(); $r ++) { $row = $res->read(); -// var_dump( $row );echo('
'); - } + // var_dump( $row );echo('
'); +} - define('DB_XMLDB_HOST', PATH_XMLFORM . 'dynaforms/dynaforms_List.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); - +define( 'DB_XMLDB_HOST', PATH_XMLFORM . 'dynaforms/dynaforms_List.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); - $G_PUBLISH = new Publisher; - - $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/dynaform_Fields', '', array('SYS_LANG' => SYS_LANG) , 'dynaforms_Save', 'dynaforms_PagedTableAjax'); - - G::RenderPage( "publish" ); +$G_PUBLISH = new Publisher(); + +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/dynaform_Fields', '', array ('SYS_LANG' => SYS_LANG +), 'dynaforms_Save', 'dynaforms_PagedTableAjax' ); + +G::RenderPage( "publish" ); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php index 0eb34d50b..95f286f96 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php @@ -12,15 +12,14 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ /* * Created on 07/01/2008 @@ -28,11 +27,11 @@ * @author David Callizaya */ global $_DBArray; -if (!isset($_DBArray)) { - $_DBArray = array(); +if (! isset( $_DBArray )) { + $_DBArray = array (); } -G::LoadClass('dynaformEditor'); -$oDynaformEditorAjax = new dynaformEditorAjax($_POST); +G::LoadClass( 'dynaformEditor' ); +$oDynaformEditorAjax = new dynaformEditorAjax( $_POST ); //if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; // @@ -226,4 +225,4 @@ $oDynaformEditorAjax = new dynaformEditorAjax($_POST); // break; // } // -?> \ No newline at end of file + diff --git a/workflow/engine/methods/dynaforms/dynaforms_AssignVariables.php b/workflow/engine/methods/dynaforms/dynaforms_AssignVariables.php index 66a37e2d7..63da2df8a 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_AssignVariables.php +++ b/workflow/engine/methods/dynaforms/dynaforms_AssignVariables.php @@ -1,29 +1,28 @@ load($_POST['ADD_TABLE'], true); +$aData = $oAdditionalTables->load( $_POST['ADD_TABLE'], true ); $addTabName = $aData['ADD_TAB_NAME']; $c = 1; foreach ($aData['FIELDS'] as $iRow => $aRow) { if ($aRow['FLD_KEY'] == 1) { $aRow['PRO_VARIABLE'] = ''; - $aFields['FIELDS'][$c++] = $aRow; + $aFields['FIELDS'][$c ++] = $aRow; } } -$aFields['DYN_UID'] = $_POST['DYN_UID']; +$aFields['DYN_UID'] = $_POST['DYN_UID']; $aFields['ADD_TABLE'] = $_POST['ADD_TABLE']; -$aFields['PRO_UID'] = $_POST['PRO_UID']; +$aFields['PRO_UID'] = $_POST['PRO_UID']; $aFields['DYN_TITLE'] = $_POST['DYN_TITLE']; -$aFields['DYN_TYPE'] = $_POST['DYN_TYPE']; -$aFields['DYN_DESCRIPTION'] = $_POST['DYN_DESCRIPTION']; -$aFields['VALIDATION_MESSAGE'] = G::LoadTranslation('ID_FILL_PRIMARY_KEYS'); +$aFields['DYN_TYPE'] = $_POST['DYN_TYPE']; +$aFields['DYN_DESCRIPTION'] = $_POST['DYN_DESCRIPTION']; +$aFields['VALIDATION_MESSAGE'] = G::LoadTranslation( 'ID_FILL_PRIMARY_KEYS' ); -G::LoadClass('xmlfield_InputPM'); +G::LoadClass( 'xmlfield_InputPM' ); $G_PUBLISH = new Publisher(); -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_AssignVariables', '', $aFields, - SYS_URI . 'dynaforms/dynaforms_Save'); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_AssignVariables', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' ); -G::RenderPage('publish-raw', 'raw'); +G::RenderPage( 'publish-raw', 'raw' ); diff --git a/workflow/engine/methods/dynaforms/dynaforms_ChoseType.php b/workflow/engine/methods/dynaforms/dynaforms_ChoseType.php index b5a285753..ad2ec161d 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_ChoseType.php +++ b/workflow/engine/methods/dynaforms/dynaforms_ChoseType.php @@ -6,4 +6,4 @@ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ChoseType', '', $aFields , SYS_URI.'dynaforms/dynaforms_Edit'); G::RenderPage( "publish-raw" , "raw" ); -?> + diff --git a/workflow/engine/methods/dynaforms/dynaforms_Delete.php b/workflow/engine/methods/dynaforms/dynaforms_Delete.php index 979ec2ef5..e9787929d 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Delete.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Delete.php @@ -12,167 +12,167 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} -require_once('classes/model/Dynaform.php'); +require_once ('classes/model/Dynaform.php'); require_once 'classes/model/ObjectPermission.php'; require_once 'classes/model/Step.php'; require_once 'classes/model/StepSupervisor.php'; require_once 'classes/model/CaseTrackerObject.php'; -/* +/* In here we are deleting all datas about this Dynaform into DB */ -if(isset($_POST['function'])) - $sfunction =$_POST['function']; -else - $sfunction =$_POST['functions']; - - switch($sfunction){ +if (isset( $_POST['function'] )) { + $sfunction = $_POST['function']; +} else { + $sfunction = $_POST['functions']; +} - case 'getRelationInfDynaform': - $oStepSupervisor = new StepSupervisor(); - $fields2=$oStepSupervisor->loadInfo($_POST['DYN_UID']); - $result=false; - if(is_array($fields2)){ - $result=true; - } - return print $result; - break; - - case 'getDynaformAssign': - $oStep = new Step(); - $aDependent=$oStep->loadInfoAssigDynaform($_POST['PRO_UID'],$_POST['DYN_UID']); - $result=false; - if(is_array($aDependent)){ - $result=true; - } - return print $result; - break; - - case 'deleteDynaform': - $dynaform = new dynaform(); - - if (!isset($_POST['DYN_UID'])) return; - //in table dynaform - $dynaform->remove( $_POST['DYN_UID'] ); - - //in table Step - $oStep = new Step(); - $oStep->removeStep('DYNAFORM', $_POST['DYN_UID']); - - //in table ObjectPermission - $oOP = new ObjectPermission(); - $oOP->removeByObject('DYNAFORM', $_POST['DYN_UID']); - - //in table Step_supervisor - $oSS = new StepSupervisor(); - $oSS->removeByObject('DYNAFORM', $_POST['DYN_UID']); - - //in table case_tracker_object - $oCTO = new CaseTrackerObject(); - $oCTO->removeByObject('DYNAFORM', $_POST['DYN_UID']); - break; - - /** erik: new and improved methods */ - case 'getDynaformSupervisorRelations': - try { - $oStepSupervisor = new StepSupervisor(); - $DYN_UIDS = explode(',', $_POST['DYN_UID']); - - $result->passed = true; - foreach($DYN_UIDS as $i=>$DYN_UID) { - $relationsList = $oStepSupervisor->loadInfo($DYN_UID); - if( is_array($relationsList) ) { - $result->passed = false; - break; +switch ($sfunction) { + case 'getRelationInfDynaform': + $oStepSupervisor = new StepSupervisor(); + $fields2 = $oStepSupervisor->loadInfo( $_POST['DYN_UID'] ); + $result = false; + if (is_array( $fields2 )) { + $result = true; } - } - - $result->success = true; - $result->msg = $result->passed ? '' : G::LoadTranslation('ID_DYNAFORM_SUPERVISOR_RELATION_EXISTS'); - } catch (Exception $e) { - $result->success = false; - $result->passed = false; - $result->msg = $e->getMessage(); - } - - print G::json_encode($result); - break; - - case 'getDynaformTaskRelations': - try { - $oStepSupervisor = new StepSupervisor(); - $DYN_UIDS = explode(',', $_POST['DYN_UID']); - $results = Array(); - - $result->passed = true; - foreach($DYN_UIDS as $i=>$DYN_UID) { + return print $result; + break; + case 'getDynaformAssign': $oStep = new Step(); - $aDependent = $oStep->loadInfoAssigDynaform($_POST['PRO_UID'], $DYN_UID); - if( is_array($aDependent) ) { - $result->passed = false; - break; + $aDependent = $oStep->loadInfoAssigDynaform( $_POST['PRO_UID'], $_POST['DYN_UID'] ); + $result = false; + if (is_array( $aDependent )) { + $result = true; } - } - - $result->success = true; - $result->msg = $result->passed ? '' : G::LoadTranslation('ID_DYNAFORM_TASK_RELATION_EXISTS'); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } + return print $result; + break; + case 'deleteDynaform': + $dynaform = new dynaform(); - print G::json_encode($result); - break; + if (! isset( $_POST['DYN_UID'] )) { + return; + } + //in table dynaform + $dynaform->remove( $_POST['DYN_UID'] ); - case 'removeDynaform': - try { - if ( ! isset($_POST['DYN_UID']) ) - throw new Exception('DYN_UID was not set!'); + //in table Step + $oStep = new Step(); + $oStep->removeStep( 'DYNAFORM', $_POST['DYN_UID'] ); - $DYN_UIDS = explode(',', $_POST['DYN_UID']); + //in table ObjectPermission + $oOP = new ObjectPermission(); + $oOP->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] ); - foreach($DYN_UIDS as $i=>$DYN_UID) { - $dynaform = new dynaform(); - //in table dynaform - $dynaform->remove( $DYN_UID ); + //in table Step_supervisor + $oSS = new StepSupervisor(); + $oSS->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] ); - //in table Step - $oStep = new Step(); - $oStep->removeStep('DYNAFORM', $DYN_UID); + //in table case_tracker_object + $oCTO = new CaseTrackerObject(); + $oCTO->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] ); + break; - //in table ObjectPermission - $oOP = new ObjectPermission(); - $oOP->removeByObject('DYNAFORM', $DYN_UID); + /** + * erik: new and improved methods + */ + case 'getDynaformSupervisorRelations': + try { + $oStepSupervisor = new StepSupervisor(); + $DYN_UIDS = explode( ',', $_POST['DYN_UID'] ); - //in table Step_supervisor - $oSS = new StepSupervisor(); - $oSS->removeByObject('DYNAFORM', $DYN_UID); + $result->passed = true; + foreach ($DYN_UIDS as $i => $DYN_UID) { + $relationsList = $oStepSupervisor->loadInfo( $DYN_UID ); + if (is_array( $relationsList )) { + $result->passed = false; + break; + } + } - //in table case_tracker_object - $oCTO = new CaseTrackerObject(); - $oCTO->removeByObject('DYNAFORM', $DYN_UID); - } - - $result->success = true; - $result->msg = G::LoadTranslation('ID_DYNAFORM_REMOVED'); - } catch (Exception $e) { - $result->success = false; - $result->msg = $e->getMessage(); - } + $result->success = true; + $result->msg = $result->passed ? '' : G::LoadTranslation( 'ID_DYNAFORM_SUPERVISOR_RELATION_EXISTS' ); + } catch (Exception $e) { + $result->success = false; + $result->passed = false; + $result->msg = $e->getMessage(); + } + print G::json_encode( $result ); + break; + case 'getDynaformTaskRelations': + try { + $oStepSupervisor = new StepSupervisor(); + $DYN_UIDS = explode( ',', $_POST['DYN_UID'] ); + $results = Array (); + + $result->passed = true; + foreach ($DYN_UIDS as $i => $DYN_UID) { + $oStep = new Step(); + $aDependent = $oStep->loadInfoAssigDynaform( $_POST['PRO_UID'], $DYN_UID ); + if (is_array( $aDependent )) { + $result->passed = false; + break; + } + } + + $result->success = true; + $result->msg = $result->passed ? '' : G::LoadTranslation( 'ID_DYNAFORM_TASK_RELATION_EXISTS' ); + } catch (Exception $e) { + $result->success = false; + $result->msg = $e->getMessage(); + } + print G::json_encode( $result ); + break; + case 'removeDynaform': + try { + if (! isset( $_POST['DYN_UID'] )) { + throw new Exception( 'DYN_UID was not set!' ); + } + + $DYN_UIDS = explode( ',', $_POST['DYN_UID'] ); + + foreach ($DYN_UIDS as $i => $DYN_UID) { + $dynaform = new dynaform(); + //in table dynaform + $dynaform->remove( $DYN_UID ); + + //in table Step + $oStep = new Step(); + $oStep->removeStep( 'DYNAFORM', $DYN_UID ); + + //in table ObjectPermission + $oOP = new ObjectPermission(); + $oOP->removeByObject( 'DYNAFORM', $DYN_UID ); + + //in table Step_supervisor + $oSS = new StepSupervisor(); + $oSS->removeByObject( 'DYNAFORM', $DYN_UID ); + + //in table case_tracker_object + $oCTO = new CaseTrackerObject(); + $oCTO->removeByObject( 'DYNAFORM', $DYN_UID ); + } + + $result->success = true; + $result->msg = G::LoadTranslation( 'ID_DYNAFORM_REMOVED' ); + } catch (Exception $e) { + $result->success = false; + $result->msg = $e->getMessage(); + } + print G::json_encode( $result ); + break; +} - print G::json_encode($result); - break; - } \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_Edit.php b/workflow/engine/methods/dynaforms/dynaforms_Edit.php index 747a1cd9b..e7171fe96 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Edit.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Edit.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - require_once('classes/model/Dynaform.php'); - require_once('classes/model/AdditionalTables.php'); - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME); - $oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL); +require_once ('classes/model/Dynaform.php'); +require_once ('classes/model/AdditionalTables.php'); - $oDataset = AdditionalTablesPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->addSelectColumn( AdditionalTablesPeer::ADD_TAB_UID ); +$oCriteria->addSelectColumn( AdditionalTablesPeer::ADD_TAB_NAME ); +$oCriteria->add( AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL ); - $aTablesList = Array(); - array_push($aTablesList, array('ADD_TAB_UID'=>'','ADD_TAB_NAME'=>'----------------')); - while ( $oDataset->next() ) { - array_push($aTablesList, $oDataset->getRow()); - } +$oDataset = AdditionalTablesPeer::doSelectRS( $oCriteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $filedNames = Array ( - "ADD_TAB_UID", - "ADD_TAB_NAME", - ); +$aTablesList = Array (); +array_push( $aTablesList, array ('ADD_TAB_UID' => '','ADD_TAB_NAME' => '----------------') ); +while ($oDataset->next()) { + array_push( $aTablesList, $oDataset->getRow() ); +} - $aTablesList = array_merge(Array($filedNames), $aTablesList); +$filedNames = Array ("ADD_TAB_UID","ADD_TAB_NAME"); - $_DBArray ['ADDITIONAL_TABLES'] = $aTablesList; - $_SESSION['_DBArray'] = $_DBArray; +$aTablesList = array_merge( Array ($filedNames), $aTablesList ); - $dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):''; - $dynaform = new dynaform(); - if ($dynUid=='') - { - $aFields['DYN_UID']= $dynUid ; - } - else - { - $aFields=$dynaform->load( $dynUid ); - } - $aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID']; +$_DBArray['ADDITIONAL_TABLES'] = $aTablesList; +$_SESSION['_DBArray'] = $_DBArray; + +$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : ''; +$dynaform = new dynaform(); +if ($dynUid == '') { + $aFields['DYN_UID'] = $dynUid; +} else { + $aFields = $dynaform->load( $dynUid ); +} +$aFields['PRO_UID'] = isset( $dynaform->Fields['PRO_UID'] ) ? $dynaform->Fields['PRO_UID'] : $_GET['PRO_UID']; + +$aFields['ACTION'] = isset( $_GET['ACTION'] ) ? $_GET['ACTION'] : ''; +//$aFields['READ_ONLY'] = ($_GET['ACTION']=='normal')?0:1; +G::LoadClass( 'xmlfield_InputPM' ); +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' ); + +G::RenderPage( "publish-raw", "raw" ); - $aFields['ACTION'] = isset($_GET['ACTION'])?$_GET['ACTION']:''; - //$aFields['READ_ONLY'] = ($_GET['ACTION']=='normal')?0:1; - G::LoadClass('xmlfield_InputPM'); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save'); - - G::RenderPage( "publish-raw" , "raw" ); diff --git a/workflow/engine/methods/dynaforms/dynaforms_FlatEditor.php b/workflow/engine/methods/dynaforms/dynaforms_FlatEditor.php index a8999136e..742b5f6c7 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_FlatEditor.php +++ b/workflow/engine/methods/dynaforms/dynaforms_FlatEditor.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('toolBar'); - G::LoadClass('dynaFormField'); - G::LoadClass('process'); - G::LoadClass('dynaform'); - //G::LoadClass('configuration'); - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'processes'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = 'FIELDS'; +G::LoadClass( 'toolBar' ); +G::LoadClass( 'dynaFormField' ); +G::LoadClass( 'process' ); +G::LoadClass( 'dynaform' ); +//G::LoadClass('configuration'); - $dbc = new DBConnection(); - $ses = new DBSession($dbc); - - //Hardcode: UID of the library by default - $PRO_UID=isset($_POST['PRO_UID'])?$_POST['PRO_UID']:'746B734DC23311'; - $process = new Process( $dbc ); - $process->Load($PRO_UID); - - $dynaform = new dynaform( $dbc ); - $dynaform->Fields['DYN_UID']=(isset($_POST['DYN_UID'])) ? urldecode($_POST['DYN_UID']):'0'; - $dynaform->Load( $dynaform->Fields['DYN_UID'] ); +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'processes'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = 'FIELDS'; - if (isset($_POST['DYN_UID']) && ($_POST['DYN_UID']!=='')) +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); + +//Hardcode: UID of the library by default +$PRO_UID = isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : '746B734DC23311'; + +$process = new Process( $dbc ); +$process->Load( $PRO_UID ); + +$dynaform = new dynaform( $dbc ); +$dynaform->Fields['DYN_UID'] = (isset( $_POST['DYN_UID'] )) ? urldecode( $_POST['DYN_UID'] ) : '0'; +$dynaform->Load( $dynaform->Fields['DYN_UID'] ); + +if (isset( $_POST['DYN_UID'] ) && ($_POST['DYN_UID'] !== '')) { $file = $dynaform->Fields['DYN_FILENAME']; - else - //Hardcode: Sample of xmlform. +} else { + //Hardcode: Sample of xmlform. $file = $PRO_UID . '/' . 'myInfo'; +} - /* Start Comment: If file doesn't exist, it is created */ - if (!file_exists( PATH_DYNAFORM . $file . '.xml' )) { + /* Start Comment: If file doesn't exist, it is created */ +if (! file_exists( PATH_DYNAFORM . $file . '.xml' )) { $newDoc = new Xml_Document(); - $newDoc->addChildNode( - new Xml_Node( 'dynaForm', 'open', '', - array( 'type'=>'xmlform', 'name' => $file ) ) ); - $newDoc->children[0]->addChildNode( - new Xml_Node( '', 'cdata', "\n" ) ); - G::verifyPath( dirname(PATH_DYNAFORM . $file . '.xml') , true ); - $newDoc->save( PATH_DYNAFORM . $file . '.xml' ); + $newDoc->addChildNode( new Xml_Node( 'dynaForm', 'open', '', array ('type' => 'xmlform','name' => $file + ) ) ); + $newDoc->children[0]->addChildNode( new Xml_Node( '', 'cdata', "\n" ) ); + G::verifyPath( dirname( PATH_DYNAFORM . $file . '.xml' ), true ); + $newDoc->save( PATH_DYNAFORM . $file . '.xml' ); unset( $newDoc ); - } - /* End Comment */ - +} +/* End Comment */ + /* Start Comment: Create and temporal copy. */ - $copy = implode('',file(PATH_DYNAFORM . $file . '.xml')); - $file.='_tmp0'; - $fcopy=fopen(PATH_DYNAFORM . $file . '.xml',"w"); - fwrite($fcopy, $copy); - fclose($fcopy); - /* End Comment */ - //Removes any other CURRENT_DYNAFORM that could be pending because of a page refresh or a failure - unset($_SESSION['CURRENT_DYNAFORM']); + $copy = implode( '', file( PATH_DYNAFORM . $file . '.xml' ) ); +$file .= '_tmp0'; +$fcopy = fopen( PATH_DYNAFORM . $file . '.xml', "w" ); +fwrite( $fcopy, $copy ); +fclose( $fcopy ); +/* End Comment */ +//Removes any other CURRENT_DYNAFORM that could be pending because of a page refresh or a failure +unset( $_SESSION['CURRENT_DYNAFORM'] ); - define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); +define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); - $title = $process->Fields['PRO_TITLE'] .' : '.$dynaform->Fields['DYN_TITLE']; +$title = $process->Fields['PRO_TITLE'] . ' : ' . $dynaform->Fields['DYN_TITLE']; - $Parameters = array( - 'SYS_LANG' => SYS_LANG, - 'URL'=> G::encrypt( $file , URL_KEY ), - 'DYN_UID'=> $dynaform->Fields['DYN_UID'], - 'DYNAFORM_NAME'=>$title - ); +$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $file, URL_KEY ),'DYN_UID' => $dynaform->Fields['DYN_UID'],'DYNAFORM_NAME' => $title +); - $openDoc = new Xml_Document(); - $openDoc->parseXmlFile(PATH_DYNAFORM . $file . '.xml'); - $XmlEditor = array( - 'URL'=> G::encrypt( $file , URL_KEY ), - 'XML'=> $openDoc->getXml() - ); - - $form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true ); - $HtmlEditor = array( - 'URL'=> G::encrypt( $file , URL_KEY ), - 'HTML'=> $form->printTemplate( $form->template , $script ) - ); - $JSEditor = array( - 'URL'=> G::encrypt( $file , URL_KEY ), - 'HTML'=> $form->printTemplate( $form->template , $script ) - ); - - /* Block : Loads the Editor configuration */ - $defaultConfig = array( - 'Editor'=>array( - 'left'=>'0',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - 'top'=>'0',//'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - 'width'=>'document.body.clientWidth-4', - 'height'=>'document.body.clientHeight-2'//'3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', - ), - 'Toolbar'=>array( - 'left'=>'document.body.clientWidth-2-toolbar.clientWidth-24-3+7',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', - 'top'=>'52'//'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - ), - 'FieldsList'=>array( - 'left'=>'4+toolbar.clientWidth+24', - 'top'=>'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', - 'width'=>268-24, - 'height'=>400, - ) - ); - /*$configuration = new Configuration($dbc); +$openDoc = new Xml_Document(); +$openDoc->parseXmlFile( PATH_DYNAFORM . $file . '.xml' ); +$XmlEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'XML' => $openDoc->getXml() +); + +$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true ); +$HtmlEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'HTML' => $form->printTemplate( $form->template, $script ) +); +$JSEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'HTML' => $form->printTemplate( $form->template, $script ) +); + +/* Block : Loads the Editor configuration */ +$defaultConfig = array ('Editor' => array ('left' => '0',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', +'top' => '0',//'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', +'width' => 'document.body.clientWidth-4','height' => 'document.body.clientHeight-2' //'3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)', +),'Toolbar' => array ('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))', +'top' => '52' //'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', +),'FieldsList' => array ('left' => '4+toolbar.clientWidth+24','top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))','width' => 268 - 24,'height' => 400 +) +); +/*$configuration = new Configuration($dbc); $configuration->load( array('CFG_UID'=>'DynaformEditor') ); if ($configuration->is_new) { $config = $defaultConfig; @@ -142,52 +124,44 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons $config = unserialize( $configuration->Fields['CFG_VALUE'] ); $config = G::array_merges( $defaultConfig , $config ); }*/ - $config=$defaultConfig; - /* End Block */ - - $G_PUBLISH = new Publisher; - $G_PUBLISH->publisherId='dynaformEditor'; - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->setTitle("Dynaform Editor"); - - //$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_ShortList', '', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax'); - $G_PUBLISH->AddContent('blank'); +$config = $defaultConfig; +/* End Block */ - $panelConf = array( - 'title'=>G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$title.']', - 'style'=>array( - 'title'=>array('textAlign'=>'left') - ), - 'width'=>700, - 'height'=>600, - 'tabWidth'=>120, - 'modal'=>true, - 'drag'=>false, - 'resize'=>false, - 'blinkToFront'=>false - ); - $panelConf = array_merge( $panelConf , $config['Editor'] ); - - $G_PUBLISH->AddContent('panel-init', 'mainPanel', $panelConf ); - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', '', $Parameters , '', ''); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', '', $Parameters , '', ''); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', '', $XmlEditor , '', ''); - //This space will be loaded dynamically by el js function: "changoToHtmlCode" - $G_PUBLISH->AddContent('blank'); - $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax'); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', '', $JSEditor , '', ''); - $G_PUBLISH->AddContent('blank'); +$G_PUBLISH = new Publisher(); +$G_PUBLISH->publisherId = 'dynaformEditor'; +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->setTitle( "Dynaform Editor" ); + +//$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_ShortList', '', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax'); +$G_PUBLISH->AddContent( 'blank' ); + +$panelConf = array ('title' => G::LoadTranslation( 'ID_DYNAFORM_EDITOR' ) . ' - [' . $title . ']','style' => array ('title' => array ('textAlign' => 'left' +) +),'width' => 700,'height' => 600,'tabWidth' => 120,'modal' => true,'drag' => false,'resize' => false,'blinkToFront' => false +); +$panelConf = array_merge( $panelConf, $config['Editor'] ); + +$G_PUBLISH->AddContent( 'panel-init', 'mainPanel', $panelConf ); +$G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_Toolbar', '', $Parameters, '', '' ); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', '', $Parameters, '', '' ); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', '', $XmlEditor, '', '' ); +//This space will be loaded dynamically by el js function: "changoToHtmlCode" +$G_PUBLISH->AddContent( 'blank' ); +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', SYS_URI . 'dynaforms/dynaforms_PagedTableAjax' ); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', '', $JSEditor, '', '' ); +$G_PUBLISH->AddContent( 'blank' ); // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', '', $JSEditor , '', ''); - $G_PUBLISH->AddContent('panel-tab','Preview','dynaformEditor[3]','changoToPreview','saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab','XML Code','dynaformEditor[4]','changoToXmlCode','saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab','HTML Template','dynaformEditor[5]','changoToHtmlCode','saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab','Fields List','dynaformEditor[6]','changoToFieldsList','saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab','JavaScripts','dynaformEditor[7]','changoToJavascripts','saveCurrentView'); - $G_PUBLISH->AddContent('panel-tab','Properties','dynaformEditor[8]','changoToProperties','saveCurrentView'); - $G_PUBLISH->AddContent('panel-close'); - - G::RenderPage( "publish", "raw" ); + +$G_PUBLISH->AddContent( 'panel-tab', 'Preview', 'dynaformEditor[3]', 'changoToPreview', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-tab', 'XML Code', 'dynaformEditor[4]', 'changoToXmlCode', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-tab', 'HTML Template', 'dynaformEditor[5]', 'changoToHtmlCode', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-tab', 'Fields List', 'dynaformEditor[6]', 'changoToFieldsList', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-tab', 'JavaScripts', 'dynaformEditor[7]', 'changoToJavascripts', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-tab', 'Properties', 'dynaformEditor[8]', 'changoToProperties', 'saveCurrentView' ); +$G_PUBLISH->AddContent( 'panel-close' ); + +G::RenderPage( "publish", "raw" ); ?> \ No newline at end of file + diff --git a/workflow/engine/methods/dynaforms/dynaforms_List.php b/workflow/engine/methods/dynaforms/dynaforms_List.php index 615453bab..f6e1bc229 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_List.php +++ b/workflow/engine/methods/dynaforms/dynaforms_List.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +} - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'processes'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = 'DYNAFORMS'; - $dbc = new DBConnection(); - $ses = new DBSession($dbc); +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'processes'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS'; - //Hardcode: UID of the library by default - $PRO_UID='746B734DC23311'; - $Fields['PRO_UID'] = $PRO_UID; - $Fields['SYS_LANG'] = SYS_LANG; - $G_PUBLISH = new Publisher; - - $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/dynaforms_List', '', $Fields , 'dynaforms_Save'); - - G::RenderPage( "publish" ); +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); + +//Hardcode: UID of the library by default +$PRO_UID = '746B734DC23311'; +$Fields['PRO_UID'] = $PRO_UID; +$Fields['SYS_LANG'] = SYS_LANG; +$G_PUBLISH = new Publisher(); + +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/dynaforms_List', '', $Fields, 'dynaforms_Save' ); + +G::RenderPage( "publish" ); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php b/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php index ddd0650b6..563702b9c 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php +++ b/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - //call plugin - // $oPluginRegistry = &PMPluginRegistry::getSingleton(); - // $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST ); +//call plugin +// $oPluginRegistry = &PMPluginRegistry::getSingleton(); +// $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST ); + //for now, we are going with the default list, because the plugin is not complete include ('dynaforms_Edit.php'); -die; +die(); //---***************** - if ( !$existsDynaforms ) { - include ('dynaforms_Edit.php'); - die; - } - print "Existe"; - print (class_exists('folderData')); - die; - //end plugin -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (! $existsDynaforms) { + include ('dynaforms_Edit.php'); + die(); +} +print "Existe"; +print (class_exists( 'folderData' )) ; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin =n 'login/login' ); +die(); +//end plugin +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - require_once('classes/model/Dynaform.php'); - - $dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):''; - $dynaform = new dynaform(); - if ($dynUid=='') - { - $aFields['DYN_UID']= $dynUid ; - } - else - { - $aFields=$dynaform->load( $dynUid ); - } - $aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID']; + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin =n 'login/login' ); + + +require_once ('classes/model/Dynaform.php'); + +$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : ''; +$dynaform = new dynaform(); +if ($dynUid == '') { + $aFields['DYN_UID'] = $dynUid; +} else { + $aFields = $dynaform->load( $dynUid ); +} +$aFields['PRO_UID'] = isset( $dynaform->Fields['PRO_UID'] ) ? $dynaform->Fields['PRO_UID'] : $_GET['PRO_UID']; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' ); + +G::RenderPage( "publish-raw", "raw" ); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save'); - - G::RenderPage( "publish-raw" , "raw" ); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_PagedTableAjax.php b/workflow/engine/methods/dynaforms/dynaforms_PagedTableAjax.php index c8adc53c1..a569a9d7e 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_PagedTableAjax.php +++ b/workflow/engine/methods/dynaforms/dynaforms_PagedTableAjax.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - function pagedTable_BeforeQuery(&$ntable) - { - $file = G::decrypt( $ntable->xmlForm->values['URL'] , URL_KEY ); - /* Start Block: Defines the virtual XMLDB*/ - G::LoadClass('xmlDb'); - define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); - /* End Block*/ - } - require_once(PATH_GULLIVER_HOME.'methods/pagedTableAjax.php'); -die; - G::LoadSystem('pagedTable'); - G::LoadInclude('ajax'); +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - $id=get_ajax_value('ptID'); - $ntable= unserialize($_SESSION['pagedTable['.$id.']']); - $page=get_ajax_value('page'); - $function=get_ajax_value('function'); +function pagedTable_BeforeQuery (&$ntable) +{ + $file = G::decrypt( $ntable->xmlForm->values['URL'], URL_KEY ); + /* Start Block: Defines the virtual XMLDB*/ + G::LoadClass( 'xmlDb' ); + define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); + define( 'DB_XMLDB_USER', '' ); + define( 'DB_XMLDB_PASS', '' ); + define( 'DB_XMLDB_NAME', '' ); + define( 'DB_XMLDB_TYPE', 'myxml' ); + /* End Block*/ +} +require_once (PATH_GULLIVER_HOME . 'methods/pagedTableAjax.php'); +die(); +G::LoadSystem( 'pagedTable' ); +G::LoadInclude( 'ajax' ); - if (isset($ntable->filterForm_Id) && ($ntable->filterForm_Id!=='')) { - $filterForm=new filterForm(G::getUIDName( $ntable->filterForm_Id )); - $filterForm->values=$_SESSION[$filterForm->id]; - parse_str( urldecode(get_ajax_value('filter')) , $newValues); - if (isset($newValues['form'])) { - $filterForm->setValues($newValues['form']); - $filter = array(); - foreach($filterForm->fields as $fieldName => $field ){ - if (($field->dataCompareField!=='') && (isset($newValues['form'][$fieldName]))) - $filter[$field->dataCompareField] = $filterForm->values[$fieldName]; - $ntable->filterType[$field->dataCompareField] = $field->dataCompareType; - } - $ntable->filter = $filter;//G::http_build_query($filter); +$id = get_ajax_value( 'ptID' ); +$ntable = unserialize( $_SESSION['pagedTable[' . $id . ']'] ); +$page = get_ajax_value( 'page' ); +$function = get_ajax_value( 'function' ); + +if (isset( $ntable->filterForm_Id ) && ($ntable->filterForm_Id !== '')) { + $filterForm = new filterForm( G::getUIDName( $ntable->filterForm_Id ) ); + $filterForm->values = $_SESSION[$filterForm->id]; + parse_str( urldecode( get_ajax_value( 'filter' ) ), $newValues ); + if (isset( $newValues['form'] )) { + $filterForm->setValues( $newValues['form'] ); + $filter = array (); + foreach ($filterForm->fields as $fieldName => $field) { + if (($field->dataCompareField !== '') && (isset( $newValues['form'][$fieldName] ))) { + $filter[$field->dataCompareField] = $filterForm->values[$fieldName]; + } + $ntable->filterType[$field->dataCompareField] = $field->dataCompareType; + } + $ntable->filter = $filter; //G::http_build_query($filter); } - } - $fastSearch=get_ajax_value('fastSearch'); - if (isset($fastSearch)) $ntable->fastSearch= urldecode($fastSearch); - $orderBy=get_ajax_value('order'); - if (isset($orderBy)) { - $orderBy=urldecode($orderBy); - $ntable->orderBy=$orderBy; - } - if (isset($page) && $page!=='') $ntable->currentPage=(int) $page; +} +$fastSearch = get_ajax_value( 'fastSearch' ); +if (isset( $fastSearch )) { + $ntable->fastSearch = urldecode( $fastSearch ); +} +$orderBy = get_ajax_value( 'order' ); +if (isset( $orderBy )) { + $orderBy = urldecode( $orderBy ); + $ntable->orderBy = $orderBy; +} +if (isset( $page ) && $page !== '') { + $ntable->currentPage = (int) $page; +} - $file = G::decrypt( $ntable->xmlForm->values['URL'] , URL_KEY ); - /* Start Block: Defines the virtual XMLDB*/ - G::LoadClass('xmlDb'); - define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); - /* End Block*/ +$file = G::decrypt( $ntable->xmlForm->values['URL'], URL_KEY ); +/* Start Block: Defines the virtual XMLDB*/ +G::LoadClass( 'xmlDb' ); +define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); +/* End Block*/ + +$ntable->prepareQuery(); +switch ($function) { + case "showHideField": + $field = get_ajax_value( 'field' ); + $ntable->style[$field]['showInTable'] = ($ntable->style[$field]['showInTable'] === '0') ? '1' : '0'; + break; + case "paint": + break; + case "delete": + $ntable->prepareQuery(); + parse_str( get_ajax_value( 'field' ), $field ); + foreach ($field as $key => $value) { + $field[$key] = urldecode( $value ); + } + $ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlDelete, $field ) ); + break; + case "update": + $ntable->prepareQuery(); + parse_str( get_ajax_value( 'field' ), $field ); + foreach ($field as $key => $value) { + $field[$key] = urldecode( $value ); + } + parse_str( get_ajax_value( 'update' ), $fieldup ); + foreach ($fieldup as $key => $value) { + $field['new' . $key] = urldecode( $value ); //join + } + $ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlUpdate, $field ) ); + break; + case "insert": + $ntable->prepareQuery(); + parse_str( get_ajax_value( 'field' ), $field ); + foreach ($field as $key => $value) { + $field[$key] = urldecode( $value ); + } + $ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlInsert, $field ) ); + break; + case "printForm": + parse_str( get_ajax_value( 'field' ), $field ); + parse_str( get_ajax_value( 'field' ), $field ); + foreach ($field as $key => $value) { + $field[$key] = urldecode( $value ); + } + $ntable->printForm( get_ajax_value( 'filename' ), $field ); + return; +} +$ntable->renderTable( 'content' ); +G::LoadClass( 'configuration' ); +$dbc = new DBConnection(); +$conf = new Configuration( $dbc, $ntable ); +$conf->setConfig( $ntable->__Configuration, $ntable, $conf->aConfig ); +$conf->saveConfig( 'pagedTable', $ntable->__OBJ_UID, '', $_SESSION['USER_LOGGED'], '' ); - $ntable->prepareQuery(); - switch ($function) - { - case "showHideField": - $field=get_ajax_value('field'); - $ntable->style[$field]['showInTable']= - ($ntable->style[$field]['showInTable']==='0')?'1':'0'; - break; - case "paint": - break; - case "delete": - $ntable->prepareQuery(); - parse_str(get_ajax_value('field'),$field); - foreach($field as $key => $value) $field[$key]=urldecode($value); - $ntable->ses->execute($ntable->replaceDataField($ntable->sqlDelete,$field)); - break; - case "update": - $ntable->prepareQuery(); - parse_str(get_ajax_value('field'),$field); - foreach($field as $key => $value) $field[$key]=urldecode($value); - parse_str(get_ajax_value('update'),$fieldup); - foreach($fieldup as $key => $value) $field['new'.$key]=urldecode($value); //join - $ntable->ses->execute($ntable->replaceDataField($ntable->sqlUpdate,$field)); - break; - case "insert": - $ntable->prepareQuery(); - parse_str(get_ajax_value('field'),$field); - foreach($field as $key => $value) $field[$key]=urldecode($value); - $ntable->ses->execute($ntable->replaceDataField($ntable->sqlInsert,$field)); - break; - case "printForm": - parse_str(get_ajax_value('field'),$field); - parse_str(get_ajax_value('field'),$field); - foreach($field as $key => $value) $field[$key]=urldecode($value); - $ntable->printForm(get_ajax_value('filename'),$field); - return ; - } - $ntable->renderTable( 'content' ); - G::LoadClass('configuration'); - $dbc = new DBConnection(); - $conf = new Configuration( $dbc , $ntable ); - $conf->setConfig($ntable->__Configuration,$ntable,$conf->aConfig); - $conf->saveConfig('pagedTable',$ntable->__OBJ_UID,'',$_SESSION['USER_LOGGED'],''); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_Preview.php b/workflow/engine/methods/dynaforms/dynaforms_Preview.php index 1f029e4da..ccfbf2c22 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Preview.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Preview.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - - G::LoadClass('toolBar'); - G::LoadClass('dynaFormField'); - - if (!(isset($_POST['A']) && $_POST['A']!=='')) return; - - $file = G::decrypt( $_POST['A'] , URL_KEY ); - - $G_PUBLISH = new Publisher; - $form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true ); - switch(basename($form->template,'.html')) - { - case 'grid': $template='grid';break; - default: $template='xmlform'; - } - $G_PUBLISH->AddContent('dynaform', $template , $file, '', - array( - '__DYNAFORM_OPTIONS'=> array( - 'PREVIOUS_STEP' => '#', - 'NEXT_STEP' => '#', - 'PREVIOUS_ACTION' => 'return false;', - 'NEXT_ACTION' => 'return false;' - ) - ), ''); - G::RenderPage('publish','raw'); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - /* $toolbar = new ToolBar( '/dynaforms/dynaforms_Toolbar' , PATH_XMLFORM, SYS_LANG, false ); +G::LoadClass( 'toolBar' ); +G::LoadClass( 'dynaFormField' ); + +if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) { + return; +} + +$file = G::decrypt( $_POST['A'], URL_KEY ); + +$G_PUBLISH = new Publisher(); +$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true ); +switch (basename( $form->template, '.html' )) { + case 'grid': + $template = 'grid'; + break; + default: + $template = 'xmlform'; +} +$G_PUBLISH->AddContent( 'dynaform', $template, $file, '', array ('__DYNAFORM_OPTIONS' => array ('PREVIOUS_STEP' => '#','NEXT_STEP' => '#','PREVIOUS_ACTION' => 'return false;','NEXT_ACTION' => 'return false;' +) +), '' ); +G::RenderPage( 'publish', 'raw' ); + +/* $toolbar = new ToolBar( '/dynaforms/dynaforms_Toolbar' , PATH_XMLFORM, SYS_LANG, false ); print($toolbar->render( $toolbar->template , $script ));*/ +//$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true ); +//print($form->render( $form->template , $script )); - //$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true ); - - //print($form->render( $form->template , $script )); - - -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index b537b4234..cbc1846b9 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -12,101 +12,99 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} +//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - require_once('classes/model/Dynaform.php'); - require_once('classes/model/Content.php'); - $oJSON = new Services_JSON(); +require_once ('classes/model/Dynaform.php'); +require_once ('classes/model/Content.php'); - if( isset($_POST['function']) ) +$oJSON = new Services_JSON(); + +if (isset( $_POST['function'] )) { $sfunction = $_POST['function']; - else if( isset($_POST['functions']) ) +} elseif (isset( $_POST['functions'] )) { $sfunction = $_POST['functions']; +} - if( isset($sfunction) && $sfunction == 'lookforNameDynaform' ) { - - $snameDyanform = urldecode($_POST['NAMEDYNAFORM']); - $sPRO_UID = urldecode($_POST['proUid']); +if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn ( DynaformPeer::DYN_UID ); - $oCriteria->add(DynaformPeer::PRO_UID, $sPRO_UID); - $oDataset = DynaformPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $snameDyanform = urldecode( $_POST['NAMEDYNAFORM'] ); + $sPRO_UID = urldecode( $_POST['proUid'] ); + + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( DynaformPeer::DYN_UID ); + $oCriteria->add( DynaformPeer::PRO_UID, $sPRO_UID ); + $oDataset = DynaformPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $flag = true; - + while ($oDataset->next() && $flag) { - $aRow = $oDataset->getRow(); + $aRow = $oDataset->getRow(); - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->addSelectColumn('COUNT(*) AS DYNAFORMS'); - $oCriteria1->add(ContentPeer::CON_CATEGORY, 'DYN_TITLE'); - $oCriteria1->add(ContentPeer::CON_ID, $aRow['DYN_UID']); - $oCriteria1->add(ContentPeer::CON_VALUE, $snameDyanform); - $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); - $oDataset1 = ContentPeer::doSelectRS($oCriteria1); - $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset1->next(); - $aRow1 = $oDataset1->getRow(); + $oCriteria1 = new Criteria( 'workflow' ); + $oCriteria1->addSelectColumn( 'COUNT(*) AS DYNAFORMS' ); + $oCriteria1->add( ContentPeer::CON_CATEGORY, 'DYN_TITLE' ); + $oCriteria1->add( ContentPeer::CON_ID, $aRow['DYN_UID'] ); + $oCriteria1->add( ContentPeer::CON_VALUE, $snameDyanform ); + $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG ); + $oDataset1 = ContentPeer::doSelectRS( $oCriteria1 ); + $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset1->next(); + $aRow1 = $oDataset1->getRow(); - if( $aRow1['DYNAFORMS'] ) - $flag = false; + if ($aRow1['DYNAFORMS']) { + $flag = false; + } } print $flag; - } else { - $dynaform = new dynaform(); - - if(isset($_POST['form'])) - { - $aData = $_POST['form']; //For old process map form - if ($aData['DYN_UID']==='') - unset($aData['DYN_UID']); - } - else - { - $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) - $aFields = array(); - $aVariables = array(); - if(isset($aData['FIELDS'])) - { - $aFields = G::json_decode($_POST['FIELDS']); - $aVariables = G::json_decode($_POST['VARIABLES']); - } - $aData['FIELDS'] = array(); - for($i=0;$iSave( $aData ); - } - else - { - if (!isset($aData['ADD_TABLE'])||$aData['ADD_TABLE']==""){ - $aFields=$dynaform->create( $aData ); - } else { - $aFields=$dynaform->createFromPMTable( $aData, $aData['ADD_TABLE']); +} else { + $dynaform = new dynaform(); + if (isset( $_POST['form'] )) { + $aData = $_POST['form']; //For old process map form + if ($aData['DYN_UID'] === '') { + unset( $aData['DYN_UID'] ); } - $aData['DYN_UID']=$dynaform->getDynUid(); + } else { + $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) + $aFields = array (); + $aVariables = array (); + if (isset( $aData['FIELDS'] )) { + $aFields = G::json_decode( $_POST['FIELDS'] ); + $aVariables = G::json_decode( $_POST['VARIABLES'] ); + } + $aData['FIELDS'] = array (); + for ($i = 0; $i < count( $aFields ); $i ++) { + $aData['FIELDS'][$i + 1]['FLD_NAME'] = $aFields[$i]; + $aData['FIELDS'][$i + 1]['PRO_VARIABLE'] = $aVariables[$i]; + } + } + //if ($aData['DYN_UID']==='') unset($aData['DYN_UID']); + + + if (isset( $aData['DYN_UID'] )) { + $dynaform->Save( $aData ); + } else { + if (! isset( $aData['ADD_TABLE'] ) || $aData['ADD_TABLE'] == "") { + $aFields = $dynaform->create( $aData ); + } else { + $aFields = $dynaform->createFromPMTable( $aData, $aData['ADD_TABLE'] ); + } + $aData['DYN_UID'] = $dynaform->getDynUid(); $dynaform->update( $aData ); - } - echo $dynaform->getDynUid(); - } -?> + } + echo $dynaform->getDynUid(); +} + diff --git a/workflow/engine/methods/dynaforms/dynaforms_SaveProperties.php b/workflow/engine/methods/dynaforms/dynaforms_SaveProperties.php index 26623ecca..305dc3131 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_SaveProperties.php +++ b/workflow/engine/methods/dynaforms/dynaforms_SaveProperties.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - - G::LoadInclude('ajax'); - G::LoadClass('dynaform'); - G::LoadClass('xmlDb'); - - $dbc = new DBConnection(); - $ses = new DBSession($dbc); - - //$dynaform = new dynaform( $dbc ); - - if ($_POST['form']['DYN_UID']==='') unset($_POST['form']['DYN_UID']); - $Fields = $_POST['form']; - if (!isset($Fields['DYN_UID'])) return; - $file = G::decrypt( $Fields['A'] , URL_KEY ); - $Fields['DYN_FILENAME'] = (strcasecmp(substr($file,-5),'_tmp0')==0)? substr($file,0,strlen($file)-5) : $file; - $_SESSION['CURRENT_DYNAFORM']=$Fields; - //$dynaform->Save( $Fields ); - - $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); - $ses2 = new DBSession($dbc2); +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); +} - if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; - $ses2->execute(G::replaceDataField("UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); - $ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); - $ses2->execute(G::replaceDataField("UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); - -?> \ No newline at end of file +G::LoadInclude( 'ajax' ); +G::LoadClass( 'dynaform' ); +G::LoadClass( 'xmlDb' ); + +$dbc = new DBConnection(); +$ses = new DBSession( $dbc ); + +//$dynaform = new dynaform( $dbc ); + + +if ($_POST['form']['DYN_UID'] === '') { + unset( $_POST['form']['DYN_UID'] ); +} +$Fields = $_POST['form']; +if (! isset( $Fields['DYN_UID'] )) { + return; +} +$file = G::decrypt( $Fields['A'], URL_KEY ); +$Fields['DYN_FILENAME'] = (strcasecmp( substr( $file, - 5 ), '_tmp0' ) == 0) ? substr( $file, 0, strlen( $file ) - 5 ) : $file; +$_SESSION['CURRENT_DYNAFORM'] = $Fields; +//$dynaform->Save( $Fields ); + + +$dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); +$ses2 = new DBSession( $dbc2 ); + +if (! isset( $Fields['ENABLETEMPLATE'] )) { + $Fields['ENABLETEMPLATE'] = "0"; +} + +$ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); +$ses2->execute( G::replaceDataField( "UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); +$ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) ); + diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save_as.php b/workflow/engine/methods/dynaforms/dynaforms_Save_as.php index c83e3b9a0..511357b09 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save_as.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save_as.php @@ -1,109 +1,106 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - /* - * dynaforms_Save_as.php - * script that handles the save-as functionality of a dynaform - * replicates the dynaform structure and content physical and in DB - * also handles the complete copy of field-events related and - * the html template if its required too. - */ - require_once('classes/model/Dynaform.php'); - if (!class_exists("FieldCondition")){ - require_once "classes/model/FieldCondition.php"; - } - - try - { - $con = Propel::getConnection( DynaformPeer::DATABASE_NAME ); - $frm=$_POST['form']; - $PRO_UID=$frm['PRO_UID']; - $DYN_UID=$frm['DYN_UID']; - $DYN_TYPE=$frm['DYN_TYPE']; - - // checks if there are conditions attached to the dynaform - $oFieldCondition = new FieldCondition(); - $aConditions = $oFieldCondition->getAllByDynUid($DYN_UID); - - $dynaform = new dynaform; - /*Save Register*/ - - $dynUid = ( G::generateUniqueID() ); - - $dynaform->setDynUid ( $dynUid ); - $dynaform->setProUid ( $PRO_UID ); - $dynaform->setDynType ( $DYN_TYPE ); - $dynaform->setDynFilename ( $PRO_UID . PATH_SEP . $dynUid ); - - $con->begin(); - $res = $dynaform->save(); - $dynaform->setDynTitle ( $frm['DYN_TITLENEW'] ); - $dynaform->setDynDescription ((!$frm['DYN_DESCRIPTIONNEW'])?'Default Dynaform Description':$frm['DYN_DESCRIPTIONNEW']); - - //$con->commit(); - - $hd = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml',"r"); - $hd1 = fopen (PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml' ,"w"); - $templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html'; - - // also make a copy of the template file in case that the html edition is enabled - if(file_exists($templateFilename)){ - $templateHd = fopen($templateFilename,"r"); - $templateHd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html' ,"w"); - } - - // also copy all the necessarily conditions if there are any - foreach ($aConditions as $condition){ - $condition['FCD_UID'] = ( G::generateUniqueID() ); - $condition['FCD_DYN_UID'] = $dynUid; - $oFieldCondition->quickSave($condition); - } - // checks if the physical dynaform file exists and copy the contents - if($hd){ - while(!feof($hd)){ - $line=fgets($hd,4096); - fwrite($hd1,str_replace($DYN_UID,$dynUid,$line)); - } - } - - fclose($hd); - fclose($hd1); - - // check if the template file also exists - if(isset($templateHd)){ - while(!feof($templateHd)){ - $line=fgets($templateHd,4096); - fwrite($templateHd1,str_replace($DYN_UID,$dynUid,$line)); - } - fclose($templateHd); - fclose($templateHd1); - } - - } - catch(Exception $e) - { - return (array) $e; - } -?> \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* + * dynaforms_Save_as.php + * script that handles the save-as functionality of a dynaform + * replicates the dynaform structure and content physical and in DB + * also handles the complete copy of field-events related and + * the html template if its required too. + */ +require_once ('classes/model/Dynaform.php'); +if (! class_exists( "FieldCondition" )) { + require_once "classes/model/FieldCondition.php"; +} + +try { + $con = Propel::getConnection( DynaformPeer::DATABASE_NAME ); + $frm = $_POST['form']; + $PRO_UID = $frm['PRO_UID']; + $DYN_UID = $frm['DYN_UID']; + $DYN_TYPE = $frm['DYN_TYPE']; + + // checks if there are conditions attached to the dynaform + $oFieldCondition = new FieldCondition(); + $aConditions = $oFieldCondition->getAllByDynUid( $DYN_UID ); + + $dynaform = new dynaform(); + /*Save Register*/ + + $dynUid = (G::generateUniqueID()); + + $dynaform->setDynUid( $dynUid ); + $dynaform->setProUid( $PRO_UID ); + $dynaform->setDynType( $DYN_TYPE ); + $dynaform->setDynFilename( $PRO_UID . PATH_SEP . $dynUid ); + + $con->begin(); + $res = $dynaform->save(); + $dynaform->setDynTitle( $frm['DYN_TITLENEW'] ); + $dynaform->setDynDescription( (! $frm['DYN_DESCRIPTIONNEW']) ? 'Default Dynaform Description' : $frm['DYN_DESCRIPTIONNEW'] ); + + //$con->commit(); + + + $hd = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml', "r" ); + $hd1 = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml', "w" ); + $templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html'; + + // also make a copy of the template file in case that the html edition is enabled + if (file_exists( $templateFilename )) { + $templateHd = fopen( $templateFilename, "r" ); + $templateHd1 = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html', "w" ); + } + + // also copy all the necessarily conditions if there are any + foreach ($aConditions as $condition) { + $condition['FCD_UID'] = (G::generateUniqueID()); + $condition['FCD_DYN_UID'] = $dynUid; + $oFieldCondition->quickSave( $condition ); + } + // checks if the physical dynaform file exists and copy the contents + if ($hd) { + while (! feof( $hd )) { + $line = fgets( $hd, 4096 ); + fwrite( $hd1, str_replace( $DYN_UID, $dynUid, $line ) ); + } + } + + fclose( $hd ); + fclose( $hd1 ); + + // check if the template file also exists + if (isset( $templateHd )) { + while (! feof( $templateHd )) { + $line = fgets( $templateHd, 4096 ); + fwrite( $templateHd1, str_replace( $DYN_UID, $dynUid, $line ) ); + } + fclose( $templateHd ); + fclose( $templateHd1 ); + } + +} catch (Exception $e) { + return (array) $e; +} + diff --git a/workflow/engine/methods/dynaforms/dynaforms_Saveas.php b/workflow/engine/methods/dynaforms/dynaforms_Saveas.php index d8f499be9..5b6729bcd 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Saveas.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Saveas.php @@ -1,44 +1,47 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; - - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - - require_once('classes/model/Dynaform.php'); - - $dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):''; - $dynaform = new dynaform(); - - - - $aFields=$dynaform->load( $dynUid ); - //print_r($aFields); - -//$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID']; - - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Saveas', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save_as'); - - G::RenderPage( "publish-raw" , "raw" ); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} + + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + + +require_once ('classes/model/Dynaform.php'); + +$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : ''; +$dynaform = new dynaform(); + +$aFields = $dynaform->load( $dynUid ); +//print_r($aFields); + + +//$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID']; + + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Saveas', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save_as' ); + +G::RenderPage( "publish-raw", "raw" ); + diff --git a/workflow/engine/methods/dynaforms/dynaforms_ToolbarAjax.php b/workflow/engine/methods/dynaforms/dynaforms_ToolbarAjax.php index 32310e2d8..d88c6c824 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_ToolbarAjax.php +++ b/workflow/engine/methods/dynaforms/dynaforms_ToolbarAjax.php @@ -1,34 +1,26 @@ SYS_LANG, - 'URL'=> G::encrypt( $_POST['FILE'] , URL_KEY ), - 'DYN_UID'=> $_POST['DYN_UID'], - 'PRO_UID'=> $_POST['PRO_UID'], - 'DYNAFORM_NAME'=>$_POST['DYN_TITLE'], - 'FILE'=>$_POST['FILE'], - ); +global $G_PUBLISH; +$script = ''; +$G_PUBLISH = new Publisher(); +$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $_POST['FILE'], URL_KEY ),'DYN_UID' => $_POST['DYN_UID'],'PRO_UID' => $_POST['PRO_UID'],'DYNAFORM_NAME' => $_POST['DYN_TITLE'],'FILE' => $_POST['FILE']); //$Parameters = ""; - if($_POST['TOOLBAR']=="grid"){ - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters , '', ''); - } else { - $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters , '', ''); - } +if ($_POST['TOOLBAR'] == "grid") { + $G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '' ); +} else { + $G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '' ); +} + +G::RenderPage( 'publish', 'raw' ); - G::RenderPage('publish', 'raw'); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/dynaforms_checkDependentFields.php b/workflow/engine/methods/dynaforms/dynaforms_checkDependentFields.php index 61c370990..88b07ca4d 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_checkDependentFields.php +++ b/workflow/engine/methods/dynaforms/dynaforms_checkDependentFields.php @@ -1,4 +1,5 @@ . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - /** - * this file is a fix to a dependency bug it was just a minor improvement, - * also the functionality of dependent fields in grids doesn't depends in this - * file so this is somewhat expendable. - * - */ - function subDependencies( $k , &$G_FORM , &$aux, $grid = '') { +/** + * this file is a fix to a dependency bug it was just a minor improvement, + * also the functionality of dependent fields in grids doesn't depends in this + * file so this is somewhat expendable. + */ +function subDependencies ($k, &$G_FORM, &$aux, $grid = '') +{ $myDependentFields = ''; - if (array_search( $k, $aux )!==FALSE) return array(); - if ($grid == '') { - if (!array_key_exists( $k , $G_FORM->fields )) return array(); - if (!isset($G_FORM->fields[$k]->dependentFields)) return array(); - $aux[] = $k; - $mydependentFields = $G_FORM->fields[$k]->dependentFields; - + if (array_search( $k, $aux ) !== false) { + return array (); } - else { - if (!array_key_exists( $k , $G_FORM->fields[$grid]->fields )) return array(); - if (!isset($G_FORM->fields[$grid]->fields[$k]->dependentFields)) return array(); - $myDependentFields = $G_FORM->fields[$grid]->fields[$k]->dependentFields; - $myDependentFields = explode( ',', $G_FORM->fields[$grid]->fields[$k]->dependentFields); - + if ($grid == '') { + if (! array_key_exists( $k, $G_FORM->fields )) { + return array (); + } + if (! isset( $G_FORM->fields[$k]->dependentFields )) { + return array (); + } + $aux[] = $k; + $mydependentFields = $G_FORM->fields[$k]->dependentFields; + + } else { + if (! array_key_exists( $k, $G_FORM->fields[$grid]->fields )) { + return array (); + } + if (! isset( $G_FORM->fields[$grid]->fields[$k]->dependentFields )) { + return array (); + } + $myDependentFields = $G_FORM->fields[$grid]->fields[$k]->dependentFields; + $myDependentFields = explode( ',', $G_FORM->fields[$grid]->fields[$k]->dependentFields ); + } return $myDependentFields; - } +} -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; -// the script responds an ajax request in order to check the dependent fields, -// and generate a json output of the values that the dependent field must have. -$sDynUid = G::getUIDName(urlDecode($_POST['DYN_UID'])); -$json=new Services_JSON(); -$formValues=($json->decode($_POST['fields'])); -$sFieldName = $_POST['fieldName']; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} + // the script responds an ajax request in order to check the dependent fields, + // and generate a json output of the values that the dependent field must have. +$sDynUid = G::getUIDName( urlDecode( $_POST['DYN_UID'] ) ); +$json = new Services_JSON(); +$formValues = ($json->decode( $_POST['fields'] )); +$sFieldName = $_POST['fieldName']; $sMasterField = ''; $sPath = PATH_DYNAFORM; -$G_FORM = new form( $sDynUid , $sPath ); -$aux = array(); -$newValues=$json->decode(urlDecode(stripslashes($_POST['form']))); +$G_FORM = new form( $sDynUid, $sPath ); +$aux = array (); +$newValues = $json->decode( urlDecode( stripslashes( $_POST['form'] ) ) ); - if (isset($_POST['grid'])) { - $_POST['row'] = (int)$_POST['row']; - $aAux = array(); +if (isset( $_POST['grid'] )) { + $_POST['row'] = (int) $_POST['row']; + $aAux = array (); foreach ($newValues as $sKey => $newValue) { - $newValue = (array)$newValue; - $aKeys = array_keys($newValue); - $aValues = array(); - for ($i = 1; $i <= ($_POST['row'] - 1); $i++) { - $aValues[$i] = array($aKeys[0] => ''); - } - $aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]); - $newValues[$sKey]->$_POST['grid'] = $aValues; - unset($newValues[$sKey]->$aKeys[0]); - } - } - - $dependentFields = array(); - $aux = array(); - $found =false; - for($r=0;$rsetValues($newValues[$r]); - //Search dependent fields - foreach($newValues[$r] as $k => $v) { - if (!is_array($v)) { - $myDependentFields = subDependencies( $k , $G_FORM , $aux ); - if(!$found){ - if (in_array($sFieldName,$myDependentFields)){ - $sMasterField = $k; - $found=true; - } + $newValue = (array) $newValue; + $aKeys = array_keys( $newValue ); + $aValues = array (); + for ($i = 1; $i <= ($_POST['row'] - 1); $i ++) { + $aValues[$i] = array ($aKeys[0] => '' + ); } - $_SESSION[$G_FORM->id][$k] = $v; - } - else { - foreach($v[$_POST['row']] as $k1 => $v1) { - $myDependentFields = subDependencies( $k1 , $G_FORM , $aux, $_POST['grid'] ); - if(!$found){ - if (in_array($sFieldName,$myDependentFields)){ - $sMasterField = $k1; - $found=true; + $aValues[$_POST['row']] = array ($aKeys[0] => $newValue[$aKeys[0]] ); + $newValues[$sKey]->$_POST['grid'] = $aValues; + unset( $newValues[$sKey]->$aKeys[0] ); + } +} + +$dependentFields = array (); +$aux = array (); +$found = false; +for ($r = 0; $r < sizeof( $newValues ); $r ++) { + $newValues[$r] = (array) $newValues[$r]; + $G_FORM->setValues( $newValues[$r] ); + //Search dependent fields + foreach ($newValues[$r] as $k => $v) { + if (! is_array( $v )) { + $myDependentFields = subDependencies( $k, $G_FORM, $aux ); + if (! $found) { + if (in_array( $sFieldName, $myDependentFields )) { + $sMasterField = $k; + $found = true; + } } - } - $_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1; - } - } - $dependentFields=array_merge($dependentFields, $myDependentFields); - } - } - switch ($_POST['function']){ + $_SESSION[$G_FORM->id][$k] = $v; + } else { + foreach ($v[$_POST['row']] as $k1 => $v1) { + $myDependentFields = subDependencies( $k1, $G_FORM, $aux, $_POST['grid'] ); + if (! $found) { + if (in_array( $sFieldName, $myDependentFields )) { + $sMasterField = $k1; + $found = true; + } + } + $_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1; + } + } + $dependentFields = array_merge( $dependentFields, $myDependentFields ); + } +} +switch ($_POST['function']) { case 'showDependentFields': - echo $json->encode(array_unique($dependentFields)); - break; + echo $json->encode( array_unique( $dependentFields ) ); + break; case 'showDependentOf': - echo $sMasterField; - break; - } - -?> + echo $sMasterField; + break; +} + diff --git a/workflow/engine/methods/dynaforms/fieldsGetterAjax.php b/workflow/engine/methods/dynaforms/fieldsGetterAjax.php index 441e90ace..555dfcdd3 100755 --- a/workflow/engine/methods/dynaforms/fieldsGetterAjax.php +++ b/workflow/engine/methods/dynaforms/fieldsGetterAjax.php @@ -1,110 +1,108 @@ AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax'); - $i = 0; - $aFields = array(); - $aFields[] = array('XMLNODE_NAME' => 'char', - 'TYPE' => 'char', - 'UP' => 'char', - 'DOWN' => 'char'); - $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml')); - $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"'); - $iMaximun = $oDataset->count(); - while ($aRow = $oDataset->Read()) { - $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], - 'TYPE' => $aRow['TYPE'], - 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), - 'DOWN' => ($i < $iMaximun-1 ? G::LoadTranslation('ID_DOWN') : ''), - 'row__' => ($i + 1)); - $i++; - } - // print_r($aFields); - // die; - } catch (Exception $e) {} - $invalidFields = validateGridConversion($aFields); - if (count($invalidFields)> 0){ - return (implode(", " , $invalidFields)); - } else { - return "ok"; - } - } - // here make a response of the invalid fields for the Ajax request - echo getTemporalFields($_POST['FILENAME']); + } + return $invalidFields; +} // end -?> \ No newline at end of file + + +// added by gustavo cruz gustavo-at-colosa.com +/** + * this function get the fields that are part of the temporal + * dynaform file. + * + * @name getTemporalFields + * @author gustavo cruz + * @access public + * @param $file - the name of the dynaform file + * @return invalidFields string + */ +function getTemporalFields ($file) +{ + try { + //$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax'); + $i = 0; + $aFields = array (); + $aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char'); + $oSession = new DBSession( new DBConnection( PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml' ) ); + $oDataset = $oSession->Execute( 'SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"' ); + $iMaximun = $oDataset->count(); + while ($aRow = $oDataset->Read()) { + $aFields[] = array ('XMLNODE_NAME' => $aRow['XMLNODE_NAME'],'TYPE' => $aRow['TYPE'],'UP' => ($i > 0 ? G::LoadTranslation( 'ID_UP' ) : ''),'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation( 'ID_DOWN' ) : ''),'row__' => ($i + 1)); + $i ++; + } + // print_r($aFields); + // die; + } catch (Exception $e) { + } + $invalidFields = validateGridConversion( $aFields ); + if (count( $invalidFields ) > 0) { + return (implode( ", ", $invalidFields )); + } else { + return "ok"; + } +} +// here make a response of the invalid fields for the Ajax request +echo getTemporalFields( $_POST['FILENAME'] ); +// end + diff --git a/workflow/engine/methods/dynaforms/fieldsHandler.php b/workflow/engine/methods/dynaforms/fieldsHandler.php index 261f44ca9..dfb56815a 100755 --- a/workflow/engine/methods/dynaforms/fieldsHandler.php +++ b/workflow/engine/methods/dynaforms/fieldsHandler.php @@ -1,8 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * 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 Aug 26th, 2009 + * @Date Aug 26th, 2009 */ - - $G_PUBLISH = new Publisher(); - $oHeadPublisher =& headPublisher::getSingleton(); - $G_PUBLISH->AddContent('view', 'dynaforms/fieldsHandlerViewer'); - G::RenderPage( "publish" , "raw" ); + +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); +$G_PUBLISH->AddContent( 'view', 'dynaforms/fieldsHandlerViewer' ); +G::RenderPage( "publish", "raw" ); + diff --git a/workflow/engine/methods/dynaforms/fieldsHandlerAjax.php b/workflow/engine/methods/dynaforms/fieldsHandlerAjax.php index 650280861..01c8002c1 100755 --- a/workflow/engine/methods/dynaforms/fieldsHandlerAjax.php +++ b/workflow/engine/methods/dynaforms/fieldsHandlerAjax.php @@ -1,8 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * 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 Aug 26th, 2009 + * @Date Aug 26th, 2009 */ - $request = $_POST['request']; - - switch($request){ - case 'save': - if( isset($_POST['items']) ){ - $items = $_POST['items']; - $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; - G::LoadSystem('dynaformhandler'); - - $o = new dynaFormHandler(PATH_DYNAFORM."{$tmpfilename}.xml"); - - $list_elements = explode(',', $items); - - $e = Array(); - foreach($list_elements as $element){ - $e[] = $o->getNode($element); - } - - $o->__cloneEmpty(); - - foreach($e as $e1){ - $o->setNode($e1); - } - - - } - break; - - case 'saveHidden': - $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; - G::LoadSystem('dynaformhandler'); - $o = new dynaFormHandler(PATH_DYNAFORM."{$tmpfilename}.xml"); - $hidden_items = Array(); - - $has_hidden_items = false; - if( isset($_POST['hidden']) ){ - if( $_POST['hidden'] != '' ){ - $has_hidden_items = true; - - $hidden_items = explode(',', $_POST['hidden']); - $hidden_items_tmp = $hidden_items; - $hidden_items = Array(); - foreach($hidden_items_tmp as $hItem){ - $tmp = explode("@", $hItem); - $hidden_items[] = $tmp[1]; - } - $hidden_items_tmp = implode(',', $hidden_items); - } - } - - if( $has_hidden_items ){ - $hStr = ''; - foreach($hidden_items as $hItem){ - $hStr .= "hideRowById('$hItem'); "; - } - //echo 'something todo'; - //print_r($hidden_items); - $msg = " @! Autogenerated by Processmaker weboot; Do not modify this content, this is autogenerated alway when dynaform is updated "; - - if( $o->nodeExists('___pm_boot_strap___') ){ - $o->remove('___pm_boot_strap___'); - } - $metaEncrypt = G::encrypt($hidden_items_tmp, 'dynafieldsHandler'); - $o->add('___pm_boot_strap___', Array('type'=>'javascript', "meta"=>$metaEncrypt), "/*$msg*/ $hStr"); - echo $metaEncrypt; - } else { //we must to remove the boot strap node; - $o->remove('___pm_boot_strap___'); - } - break; - default: - echo 'no request param.'; - } - - - - - - - - - - - - - - - \ No newline at end of file +$request = $_POST['request']; + +switch ($request) { + case 'save': + if (isset( $_POST['items'] )) { + $items = $_POST['items']; + $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; + G::LoadSystem( 'dynaformhandler' ); + + $o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" ); + + $list_elements = explode( ',', $items ); + + $e = Array (); + foreach ($list_elements as $element) { + $e[] = $o->getNode( $element ); + } + + $o->__cloneEmpty(); + + foreach ($e as $e1) { + $o->setNode( $e1 ); + } + + } + break; + case 'saveHidden': + $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; + G::LoadSystem( 'dynaformhandler' ); + $o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" ); + $hidden_items = Array (); + + $has_hidden_items = false; + if (isset( $_POST['hidden'] )) { + if ($_POST['hidden'] != '') { + $has_hidden_items = true; + + $hidden_items = explode( ',', $_POST['hidden'] ); + $hidden_items_tmp = $hidden_items; + $hidden_items = Array (); + foreach ($hidden_items_tmp as $hItem) { + $tmp = explode( "@", $hItem ); + $hidden_items[] = $tmp[1]; + } + $hidden_items_tmp = implode( ',', $hidden_items ); + } + } + + if ($has_hidden_items) { + $hStr = ''; + foreach ($hidden_items as $hItem) { + $hStr .= "hideRowById('$hItem'); "; + } + //echo 'something todo'; + //print_r($hidden_items); + $msg = " @! Autogenerated by Processmaker weboot; Do not modify this content, this is autogenerated alway when dynaform is updated "; + + if ($o->nodeExists( '___pm_boot_strap___' )) { + $o->remove( '___pm_boot_strap___' ); + } + $metaEncrypt = G::encrypt( $hidden_items_tmp, 'dynafieldsHandler' ); + $o->add( '___pm_boot_strap___', Array ('type' => 'javascript',"meta" => $metaEncrypt + ), "/*$msg*/ $hStr" ); + echo $metaEncrypt; + } else { + //we must to remove the boot strap node; + $o->remove( '___pm_boot_strap___' ); + } + break; + default: + echo 'no request param.'; +} + diff --git a/workflow/engine/methods/dynaforms/fieldsHandlerViewer.php b/workflow/engine/methods/dynaforms/fieldsHandlerViewer.php index a265bbfbc..c251a8d0f 100755 --- a/workflow/engine/methods/dynaforms/fieldsHandlerViewer.php +++ b/workflow/engine/methods/dynaforms/fieldsHandlerViewer.php @@ -1,8 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * 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 Aug 26th, 2009 + * @Date Aug 26th, 2009 */ - $G_PUBLISH = new Publisher(); +$G_PUBLISH = new Publisher(); - $_POST['fieldsList'] = Array('button', 'checkbox', 'checkgroup', 'currency', 'date', 'dropdown', 'file', 'grid', 'hidden', 'javascript', - 'link', 'listbox', 'password', 'percentage', 'radiogroup', 'radiogroupview', 'reset', 'submit', 'subtitle', 'suggest', 'text', - 'textarea', 'title', 'yesno'); +$_POST['fieldsList'] = Array ('button','checkbox','checkgroup','currency','date','dropdown','file','grid','hidden','javascript','link','listbox','password','percentage','radiogroup','radiogroupview','reset','submit','subtitle','suggest','text','textarea','title','yesno'); + +$G_PUBLISH->AddContent( 'view', 'dynaforms/fieldsHandler' ); +G::RenderPage( "publish", "raw" ); - $G_PUBLISH->AddContent('view', 'dynaforms/fieldsHandler'); - G::RenderPage( "publish" , "raw" ); diff --git a/workflow/engine/methods/dynaforms/fields_Ajax.php b/workflow/engine/methods/dynaforms/fields_Ajax.php index b0437aa77..7a74395cf 100755 --- a/workflow/engine/methods/dynaforms/fields_Ajax.php +++ b/workflow/engine/methods/dynaforms/fields_Ajax.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; -/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/ -if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) eval($_SESSION['CURRENT_PAGE_INITILIZATION']); -//G::LoadSystem('json'); -require_once(PATH_THIRDPARTY . 'pear/json/class.json.php'); -$json=new Services_JSON(); -$G_FORM=new form(G::getUIDName(urlDecode($_POST['form']))); -$G_FORM->id=urlDecode($_POST['form']); -$G_FORM->values=$_SESSION[$G_FORM->id]; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} + /*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/ +if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] )) { + eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] ); +} + //G::LoadSystem('json'); +require_once (PATH_THIRDPARTY . 'pear/json/class.json.php'); +$json = new Services_JSON(); +$G_FORM = new form( G::getUIDName( urlDecode( $_POST['form'] ) ) ); +$G_FORM->id = urlDecode( $_POST['form'] ); +$G_FORM->values = $_SESSION[$G_FORM->id]; -G::LoadClass('xmlDb'); -$file = G::decrypt( $G_FORM->values['PME_A'] , URL_KEY ); -define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); -define('DB_XMLDB_USER',''); -define('DB_XMLDB_PASS',''); -define('DB_XMLDB_NAME',''); -define('DB_XMLDB_TYPE','myxml'); +G::LoadClass( 'xmlDb' ); +$file = G::decrypt( $G_FORM->values['PME_A'], URL_KEY ); +define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); -$newValues=($json->decode(urlDecode(stripslashes($_POST['fields'])))); +$newValues = ($json->decode( urlDecode( stripslashes( $_POST['fields'] ) ) )); //Resolve dependencies //Returns an array ($dependentFields) with the names of the fields //that depends of fields passed through AJAX ($_GET/$_POST) -$dependentFields=array(); $aux=array(); -for($r=0;$rsetValues($newValues[$r]); - //Search dependent fields - foreach($newValues[$r] as $k => $v) { - $myDependentFields = subDependencies( $k , $G_FORM , $aux ); - $dependentFields=array_merge($dependentFields, $myDependentFields); - } +$dependentFields = array (); +$aux = array (); +for ($r = 0; $r < sizeof( $newValues ); $r ++) { + $newValues[$r] = (array) $newValues[$r]; + $G_FORM->setValues( $newValues[$r] ); + //Search dependent fields + foreach ($newValues[$r] as $k => $v) { + $myDependentFields = subDependencies( $k, $G_FORM, $aux ); + $dependentFields = array_merge( $dependentFields, $myDependentFields ); + } } -$dependentFields=array_unique($dependentFields); +$dependentFields = array_unique( $dependentFields ); //Parse and update the new content $template = PATH_CORE . 'templates/xmlform.html'; -$newContent=$G_FORM->getFields($template); +$newContent = $G_FORM->getFields( $template ); //Returns the dependentFields's content -$sendContent=array(); -$r=0; -foreach($dependentFields as $d) { - $sendContent[$r]->name=$d; - $sendContent[$r]->content=NULL; - foreach($G_FORM->fields[$d] as $attribute => $value) { - switch($attribute) { - case 'type': - $sendContent[$r]->content->{$attribute}=$value; break; - case 'options': - $sendContent[$r]->content->{$attribute}=toJSArray($value); break; - } - } - $sendContent[$r]->value=$G_FORM->values[$d]; - $r++; +$sendContent = array (); +$r = 0; +foreach ($dependentFields as $d) { + $sendContent[$r]->name = $d; + $sendContent[$r]->content = null; + foreach ($G_FORM->fields[$d] as $attribute => $value) { + switch ($attribute) { + case 'type': + $sendContent[$r]->content->{$attribute} = $value; + break; + case 'options': + $sendContent[$r]->content->{$attribute} = toJSArray( $value ); + break; + } + } + $sendContent[$r]->value = $G_FORM->values[$d]; + $r ++; } -echo($json->encode($sendContent)); +echo ($json->encode( $sendContent )); -function toJSArray($array) +function toJSArray ($array) { - $result=array(); - foreach($array as $k => $v){ - $o=NULL; - $o->key=$k; - $o->value=$v; - $result[]=$o; - } - return $result; + $result = array (); + foreach ($array as $k => $v) { + $o = null; + $o->key = $k; + $o->value = $v; + $result[] = $o; + } + return $result; } -function subDependencies( $k , &$G_FORM , &$aux ) { - if (array_search( $k, $aux )!==FALSE) return array(); - if (!array_key_exists( $k , $G_FORM->fields )) return array(); - if (!isset($G_FORM->fields[$k]->dependentFields)) return array(); - $aux[] = $k; - $myDependentFields = explode( ',', $G_FORM->fields[$k]->dependentFields); - for( $r=0 ; $r < sizeof($myDependentFields) ; $r++ ) { - if ($myDependentFields[$r]=="") unset($myDependentFields[$r]); - } - $mD = $myDependentFields; - foreach( $mD as $ki) { - $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux ) ); - } - return $myDependentFields; +function subDependencies ($k, &$G_FORM, &$aux) +{ + if (array_search( $k, $aux ) !== false) { + return array (); + } + if (! array_key_exists( $k, $G_FORM->fields )) { + return array (); + } + if (! isset( $G_FORM->fields[$k]->dependentFields )) { + return array (); + } + $aux[] = $k; + $myDependentFields = explode( ',', $G_FORM->fields[$k]->dependentFields ); + for ($r = 0; $r < sizeof( $myDependentFields ); $r ++) { + if ($myDependentFields[$r] == "") { + unset( $myDependentFields[$r] ); + } + } + $mD = $myDependentFields; + foreach ($mD as $ki) { + $myDependentFields = array_merge( $myDependentFields, subDependencies( $ki, $G_FORM, $aux ) ); + } + return $myDependentFields; } -?> \ No newline at end of file + diff --git a/workflow/engine/methods/dynaforms/fields_Delete.php b/workflow/engine/methods/dynaforms/fields_Delete.php index 6b12b492e..d97cd7abe 100755 --- a/workflow/engine/methods/dynaforms/fields_Delete.php +++ b/workflow/engine/methods/dynaforms/fields_Delete.php @@ -12,53 +12,53 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('dynaFormField'); - if (!(isset($_POST['A']) && $_POST['A']!=='')) return; +G::LoadClass( 'dynaFormField' ); - $file = G::decrypt( $_POST['A'] , URL_KEY ); +if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) { + return; +} - $dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); - $ses = new DBSession($dbc); +$file = G::decrypt( $_POST['A'], URL_KEY ); - $fields = new DynaFormField( $dbc ); +$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); +$ses = new DBSession( $dbc ); - if (!isset($_POST['XMLNODE_NAME'])) return; +$fields = new DynaFormField( $dbc ); - $fields->Delete( $_POST['XMLNODE_NAME'] ); +if (! isset( $_POST['XMLNODE_NAME'] )) { + return; +} + +$fields->Delete( $_POST['XMLNODE_NAME'] ); + +G::LoadClass( 'xmlDb' ); +$i = 0; +$aFields = array (); +$aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char'); +$oSession = new DBSession( new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ) ); +$oDataset = $oSession->Execute( 'SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )' ); +$iMaximun = $oDataset->count(); +while ($aRow = $oDataset->Read()) { + $aFields[] = array ('XMLNODE_NAME' => $aRow['XMLNODE_NAME'],'TYPE' => $aRow['TYPE'],'UP' => ($i > 0 ? G::LoadTranslation( 'ID_UP' ) : ''),'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation( 'ID_DOWN' ) : '') ); + $i ++; +} +global $_DBArray; +$_DBArray['fields'] = $aFields; +$_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('xmlDb'); - $i = 0; - $aFields = array(); - $aFields[] = array('XMLNODE_NAME' => 'char', - 'TYPE' => 'char', - 'UP' => 'char', - 'DOWN' => 'char'); - $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml')); - $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )'); - $iMaximun = $oDataset->count(); - while ($aRow = $oDataset->Read()) { - $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], - 'TYPE' => $aRow['TYPE'], - 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), - 'DOWN' => ($i < $iMaximun-1 ? G::LoadTranslation('ID_DOWN') : '')); - $i++; - } - global $_DBArray; - $_DBArray['fields'] = $aFields; - $_SESSION['_DBArray'] = $_DBArray; -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/fields_Edit.php b/workflow/engine/methods/dynaforms/fields_Edit.php index 125ed576c..b4352c326 100755 --- a/workflow/engine/methods/dynaforms/fields_Edit.php +++ b/workflow/engine/methods/dynaforms/fields_Edit.php @@ -12,50 +12,54 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('dynaFormField'); - if (!(isset($_GET['A']) && $_GET['A']!=='')) return; +G::LoadClass( 'dynaFormField' ); - $file = G::decrypt( $_GET['A'] , URL_KEY ); +if (! (isset( $_GET['A'] ) && $_GET['A'] !== '')) { + return; +} - $dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); - $ses = new DBSession($dbc); +$file = G::decrypt( $_GET['A'], URL_KEY ); - //TODO: Improve how to obtain the PRO_UID. - $aFile=explode('/',str_replace('\\','/',$file)); - $proUid=$aFile[0]; - $dynUid=str_replace("_tmp0","",$aFile[1]); - - require_once 'classes/model/Dynaform.php'; - $k=new Criteria('workflow'); - $k->addSelectColumn(DynaformPeer::DYN_TYPE); - $k->add(DynaformPeer::DYN_UID,$dynUid); - $ods=DynaformPeer::doSelectRS($k); - $ods->next(); - $row=$ods->getRow(); - $dynType=$row[0]; +$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' ); +$ses = new DBSession( $dbc ); - $Fields['PME_DYN_TYPE']=$dynType; - - $fields = new DynaFormField( $dbc ); - $fields->Fields['XMLNODE_NAME']=(isset($_GET['XMLNODE_NAME'])) ? urldecode($_GET['XMLNODE_NAME']):''; - $fields->Load( $fields->Fields['XMLNODE_NAME'] ); +//TODO: Improve how to obtain the PRO_UID. +$aFile = explode( '/', str_replace( '\\', '/', $file ) ); +$proUid = $aFile[0]; +$dynUid = str_replace( "_tmp0", "", $aFile[1] ); - /* Start Comment: Modify the options grid to set dynamically the language +require_once 'classes/model/Dynaform.php'; +$k = new Criteria( 'workflow' ); +$k->addSelectColumn( DynaformPeer::DYN_TYPE ); +$k->add( DynaformPeer::DYN_UID, $dynUid ); +$ods = DynaformPeer::doSelectRS( $k ); +$ods->next(); +$row = $ods->getRow(); +$dynType = $row[0]; + +$Fields['PME_DYN_TYPE'] = $dynType; + +$fields = new DynaFormField( $dbc ); +$fields->Fields['XMLNODE_NAME'] = (isset( $_GET['XMLNODE_NAME'] )) ? urldecode( $_GET['XMLNODE_NAME'] ) : ''; +$fields->Load( $fields->Fields['XMLNODE_NAME'] ); + +/* Start Comment: Modify the options grid to set dynamically the language * label columns. */ // $dbc2 = new DBConnection( PATH_XMLFORM . 'dynaforms/fields/_options.xml' ,'','','','myxml' ); @@ -71,128 +75,119 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons // $ses2->execute("INSERT INTO dynaForm.LABEL_{$LANG} (XMLNODE_NAME,XMLNODE_VALUE) VALUES ('".SYS_LANG."', '{$Label} ({$lang})') "); // $ses2->execute("INSERT INTO dynaForm (XMLNODE_NAME,XMLNODE_TYPE,XMLNODE_VALUE) VALUES ('', 'cdata', '\n') "); // } - /* End Comment: */ +/* End Comment: */ +define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); - define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); +$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true ); - $form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true ); +if (is_array( $fields->Fields )) { + foreach ($fields->Fields as $key => $value) { + $Fields['PME_' . $key] = $value; + } +} - if (is_array($fields->Fields)) { - foreach( $fields->Fields as $key => $value ) { - $Fields['PME_'.$key] = $value; - } - } +$Fields['PME_A'] = $_GET['A']; +$Fields['PME_PRO_UID'] = $proUid; +$Fields['PME_XMLNODE_NAME_OLD'] = (isset( $Fields['PME_XMLNODE_NAME'] ) ? $Fields['PME_XMLNODE_NAME'] : ''); - $Fields['PME_A'] = $_GET['A']; - $Fields['PME_PRO_UID'] = $proUid; - $Fields['PME_XMLNODE_NAME_OLD'] = (isset($Fields['PME_XMLNODE_NAME']) ? $Fields['PME_XMLNODE_NAME'] : ''); - - $G_PUBLISH = new Publisher(); +$G_PUBLISH = new Publisher(); - if ( !( isset($fields->Fields['XMLNODE_NAME']) && ($fields->Fields['XMLNODE_NAME']!=='') ) ) { - $type = strtolower( $_GET['TYPE'] ); - } else { - $type = strtolower( $fields->Fields['TYPE'] ); - } +if (! (isset( $fields->Fields['XMLNODE_NAME'] ) && ($fields->Fields['XMLNODE_NAME'] !== ''))) { + $type = strtolower( $_GET['TYPE'] ); +} else { + $type = strtolower( $fields->Fields['TYPE'] ); +} - if( $type == 'suggest' || - $type == 'checkgroup' || - $type == 'dropdown' || - $type == 'radiogroup' || - $type == 'text' || - $type == 'listbox' || - $type == 'currency' || - $type == 'percentage' || - $type == 'textarea' || - $type == 'hidden' ) { +if ($type == 'suggest' || $type == 'checkgroup' || $type == 'dropdown' || $type == 'radiogroup' || $type == 'text' || $type == 'listbox' || $type == 'currency' || $type == 'percentage' || $type == 'textarea' || $type == 'hidden') { - $aDefaultConnections = array(); - $aDBConn = array(); - G::LoadClass ( 'dbConnections'); - $oDBConn = new DbConnections (); - $aDefaultConnections = array ( - array('DBS_UID' => '', 'DBS_NAME' => ''), - array('DBS_UID' => 'dbarray', 'DBS_NAME' => 'dbarray'), - array('DBS_UID' => 'workflow', 'DBS_NAME' => 'Workflow'), - array('DBS_UID' => 'rbac', 'DBS_NAME' => 'RBAC'), - array('DBS_UID' => 'rp', 'DBS_NAME' => 'REPORT') + $aDefaultConnections = array (); + $aDBConn = array (); + G::LoadClass( 'dbConnections' ); + $oDBConn = new DbConnections(); + $aDefaultConnections = array (array ('DBS_UID' => '','DBS_NAME' => '' + ),array ('DBS_UID' => 'dbarray','DBS_NAME' => 'dbarray' + ),array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow' + ),array ('DBS_UID' => 'rbac','DBS_NAME' => 'RBAC' + ),array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT' + ) ); - $aDBConn = $oDBConn->getConnectionsProUid($proUid); - $aDbConnections = array_merge($aDefaultConnections, $aDBConn ); - $_DBArray ['DB_CONNECTIONS'] = $aDbConnections; + $aDBConn = $oDBConn->getConnectionsProUid( $proUid ); + $aDbConnections = array_merge( $aDefaultConnections, $aDBConn ); + $_DBArray['DB_CONNECTIONS'] = $aDbConnections; $_SESSION['_DBArray'] = $_DBArray; - } +} - if ( !( isset($fields->Fields['XMLNODE_NAME']) && - ($fields->Fields['XMLNODE_NAME']!=='') ) ) { +if (! (isset( $fields->Fields['XMLNODE_NAME'] ) && ($fields->Fields['XMLNODE_NAME'] !== ''))) { $type = strtolower( $_GET['TYPE'] ); $Fields['PME_TYPE'] = $type; - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax'); - } else { + + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields, SYS_URI . 'dynaforms/fields_Save', SYS_URI . 'dynaforms/fields_Ajax' ); +} else { $Fields['PME_LABEL'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->label; - if (isset($form->fields[$fields->Fields['XMLNODE_NAME']]->code)) $Fields['PME_CODE'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->code; - $options=isset($form->fields[$fields->Fields['XMLNODE_NAME']]->option)? - $form->fields[$fields->Fields['XMLNODE_NAME']]->option:array(); - if (!is_array($options) || count($options)==0) $options =array('' => ''); - $Fields['PME_OPTIONS'] = array( - 'NAME' => array_keys($options), - 'LABEL' => array_values($options) - ); + if (isset( $form->fields[$fields->Fields['XMLNODE_NAME']]->code )) { + $Fields['PME_CODE'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->code; + } + $options = isset( $form->fields[$fields->Fields['XMLNODE_NAME']]->option ) ? $form->fields[$fields->Fields['XMLNODE_NAME']]->option : array (); + if (! is_array( $options ) || count( $options ) == 0) { + $options = array ('' => '' ); + } + $Fields['PME_OPTIONS'] = array ('NAME' => array_keys( $options ),'LABEL' => array_values( $options ) ); $type = strtolower( $fields->Fields['TYPE'] ); - if ($type==='checkbox') { - if ($Fields['PME_DEFAULTVALUE']===$Fields['PME_VALUE']) { - $Fields['PME_DEFAULTVALUE']='On'; - } else { - $Fields['PME_DEFAULTVALUE']='Off'; - } - } - - if( $type == 'suggest' && isset($Fields['PME_SQLCONNECTION']) && $Fields['PME_SQLCONNECTION']!='') { - //define the dbArray with the table fields - //g::pr($Fields); - - $tableExists = true; - $sDataBase = 'database_' . strtolower(DB_ADAPTER); - if(G::LoadSystemExist($sDataBase)){ - G::LoadSystem($sDataBase); - $oDataBase = new database(); - $dataBase = $Fields['PME_SQLCONNECTION']; - if($Fields['PME_SQLCONNECTION']=='workflow') - $dataBase = DB_NAME; - $tableExists = $oDataBase->tableExists('USERS', $dataBase); - } - if($tableExists) { - $con = Propel::getConnection($Fields['PME_SQLCONNECTION']); - $rs = $con->executeQuery("SHOW COLUMNS FROM USERS"); - $result = Array(); - $i=0; - while ($rs->next()) { - $result[$i++] = $rs->getRow(); + if ($type === 'checkbox') { + if ($Fields['PME_DEFAULTVALUE'] === $Fields['PME_VALUE']) { + $Fields['PME_DEFAULTVALUE'] = 'On'; + } else { + $Fields['PME_DEFAULTVALUE'] = 'Off'; } - } - } - //g::pr($result); - - - if( isset($Fields['PME_HINT']) ) { - $Fields['PME_HINT'] = stripslashes($Fields['PME_HINT']); - $Fields['PME_HINT'] = htmlspecialchars_decode($Fields['PME_HINT']); - $Fields['PME_HINT'] = str_replace("'", "'", $Fields['PME_HINT']); } - if (file_exists( PATH_XMLFORM . 'dynaforms/fields/' . $type . '.xml')) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax'); + if ($type == 'suggest' && isset( $Fields['PME_SQLCONNECTION'] ) && $Fields['PME_SQLCONNECTION'] != '') { + //define the dbArray with the table fields + //g::pr($Fields); + + + $tableExists = true; + $sDataBase = 'database_' . strtolower( DB_ADAPTER ); + if (G::LoadSystemExist( $sDataBase )) { + G::LoadSystem( $sDataBase ); + $oDataBase = new database(); + $dataBase = $Fields['PME_SQLCONNECTION']; + if ($Fields['PME_SQLCONNECTION'] == 'workflow') { + $dataBase = DB_NAME; + } + $tableExists = $oDataBase->tableExists( 'USERS', $dataBase ); + } + if ($tableExists) { + $con = Propel::getConnection( $Fields['PME_SQLCONNECTION'] ); + $rs = $con->executeQuery( "SHOW COLUMNS FROM USERS" ); + $result = Array (); + $i = 0; + while ($rs->next()) { + $result[$i ++] = $rs->getRow(); + } + } + } + //g::pr($result); + + + if (isset( $Fields['PME_HINT'] )) { + $Fields['PME_HINT'] = stripslashes( $Fields['PME_HINT'] ); + $Fields['PME_HINT'] = htmlspecialchars_decode( $Fields['PME_HINT'] ); + $Fields['PME_HINT'] = str_replace( "'", "'", $Fields['PME_HINT'] ); + } + + if (file_exists( PATH_XMLFORM . 'dynaforms/fields/' . $type . '.xml' )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields, SYS_URI . 'dynaforms/fields_Save', SYS_URI . 'dynaforms/fields_Ajax' ); } else { - print(G::LoadTranslation('ID_UNKNOWN_FIELD_TYPE')); + print (G::LoadTranslation( 'ID_UNKNOWN_FIELD_TYPE' )) ; } - } +} + +G::RenderPage( "publish", "raw" ); - G::RenderPage( "publish" , "raw" ); -?> diff --git a/workflow/engine/methods/dynaforms/fields_List.php b/workflow/engine/methods/dynaforms/fields_List.php index cb05c0d96..626bcb701 100755 --- a/workflow/engine/methods/dynaforms/fields_List.php +++ b/workflow/engine/methods/dynaforms/fields_List.php @@ -12,44 +12,43 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - G::LoadClass('dynaFormField'); - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'processes'; - $G_ID_MENU_SELECTED = 'PROCESSES'; - $G_ID_SUB_MENU_SELECTED = 'FIELDS'; +G::LoadClass( 'dynaFormField' ); - $PRO_UID='746B734DC23311'; - $file = $PRO_UID . '/' . 'myInfo'; +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'processes'; +$G_ID_MENU_SELECTED = 'PROCESSES'; +$G_ID_SUB_MENU_SELECTED = 'FIELDS'; - define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); - define('DB_XMLDB_USER',''); - define('DB_XMLDB_PASS',''); - define('DB_XMLDB_NAME',''); - define('DB_XMLDB_TYPE','myxml'); +$PRO_UID = '746B734DC23311'; +$file = $PRO_UID . '/' . 'myInfo'; - $G_PUBLISH = new Publisher; +define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' ); +define( 'DB_XMLDB_USER', '' ); +define( 'DB_XMLDB_PASS', '' ); +define( 'DB_XMLDB_NAME', '' ); +define( 'DB_XMLDB_TYPE', 'myxml' ); - $Parameters = array( - 'SYS_LANG' => SYS_LANG, - 'URL'=> G::encrypt( $file , URL_KEY ) ); +$G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters , '', 'dynaforms_PagedTableAjax'); +$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $file, URL_KEY )); - G::RenderPage( "publish" ); +$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', 'dynaforms_PagedTableAjax' ); + +G::RenderPage( "publish" ); -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/fields_Order.php b/workflow/engine/methods/dynaforms/fields_Order.php index f304278d6..2b8299ac8 100755 --- a/workflow/engine/methods/dynaforms/fields_Order.php +++ b/workflow/engine/methods/dynaforms/fields_Order.php @@ -12,88 +12,94 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} - //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); + //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' ); - if (!(isset($_POST['A']) && $_POST['A']!=='')) return; - if (!(isset($_POST['XMLNODE_NAME']) && $_POST['XMLNODE_NAME']!=='')) return; - if (!(isset($_POST['NEW_POS']) && $_POST['NEW_POS']!=='')) return; +if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) { + return; +} +if (! (isset( $_POST['XMLNODE_NAME'] ) && $_POST['XMLNODE_NAME'] !== '')) { + return; +} +if (! (isset( $_POST['NEW_POS'] ) && $_POST['NEW_POS'] !== '')) { + return; +} - $file = PATH_DYNAFORM . G::decrypt( $_POST['A'] , URL_KEY ) . '.xml'; - $fieldName = $_POST['XMLNODE_NAME']; - $newPos = intval($_POST['NEW_POS']); +$file = PATH_DYNAFORM . G::decrypt( $_POST['A'], URL_KEY ) . '.xml'; +$fieldName = $_POST['XMLNODE_NAME']; +$newPos = intval( $_POST['NEW_POS'] ); - if (!file_exists($file)) return; +if (! file_exists( $file )) { + return; +} - $xmldoc = new Xml_Document(); - $xmldoc->parseXmlFile( $file ); +$xmldoc = new Xml_Document(); +$xmldoc->parseXmlFile( $file ); - $node =& $xmldoc->findNode( '/dynaForm/' . $fieldName ); +$node = & $xmldoc->findNode( '/dynaForm/' . $fieldName ); - if (!isset( $node )) return; - $numFields = 0; - foreach( $xmldoc->children[0]->children as $child ) - $numFields += ($child->name!=='')? 1 : 0; +if (! isset( $node )) { + return; +} +$numFields = 0; +foreach ($xmldoc->children[0]->children as $child) { + $numFields += ($child->name !== '') ? 1 : 0; +} - $newPos = ($newPos<1) ? 1 : $newPos; - $newPos = ($newPos>$numFields) ? $numFields : $newPos; +$newPos = ($newPos < 1) ? 1 : $newPos; +$newPos = ($newPos > $numFields) ? $numFields : $newPos; - $rowCounter = (int) 0; - $newOrder = array(); - foreach( $xmldoc->children[0]->children as $index => $child ) { - if ($child->name!=='') $rowCounter++; - if ($rowCounter==$newPos) { - $newOrder[] = $node; - $rowCounter++; - $newPos=-1; +$rowCounter = (int) 0; +$newOrder = array (); +foreach ($xmldoc->children[0]->children as $index => $child) { + if ($child->name !== '') { + $rowCounter ++; } - if ( $child->name !== $node->name ){ - $newOrder[] = $xmldoc->children[0]->children[$index]; + if ($rowCounter == $newPos) { + $newOrder[] = $node; + $rowCounter ++; + $newPos = - 1; } - else - $rowCounter--; - } - if ($rowCounter < $newPos) { - $newOrder[] = $node; - $rowCounter++; - $newPos=-1; - } - $xmldoc->children[0]->children = $newOrder; + if ($child->name !== $node->name) { + $newOrder[] = $xmldoc->children[0]->children[$index]; + } else { + $rowCounter --; + } +} +if ($rowCounter < $newPos) { + $newOrder[] = $node; + $rowCounter ++; + $newPos = - 1; +} +$xmldoc->children[0]->children = $newOrder; - $xmldoc->save( $file ); +$xmldoc->save( $file ); + +G::LoadClass( 'xmlDb' ); +$i = 0; +$aFields = array (); +$aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char','row__' => 'integer'); +$oSession = new DBSession( new DBConnection( $file, '', '', '', 'myxml' ) ); +$oDataset = $oSession->Execute( 'SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )' ); +$iMaximun = $oDataset->count(); +while ($aRow = $oDataset->Read()) { + $aFields[] = array ('XMLNODE_NAME' => $aRow['XMLNODE_NAME'],'TYPE' => $aRow['TYPE'],'UP' => ($i > 0 ? G::LoadTranslation( 'ID_UP' ) : ''),'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation( 'ID_DOWN' ) : ''),'row__' => ($i + 1) ); + $i ++; +} +global $_DBArray; +$_DBArray['fields'] = $aFields; +$_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('xmlDb'); - $i = 0; - $aFields = array(); - $aFields[] = array('XMLNODE_NAME' => 'char', - 'TYPE' => 'char', - 'UP' => 'char', - 'DOWN' => 'char', - 'row__' => 'integer'); - $oSession = new DBSession(new DBConnection($file, '', '', '', 'myxml')); - $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )'); - $iMaximun = $oDataset->count(); - while ($aRow = $oDataset->Read()) { - $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], - 'TYPE' => $aRow['TYPE'], - 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), - 'DOWN' => ($i < $iMaximun-1 ? G::LoadTranslation('ID_DOWN') : ''), - 'row__' => ($i + 1)); - $i++; - } - global $_DBArray; - $_DBArray['fields'] = $aFields; - $_SESSION['_DBArray'] = $_DBArray; -?> \ No newline at end of file diff --git a/workflow/engine/methods/dynaforms/test.php b/workflow/engine/methods/dynaforms/test.php index 044e0f523..4dfc23836 100755 --- a/workflow/engine/methods/dynaforms/test.php +++ b/workflow/engine/methods/dynaforms/test.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; -/* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/ - for($r=1;$r<10;$r++){ -/* The timestamp is a 60-bit value. For UUID version 1, this is - * represented by Coordinated Universal Time (UTC) as a count of 100- - * nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of - * Gregorian reform to the Christian calendar). - */ - $t=explode(' ',microtime()); - $ts=$t[1].substr($t[0],2,7); - $t[0]=substr('00'.base_convert($ts,10,16),-15); - var_dump($ts); - print("\n
"); - var_dump($t); - print("\n
"); - } +if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { + return $RBAC_Response; +} + /* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/ +for ($r = 1; $r < 10; $r ++) { + /* The timestamp is a 60-bit value. For UUID version 1, this is + * represented by Coordinated Universal Time (UTC) as a count of 100- + * nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of + * Gregorian reform to the Christian calendar). + */ + $t = explode( ' ', microtime() ); + $ts = $t[1] . substr( $t[0], 2, 7 ); + $t[0] = substr( '00' . base_convert( $ts, 10, 16 ), - 15 ); + var_dump( $ts ); + print ("\n
") ; + var_dump( $t ); + print ("\n
") ; +} /* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/ ?>
- - +
';} - } -?> +$test = $_POST['form']['test']; +if ($test) { + foreach ($test as $t) { + echo 'You selected ', $t, '
'; + } +} + From fd5ff3da7713ea9ff4e04f54706acaafdd25d409 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Thu, 18 Oct 2012 16:05:43 +0000 Subject: [PATCH 3/5] CODE STYLE Formating workflow/engine/methods/cases Change format files in workflow/engine/methods/cases --- workflow/engine/methods/cases/casesDemo.php | 1 + .../cases/casesGenerateDocumentPage_Ajax.php | 208 +- .../cases/casesHistoryDynaformPage_Ajax.php | 305 ++- .../engine/methods/cases/casesListExtJs.php | 1744 +++++++++------ .../cases/casesListExtJsRedirector.php | 54 +- .../engine/methods/cases/casesList_Ajax.php | 613 ++--- .../engine/methods/cases/casesMenuLoader.php | 381 ++-- .../methods/cases/casesSaveDataView.php | 73 +- .../methods/cases/casesSchedulerLog_Ajax.php | 84 +- .../engine/methods/cases/casesStartPage.php | 95 +- .../methods/cases/casesStartPage_Ajax.php | 711 +++--- .../methods/cases/casesToRevisePanelExtJs.php | 23 +- .../cases/casesToReviseTreeContent.php | 190 +- .../cases/cases_ShowOutputDocument.php | 169 +- .../cases_ShowToReviseOutputDocument.php | 120 +- workflow/engine/methods/cases/cases_Step.php | 1974 ++++++++--------- .../methods/cases/cases_StepToRevise.php | 221 +- .../cases/cases_StepToReviseInputs.php | 226 +- .../cases/cases_StepToReviseOutputs.php | 132 +- .../cases/cases_SupervisorSaveDocument.php | 154 +- .../cases/cases_ToReviseInputDocView.php | 159 +- .../cases/cases_ToReviseOutputDocView.php | 172 +- .../methods/cases/cases_UsersReassign.php | 149 +- .../engine/methods/cases/cases_toRevise.php | 58 +- .../methods/cases/data_casesSchedulerLog.php | 167 +- .../engine/methods/cases/debug_triggers.php | 129 +- workflow/engine/methods/cases/debug_vars.php | 202 +- workflow/engine/methods/cases/index.php | 56 +- workflow/engine/methods/cases/main.php | 71 +- workflow/engine/methods/cases/main_init.php | 60 +- workflow/engine/methods/cases/open.php | 181 +- .../engine/methods/cases/proxyCasesList.php | 136 +- .../engine/methods/cases/proxyProcessList.php | 137 +- .../methods/cases/proxyReassignCasesList.php | 208 +- .../methods/cases/proxyReassignUsersList.php | 210 +- .../cases/proxySaveReassignCasesList.php | 182 +- workflow/engine/methods/cases/summary.php | 157 +- 37 files changed, 5031 insertions(+), 4881 deletions(-) diff --git a/workflow/engine/methods/cases/casesDemo.php b/workflow/engine/methods/cases/casesDemo.php index 6ac60175b..644ddff14 100755 --- a/workflow/engine/methods/cases/casesDemo.php +++ b/workflow/engine/methods/cases/casesDemo.php @@ -167,3 +167,4 @@ catch ( Exception $e ){ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage('publish'); } + diff --git a/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php b/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php index 2d303dc40..58db609e5 100644 --- a/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php +++ b/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php @@ -12,138 +12,128 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * 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; - - - function casesShowOuputDocumentExist($url){ - - $urlArray = explode("?",$url); +$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; + +function casesShowOuputDocumentExist ($url) +{ + $urlArray = explode( "?", $url ); $urlParametroString = $urlArray[1]; - - parse_str($urlParametroString, $_GET); + parse_str( $urlParametroString, $_GET ); + + require_once ("classes/model/AppDocumentPeer.php"); - require_once ( "classes/model/AppDocumentPeer.php" ); - $oAppDocument = new AppDocument(); - $oAppDocument->Fields = $oAppDocument->load($_GET['a'],(isset($_GET['v']) )? $_GET['v'] : NULL ); - + $oAppDocument->Fields = $oAppDocument->load( $_GET['a'], (isset( $_GET['v'] )) ? $_GET['v'] : NULL ); + $sAppDocUid = $oAppDocument->getAppDocUid(); $info = pathinfo( $oAppDocument->getAppDocFilename() ); - if (!isset($_GET['ext'])) { + if (! isset( $_GET['ext'] )) { $ext = $info['extension']; - } - else { + } else { if ($_GET['ext'] != '') { $ext = $_GET['ext']; - } - else { + } else { $ext = $info['extension']; } } - $ver= (isset($_GET['v']) && $_GET['v']!='') ? '_'.$_GET['v'] : ''; - - if(!$ver) //This code is in the case the outputdocument won't be versioned - $ver='_1'; - - $realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid .$ver. '.' . $ext ; - $realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] .$ver. '.' . $ext ; - $realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename']. '.' . $ext ; - $sw_file_exists=false; - if(file_exists($realPath)){ - $sw_file_exists=true; - }elseif(file_exists($realPath1)){ - $sw_file_exists=true; - $realPath=$realPath1; - }elseif(file_exists($realPath2)){ - $sw_file_exists=true; - $realPath=$realPath2; + $ver = (isset( $_GET['v'] ) && $_GET['v'] != '') ? '_' . $_GET['v'] : ''; + + if (! $ver) //This code is in the case the outputdocument won't be versioned + $ver = '_1'; + + $realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext; + $realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . $ver . '.' . $ext; + $realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . '.' . $ext; + $sw_file_exists = false; + if (file_exists( $realPath )) { + $sw_file_exists = true; + } elseif (file_exists( $realPath1 )) { + $sw_file_exists = true; + $realPath = $realPath1; + } elseif (file_exists( $realPath2 )) { + $sw_file_exists = true; + $realPath = $realPath2; } - + $swFileExist = 0; - if($sw_file_exists){ + if ($sw_file_exists) { $swFileExist = 1; - } - return $swFileExist; - } - - if($actionAjax=='casesGenerateDocumentPage'){ - global $G_PUBLISH; - - $oHeadPublisher =& headPublisher::getSingleton(); - G::loadClass('configuration'); - $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'); - } - if($actionAjax=='generateDocumentGrid_Ajax'){ - G::LoadClass('case'); - G::LoadClass("BasePeer" ); - - global $G_PUBLISH; - $oCase = new Cases(); - - $aProcesses = Array(); + } + return $swFileExist; +} - $G_PUBLISH = new Publisher(); - $c = $oCase->getAllGeneratedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']); - if ( $c->getDbName() == 'dbarray' ){ - $rs = ArrayBasePeer::doSelectRs ($c); - } - else{ - $rs = GulliverBasePeer::doSelectRs ($c); - } - - $rs->setFetchmode (ResultSet::FETCHMODE_ASSOC); - $rs->next(); - - $totalCount = 0; - for($j=0;$j< $rs->getRecordCount() ;$j++) { - $result = $rs->getRow(); - - $result["FILEDOCEXIST"] = casesShowOuputDocumentExist($result["FILEDOC"]); - $result["FILEPDFEXIST"] = casesShowOuputDocumentExist($result["FILEPDF"]); - - $aProcesses[] = $result; - +if ($actionAjax == 'casesGenerateDocumentPage') { + global $G_PUBLISH; - $rs->next(); - $totalCount++; - } - - //!dateFormat - G::LoadClass ( 'configuration' ); - $conf = new Configurations(); - try { - $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '' ); - } - catch (Exception $e){ - $generalConfCasesList = array(); - } - $dateFormat = ""; - if (isset($generalConfCasesList['casesListDateFormat'])&&!empty($generalConfCasesList['casesListDateFormat'])) { + $oHeadPublisher = & headPublisher::getSingleton(); + G::loadClass( 'configuration' ); + $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' ); +} +if ($actionAjax == 'generateDocumentGrid_Ajax') { + G::LoadClass( 'case' ); + G::LoadClass( "BasePeer" ); + + global $G_PUBLISH; + $oCase = new Cases(); + + $aProcesses = Array (); + + $G_PUBLISH = new Publisher(); + $c = $oCase->getAllGeneratedDocumentsCriteria( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED'] ); + if ($c->getDbName() == 'dbarray') { + $rs = ArrayBasePeer::doSelectRs( $c ); + } else { + $rs = GulliverBasePeer::doSelectRs( $c ); + } + + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + + $totalCount = 0; + for ($j = 0; $j < $rs->getRecordCount(); $j ++) { + $result = $rs->getRow(); + + $result["FILEDOCEXIST"] = casesShowOuputDocumentExist( $result["FILEDOC"] ); + $result["FILEPDFEXIST"] = casesShowOuputDocumentExist( $result["FILEPDF"] ); + + $aProcesses[] = $result; + + $rs->next(); + $totalCount ++; + } + + //!dateFormat + G::LoadClass( 'configuration' ); + $conf = new Configurations(); + try { + $generalConfCasesList = $conf->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); + } catch (Exception $e) { + $generalConfCasesList = array (); + } + $dateFormat = ""; + if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { $dateFormat = $generalConfCasesList['casesListDateFormat']; - } + } + + $newDir = '/tmp/test/directory'; + $r = G::verifyPath( $newDir ); + $r->data = $aProcesses; + $r->totalCount = $totalCount; + $r->dataFormat = $dateFormat; + echo G::json_encode( $r ); +} - - - $newDir = '/tmp/test/directory'; - $r = G::verifyPath ( $newDir ); - $r->data = $aProcesses; - $r->totalCount = $totalCount; - $r->dataFormat = $dateFormat; - echo G::json_encode($r); - } -?> \ No newline at end of file diff --git a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php index 3342848a5..b89da3608 100644 --- a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php +++ b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php @@ -12,78 +12,75 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * 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; +$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; +if ($actionAjax == "historyDynaformPage") { + global $G_PUBLISH; + $oHeadPublisher = & headPublisher::getSingleton(); + G::loadClass( 'configuration' ); + $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' ); +} +if ($actionAjax == 'historyDynaformGrid_Ajax') { + G::LoadClass( 'case' ); + G::LoadClass( "BasePeer" ); - if($actionAjax=="historyDynaformPage"){ - global $G_PUBLISH; - $oHeadPublisher =& headPublisher::getSingleton(); - G::loadClass('configuration'); - $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'); - } - if($actionAjax=='historyDynaformGrid_Ajax'){ - G::LoadClass('case'); - G::LoadClass("BasePeer" ); + global $G_PUBLISH; + $oCase = new Cases(); - global $G_PUBLISH; - $oCase = new Cases(); + $aProcesses = Array (); + $c = $oCase->getallDynaformsCriteria( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED'] ); - $aProcesses = Array(); - $c = $oCase->getallDynaformsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']); - - if ( $c->getDbName() == 'dbarray' ){ - $rs = ArrayBasePeer::doSelectRs ($c); - } - else{ - $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 ($c->getDbName() == 'dbarray') { + $rs = ArrayBasePeer::doSelectRs( $c ); + } else { + $rs = GulliverBasePeer::doSelectRs( $c ); } + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); - if($actionAjax=='showHistoryMessage'){ -?> - - - AddContent('xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID'])); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) ); - -?> - - - - AddContent('view', 'cases/cases_DynaformHistory'); + require_once 'classes/model/AppHistory.php'; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'view', 'cases/cases_DynaformHistory' ); - G::RenderPage('publish', 'raw'); - } + G::RenderPage( 'publish', 'raw' ); +} - if($actionAjax=='dynaformChangeLogViewHistory'){ +if ($actionAjax == 'dynaformChangeLogViewHistory') { -?> - - - AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' ); - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $FieldsHistory=unserialize($_SESSION['HISTORY_DATA']); - $Fields['APP_DATA'] = $FieldsHistory[$_POST['HISTORY_ID']]; - $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'); - - -?> - - - - loadCase($_SESSION['APPLICATION']); - $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;'; - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_POST['DYN_UID']; + $G_PUBLISH = new Publisher(); + $oCase = new Cases(); + $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + $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;'; + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_POST['DYN_UID']; - $_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID']; - $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); + $_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID']; + $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' ); -?> + ?> setExtSkin( 'xtheme-blue'); - - //get the configuration for this action - $conf = new Configurations(); - try { - // the setup for search is the same as the Sent (participated) - $confCasesList = $conf->getConfiguration('casesList', ($action=='search'||$action=='simple_search') ? 'search': $action ); - $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '' ); - } - catch (Exception $e){ - $confCasesList = array(); - $generalConfCasesList = array(); - } - - // reassign header configuration - $confReassignList = getReassignList(); - - // evaluates an action and the configuration for the list that will be rendered - $config = getAdditionalFields($action, (class_exists('enterprisePlugin') ? $confCasesList : array())); - $columns = $config['caseColumns']; - $readerFields = $config['caseReaderFields']; - $reassignColumns = $confReassignList['caseColumns']; - $reassignReaderFields = $confReassignList['caseReaderFields']; - - // if the general settings has been set the pagesize values are extracted from that record - if (isset($generalConfCasesList['casesListRowNumber'])&&!empty($generalConfCasesList['casesListRowNumber'])){ - $pageSize = intval($generalConfCasesList['casesListRowNumber']); - } - else { - $pageSize = intval($config['rowsperpage']); - } - - // if the general settings has been set the dateFormat values are extracted from that record - if (isset($generalConfCasesList['casesListDateFormat']) && !empty($generalConfCasesList['casesListDateFormat'])){ - $dateFormat = $generalConfCasesList['casesListDateFormat']; - } - else { - $dateFormat = $config['dateformat']; - } - - - - if ( $action == 'draft' /* && $action == 'cancelled' */) { +setExtSkin( 'xtheme-blue'); + + +//get the configuration for this action +$conf = new Configurations(); +try { + // the setup for search is the same as the Sent (participated) + $confCasesList = $conf->getConfiguration( 'casesList', ($action == 'search' || $action == 'simple_search') ? 'search' : $action ); + $generalConfCasesList = $conf->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); +} catch (Exception $e) { + $confCasesList = array (); + $generalConfCasesList = array (); +} + +// reassign header configuration +$confReassignList = getReassignList(); + +// evaluates an action and the configuration for the list that will be rendered +$config = getAdditionalFields( $action, (class_exists( 'enterprisePlugin' ) ? $confCasesList : array ()) ); +$columns = $config['caseColumns']; +$readerFields = $config['caseReaderFields']; +$reassignColumns = $confReassignList['caseColumns']; +$reassignReaderFields = $confReassignList['caseReaderFields']; + +// if the general settings has been set the pagesize values are extracted from that record +if (isset( $generalConfCasesList['casesListRowNumber'] ) && ! empty( $generalConfCasesList['casesListRowNumber'] )) { + $pageSize = intval( $generalConfCasesList['casesListRowNumber'] ); +} else { + $pageSize = intval( $config['rowsperpage'] ); +} + +// if the general settings has been set the dateFormat values are extracted from that record +if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { + $dateFormat = $generalConfCasesList['casesListDateFormat']; +} else { + $dateFormat = $config['dateformat']; +} + +if ($action == 'draft' /* && $action == 'cancelled' */) { //array_unshift ( $columns, array( 'header'=> '', 'width'=> 50, 'sortable'=> false, 'id'=> 'deleteLink' ) ); - } - if ( $action == 'selfservice' ) { - array_unshift ( $columns, array( 'header'=> '', 'width'=> 50, 'sortable'=> false, 'id'=> 'viewLink' ) ); - } - - if ( $action == 'paused' ) { +} +if ($action == 'selfservice') { + array_unshift( $columns, array ('header' => '','width' => 50,'sortable' => false,'id' => 'viewLink' + ) ); +} + +if ($action == 'paused') { //array_unshift ( $columns, array( 'header'=> '', 'width'=> 50, 'sortable'=> false, 'id'=> 'unpauseLink' ) ); - } +} /* if ( $action == 'to_reassign' ) { array_unshift ( $columns, array( 'header'=> '', 'width'=> 50, 'sortable'=> false, 'id'=> 'reassignLink' ) ); } -*/ +*/ // if ( $action == 'cancelled' ) { // array_unshift ( $columns, array( 'header'=> '', 'width'=> 50, 'sortable'=> false, 'id'=> 'reactivateLink' ) ); // } - - $userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; - $oAppCache = new AppCacheView(); - $oAppCache->confCasesList = $confCasesList; - - //get values for the comboBoxes - $processes[] = array ( '', G::LoadTranslation('ID_ALL_PROCESS')); - $status = getStatusArray($action, $userUid ); - $category = getCategoryArray(); - $users = getUserArray($action, $userUid ); - $allUsers = getAllUsersArray($action); - - $oHeadPublisher->assign('reassignReaderFields', $reassignReaderFields ); //sending the fields to get from proxy - $oHeadPublisher->addExtJsScript('cases/reassignList', false); - $oHeadPublisher->assign('pageSize', $pageSize); //sending the page size - $oHeadPublisher->assign('columns', $columns); //sending the columns to display in grid - $oHeadPublisher->assign('readerFields', $readerFields); //sending the fields to get from proxy - $oHeadPublisher->assign('reassignColumns', $reassignColumns); //sending the columns to display in grid - $oHeadPublisher->assign('action', $action); //sending the action to make - $oHeadPublisher->assign('PMDateFormat', $dateFormat); //sending the fields to get from proxy - $oHeadPublisher->assign('statusValues', $status); //Sending the listing of status - $oHeadPublisher->assign('processValues', $processes); //Sending the listing of processes - $oHeadPublisher->assign('categoryValues', $category); //Sending the listing of categories - $oHeadPublisher->assign('userValues', $users); //Sending the listing of users - $oHeadPublisher->assign('allUsersValues',$allUsers); //Sending the listing of all users - $oHeadPublisher->assign("solrEnabled", (($aux = System::solrEnv()) !== false)? 1 : 0); //Sending the status of solar - - //menu permissions - /*$c = new Criteria('workflow'); + + +$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null; +$oAppCache = new AppCacheView(); +$oAppCache->confCasesList = $confCasesList; + +//get values for the comboBoxes +$processes[] = array ('',G::LoadTranslation( 'ID_ALL_PROCESS' ) +); +$status = getStatusArray( $action, $userUid ); +$category = getCategoryArray(); +$users = getUserArray( $action, $userUid ); +$allUsers = getAllUsersArray( $action ); + +$oHeadPublisher->assign( 'reassignReaderFields', $reassignReaderFields ); //sending the fields to get from proxy +$oHeadPublisher->addExtJsScript( 'cases/reassignList', false ); +$oHeadPublisher->assign( 'pageSize', $pageSize ); //sending the page size +$oHeadPublisher->assign( 'columns', $columns ); //sending the columns to display in grid +$oHeadPublisher->assign( 'readerFields', $readerFields ); //sending the fields to get from proxy +$oHeadPublisher->assign( 'reassignColumns', $reassignColumns ); //sending the columns to display in grid +$oHeadPublisher->assign( 'action', $action ); //sending the action to make +$oHeadPublisher->assign( 'PMDateFormat', $dateFormat ); //sending the fields to get from proxy +$oHeadPublisher->assign( 'statusValues', $status ); //Sending the listing of status +$oHeadPublisher->assign( 'processValues', $processes ); //Sending the listing of processes +$oHeadPublisher->assign( 'categoryValues', $category ); //Sending the listing of categories +$oHeadPublisher->assign( 'userValues', $users ); //Sending the listing of users +$oHeadPublisher->assign( 'allUsersValues', $allUsers ); //Sending the listing of all users +$oHeadPublisher->assign( "solrEnabled", (($aux = System::solrEnv()) !== false) ? 1 : 0 ); //Sending the status of solar + + +//menu permissions +/*$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' ); - $cnt = AppThreadPeer::doCount($c);*/ - $cnt = ''; - $menuPerms = ''; - $menuPerms = $menuPerms . ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) ? 'R': ''; //can reassign case - - $oHeadPublisher->assign( '___p34315105', $menuPerms); // user menu permissions - - G::LoadClass('configuration'); - $c = new Configurations(); - - //$oHeadPublisher->addExtJsScript('cases/caseUtils', true); - $oHeadPublisher->addExtJsScript('app/main', true); - $oHeadPublisher->addExtJsScript('cases/casesList', false ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesListExtJs'); //adding a html file .html. - $oHeadPublisher->assign('FORMATS',$c->getFormats()); - G::RenderPage('publish', 'extJs'); - - function getUserArray ( $action, $userUid ) { - global $oAppCache; - $status = array(); - $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER")); - $users[] = array("", G::LoadTranslation("ID_ALL_USERS")); - + $cnt = AppThreadPeer::doCount($c);*/ +$cnt = ''; +$menuPerms = ''; +$menuPerms = $menuPerms . ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) ? 'R' : ''; //can reassign case + + +$oHeadPublisher->assign( '___p34315105', $menuPerms ); // user menu permissions + + +G::LoadClass( 'configuration' ); +$c = new Configurations(); + +//$oHeadPublisher->addExtJsScript('cases/caseUtils', true); +$oHeadPublisher->addExtJsScript( 'app/main', true ); +$oHeadPublisher->addExtJsScript( 'cases/casesList', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'cases/casesListExtJs' ); //adding a html file .html. +$oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); +G::RenderPage( 'publish', 'extJs' ); + +function getUserArray ($action, $userUid) +{ + global $oAppCache; + $status = array (); + $users[] = array ("CURRENT_USER",G::LoadTranslation( "ID_CURRENT_USER" ) + ); + $users[] = array ("",G::LoadTranslation( "ID_ALL_USERS" ) + ); + //now get users, just for the Search action - switch ( $action ) { - case 'search_simple': - case 'search' : - $cUsers = new Criteria('workflow'); - $cUsers->clearSelectColumns ( ); - $cUsers->addSelectColumn ( UsersPeer::USR_UID ); - $cUsers->addSelectColumn ( UsersPeer::USR_FIRSTNAME ); - $cUsers->addSelectColumn ( UsersPeer::USR_LASTNAME ); - $oDataset = UsersPeer::doSelectRS($cUsers); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while($aRow = $oDataset->getRow()){ - $users[] = array( $aRow['USR_UID'], $aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'] ); - $oDataset->next(); - } - break; - default: - return $users; - break; - } - return $users; - } - - function getCategoryArray () { - global $oAppCache; - require_once 'classes/model/ProcessCategory.php'; - $category[] = array("", G::LoadTranslation("ID_ALL_CATEGORIES")); - - $criteria = new Criteria('workflow'); - $criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID); - $criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME); - $dataset = ProcessCategoryPeer::doSelectRS($criteria); - $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $dataset->next(); - - while ($row = $dataset->getRow()) { - $category[] = array( $row['CATEGORY_UID'], $row['CATEGORY_NAME']); - $dataset->next(); - } - return $category; - } - - function getAllUsersArray ( $action ) { - global $oAppCache; - $status = array(); - $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER")); - $users[] = array("", G::LoadTranslation("ID_ALL_USERS")); - - if ($action=='to_reassign') { - //now get users, just for the Search action - $cUsers = $oAppCache->getToReassignListCriteria(); - $cUsers->addSelectColumn(AppCacheViewPeer::USR_UID); - - if(g::MySQLSintaxis()) - $cUsers->addGroupByColumn(AppCacheViewPeer::USR_UID); - - $cUsers->addAscendingOrderByColumn ( AppCacheViewPeer::APP_CURRENT_USER ); - $oDataset = AppCacheViewPeer::doSelectRS($cUsers); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while($aRow = $oDataset->getRow()){ - $users[] = array( $aRow['USR_UID'], $aRow['APP_CURRENT_USER'] ); - $oDataset->next(); - } - } - return $users; - } - - function getStatusArray ( $action, $userUid ) { - global $oAppCache; - $status = array(); - $status[] = array( '', G::LoadTranslation('ID_ALL_STATUS') ); -//get the list based in the action provided - switch ( $action ) { - case 'sent' : - $cStatus = $oAppCache->getSentListProcessCriteria ($userUid); // a little slow - break; - case 'simple_search': - case 'search' : - $cStatus = new Criteria('workflow'); - $cStatus->clearSelectColumns ( ); - $cStatus->setDistinct(); - $cStatus->addSelectColumn ( ApplicationPeer::APP_STATUS ); - $oDataset = ApplicationPeer::doSelectRS($cStatus); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while($aRow = $oDataset->getRow()){ - $status[] = array( $aRow['APP_STATUS'], G::LoadTranslation('ID_CASES_STATUS_'.$aRow['APP_STATUS']) ); //here we can have a translation for the status ( the second param) - $oDataset->next(); - } - return $status; - break; - - case 'selfservice' : - $cStatus = $oAppCache->getUnassignedListCriteria($userUid); - break; - case 'paused' : - $cStatus = $oAppCache->getPausedListCriteria($userUid); - break; - case 'to_revise' : - $cStatus = $oAppCache->getToReviseListCriteria($userUid); -// $cStatus = $oAppCache->getPausedListCriteria($userUid); - break; - case 'to_reassign' : - $cStatus = $oAppCache->getToReassignListCriteria(); - break; - case 'todo' : - case 'draft' : - case 'gral' : -// case 'to_revise' : - default: - return $status; - break; - } - + switch ($action) { + case 'search_simple': + case 'search': + $cUsers = new Criteria( 'workflow' ); + $cUsers->clearSelectColumns(); + $cUsers->addSelectColumn( UsersPeer::USR_UID ); + $cUsers->addSelectColumn( UsersPeer::USR_FIRSTNAME ); + $cUsers->addSelectColumn( UsersPeer::USR_LASTNAME ); + $oDataset = UsersPeer::doSelectRS( $cUsers ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $users[] = array ($aRow['USR_UID'],$aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'] + ); + $oDataset->next(); + } + break; + default: + return $users; + break; + } + return $users; +} + +function getCategoryArray () +{ + global $oAppCache; + require_once 'classes/model/ProcessCategory.php'; + $category[] = array ("",G::LoadTranslation( "ID_ALL_CATEGORIES" ) + ); + + $criteria = new Criteria( 'workflow' ); + $criteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_UID ); + $criteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME ); + $dataset = ProcessCategoryPeer::doSelectRS( $criteria ); + $dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $dataset->next(); + + while ($row = $dataset->getRow()) { + $category[] = array ($row['CATEGORY_UID'],$row['CATEGORY_NAME'] + ); + $dataset->next(); + } + return $category; +} + +function getAllUsersArray ($action) +{ + global $oAppCache; + $status = array (); + $users[] = array ("CURRENT_USER",G::LoadTranslation( "ID_CURRENT_USER" ) + ); + $users[] = array ("",G::LoadTranslation( "ID_ALL_USERS" ) + ); + + if ($action == 'to_reassign') { + //now get users, just for the Search action + $cUsers = $oAppCache->getToReassignListCriteria(); + $cUsers->addSelectColumn( AppCacheViewPeer::USR_UID ); + + if (g::MySQLSintaxis()) + $cUsers->addGroupByColumn( AppCacheViewPeer::USR_UID ); + + $cUsers->addAscendingOrderByColumn( AppCacheViewPeer::APP_CURRENT_USER ); + $oDataset = AppCacheViewPeer::doSelectRS( $cUsers ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $users[] = array ($aRow['USR_UID'],$aRow['APP_CURRENT_USER'] + ); + $oDataset->next(); + } + } + return $users; +} + +function getStatusArray ($action, $userUid) +{ + global $oAppCache; + $status = array (); + $status[] = array ('',G::LoadTranslation( 'ID_ALL_STATUS' ) + ); + //get the list based in the action provided + switch ($action) { + case 'sent': + $cStatus = $oAppCache->getSentListProcessCriteria( $userUid ); // a little slow + break; + case 'simple_search': + case 'search': + $cStatus = new Criteria( 'workflow' ); + $cStatus->clearSelectColumns(); + $cStatus->setDistinct(); + $cStatus->addSelectColumn( ApplicationPeer::APP_STATUS ); + $oDataset = ApplicationPeer::doSelectRS( $cStatus ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] ) + ); //here we can have a translation for the status ( the second param) + $oDataset->next(); + } + return $status; + break; + + case 'selfservice': + $cStatus = $oAppCache->getUnassignedListCriteria( $userUid ); + break; + case 'paused': + $cStatus = $oAppCache->getPausedListCriteria( $userUid ); + break; + case 'to_revise': + $cStatus = $oAppCache->getToReviseListCriteria( $userUid ); + // $cStatus = $oAppCache->getPausedListCriteria($userUid); + break; + case 'to_reassign': + $cStatus = $oAppCache->getToReassignListCriteria(); + break; + case 'todo': + case 'draft': + case 'gral': + // case 'to_revise' : + default: + return $status; + break; + } + //get the status for this user in this action only for participated, unassigned, paused -// if ( $action != 'todo' && $action != 'draft' && $action != 'to_revise') { - if ( $action != 'todo' && $action != 'draft' ) { - //$cStatus = new Criteria('workflow'); - $cStatus->clearSelectColumns ( ); - $cStatus->setDistinct(); - $cStatus->addSelectColumn ( AppCacheViewPeer::APP_STATUS ); - $oDataset = AppCacheViewPeer::doSelectRS($cStatus); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while($aRow = $oDataset->getRow()){ - $status[] = array( $aRow['APP_STATUS'], G::LoadTranslation('ID_CASES_STATUS_'.$aRow['APP_STATUS']) ); //here we can have a translation for the status ( the second param) - $oDataset->next(); - } - } - return $status; - } - - //these getXX function gets the default fields in casesListSetup - function getToDo() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 110); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PRIORITY'), 'dataIndex' => 'DEL_PRIORITY', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getDraft() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 110); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'),'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PRIORITY'), 'dataIndex' => 'DEL_PRIORITY', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getParticipated() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); + // if ( $action != 'todo' && $action != 'draft' && $action != 'to_revise') { + if ($action != 'todo' && $action != 'draft') { + //$cStatus = new Criteria('workflow'); + $cStatus->clearSelectColumns(); + $cStatus->setDistinct(); + $cStatus->addSelectColumn( AppCacheViewPeer::APP_STATUS ); + $oDataset = AppCacheViewPeer::doSelectRS( $cStatus ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] ) + ); //here we can have a translation for the status ( the second param) + $oDataset->next(); + } + } + return $status; +} + +//these getXX function gets the default fields in casesListSetup +function getToDo () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SENT_BY' ),'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DUE_DATE' ),'dataIndex' => 'DEL_TASK_DUE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PRIORITY' ),'dataIndex' => 'DEL_PRIORITY','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_FIRSTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_LASTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_USERNAME' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getDraft () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DUE_DATE' ),'dataIndex' => 'DEL_TASK_DUE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PRIORITY' ),'dataIndex' => 'DEL_PRIORITY','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getParticipated () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); //$caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'),'dataIndex' => 'APP_CURRENT_USER', 'width' => 120, 'sortable'=>false ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 80 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_STATUS'), 'dataIndex' => 'APP_STATUS', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getSearch() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 100 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CURRENT_USER' ),'dataIndex' => 'APP_CURRENT_USER','width' => 120,'sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 80 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_STATUS' ),'dataIndex' => 'APP_STATUS','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_FIRSTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_LASTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_USERNAME' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getSearch () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 100 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); //$caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'), 'dataIndex' => 'APP_CURRENT_USER', 'width' => 120, 'sortable'=>false ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 80 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DELEGATION_DATE'),'dataIndex' => 'DEL_DELEGATE_DATE', 'width' => 80 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 80); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_STATUS'), 'dataIndex' => 'APP_STATUS', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_DELEGATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getUnassigned() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 40, 'align' => 'left'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DUE_DATE'), 'dataIndex' => 'DEL_TASK_DUE_DATE', 'width' => 110); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 80 ); - -// $caseColumns[] = array( 'header' => G::LoadTranslation('ID_COMPLETED_BY_USER'),'dataIndex' => 'APP_CURRENT_USER','width' => 110 ); -// $caseColumns[] = array( 'header' => G::LoadTranslation('ID_FINISH_DATE'), 'dataIndex' => 'APP_FINISH_DATE', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getPaused() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 80 ); - - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_THREAD_INDEX'),'dataIndex' => 'APP_THREAD_INDEX', 'width' => 80 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_DEL_INDEX'), 'dataIndex' => 'DEL_INDEX', 'width' => 80 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_THREAD_INDEX' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getToRevise() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'),'dataIndex' => 'APP_CURRENT_USER','width' => 90, 'sortable'=>false ); -// $caseColumns[] = array( 'header' =>'Sent By', 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); -///-- $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PRIORITY'), 'dataIndex' => 'DEL_PRIORITY', 'width' => 50 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_STATUS'), 'dataIndex' => 'APP_STATUS', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_FIRSTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_LASTNAME' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_USERNAME' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); -// $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'DEL_TASK_DUE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getToReassign() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'),'dataIndex' => 'APP_CURRENT_USER','width' => 90, 'sortable'=>false ); -// $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_STATUS'), 'dataIndex' => 'APP_STATUS', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'TAS_UID' ); - $caseReaderFields[] = array( 'name' => 'DEL_INDEX' ); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); -// $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getGeneral() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'), 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45, 'align' => 'center', 'sortable'=>false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); - $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CURRENT_USER'),'dataIndex' => 'APP_CURRENT_USER', 'width' => 90, 'sortable'=>false ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_STATUS'), 'dataIndex' => 'APP_STATUS', 'width' => 50 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'PREVIOUS_USR_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); - $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); - $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - /** - * get the list configuration headers of the cases checked for reassign, for the - * reassign cases list. - */ - function getReassignList() { - $caseColumns = array (); - $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 40 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SUMMARY'), 'dataIndex' => 'CASE_SUMMARY', 'width' => 45,'hidden'=> true); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASES_NOTES'),'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 45,'hidden'=> true); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 100, 'hidden'=> true); - $caseColumns[] = array( 'header' => 'CaseId', 'dataIndex' => 'APP_UID' , 'width' => 200, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => 'User', 'dataIndex' => 'USR_UID' , 'width' => 200, 'hidden'=> true, 'hideable'=> false); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_TASK'), 'dataIndex' => 'APP_TAS_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_PROCESS'), 'dataIndex' => 'APP_PRO_TITLE', 'width' => 120 ); - $caseColumns[] = array( 'header' => 'Reassigned Uid', 'dataIndex' => 'APP_REASSIGN_USER_UID','width' => 120, 'hidden'=> true, 'hideable'=> false ); - $caseColumns[] = array( 'header' => 'Reassigned Uid', 'dataIndex' => 'TAS_UID', 'width' => 120, 'hidden'=> true, 'hideable'=> false ); - $caseColumns[] = array( 'header' => G::LoadTranslation('ID_REASSIGN_TO'),'dataIndex' => 'APP_REASSIGN_USER', 'width' => 170 ); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'APP_NUMBER' ); - $caseReaderFields[] = array( 'name' => 'APP_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_UID' ); - $caseReaderFields[] = array( 'name' => 'USR_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_TAS_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_PRO_TITLE' ); - $caseReaderFields[] = array( 'name' => 'APP_REASSIGN_USER_UID' ); - $caseReaderFields[] = array( 'name' => 'TAS_UID' ); - $caseReaderFields[] = array( 'name' => 'APP_REASSIGN_USER' ); - $caseReaderFields[] = array( 'name' => 'CASE_SUMMARY' ); - $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - - function getReassignUsersList() { - $caseColumns = array (); - - $caseReaderFields = array(); - $caseReaderFields[] = array( 'name' => 'userUid' ); - $caseReaderFields[] = array( 'name' => 'userFullname' ); - - return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); - } - + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CURRENT_USER' ),'dataIndex' => 'APP_CURRENT_USER','width' => 120,'sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 80 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DELEGATION_DATE' ),'dataIndex' => 'DEL_DELEGATE_DATE','width' => 80 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DUE_DATE' ),'dataIndex' => 'DEL_TASK_DUE_DATE','width' => 80 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_STATUS' ),'dataIndex' => 'APP_STATUS','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_DELEGATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getUnassigned () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 40,'align' => 'left' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SENT_BY' ),'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DUE_DATE' ),'dataIndex' => 'DEL_TASK_DUE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 80 + ); + + // $caseColumns[] = array( 'header' => G::LoadTranslation('ID_COMPLETED_BY_USER'),'dataIndex' => 'APP_CURRENT_USER','width' => 110 ); + // $caseColumns[] = array( 'header' => G::LoadTranslation('ID_FINISH_DATE'), 'dataIndex' => 'APP_FINISH_DATE', 'width' => 50 ); + + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_FIRSTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_LASTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_USERNAME' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getPaused () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SENT_BY' ),'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 80 + ); + + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_THREAD_INDEX' ),'dataIndex' => 'APP_THREAD_INDEX','width' => 80 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_DEL_INDEX' ),'dataIndex' => 'DEL_INDEX','width' => 80 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_FIRSTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_LASTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_USERNAME' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_THREAD_INDEX' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getToRevise () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SENT_BY' ),'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CURRENT_USER' ),'dataIndex' => 'APP_CURRENT_USER','width' => 90,'sortable' => false + ); + // $caseColumns[] = array( 'header' =>'Sent By', 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); + ///-- $caseColumns[] = array( 'header' => G::LoadTranslation('ID_LAST_MODIFY'), 'dataIndex' => 'APP_UPDATE_DATE', 'width' => 110 ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PRIORITY' ),'dataIndex' => 'DEL_PRIORITY','width' => 50 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_STATUS' ),'dataIndex' => 'APP_STATUS','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_FIRSTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_LASTNAME' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_USERNAME' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + // $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'DEL_TASK_DUE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'DEL_PRIORITY' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'APP_FINISH_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getToReassign () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CURRENT_USER' ),'dataIndex' => 'APP_CURRENT_USER','width' => 90,'sortable' => false + ); + // $caseColumns[] = array( 'header' => G::LoadTranslation('ID_SENT_BY'), 'dataIndex' => 'APP_DEL_PREVIOUS_USER', 'width' => 90 ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_STATUS' ),'dataIndex' => 'APP_STATUS','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'TAS_UID' + ); + $caseReaderFields[] = array ('name' => 'DEL_INDEX' + ); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + // $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getGeneral () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 45,'align' => 'center' + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'align' => 'center','sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 150 + ); + $caseColumns[] = array ('header' => 'UserUid','dataIndex' => 'USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'PreUsrUid','dataIndex' => 'PREVIOUS_USR_UID','width' => 50,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CURRENT_USER' ),'dataIndex' => 'APP_CURRENT_USER','width' => 90,'sortable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SENT_BY' ),'dataIndex' => 'APP_DEL_PREVIOUS_USER','width' => 90 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_LAST_MODIFY' ),'dataIndex' => 'APP_UPDATE_DATE','width' => 110 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_STATUS' ),'dataIndex' => 'APP_STATUS','width' => 50 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_UID' + ); + $caseReaderFields[] = array ('name' => 'USR_UID' + ); + $caseReaderFields[] = array ('name' => 'PREVIOUS_USR_UID' + ); + $caseReaderFields[] = array ('name' => 'APP_NUMBER' + ); + $caseReaderFields[] = array ('name' => 'APP_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE' + ); + $caseReaderFields[] = array ('name' => 'APP_CURRENT_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_DEL_PREVIOUS_USER' + ); + $caseReaderFields[] = array ('name' => 'APP_UPDATE_DATE' + ); + $caseReaderFields[] = array ('name' => 'APP_STATUS' + ); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY' + ); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +/** + * get the list configuration headers of the cases checked for reassign, for the + * reassign cases list. + */ +function getReassignList () +{ + $caseColumns = array (); + $caseColumns[] = array ('header' => '#','dataIndex' => 'APP_NUMBER','width' => 40); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_SUMMARY' ),'dataIndex' => 'CASE_SUMMARY','width' => 45,'hidden' => true + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASES_NOTES' ),'dataIndex' => 'CASE_NOTES_COUNT','width' => 45,'hidden' => true + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_CASE' ),'dataIndex' => 'APP_TITLE','width' => 100,'hidden' => true + ); + $caseColumns[] = array ('header' => 'CaseId','dataIndex' => 'APP_UID','width' => 200,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'User','dataIndex' => 'USR_UID','width' => 200,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_TASK' ),'dataIndex' => 'APP_TAS_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_PROCESS' ),'dataIndex' => 'APP_PRO_TITLE','width' => 120 + ); + $caseColumns[] = array ('header' => 'Reassigned Uid','dataIndex' => 'APP_REASSIGN_USER_UID','width' => 120,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => 'Reassigned Uid','dataIndex' => 'TAS_UID','width' => 120,'hidden' => true,'hideable' => false + ); + $caseColumns[] = array ('header' => G::LoadTranslation( 'ID_REASSIGN_TO' ),'dataIndex' => 'APP_REASSIGN_USER','width' => 170 + ); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'APP_NUMBER'); + $caseReaderFields[] = array ('name' => 'APP_TITLE'); + $caseReaderFields[] = array ('name' => 'APP_UID'); + $caseReaderFields[] = array ('name' => 'USR_UID'); + $caseReaderFields[] = array ('name' => 'APP_TAS_TITLE'); + $caseReaderFields[] = array ('name' => 'APP_PRO_TITLE'); + $caseReaderFields[] = array ('name' => 'APP_REASSIGN_USER_UID'); + $caseReaderFields[] = array ('name' => 'TAS_UID'); + $caseReaderFields[] = array ('name' => 'APP_REASSIGN_USER'); + $caseReaderFields[] = array ('name' => 'CASE_SUMMARY'); + $caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT'); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + +function getReassignUsersList () +{ + $caseColumns = array (); + + $caseReaderFields = array (); + $caseReaderFields[] = array ('name' => 'userUid' + ); + $caseReaderFields[] = array ('name' => 'userFullname' + ); + + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y' + ); +} + // Ext.namespace("Ext.ux"); // Ext.ux.comboBoxRenderer = function(combo) { // return function(value) { @@ -676,61 +997,66 @@ // return rec.get(combo.displayField); // } // } - /** - * loads the PM Table field list from the database based in an action parameter - * then assemble the List of fields with these data, for the configuration in cases list. - * @param String $action - * @return Array $config - */ - -function getAdditionalFields($action, $confCasesList=array()) { - if (!empty($confCasesList) && !empty($confCasesList['second']['data'])) {// For the case list builder in the enterprise plugin - $caseColumns = array(); - $caseReaderFields = array(); - - foreach($confCasesList['second']['data'] as $fieldData) { - if ($fieldData['fieldType'] != 'key') { - $label = $fieldData['label']; - $caseColumns[] = array('header' => $label, 'dataIndex' => $fieldData['name'], 'width' => $fieldData['width'], 'align' => $fieldData['align']); - $caseReaderFields[] = array('name' => $fieldData['name']); - } - } - return array('caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => $confCasesList['rowsperpage'], 'dateformat' => $confCasesList['dateformat']); - } else { - switch ($action) { - case 'draft' : - $config = getDraft(); - break; - case 'simple_search': - case 'search' : - $config = getSearch(); - break; - case 'participated' : - case 'sent' : - $config = getParticipated(); - break; - case 'unassigned' : - $config = getUnassigned(); - break; - case 'paused' : - $config = getPaused(); - break; - case 'to_revise' : - $config = getToRevise(); - break; - case 'to_reassign' : - $config = getToReassign(); - break; - case 'gral' : - $config = getGeneral(); - break; - case 'todo' : - default : - $action = 'todo'; - $config = getToDo(); - break; - } - return $config; - } +/** + * loads the PM Table field list from the database based in an action parameter + * then assemble the List of fields with these data, for the configuration in cases list. + * + * @param String $action + * @return Array $config + */ + +function getAdditionalFields ($action, $confCasesList = array()) +{ + if (! empty( $confCasesList ) && ! empty( $confCasesList['second']['data'] )) { // For the case list builder in the enterprise plugin + $caseColumns = array (); + $caseReaderFields = array (); + + foreach ($confCasesList['second']['data'] as $fieldData) { + if ($fieldData['fieldType'] != 'key') { + $label = $fieldData['label']; + $caseColumns[] = array ('header' => $label,'dataIndex' => $fieldData['name'],'width' => $fieldData['width'],'align' => $fieldData['align'] + ); + $caseReaderFields[] = array ('name' => $fieldData['name'] + ); + } + } + return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => $confCasesList['rowsperpage'],'dateformat' => $confCasesList['dateformat'] + ); + } else { + switch ($action) { + case 'draft': + $config = getDraft(); + break; + case 'simple_search': + case 'search': + $config = getSearch(); + break; + case 'participated': + case 'sent': + $config = getParticipated(); + break; + case 'unassigned': + $config = getUnassigned(); + break; + case 'paused': + $config = getPaused(); + break; + case 'to_revise': + $config = getToRevise(); + break; + case 'to_reassign': + $config = getToReassign(); + break; + case 'gral': + $config = getGeneral(); + break; + case 'todo': + default: + $action = 'todo'; + $config = getToDo(); + break; + } + return $config; + } } diff --git a/workflow/engine/methods/cases/casesListExtJsRedirector.php b/workflow/engine/methods/cases/casesListExtJsRedirector.php index 56967121e..96bd50551 100755 --- a/workflow/engine/methods/cases/casesListExtJsRedirector.php +++ b/workflow/engine/methods/cases/casesListExtJsRedirector.php @@ -1,31 +1,31 @@ \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/casesList_Ajax.php b/workflow/engine/methods/cases/casesList_Ajax.php index 6dc041f8e..8b454572e 100755 --- a/workflow/engine/methods/cases/casesList_Ajax.php +++ b/workflow/engine/methods/cases/casesList_Ajax.php @@ -12,253 +12,256 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - 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'; - - require_once ( "classes/model/AppCacheView.php" ); - require_once ( "classes/model/AppDelegation.php" ); - require_once ( "classes/model/AdditionalTables.php" ); - require_once ( "classes/model/AppDelay.php" ); - G::LoadClass('case'); +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'; - $actionAjax = isset($_REQUEST['actionAjax'])?$_REQUEST['actionAjax']: null; - - if ($actionAjax == "processListExtJs") { - $action = isset($_REQUEST['action']) ? $_REQUEST['action']: null; - $categoryUid = isset($_REQUEST['CATEGORY_UID']) ? $_REQUEST['CATEGORY_UID'] : null; - $userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; +require_once ("classes/model/AppCacheView.php"); +require_once ("classes/model/AppDelegation.php"); +require_once ("classes/model/AdditionalTables.php"); +require_once ("classes/model/AppDelay.php"); +G::LoadClass( 'case' ); - global $oAppCache; - $oAppCache = new AppCacheView(); - $processes = Array(); - $processes[] = array ( '', G::LoadTranslation('ID_ALL_PROCESS') ); +$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; - //get the list based in the action provided - switch ( $action ) { - case 'draft': - $cProcess = $oAppCache->getDraftListCriteria($userUid); //fast enough - break; - case 'sent': - $cProcess = $oAppCache->getSentListProcessCriteria ($userUid); // fast enough - break; - case 'simple_search': - case 'search': - //in search action, the query to obtain all process is too slow, so we need to query directly to - //process and content tables, and for that reason we need the current language in AppCacheView. - G::loadClass('configuration'); - $oConf = new Configurations; - $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE','','','',''); - $appCacheViewEngine = $oConf->aConfig; - $lang = isset($appCacheViewEngine['LANG']) ? $appCacheViewEngine['LANG'] : 'en'; +if ($actionAjax == "processListExtJs") { + $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null; + $categoryUid = isset( $_REQUEST['CATEGORY_UID'] ) ? $_REQUEST['CATEGORY_UID'] : null; + $userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null; - $cProcess = new Criteria('workflow'); - $cProcess->clearSelectColumns ( ); - $cProcess->addSelectColumn ( ProcessPeer::PRO_UID ); - $cProcess->addSelectColumn ( ContentPeer::CON_VALUE ); - if ($categoryUid) { - $cProcess->add (ProcessPeer::PRO_CATEGORY, $categoryUid); - } - $del = DBAdapter::getStringDelimiter(); - $conds = array(); - $conds[] = array(ProcessPeer::PRO_UID, ContentPeer::CON_ID ); - $conds[] = array(ContentPeer::CON_CATEGORY, $del . 'PRO_TITLE' . $del); - $conds[] = array(ContentPeer::CON_LANG, $del . $lang . $del); - $cProcess->addJoinMC($conds, Criteria::LEFT_JOIN); - $cProcess->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); - $oDataset = ProcessPeer::doSelectRS($cProcess); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); + global $oAppCache; + $oAppCache = new AppCacheView(); + $processes = Array (); + $processes[] = array ('',G::LoadTranslation( 'ID_ALL_PROCESS' ) + ); - while ($aRow = $oDataset->getRow()) { - $processes[] = array ( $aRow['PRO_UID'], $aRow['CON_VALUE'] ); - $oDataset->next(); - } - return print G::json_encode($processes); - break; - case 'unassigned': - $cProcess = $oAppCache->getUnassignedListCriteria($userUid); - break; - case 'paused': - $cProcess = $oAppCache->getPausedListCriteria($userUid); - break; - case 'to_revise': - $cProcess = $oAppCache->getToReviseListCriteria($userUid); - break; - case 'to_reassign': - $cProcess = $oAppCache->getToReassignListCriteria(); - $cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE); - break; - case 'gral': - $cProcess = $oAppCache->getGeneralListCriteria(); - $cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE); - break; - case 'todo': - default: - $cProcess = $oAppCache->getToDoListCriteria($userUid); //fast enough - break; - } - //get the processes for this user in this action - $cProcess->clearSelectColumns(); - $cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID); - $cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE); - $cProcess->setDistinct(AppCacheViewPeer::PRO_UID); - if ($categoryUid) { - $cProcess->addAlias('CP', 'PROCESS'); - $cProcess->add('CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL ); - $cProcess->addJoin(AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN); - $cProcess->addAsColumn('CATEGORY_UID', 'CP.PRO_CATEGORY'); - } - $oDataset = AppCacheViewPeer::doSelectRS($cProcess); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); + //get the list based in the action provided + switch ($action) { + case 'draft': + $cProcess = $oAppCache->getDraftListCriteria( $userUid ); //fast enough + break; + case 'sent': + $cProcess = $oAppCache->getSentListProcessCriteria( $userUid ); // fast enough + break; + case 'simple_search': + case 'search': + //in search action, the query to obtain all process is too slow, so we need to query directly to + //process and content tables, and for that reason we need the current language in AppCacheView. + G::loadClass( 'configuration' ); + $oConf = new Configurations(); + $oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' ); + $appCacheViewEngine = $oConf->aConfig; + $lang = isset( $appCacheViewEngine['LANG'] ) ? $appCacheViewEngine['LANG'] : 'en'; - while ($aRow = $oDataset->getRow()) { - $processes[] = array ( $aRow['PRO_UID'], $aRow['APP_PRO_TITLE'] ); + $cProcess = new Criteria( 'workflow' ); + $cProcess->clearSelectColumns(); + $cProcess->addSelectColumn( ProcessPeer::PRO_UID ); + $cProcess->addSelectColumn( ContentPeer::CON_VALUE ); + if ($categoryUid) { + $cProcess->add( ProcessPeer::PRO_CATEGORY, $categoryUid ); + } + $del = DBAdapter::getStringDelimiter(); + $conds = array (); + $conds[] = array (ProcessPeer::PRO_UID,ContentPeer::CON_ID + ); + $conds[] = array (ContentPeer::CON_CATEGORY,$del . 'PRO_TITLE' . $del + ); + $conds[] = array (ContentPeer::CON_LANG,$del . $lang . $del + ); + $cProcess->addJoinMC( $conds, Criteria::LEFT_JOIN ); + $cProcess->add( ProcessPeer::PRO_STATUS, 'ACTIVE' ); + $oDataset = ProcessPeer::doSelectRS( $cProcess ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); - } - return print G::json_encode($processes); + + while ($aRow = $oDataset->getRow()) { + $processes[] = array ($aRow['PRO_UID'],$aRow['CON_VALUE'] + ); + $oDataset->next(); + } + return print G::json_encode( $processes ); + break; + case 'unassigned': + $cProcess = $oAppCache->getUnassignedListCriteria( $userUid ); + break; + case 'paused': + $cProcess = $oAppCache->getPausedListCriteria( $userUid ); + break; + case 'to_revise': + $cProcess = $oAppCache->getToReviseListCriteria( $userUid ); + break; + case 'to_reassign': + $cProcess = $oAppCache->getToReassignListCriteria(); + $cProcess->addAscendingOrderByColumn( AppCacheViewPeer::APP_PRO_TITLE ); + break; + case 'gral': + $cProcess = $oAppCache->getGeneralListCriteria(); + $cProcess->addAscendingOrderByColumn( AppCacheViewPeer::APP_PRO_TITLE ); + break; + case 'todo': + default: + $cProcess = $oAppCache->getToDoListCriteria( $userUid ); //fast enough + break; } - - if ($actionAjax=="getUsersToReassign") { - $_SESSION['TASK'] = $_REQUEST['TAS_UID']; - $case = new Cases(); - $result->data = $case->getUsersToReassign($_SESSION['TASK'], $_SESSION['USER_LOGGED']); - print G::json_encode($result); + //get the processes for this user in this action + $cProcess->clearSelectColumns(); + $cProcess->addSelectColumn( AppCacheViewPeer::PRO_UID ); + $cProcess->addSelectColumn( AppCacheViewPeer::APP_PRO_TITLE ); + $cProcess->setDistinct( AppCacheViewPeer::PRO_UID ); + if ($categoryUid) { + $cProcess->addAlias( 'CP', 'PROCESS' ); + $cProcess->add( 'CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL ); + $cProcess->addJoin( AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN ); + $cProcess->addAsColumn( 'CATEGORY_UID', 'CP.PRO_CATEGORY' ); } - if ($actionAjax=='reassignCase') { - - $APP_UID = $_REQUEST["APP_UID"]; - $DEL_INDEX = $_REQUEST["DEL_INDEX"]; + $oDataset = AppCacheViewPeer::doSelectRS( $cProcess ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); - $_SESSION['APPLICATION'] = $APP_UID; - $_SESSION['INDEX'] = $DEL_INDEX; + while ($aRow = $oDataset->getRow()) { + $processes[] = array ($aRow['PRO_UID'],$aRow['APP_PRO_TITLE'] + ); + $oDataset->next(); + } + return print G::json_encode( $processes ); +} +if ($actionAjax == "getUsersToReassign") { + $_SESSION['TASK'] = $_REQUEST['TAS_UID']; + $case = new Cases(); + $result->data = $case->getUsersToReassign( $_SESSION['TASK'], $_SESSION['USER_LOGGED'] ); + print G::json_encode( $result ); +} +if ($actionAjax == 'reassignCase') { - $cases = new Cases(); - $user = new Users(); - $app = new Application(); - - $TO_USR_UID = $_POST['USR_UID']; + $APP_UID = $_REQUEST["APP_UID"]; + $DEL_INDEX = $_REQUEST["DEL_INDEX"]; - try{ - $cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID); - $caseData = $app->load($_SESSION['APPLICATION']); - $userData = $user->load($TO_USR_UID); + $_SESSION['APPLICATION'] = $APP_UID; + $_SESSION['INDEX'] = $DEL_INDEX; + + $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 + $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->msg = G::LoadTranslation( 'ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data ); + } catch (Exception $e) { $result->status = 1; $result->msg = $e->getMessage(); - } - - print G::json_encode($result); - - } - - - if($actionAjax=='showHistoryMessage'){ -?> - - - AddContent('xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID'])); - - -?> - - - - AddContent('view', 'cases/cases_DynaformHistory'); - - G::RenderPage('publish', 'raw'); - } - - if($actionAjax=='dynaformChangeLogViewHistory'){ - -?> - - - AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); - - -?> - - - - loadCase($_SESSION['APPLICATION']); - $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;'; - $_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID']; - $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); - -?> - load('cases'); - - $oCases = new Cases(); - $aTypes = Array( - 'to_do', - 'draft', - 'cancelled', - 'sent', - 'paused', - 'completed', - 'selfservice', - //'to_revise', - //'to_reassign' - ); - $aTypesID = Array( - 'CASES_INBOX'=>'to_do', - 'CASES_DRAFT'=>'draft', - 'CASES_CANCELLED'=>'cancelled', - 'CASES_SENT'=>'sent', - 'CASES_PAUSED'=>'paused', - 'CASES_COMPLETED'=>'completed', - 'CASES_SELFSERVICE'=>'selfservice', - //'CASES_TO_REVISE'=>'to_revise', - //'CASES_TO_REASSIGN'=>'to_reassign' - ); - - $list = array(); - $list['count'] = ' '; - - $empty = array(); - foreach ( $aTypes as $key => $val ) { - $empty[$val] = $list; - } - + getLoadTreeMenuData(); + break; +} + +function getLoadTreeMenuData () +{ + header( "content-type: text/xml" ); + + global $G_TMP_MENU; + $oMenu = new Menu(); + $oMenu->load( 'cases' ); + + $oCases = new Cases(); + $aTypes = Array ('to_do','draft','cancelled','sent','paused','completed','selfservice' + //'to_revise', + //'to_reassign' + ; + $aTypesID = Array ('CASES_INBOX' => 'to_do','CASES_DRAFT' => 'draft','CASES_CANCELLED' => 'cancelled','CASES_SENT' => 'sent','CASES_PAUSED' => 'paused','CASES_COMPLETED' => 'completed','CASES_SELFSERVICE' => 'selfservice' + //'CASES_TO_REVISE'=>'to_revise', + //'CASES_TO_REASSIGN'=>'to_reassign' + ; + + $list = array (); + $list['count'] = ' '; + + $empty = array (); + foreach ($aTypes as $key => $val) { + $empty[$val] = $list; + } + $aCount = $empty; //$oCases->getAllConditionCasesCount($aTypes, true); - $processNameMaxSize = 20; - + $processNameMaxSize = 20; + //now drawing the treeview using the menu options from menu/cases.php - $menuCases = array(); - foreach( $oMenu->Options as $i => $option ) { - if( $oMenu->Types[$i] == 'blockHeader' ) { - $CurrentBlockID = $oMenu->Id[$i]; - $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; - if($oMenu->Options[$i]!=""){ - $menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; - } - }elseif( $oMenu->Types[$i] == 'blockNestedTree' ){ - $CurrentBlockID = $oMenu->Id[$i]; - $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; - $menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; - $menuCases[$CurrentBlockID]['loaderurl'] = $oMenu->Options[$i]; - }elseif( $oMenu->Types[$i] == 'blockHeaderNoChild' ){ - $CurrentBlockID = $oMenu->Id[$i]; - $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; - $menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; - $menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; - }else { - $menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = Array ( - 'label' => $oMenu->Labels[$i], - 'link' => $oMenu->Options[$i], - 'icon' => (isset($oMenu->Icons[$i]) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png' - ); - - if( isset($aTypesID[$oMenu->Id[$i]]) ) { - $menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]]['cases_count'] = $aCount[$aTypesID[$oMenu->Id[$i]]]['count']; - } - } - } + $menuCases = array (); + foreach ($oMenu->Options as $i => $option) { + if ($oMenu->Types[$i] == 'blockHeader') { + $CurrentBlockID = $oMenu->Id[$i]; + $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; + if ($oMenu->Options[$i] != "") { + $menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; + } + } elseif ($oMenu->Types[$i] == 'blockNestedTree') { + $CurrentBlockID = $oMenu->Id[$i]; + $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; + $menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; + $menuCases[$CurrentBlockID]['loaderurl'] = $oMenu->Options[$i]; + } elseif ($oMenu->Types[$i] == 'blockHeaderNoChild') { + $CurrentBlockID = $oMenu->Id[$i]; + $menuCases[$CurrentBlockID]['blockTitle'] = $oMenu->Labels[$i]; + $menuCases[$CurrentBlockID]['blockType'] = $oMenu->Types[$i]; + $menuCases[$CurrentBlockID]['link'] = $oMenu->Options[$i]; + } else { + $menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]] = Array ('label' => $oMenu->Labels[$i],'link' => $oMenu->Options[$i],'icon' => (isset( $oMenu->Icons[$i] ) && $oMenu->Icons[$i] != '') ? $oMenu->Icons[$i] : 'kcmdf.png' + ); + + if (isset( $aTypesID[$oMenu->Id[$i]] )) { + $menuCases[$CurrentBlockID]['blockItems'][$oMenu->Id[$i]]['cases_count'] = $aCount[$aTypesID[$oMenu->Id[$i]]]['count']; + } + } + } //now build the menu in xml format - $xml = ''; - $i = 0; - foreach( $menuCases as $menu => $aMenuBlock ) { - if( isset($aMenuBlock['blockItems']) && sizeof($aMenuBlock['blockItems']) > 0 ) { - $urlProperty=""; - if((isset($aMenuBlock['link']))&&($aMenuBlock['link']!="")){ - $urlProperty="url='".$aMenuBlock['link']."'"; - } - $xml .= ''; - foreach( $aMenuBlock['blockItems'] as $id => $aMenu ) { - $i++; - if( isset($aMenu['cases_count']) && $aMenu['cases_count'] !== '') { - $nofifier = "cases_count=\"{$aMenu['cases_count']}\" "; - } - else { - $nofifier = ''; - } - $xml .= ''; - } - $xml .= ''; - }elseif( isset($aMenuBlock['blockType']) && $aMenuBlock['blockType']=="blockNestedTree" ) { - $xml .= ''; - $xml .= ''; - }elseif( isset($aMenuBlock['blockType']) && $aMenuBlock['blockType']=="blockHeaderNoChild" ) { - $xml .= ''; - //$xml .= ''; - $xml .= ''; - } - } - $xml .= ''; - - print $xml; - } - - // get the process summary of specific case list type, - function getProcess () { - global $G_TMP_MENU; - global $userId; - if ( !isset($_GET['item']) ) { - die; - } - - $oMenu = new Menu(); - $oMenu->load('cases'); - $type = $_GET['item']; - $oCases = new AppCacheView(); - - $aTypesID = array(); - $aTypesID['CASES_INBOX'] = 'to_do'; - $aTypesID['CASES_DRAFT'] = 'draft'; - $aTypesID['CASES_CANCELLED'] = 'cancelled'; - $aTypesID['CASES_SENT'] = 'sent'; - $aTypesID['CASES_PAUSED'] = 'paused'; - $aTypesID['CASES_COMPLETED'] = 'completed'; - $aTypesID['CASES_SELFSERVICE'] = 'selfservice'; + $xml = ''; + $i = 0; + foreach ($menuCases as $menu => $aMenuBlock) { + if (isset( $aMenuBlock['blockItems'] ) && sizeof( $aMenuBlock['blockItems'] ) > 0) { + $urlProperty = ""; + if ((isset( $aMenuBlock['link'] )) && ($aMenuBlock['link'] != "")) { + $urlProperty = "url='" . $aMenuBlock['link'] . "'"; + } + $xml .= ''; + foreach ($aMenuBlock['blockItems'] as $id => $aMenu) { + $i ++; + if (isset( $aMenu['cases_count'] ) && $aMenu['cases_count'] !== '') { + $nofifier = "cases_count=\"{$aMenu['cases_count']}\" "; + } else { + $nofifier = ''; + } + $xml .= ''; + } + $xml .= ''; + } elseif (isset( $aMenuBlock['blockType'] ) && $aMenuBlock['blockType'] == "blockNestedTree") { + $xml .= ''; + $xml .= ''; + } elseif (isset( $aMenuBlock['blockType'] ) && $aMenuBlock['blockType'] == "blockHeaderNoChild") { + $xml .= ''; + //$xml .= ''; + $xml .= ''; + } + } + $xml .= ''; + + print $xml; +} + +// get the process summary of specific case list type, +function getProcess () +{ + global $G_TMP_MENU; + global $userId; + if (! isset( $_GET['item'] )) { + die(); + } + + $oMenu = new Menu(); + $oMenu->load( 'cases' ); + $type = $_GET['item']; + $oCases = new AppCacheView(); + + $aTypesID = array (); + $aTypesID['CASES_INBOX'] = 'to_do'; + $aTypesID['CASES_DRAFT'] = 'draft'; + $aTypesID['CASES_CANCELLED'] = 'cancelled'; + $aTypesID['CASES_SENT'] = 'sent'; + $aTypesID['CASES_PAUSED'] = 'paused'; + $aTypesID['CASES_COMPLETED'] = 'completed'; + $aTypesID['CASES_SELFSERVICE'] = 'selfservice'; //$aTypesID['CASES_TO_REVISE'] = 'to_revise'; //$aTypesID['CASES_TO_REASSIGN'] = 'to_reassign'; - $aTypesID = Array('CASES_INBOX'=>'to_do', 'CASES_DRAFT'=>'draft', 'CASES_CANCELLED'=>'cancelled', 'CASES_SENT'=>'sent', 'CASES_PAUSED'=>'paused', 'CASES_COMPLETED'=>'completed','CASES_SELFSERVICE'=>'selfservice','CASES_TO_REVISE'=>'to_revise','CASES_TO_REASSIGN'=>'to_reassign'); - - $aCount = $oCases->getAllCounters(Array($aTypesID[$type]), $userId, true); - - $response = Array(); -//disabling the summary... -/* + $aTypesID = Array ('CASES_INBOX' => 'to_do','CASES_DRAFT' => 'draft','CASES_CANCELLED' => 'cancelled','CASES_SENT' => 'sent','CASES_PAUSED' => 'paused','CASES_COMPLETED' => 'completed','CASES_SELFSERVICE' => 'selfservice','CASES_TO_REVISE' => 'to_revise','CASES_TO_REASSIGN' => 'to_reassign' + ); + + $aCount = $oCases->getAllCounters( Array ($aTypesID[$type] + ), $userId, true ); + + $response = Array (); + //disabling the summary... + /* $i=0; foreach($aCount[$aTypesID[$type]]['sumary'] as $PRO_UID=>$process){ //{"text":"state","id":"src\/state","cls":"folder", loaded:true}, @@ -167,7 +152,7 @@ $response[$i]->loaded = true; $i++; } -*/ +*/ //ordering /*for($i=0; $i<=count($response)-1; $i++){ for($j=$i+1; $j<=count($response); $j++){ @@ -179,48 +164,50 @@ $response[$j] = $x; } } - }*/ - echo G::json_encode($response); - } - - function getAllCounters() { - $userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; - $oAppCache = new AppCacheView(); - $aTypes = Array(); - $aTypes['to_do'] = 'CASES_INBOX'; - $aTypes['draft'] = 'CASES_DRAFT'; - $aTypes['cancelled'] = 'CASES_CANCELLED'; - $aTypes['sent'] = 'CASES_SENT'; - $aTypes['paused'] = 'CASES_PAUSED'; - $aTypes['completed'] = 'CASES_COMPLETED'; - $aTypes['selfservice'] = 'CASES_SELFSERVICE'; + }*/ + echo G::json_encode( $response ); +} + +function getAllCounters () +{ + $userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null; + $oAppCache = new AppCacheView(); + $aTypes = Array (); + $aTypes['to_do'] = 'CASES_INBOX'; + $aTypes['draft'] = 'CASES_DRAFT'; + $aTypes['cancelled'] = 'CASES_CANCELLED'; + $aTypes['sent'] = 'CASES_SENT'; + $aTypes['paused'] = 'CASES_PAUSED'; + $aTypes['completed'] = 'CASES_COMPLETED'; + $aTypes['selfservice'] = 'CASES_SELFSERVICE'; //$aTypes['to_revise'] = 'CASES_TO_REVISE'; //$aTypes['to_reassign'] = 'CASES_TO_REASSIGN'; - - if ((($solrConf = System::solrEnv()) !== false)) { - G::LoadClass ( 'AppSolr' ); - $ApplicationSolrIndex = new AppSolr ($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']); - - $aCount = $ApplicationSolrIndex->getCasesCount ( $userUid ); - - //get paused count - $aCountMissing = $oAppCache->getAllCounters( array('paused', 'completed', 'cancelled'), $userUid ); - - $aCount = array_merge($aCount, $aCountMissing); - } - else { - - $aCount = $oAppCache->getAllCounters( array_keys($aTypes), $userUid ); - - } - - $response = Array(); - $i = 0; - foreach ($aCount as $type=>$count) { - $response[$i]->item = $aTypes[$type]; - $response[$i]->count = $count; - $i++; - } - echo G::json_encode($response); - } - \ No newline at end of file + + + if ((($solrConf = System::solrEnv()) !== false)) { + G::LoadClass( 'AppSolr' ); + $ApplicationSolrIndex = new AppSolr( $solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance'] ); + + $aCount = $ApplicationSolrIndex->getCasesCount( $userUid ); + + //get paused count + $aCountMissing = $oAppCache->getAllCounters( array ('paused','completed','cancelled' + ), $userUid ); + + $aCount = array_merge( $aCount, $aCountMissing ); + } else { + + $aCount = $oAppCache->getAllCounters( array_keys( $aTypes ), $userUid ); + + } + + $response = Array (); + $i = 0; + foreach ($aCount as $type => $count) { + $response[$i]->item = $aTypes[$type]; + $response[$i]->count = $count; + $i ++; + } + echo G::json_encode( $response ); +} + diff --git a/workflow/engine/methods/cases/casesSaveDataView.php b/workflow/engine/methods/cases/casesSaveDataView.php index 94de05242..2d40d3c83 100755 --- a/workflow/engine/methods/cases/casesSaveDataView.php +++ b/workflow/engine/methods/cases/casesSaveDataView.php @@ -1,4 +1,4 @@ -. + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ //validate the data post //$oForm = new Form ( $_SESSION ['PROCESS'] . '/' . $_GET ['UID'], PATH_DYNAFORM ); //$oForm->validatePost (); + /* @author Alvaro Campos Sanchez */ /* Includes */ -G::LoadClass ( 'case' ); +G::LoadClass( 'case' ); //load the variables -$oCase = new Cases ( ); -$oCase->thisIsTheCurrentUser ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['USER_LOGGED'], 'REDIRECT', 'cases_List' ); -$Fields = $oCase->loadCase ( $_SESSION ['APPLICATION'] ); -$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], G::getSystemConstants () ); -$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], ( array ) $_POST ['form'] ); +$oCase = new Cases(); +$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' ); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); +$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); +$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], (array) $_POST['form'] ); #here we must verify if is a debug session -$trigger_debug_session = $_SESSION ['TRIGGER_DEBUG'] ['ISSET']; #here we must verify if is a debugg session +$trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session #trigger debug routines... //cleaning debug variables -$_SESSION ['TRIGGER_DEBUG'] ['ERRORS'] = Array (); -$_SESSION ['TRIGGER_DEBUG'] ['DATA'] = Array (); -$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = Array (); -$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = Array (); -$triggers = $oCase->loadTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER' ); -$_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] = count ( $triggers ); -$_SESSION ['TRIGGER_DEBUG'] ['TIME'] = 'AFTER'; - -if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) { - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = $oCase->getTriggerNames ( $triggers ); - $_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = $triggers; -} - -if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) { - //Execute after triggers - Start - $Fields ['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER', $Fields ['APP_DATA'] ); - //Execute after triggers - End +$_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); +$_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); +$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); +$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); +$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER' ); +$_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); +$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; + +if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; } +if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + //Execute after triggers - Start + $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); + //Execute after triggers - End +} //go to the next step -$aNextStep = $oCase->getNextStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] ); -if (isset ( $_GET ['_REFRESH_'] )) { - G::header ( 'location: ' . $_SERVER ['HTTP_REFERER'] ); - die (); +$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); +if (isset( $_GET['_REFRESH_'] )) { + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); } -$_SESSION ['STEP_POSITION'] = $aNextStep ['POSITION']; +$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; -$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep ['PAGE']; +$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep['PAGE']; if ($trigger_debug_session) { - $_SESSION ['TRIGGER_DEBUG'] ['BREAKPAGE'] = $aNextStep ['PAGE']; - $aNextStep ['PAGE'] = $aNextStep ['PAGE'] . '&breakpoint=triggerdebug'; + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; + $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug'; } -G::header ( 'location: ' . $aNextStep ['PAGE'] ); +G::header( 'location: ' . $aNextStep['PAGE'] ); diff --git a/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php b/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php index 9b632c9d9..8b879cd01 100755 --- a/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php +++ b/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php @@ -1,44 +1,42 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ //if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response; -G::LoadInclude('ajax'); -$_POST['action'] = get_ajax_value('action'); - -switch ($_POST['action']) -{ - case 'updatePageSize': - G::LoadClass('configuration'); - $c = new Configurations(); - $arr['pageSize'] = $_REQUEST['size']; - $arr['dateSave'] = date('Y-m-d H:i:s'); - $config = Array(); - $config[] = $arr; - $c->aConfig = $config; - $c->saveConfig('casesSchedulerLogList', 'pageSize','',$_SESSION['USER_LOGGED']); - echo '{success: true}'; - break; -break; -} -?> +G::LoadInclude( 'ajax' ); +$_POST['action'] = get_ajax_value( 'action' ); + +switch ($_POST['action']) { + case 'updatePageSize': + G::LoadClass( 'configuration' ); + $c = new Configurations(); + $arr['pageSize'] = $_REQUEST['size']; + $arr['dateSave'] = date( 'Y-m-d H:i:s' ); + $config = Array (); + $config[] = $arr; + $c->aConfig = $config; + $c->saveConfig( 'casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); + echo '{success: true}'; + break; + break; +} + diff --git a/workflow/engine/methods/cases/casesStartPage.php b/workflow/engine/methods/cases/casesStartPage.php index 760d016ef..7b8529e05 100755 --- a/workflow/engine/methods/cases/casesStartPage.php +++ b/workflow/engine/methods/cases/casesStartPage.php @@ -1,47 +1,48 @@ -addExtJsScript('cases/casesStartCase', true); //adding a javascript file .js - - $oHeadPublisher->addContent( 'cases/casesStartCase'); //adding a html file .html. - G::LoadClass('configuration'); - $c = new Configurations(); - $oHeadPublisher->assign('FORMATS',$c->getFormats()); - break; - case "documents": - - G::LoadClass('configuration'); - $c = new Configurations(); - $configPage = $c->getConfiguration('documentsModule', 'pageSize','',$_SESSION['USER_LOGGED']); - $configEnv = $c->getConfiguration('ENVIRONMENT_SETTINGS', ''); - $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; - $oHeadPublisher->assign('CONFIG', $Config); - $oHeadPublisher->assign('FORMATS',$c->getFormats()); - - $oHeadPublisher->assign('permitodelete' ,$RBAC->userCanAccess('PM_FOLDER_DELETE') ); - $oHeadPublisher->assign('permitoaddfile' ,$RBAC->userCanAccess('PM_FOLDERS_ADD_FILE') ); - $oHeadPublisher->assign('permitoaddfolder',$RBAC->userCanAccess('PM_FOLDERS_ADD_FOLDER')); - - $oHeadPublisher->addExtJsScript('cases/casesDocuments', false); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesDocuments'); //adding a html file .html. - break; - default: - $oHeadPublisher->addExtJsScript('cases/casesStartPage', false); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesStartPage'); //adding a html file .html. - break; - -} - - -G::RenderPage('publish', 'extJs'); +addExtJsScript( 'cases/casesStartCase', true ); //adding a javascript file .js + + + $oHeadPublisher->addContent( 'cases/casesStartCase' ); //adding a html file .html. + G::LoadClass( 'configuration' ); + $c = new Configurations(); + $oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); + break; + case "documents": + + G::LoadClass( 'configuration' ); + $c = new Configurations(); + $configPage = $c->getConfiguration( 'documentsModule', 'pageSize', '', $_SESSION['USER_LOGGED'] ); + $configEnv = $c->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); + $Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20; + $oHeadPublisher->assign( 'CONFIG', $Config ); + $oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); + + $oHeadPublisher->assign( 'permitodelete', $RBAC->userCanAccess( 'PM_FOLDER_DELETE' ) ); + $oHeadPublisher->assign( 'permitoaddfile', $RBAC->userCanAccess( 'PM_FOLDERS_ADD_FILE' ) ); + $oHeadPublisher->assign( 'permitoaddfolder', $RBAC->userCanAccess( 'PM_FOLDERS_ADD_FOLDER' ) ); + + $oHeadPublisher->addExtJsScript( 'cases/casesDocuments', false ); //adding a javascript file .js + $oHeadPublisher->addContent( 'cases/casesDocuments' ); //adding a html file .html. + break; + default: + $oHeadPublisher->addExtJsScript( 'cases/casesStartPage', false ); //adding a javascript file .js + $oHeadPublisher->addContent( 'cases/casesStartPage' ); //adding a html file .html. + break; + +} + +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/cases/casesStartPage_Ajax.php b/workflow/engine/methods/cases/casesStartPage_Ajax.php index 531c9fff3..37eefa9fb 100755 --- a/workflow/engine/methods/cases/casesStartPage_Ajax.php +++ b/workflow/engine/methods/cases/casesStartPage_Ajax.php @@ -1,349 +1,366 @@ -getAllProcesses($start, $limit, null, null, false, true); - - $bCanStart = $oCase->canStartCase ( $_SESSION ['USER_LOGGED'] ); - if ($bCanStart) { - $processListInitial = $oCase->getStartCasesPerType ( $_SESSION ['USER_LOGGED'], 'category' ); - $processList = array (); - foreach ( $processListInitial as $key => $procInfo ) { - if (isset ( $procInfo ['pro_uid'] )) { - if (trim ( $procInfo ['cat'] ) == "") - $procInfo ['cat'] = "_OTHER_"; - $processList [$procInfo ['catname']] [$procInfo ['value']] = $procInfo; - } - } - ksort ( $processList ); - foreach ( $processList as $key => $processInfo ) { - ksort ( $processList [$key] ); - } - - if (! isset ( $_REQUEST ['node'] )) { - $node = 'root'; - } else { - $node = $_REQUEST ['node']; - } - - - foreach($proData as $key => $proInfo){ - $proData[$proInfo['PRO_UID']]=$proInfo; - } - - $processListTree = array (); - if (1) { - foreach ( $processList as $key => $processInfo ) { - $tempTree ['text'] = $key; - $tempTree ['id'] = $key; - $tempTree ['cls'] = 'folder'; - $tempTree ['draggable'] = true; - $tempTree ['optionType'] = "category"; - //$tempTree['allowDrop']=false; - $tempTree ['singleClickExpand'] = true; - if ($key != "No Category") { - $tempTree ['expanded'] = true; - } else { - //$tempTree ['expanded'] = false; - $tempTree ['expanded'] = true; - } - $tempTreeChildren=array(); - foreach ( $processList [$key] as $keyChild => $processInfoChild ) { - //print_r($processInfo); - $tempTreeChild ['text'] = $keyChild; //ellipsis ( $keyChild, 50 ); - //$tempTree['text']=$key; - $tempTreeChild ['id'] = $keyChild; - $tempTreeChild ['draggable'] = true; - $tempTreeChild ['leaf'] = true; - $tempTreeChild ['icon'] = '/images/icon.trigger.png'; - $tempTreeChild ['allowChildren'] = false; - $tempTreeChild ['optionType'] = "startProcess"; - $tempTreeChild ['pro_uid'] = $processInfoChild ['pro_uid']; - $tempTreeChild ['tas_uid'] = $processInfoChild ['uid']; - $processInfoChild ['myInbox']=0; - $processInfoChild ['totalInbox']=0; - if(isset($proData[ $processInfoChild ['pro_uid'] ])){ - $tempTreeChild ['otherAttributes'] = array_merge($processInfoChild,$proData[ $processInfoChild ['pro_uid'] ],$calendar->getCalendarFor ( $processInfoChild ['uid'], $processInfoChild ['uid'], $processInfoChild ['uid'] )); - $tempTreeChild ['otherAttributes']['PRO_TAS_TITLE']=str_replace(")","",str_replace("(","",trim(str_replace($tempTreeChild ['otherAttributes']['PRO_TITLE'],"",$tempTreeChild ['otherAttributes']["value"])))); - $tempTreeChild ['qtip']=$tempTreeChild ['otherAttributes']['PRO_DESCRIPTION']; - - //$tempTree['cls']='file'; - - $tempTreeChildren [] = $tempTreeChild; - } - } - - $tempTree['children']=$tempTreeChildren; - - $processListTree [] = $tempTree; - } - } else { - foreach ( $processList [$node] as $key => $processInfo ) { - //print_r($processInfo); - $tempTree ['text'] = $key; //ellipsis ( $key, 50 ); - //$tempTree['text']=$key; - $tempTree ['id'] = $key; - $tempTree ['draggable'] = true; - $tempTree ['leaf'] = true; - $tempTree ['icon'] = '/images/icon.trigger.png'; - $tempTree ['allowChildren'] = false; - $tempTree ['optionType'] = "startProcess"; - $tempTree ['pro_uid'] = $processInfo ['pro_uid']; - $tempTree ['tas_uid'] = $processInfo ['uid']; - $processInfo ['myInbox']=0; - $processInfo ['totalInbox']=0; - $tempTree ['otherAttributes'] = array_merge($processInfo,$proData[ $processInfo ['pro_uid'] ],$calendar->getCalendarFor ( $processInfo ['uid'], $processInfo ['uid'], $processInfo ['uid'] )); - $tempTree ['otherAttributes']['PRO_TAS_TITLE']=str_replace(")","",str_replace("(","",trim(str_replace($tempTree ['otherAttributes']['PRO_TITLE'],"",$tempTree ['otherAttributes']["value"])))); - $tempTree ['qtip']=$tempTree ['otherAttributes']['PRO_DESCRIPTION']; - //$tempTree['cls']='file'; - $processListTree [] = $tempTree; - } - - } - $processList = $processListTree; - } else { - $processList ['success'] = 'failure'; - $processList ['message'] = 'User can\'t start process'; - } - print G::json_encode ( $processList ); - die (); -} - -function ellipsis($text, $numb) { - $text = html_entity_decode ( $text, ENT_QUOTES ); - if (strlen ( $text ) > $numb) { - $text = substr ( $text, 0, $numb ); - $text = substr ( $text, 0, strrpos ( $text, " " ) ); - //This strips the full stop: - if ((substr ( $text, - 1 )) == ".") { - $text = substr ( $text, 0, (strrpos ( $text, "." )) ); - } - $etc = "..."; - $text = $text . $etc; - } - - return $text; -} - - function lookinginforContentProcess($sproUid){ - require_once 'classes/model/Content.php'; - require_once 'classes/model/Task.php'; - require_once 'classes/model/Content.php'; - - $oContent = new Content(); +getAllProcesses( $start, $limit, null, null, false, true ); + + $bCanStart = $oCase->canStartCase( $_SESSION['USER_LOGGED'] ); + if ($bCanStart) { + $processListInitial = $oCase->getStartCasesPerType( $_SESSION['USER_LOGGED'], 'category' ); + $processList = array (); + foreach ($processListInitial as $key => $procInfo) { + if (isset( $procInfo['pro_uid'] )) { + if (trim( $procInfo['cat'] ) == "") + $procInfo['cat'] = "_OTHER_"; + $processList[$procInfo['catname']][$procInfo['value']] = $procInfo; + } + } + ksort( $processList ); + foreach ($processList as $key => $processInfo) { + ksort( $processList[$key] ); + } + + if (! isset( $_REQUEST['node'] )) { + $node = 'root'; + } else { + $node = $_REQUEST['node']; + } + + foreach ($proData as $key => $proInfo) { + $proData[$proInfo['PRO_UID']] = $proInfo; + } + + $processListTree = array (); + if (1) { + foreach ($processList as $key => $processInfo) { + $tempTree['text'] = $key; + $tempTree['id'] = $key; + $tempTree['cls'] = 'folder'; + $tempTree['draggable'] = true; + $tempTree['optionType'] = "category"; + //$tempTree['allowDrop']=false; + $tempTree['singleClickExpand'] = true; + if ($key != "No Category") { + $tempTree['expanded'] = true; + } else { + //$tempTree ['expanded'] = false; + $tempTree['expanded'] = true; + } + $tempTreeChildren = array (); + foreach ($processList[$key] as $keyChild => $processInfoChild) { + //print_r($processInfo); + $tempTreeChild['text'] = $keyChild; //ellipsis ( $keyChild, 50 ); + //$tempTree['text']=$key; + $tempTreeChild['id'] = $keyChild; + $tempTreeChild['draggable'] = true; + $tempTreeChild['leaf'] = true; + $tempTreeChild['icon'] = '/images/icon.trigger.png'; + $tempTreeChild['allowChildren'] = false; + $tempTreeChild['optionType'] = "startProcess"; + $tempTreeChild['pro_uid'] = $processInfoChild['pro_uid']; + $tempTreeChild['tas_uid'] = $processInfoChild['uid']; + $processInfoChild['myInbox'] = 0; + $processInfoChild['totalInbox'] = 0; + if (isset( $proData[$processInfoChild['pro_uid']] )) { + $tempTreeChild['otherAttributes'] = array_merge( $processInfoChild, $proData[$processInfoChild['pro_uid']], $calendar->getCalendarFor( $processInfoChild['uid'], $processInfoChild['uid'], $processInfoChild['uid'] ) ); + $tempTreeChild['otherAttributes']['PRO_TAS_TITLE'] = str_replace( ")", "", str_replace( "(", "", trim( str_replace( $tempTreeChild['otherAttributes']['PRO_TITLE'], "", $tempTreeChild['otherAttributes']["value"] ) ) ) ); + $tempTreeChild['qtip'] = $tempTreeChild['otherAttributes']['PRO_DESCRIPTION']; + + //$tempTree['cls']='file'; + + + $tempTreeChildren[] = $tempTreeChild; + } + } + + $tempTree['children'] = $tempTreeChildren; + + $processListTree[] = $tempTree; + } + } else { + foreach ($processList[$node] as $key => $processInfo) { + //print_r($processInfo); + $tempTree['text'] = $key; //ellipsis ( $key, 50 ); + //$tempTree['text']=$key; + $tempTree['id'] = $key; + $tempTree['draggable'] = true; + $tempTree['leaf'] = true; + $tempTree['icon'] = '/images/icon.trigger.png'; + $tempTree['allowChildren'] = false; + $tempTree['optionType'] = "startProcess"; + $tempTree['pro_uid'] = $processInfo['pro_uid']; + $tempTree['tas_uid'] = $processInfo['uid']; + $processInfo['myInbox'] = 0; + $processInfo['totalInbox'] = 0; + $tempTree['otherAttributes'] = array_merge( $processInfo, $proData[$processInfo['pro_uid']], $calendar->getCalendarFor( $processInfo['uid'], $processInfo['uid'], $processInfo['uid'] ) ); + $tempTree['otherAttributes']['PRO_TAS_TITLE'] = str_replace( ")", "", str_replace( "(", "", trim( str_replace( $tempTree['otherAttributes']['PRO_TITLE'], "", $tempTree['otherAttributes']["value"] ) ) ) ); + $tempTree['qtip'] = $tempTree['otherAttributes']['PRO_DESCRIPTION']; + //$tempTree['cls']='file'; + $processListTree[] = $tempTree; + } + + } + $processList = $processListTree; + } else { + $processList['success'] = 'failure'; + $processList['message'] = 'User can\'t start process'; + } + print G::json_encode( $processList ); + die(); +} + +function ellipsis ($text, $numb) +{ + $text = html_entity_decode( $text, ENT_QUOTES ); + if (strlen( $text ) > $numb) { + $text = substr( $text, 0, $numb ); + $text = substr( $text, 0, strrpos( $text, " " ) ); + //This strips the full stop: + if ((substr( $text, - 1 )) == ".") { + $text = substr( $text, 0, (strrpos( $text, "." )) ); + } + $etc = "..."; + $text = $text . $etc; + } + + return $text; +} + +function lookinginforContentProcess ($sproUid) +{ + require_once 'classes/model/Content.php'; + require_once 'classes/model/Task.php'; + require_once 'classes/model/Content.php'; + + $oContent = new Content(); ///we are looking for a pro title for this process $sproUid - $oCriteria = new Criteria('workflow'); - $oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE'); - $oCriteria->add( ContentPeer::CON_LANG, 'en'); - $oCriteria->add( ContentPeer::CON_ID, $sproUid); - $oDataset = ContentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - $aRow = $oDataset->getRow(); - if(!is_array($aRow)){ - - $oC = new Criteria('workflow'); - $oC->addSelectColumn(TaskPeer::TAS_UID); - $oC->add( TaskPeer::PRO_UID, $sproUid); - $oDataset1 = TaskPeer::doSelectRS($oC); - $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while($oDataset1->next()){ - $aRow1 = $oDataset1->getRow(); - - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE'); - $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG); - $oCriteria1->add( ContentPeer::CON_ID, $aRow1['TAS_UID']); - $oDataset2 = ContentPeer::doSelectRS($oCriteria1); - $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset2->next(); - $aRow2 = $oDataset2->getRow(); - - Content::insertContent( 'TAS_TITLE', '', $aRow2['CON_ID'], 'en', $aRow2['CON_VALUE'] ); - } - $oC2 = new Criteria('workflow'); - $oC2->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE'); - $oC2->add( ContentPeer::CON_LANG, SYS_LANG); - $oC2->add( ContentPeer::CON_ID, $sproUid); - $oDataset3 = ContentPeer::doSelectRS($oC2); - $oDataset3->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset3->next(); - $aRow3 = $oDataset3->getRow(); - - Content::insertContent( 'PRO_TITLE', '', $aRow3['CON_ID'], 'en', $aRow3['CON_VALUE'] ); - - } - return 1; - - } - - -function startCase() { - G::LoadClass ( 'case' ); - - /* GET , POST & $_SESSION Vars */ + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $oCriteria->add( ContentPeer::CON_LANG, 'en' ); + $oCriteria->add( ContentPeer::CON_ID, $sproUid ); + $oDataset = ContentPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aRow = $oDataset->getRow(); + if (! is_array( $aRow )) { + + $oC = new Criteria( 'workflow' ); + $oC->addSelectColumn( TaskPeer::TAS_UID ); + $oC->add( TaskPeer::PRO_UID, $sproUid ); + $oDataset1 = TaskPeer::doSelectRS( $oC ); + $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + while ($oDataset1->next()) { + $aRow1 = $oDataset1->getRow(); + + $oCriteria1 = new Criteria( 'workflow' ); + $oCriteria1->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE' ); + $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG ); + $oCriteria1->add( ContentPeer::CON_ID, $aRow1['TAS_UID'] ); + $oDataset2 = ContentPeer::doSelectRS( $oCriteria1 ); + $oDataset2->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset2->next(); + $aRow2 = $oDataset2->getRow(); + + Content::insertContent( 'TAS_TITLE', '', $aRow2['CON_ID'], 'en', $aRow2['CON_VALUE'] ); + } + $oC2 = new Criteria( 'workflow' ); + $oC2->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); + $oC2->add( ContentPeer::CON_LANG, SYS_LANG ); + $oC2->add( ContentPeer::CON_ID, $sproUid ); + $oDataset3 = ContentPeer::doSelectRS( $oC2 ); + $oDataset3->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset3->next(); + $aRow3 = $oDataset3->getRow(); + + Content::insertContent( 'PRO_TITLE', '', $aRow3['CON_ID'], 'en', $aRow3['CON_VALUE'] ); + + } + return 1; + +} + +function startCase () +{ + G::LoadClass( 'case' ); + + /* GET , POST & $_SESSION Vars */ /* unset any variable, because we are starting a new case */ - if (isset ( $_SESSION ['APPLICATION'] )) unset ( $_SESSION ['APPLICATION'] ); - if (isset ( $_SESSION ['PROCESS'] )) unset ( $_SESSION ['PROCESS'] ); - if (isset ( $_SESSION ['TASK'] )) unset ( $_SESSION ['TASK'] ); - if (isset ( $_SESSION ['INDEX'] )) unset ( $_SESSION ['INDEX'] ); - if (isset ( $_SESSION ['STEP_POSITION'] )) unset ( $_SESSION ['STEP_POSITION'] ); - - /* Process */ - try { - $oCase = new Cases ( ); - - lookinginforContentProcess($_POST['processId']); - - $aData = $oCase->startCase ( $_REQUEST ['taskId'], $_SESSION ['USER_LOGGED'] ); - - $_SESSION ['APPLICATION'] = $aData ['APPLICATION']; - $_SESSION ['INDEX'] = $aData ['INDEX']; - $_SESSION ['PROCESS'] = $aData ['PROCESS']; - $_SESSION ['TASK'] = $_REQUEST ['taskId']; - $_SESSION ['STEP_POSITION'] = 0; - - $_SESSION ['CASES_REFRESH'] = true; - - // Execute Events - require_once 'classes/model/Event.php'; - $event = new Event(); - $event->createAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']); - - $oCase = new Cases ( ); - $aNextStep = $oCase->getNextStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] ); - - $aNextStep['PAGE'] = 'open?APP_UID='.$aData ['APPLICATION'].'&DEL_INDEX='.$aData ['INDEX'].'&action=draft'; - - $_SESSION ['BREAKSTEP'] ['NEXT_STEP'] = $aNextStep; - $aData ['openCase'] = $aNextStep; - - $aData ['status'] = 'success'; - print (G::json_encode ( $aData )) ; - } - catch ( Exception $e ) { - $aData ['status'] = 'failure'; - $aData ['message'] = $e->getMessage (); - print_r ( G::json_encode ( $aData ) ); - } -} - -function getSimpleDashboardData() { - G::LoadClass ( "BasePeer" ); - require_once ("classes/model/AppCacheView.php"); - require_once 'classes/model/Process.php'; - $sUIDUserLogged = $_SESSION ['USER_LOGGED']; - - $Criteria = new Criteria ( 'workflow' ); - - $Criteria->clearSelectColumns (); - - $Criteria->addSelectColumn ( AppCacheViewPeer::PRO_UID ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_UID ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_NUMBER ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_STATUS ); - $Criteria->addSelectColumn ( AppCacheViewPeer::DEL_INDEX ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_TITLE ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_PRO_TITLE ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_TAS_TITLE ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_DEL_PREVIOUS_USER ); - $Criteria->addSelectColumn ( AppCacheViewPeer::DEL_TASK_DUE_DATE ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_UPDATE_DATE ); - $Criteria->addSelectColumn ( AppCacheViewPeer::DEL_PRIORITY ); - $Criteria->addSelectColumn ( AppCacheViewPeer::DEL_DELAYED ); - $Criteria->addSelectColumn ( AppCacheViewPeer::USR_UID ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_THREAD_STATUS ); - - $Criteria->add ( AppCacheViewPeer::APP_STATUS, array ("TO_DO", "DRAFT" ), CRITERIA::IN ); - $Criteria->add ( AppCacheViewPeer::USR_UID, array ($sUIDUserLogged, "" ), CRITERIA::IN ); - - $Criteria->add ( AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); - - //$Criteria->add ( AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN' ); - - - $Criteria->add ( AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN' ); - - //execute the query - $oDataset = AppCacheViewPeer::doSelectRS ( $Criteria ); - $oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next (); - - $oProcess = new Process ( ); - - $rows = array (); - $processNames = array (); - while ( $aRow = $oDataset->getRow () ) { - // G::pr($aRow); - if (! isset ( $processNames [$aRow ['PRO_UID']] )) { - $aProcess = $oProcess->load ( $aRow ['PRO_UID'] ); - $processNames [$aRow ['PRO_UID']] = $aProcess ['PRO_TITLE']; - } - - if ($aRow ['USR_UID'] == "") - $aRow ['APP_STATUS'] = "UNASSIGNED"; - if (((in_array ( $aRow ['APP_STATUS'], array ("TO_DO", "UNASSIGNED" ) )) && ($aRow ['APP_THREAD_STATUS'] == "OPEN")) || ($aRow ['APP_STATUS'] == "DRAFT")) { - $rows [$processNames [$aRow ['PRO_UID']]] [$aRow ['APP_STATUS']] [$aRow ['DEL_DELAYED']] [] = $aRow ['APP_UID']; - if(!isset($rows [$processNames [$aRow ['PRO_UID']]] [$aRow ['APP_STATUS']]['count'])) $rows [$processNames [$aRow ['PRO_UID']]] [$aRow ['APP_STATUS']]['count']=0; - $rows [$processNames [$aRow ['PRO_UID']]][$aRow ['APP_STATUS']]['count']++; - } - - $oDataset->next (); - } - //Generate different groups of data for graphs - $rowsResponse=array(); - $i=0; - foreach($rows as $processID => $processInfo){ - $i++; - if($i<=10){ - $rowsResponse['caseStatusByProcess'][]=array('process'=>$processID,'inbox'=>isset($processInfo['TO_DO']['count'])?$processInfo['TO_DO']['count']:0,'draft'=>isset($processInfo['DRAFT']['count'])?$processInfo['DRAFT']['count']:0,'unassigned'=>isset($processInfo['UNASSIGNED']['count'])?$processInfo['UNASSIGNED']['count']:0); - - } - } - $rowsResponse['caseDelayed'][]=array('delayed'=>'On Time','total'=>100); - $rowsResponse['caseDelayed'][]=array('delayed'=>'Delayed','total'=>50); - - print_r ( G::json_encode ( $rowsResponse ) ); -} - -function getRegisteredDashboards() { - $oPluginRegistry = & PMPluginRegistry::getSingleton (); - $dashBoardPages = $oPluginRegistry->getDashboardPages (); - print_r ( G::json_encode ( $dashBoardPages ) ); -} - -function getDefaultDashboard(){ - $defaultDashboard['defaultTab']="mainDashboard"; - if(isset($_SESSION['__currentTabDashboard'])){ - $defaultDashboard['defaultTab']=$_SESSION['__currentTabDashboard']; - } - print_r ( G::json_encode ( $defaultDashboard ) ); -} + if (isset( $_SESSION['APPLICATION'] )) + unset( $_SESSION['APPLICATION'] ); + if (isset( $_SESSION['PROCESS'] )) + unset( $_SESSION['PROCESS'] ); + if (isset( $_SESSION['TASK'] )) + unset( $_SESSION['TASK'] ); + if (isset( $_SESSION['INDEX'] )) + unset( $_SESSION['INDEX'] ); + if (isset( $_SESSION['STEP_POSITION'] )) + unset( $_SESSION['STEP_POSITION'] ); + + /* Process */ + try { + $oCase = new Cases(); + + lookinginforContentProcess( $_POST['processId'] ); + + $aData = $oCase->startCase( $_REQUEST['taskId'], $_SESSION['USER_LOGGED'] ); + + $_SESSION['APPLICATION'] = $aData['APPLICATION']; + $_SESSION['INDEX'] = $aData['INDEX']; + $_SESSION['PROCESS'] = $aData['PROCESS']; + $_SESSION['TASK'] = $_REQUEST['taskId']; + $_SESSION['STEP_POSITION'] = 0; + + $_SESSION['CASES_REFRESH'] = true; + + // Execute Events + require_once 'classes/model/Event.php'; + $event = new Event(); + $event->createAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] ); + + $oCase = new Cases(); + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + + $aNextStep['PAGE'] = 'open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft'; + + $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; + $aData['openCase'] = $aNextStep; + + $aData['status'] = 'success'; + print (G::json_encode( $aData )) ; + } catch (Exception $e) { + $aData['status'] = 'failure'; + $aData['message'] = $e->getMessage(); + print_r( G::json_encode( $aData ) ); + } +} + +function getSimpleDashboardData () +{ + G::LoadClass( "BasePeer" ); + require_once ("classes/model/AppCacheView.php"); + require_once 'classes/model/Process.php'; + $sUIDUserLogged = $_SESSION['USER_LOGGED']; + + $Criteria = new Criteria( 'workflow' ); + + $Criteria->clearSelectColumns(); + + $Criteria->addSelectColumn( AppCacheViewPeer::PRO_UID ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_UID ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_NUMBER ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_STATUS ); + $Criteria->addSelectColumn( AppCacheViewPeer::DEL_INDEX ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_TITLE ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_PRO_TITLE ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_TAS_TITLE ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_DEL_PREVIOUS_USER ); + $Criteria->addSelectColumn( AppCacheViewPeer::DEL_TASK_DUE_DATE ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_UPDATE_DATE ); + $Criteria->addSelectColumn( AppCacheViewPeer::DEL_PRIORITY ); + $Criteria->addSelectColumn( AppCacheViewPeer::DEL_DELAYED ); + $Criteria->addSelectColumn( AppCacheViewPeer::USR_UID ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_THREAD_STATUS ); + + $Criteria->add( AppCacheViewPeer::APP_STATUS, array ("TO_DO","DRAFT" + ), CRITERIA::IN ); + $Criteria->add( AppCacheViewPeer::USR_UID, array ($sUIDUserLogged,"" + ), CRITERIA::IN ); + + $Criteria->add( AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); + + //$Criteria->add ( AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN' ); + + + $Criteria->add( AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN' ); + + //execute the query + $oDataset = AppCacheViewPeer::doSelectRS( $Criteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + + $oProcess = new Process(); + + $rows = array (); + $processNames = array (); + while ($aRow = $oDataset->getRow()) { + // G::pr($aRow); + if (! isset( $processNames[$aRow['PRO_UID']] )) { + $aProcess = $oProcess->load( $aRow['PRO_UID'] ); + $processNames[$aRow['PRO_UID']] = $aProcess['PRO_TITLE']; + } + + if ($aRow['USR_UID'] == "") + $aRow['APP_STATUS'] = "UNASSIGNED"; + if (((in_array( $aRow['APP_STATUS'], array ("TO_DO","UNASSIGNED" + ) )) && ($aRow['APP_THREAD_STATUS'] == "OPEN")) || ($aRow['APP_STATUS'] == "DRAFT")) { + $rows[$processNames[$aRow['PRO_UID']]][$aRow['APP_STATUS']][$aRow['DEL_DELAYED']][] = $aRow['APP_UID']; + if (! isset( $rows[$processNames[$aRow['PRO_UID']]][$aRow['APP_STATUS']]['count'] )) + $rows[$processNames[$aRow['PRO_UID']]][$aRow['APP_STATUS']]['count'] = 0; + $rows[$processNames[$aRow['PRO_UID']]][$aRow['APP_STATUS']]['count'] ++; + } + + $oDataset->next(); + } + //Generate different groups of data for graphs + $rowsResponse = array (); + $i = 0; + foreach ($rows as $processID => $processInfo) { + $i ++; + if ($i <= 10) { + $rowsResponse['caseStatusByProcess'][] = array ('process' => $processID,'inbox' => isset( $processInfo['TO_DO']['count'] ) ? $processInfo['TO_DO']['count'] : 0,'draft' => isset( $processInfo['DRAFT']['count'] ) ? $processInfo['DRAFT']['count'] : 0,'unassigned' => isset( $processInfo['UNASSIGNED']['count'] ) ? $processInfo['UNASSIGNED']['count'] : 0 + ); + + } + } + $rowsResponse['caseDelayed'][] = array ('delayed' => 'On Time','total' => 100 + ); + $rowsResponse['caseDelayed'][] = array ('delayed' => 'Delayed','total' => 50 + ); + + print_r( G::json_encode( $rowsResponse ) ); +} + +function getRegisteredDashboards () +{ + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + $dashBoardPages = $oPluginRegistry->getDashboardPages(); + print_r( G::json_encode( $dashBoardPages ) ); +} + +function getDefaultDashboard () +{ + $defaultDashboard['defaultTab'] = "mainDashboard"; + if (isset( $_SESSION['__currentTabDashboard'] )) { + $defaultDashboard['defaultTab'] = $_SESSION['__currentTabDashboard']; + } + print_r( G::json_encode( $defaultDashboard ) ); +} + diff --git a/workflow/engine/methods/cases/casesToRevisePanelExtJs.php b/workflow/engine/methods/cases/casesToRevisePanelExtJs.php index 24cd2f79c..8a7514daa 100755 --- a/workflow/engine/methods/cases/casesToRevisePanelExtJs.php +++ b/workflow/engine/methods/cases/casesToRevisePanelExtJs.php @@ -1,15 +1,14 @@ -assign( 'TRANSLATIONS', $TRANSLATIONS); //translations - $casesPanelUrl = 'casesToReviseTreeContent?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex; - $oHeadPublisher->assign( 'casesPanelUrl', $casesPanelUrl); //translations - $oHeadPublisher->assign( 'treeTitle', G::loadtranslation('ID_STEP_LIST')); //translations - $oHeadPublisher->addExtJsScript('cases/casesToRevisePanel', false ); //adding a javascript file .js - $oHeadPublisher->addContent( 'cases/casesToRevisePanel'); //adding a html file .html. - - G::RenderPage('publish', 'extJs'); - \ No newline at end of file +$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; +$oHeadPublisher->assign( 'casesPanelUrl', $casesPanelUrl ); //translations +$oHeadPublisher->assign( 'treeTitle', G::loadtranslation( 'ID_STEP_LIST' ) ); //translations +$oHeadPublisher->addExtJsScript( 'cases/casesToRevisePanel', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'cases/casesToRevisePanel' ); //adding a html file .html. + +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/cases/casesToReviseTreeContent.php b/workflow/engine/methods/cases/casesToReviseTreeContent.php index b84fc5f9d..ea7631550 100755 --- a/workflow/engine/methods/cases/casesToReviseTreeContent.php +++ b/workflow/engine/methods/cases/casesToReviseTreeContent.php @@ -1,93 +1,99 @@ -id = $id; - $this->text = $text; - $this->iconCls = $iconCls; - $this->leaf = $leaf; - $this->draggable = $draggable; - $this->href = $href; - $this->hrefTarget = $hrefTarget; - } - - function toJson() { - return G::json_encode($this); - } -} - -class ExtJsTreeNode extends TreeNode { - public $children = array(); - function add($object) { - $this->children[] = $object; - } - - function toJson() { - return G::json_encode($this); - } -} - -G::LoadClass('case'); - -$o = new Cases(); - -$PRO_UID = $_SESSION['PROCESS']; - -$treeArray = array(); +id = $id; + $this->text = $text; + $this->iconCls = $iconCls; + $this->leaf = $leaf; + $this->draggable = $draggable; + $this->href = $href; + $this->hrefTarget = $hrefTarget; + } + + function toJson () + { + return G::json_encode( $this ); + } +} + +class ExtJsTreeNode extends TreeNode +{ + public $children = array (); + + function add ($object) + { + $this->children[] = $object; + } + + function toJson () + { + return G::json_encode( $this ); + } +} + +G::LoadClass( 'case' ); + +$o = new Cases(); + +$PRO_UID = $_SESSION['PROCESS']; + +$treeArray = array (); //if (isset($_GET['action'])&&$_GET['action']=='test'){ - echo "["; - // dynaforms assemble - $extTreeDynaforms = new ExtJsTreeNode("node-dynaforms", G::loadtranslation('ID_DYNAFORMS'), "", false, false, "", ""); - $i = 0; - $APP_UID = $_GET['APP_UID']; - $DEL_INDEX = $_GET['DEL_INDEX']; - $steps = $o->getAllDynaformsStepsToRevise($_GET['APP_UID']); - $steps->next(); - while ($step = $steps->getRow()) { - require_once 'classes/model/Dynaform.php'; - $od = new Dynaform(); - $dynaformF = $od->Load($step['STEP_UID_OBJ']); - - $n = $step['STEP_POSITION']; - $TITLE = " - ".$dynaformF['DYN_TITLE']; - $DYN_UID = $dynaformF['DYN_UID']; - $href = "cases_StepToRevise?type=DYNAFORM&ex=$i&PRO_UID=$PRO_UID&DYN_UID=$DYN_UID&APP_UID=$APP_UID&position=".$step['STEP_POSITION']."&DEL_INDEX=$DEL_INDEX"; - $extTreeDynaforms->add(new TreeNode($DYN_UID,$TITLE,"datasource",true,false,$href,"openCaseFrame")); - $i++; - $steps->next(); - } - echo $extTreeDynaforms->toJson(); - // end the dynaforms tree menu - echo ","; - // assembling the input documents tree menu - $extTreeInputDocs = new ExtJsTreeNode("node-input-documents", G::loadtranslation('ID_REQUEST_DOCUMENTS'), "", false, false, "", ""); - $i = 0; - $APP_UID = $_GET['APP_UID']; - $DEL_INDEX = $_GET['DEL_INDEX']; - $steps = $o->getAllInputsStepsToRevise($_GET['APP_UID']); - $steps->next(); - while ($step = $steps->getRow()) { - require_once 'classes/model/InputDocument.php'; - $od = new InputDocument(); - $IDF = $od->Load($step['STEP_UID_OBJ']); - - $n = $step['STEP_POSITION']; - $TITLE = " - ".$IDF['INP_DOC_TITLE']; - $INP_DOC_UID = $IDF['INP_DOC_UID']; - $href = "cases_StepToReviseInputs?type=INPUT_DOCUMENT&ex=$i&PRO_UID=$PRO_UID&INP_DOC_UID=$INP_DOC_UID&APP_UID=$APP_UID&position=".$step['STEP_POSITION']."&DEL_INDEX=$DEL_INDEX"; - $extTreeInputDocs->add(new TreeNode($INP_DOC_UID,$TITLE,"datasource",true,false,$href,"openCaseFrame")); - $i++; - $steps->next(); - } - echo $extTreeInputDocs->toJson(); - echo "]"; \ No newline at end of file +echo "["; +// dynaforms assemble +$extTreeDynaforms = new ExtJsTreeNode( "node-dynaforms", G::loadtranslation( 'ID_DYNAFORMS' ), "", false, false, "", "" ); +$i = 0; +$APP_UID = $_GET['APP_UID']; +$DEL_INDEX = $_GET['DEL_INDEX']; +$steps = $o->getAllDynaformsStepsToRevise( $_GET['APP_UID'] ); +$steps->next(); +while ($step = $steps->getRow()) { + require_once 'classes/model/Dynaform.php'; + $od = new Dynaform(); + $dynaformF = $od->Load( $step['STEP_UID_OBJ'] ); + + $n = $step['STEP_POSITION']; + $TITLE = " - " . $dynaformF['DYN_TITLE']; + $DYN_UID = $dynaformF['DYN_UID']; + $href = "cases_StepToRevise?type=DYNAFORM&ex=$i&PRO_UID=$PRO_UID&DYN_UID=$DYN_UID&APP_UID=$APP_UID&position=" . $step['STEP_POSITION'] . "&DEL_INDEX=$DEL_INDEX"; + $extTreeDynaforms->add( new TreeNode( $DYN_UID, $TITLE, "datasource", true, false, $href, "openCaseFrame" ) ); + $i ++; + $steps->next(); +} +echo $extTreeDynaforms->toJson(); +// end the dynaforms tree menu +echo ","; +// assembling the input documents tree menu +$extTreeInputDocs = new ExtJsTreeNode( "node-input-documents", G::loadtranslation( 'ID_REQUEST_DOCUMENTS' ), "", false, false, "", "" ); +$i = 0; +$APP_UID = $_GET['APP_UID']; +$DEL_INDEX = $_GET['DEL_INDEX']; +$steps = $o->getAllInputsStepsToRevise( $_GET['APP_UID'] ); +$steps->next(); +while ($step = $steps->getRow()) { + require_once 'classes/model/InputDocument.php'; + $od = new InputDocument(); + $IDF = $od->Load( $step['STEP_UID_OBJ'] ); + + $n = $step['STEP_POSITION']; + $TITLE = " - " . $IDF['INP_DOC_TITLE']; + $INP_DOC_UID = $IDF['INP_DOC_UID']; + $href = "cases_StepToReviseInputs?type=INPUT_DOCUMENT&ex=$i&PRO_UID=$PRO_UID&INP_DOC_UID=$INP_DOC_UID&APP_UID=$APP_UID&position=" . $step['STEP_POSITION'] . "&DEL_INDEX=$DEL_INDEX"; + $extTreeInputDocs->add( new TreeNode( $INP_DOC_UID, $TITLE, "datasource", true, false, $href, "openCaseFrame" ) ); + $i ++; + $steps->next(); +} +echo $extTreeInputDocs->toJson(); +echo "]"; + diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php index fd71d43fd..e5fd70af5 100755 --- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php @@ -1,90 +1,87 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ /* * Created on 13-02-2008 * * @author David Callizaya - */ - -require_once ( "classes/model/AppDocumentPeer.php" ); - -$oAppDocument = new AppDocument(); -$oAppDocument->Fields = $oAppDocument->load($_GET['a'],(isset($_GET['v']) )? $_GET['v'] : NULL ); - -$sAppDocUid = $oAppDocument->getAppDocUid(); -$info = pathinfo( $oAppDocument->getAppDocFilename() ); -if (!isset($_GET['ext'])) { - $ext = $info['extension']; -} -else { - if ($_GET['ext'] != '') { - $ext = $_GET['ext']; - } - else { - $ext = $info['extension']; - } -} -$ver= (isset($_GET['v']) && $_GET['v']!='') ? '_'.$_GET['v'] : ''; - -if(!$ver) //This code is in the case the outputdocument won't be versioned - $ver='_1'; - -$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid .$ver. '.' . $ext ; -$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] .$ver. '.' . $ext ; -$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename']. '.' . $ext ; -$sw_file_exists=false; -if(file_exists($realPath)){ - $sw_file_exists=true; -}elseif(file_exists($realPath1)){ - $sw_file_exists=true; - $realPath=$realPath1; -}elseif(file_exists($realPath2)){ - $sw_file_exists=true; - $realPath=$realPath2; -} -if(!$sw_file_exists){ - $error_message="'".$info['basename'] .$ver. '.' . $ext."' ".G::LoadTranslation('ID_ERROR_STREAMING_FILE'); - if((isset($_POST['request']))&&($_POST['request']==true)){ - $res ['success'] = 'failure'; - $res ['message'] = $error_message; - print G::json_encode ( $res ); - }else{ - G::SendMessageText($error_message, "ERROR"); - $backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']); - G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]); - die; - } - -}else{ - if((isset($_POST['request']))&&($_POST['request']==true)){ - $res ['success'] = 'success'; - $res ['message'] = $info['basename'] .$ver. '.' . $ext; - print G::json_encode ( $res ); - }else{ - G::streamFile ( $realPath, true ,$info['basename'] .$ver. '.' . $ext ); - } -} -//G::streamFile ( $realPath, true); -?> \ No newline at end of file + */ + +require_once ("classes/model/AppDocumentPeer.php"); + +$oAppDocument = new AppDocument(); +$oAppDocument->Fields = $oAppDocument->load( $_GET['a'], (isset( $_GET['v'] )) ? $_GET['v'] : NULL ); + +$sAppDocUid = $oAppDocument->getAppDocUid(); +$info = pathinfo( $oAppDocument->getAppDocFilename() ); +if (! isset( $_GET['ext'] )) { + $ext = $info['extension']; +} else { + if ($_GET['ext'] != '') { + $ext = $_GET['ext']; + } else { + $ext = $info['extension']; + } +} +$ver = (isset( $_GET['v'] ) && $_GET['v'] != '') ? '_' . $_GET['v'] : ''; + +if (! $ver) //This code is in the case the outputdocument won't be versioned + $ver = '_1'; + +$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext; +$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . $ver . '.' . $ext; +$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . '.' . $ext; +$sw_file_exists = false; +if (file_exists( $realPath )) { + $sw_file_exists = true; +} elseif (file_exists( $realPath1 )) { + $sw_file_exists = true; + $realPath = $realPath1; +} elseif (file_exists( $realPath2 )) { + $sw_file_exists = true; + $realPath = $realPath2; +} +if (! $sw_file_exists) { + $error_message = "'" . $info['basename'] . $ver . '.' . $ext . "' " . G::LoadTranslation( 'ID_ERROR_STREAMING_FILE' ); + if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) { + $res['success'] = 'failure'; + $res['message'] = $error_message; + print G::json_encode( $res ); + } else { + G::SendMessageText( $error_message, "ERROR" ); + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + +} else { + if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) { + $res['success'] = 'success'; + $res['message'] = $info['basename'] . $ver . '.' . $ext; + print G::json_encode( $res ); + } else { + G::streamFile( $realPath, true, $info['basename'] . $ver . '.' . $ext ); + } +} +//G::streamFile ( $realPath, true); + diff --git a/workflow/engine/methods/cases/cases_ShowToReviseOutputDocument.php b/workflow/engine/methods/cases/cases_ShowToReviseOutputDocument.php index b1a0036c6..3146dfade 100755 --- a/workflow/engine/methods/cases/cases_ShowToReviseOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowToReviseOutputDocument.php @@ -1,66 +1,62 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ /* * Created on 13-02-2008 * * @author David Callizaya - */ - - switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - require_once ( "classes/model/AppDocumentPeer.php" ); - - $oAppDocument = new AppDocument(); - $oAppDocument->Fields = $oAppDocument->load($_GET['a']); - - $sAppDocUid = $oAppDocument->getAppDocUid(); - $info = pathinfo( $oAppDocument->getAppDocFilename() ); - if (!isset($_GET['ext'])) { - $ext = $info['extension']; - } - else { - if ($_GET['ext'] != '') { - $ext = $_GET['ext']; - } - else { - $ext = $info['extension']; - } - } - - $realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/outdocs/' . $info['basename'] . '.' . $ext ; - G::streamFile ( $realPath, true ); - -?> \ No newline at end of file + */ + +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +require_once ("classes/model/AppDocumentPeer.php"); + +$oAppDocument = new AppDocument(); +$oAppDocument->Fields = $oAppDocument->load( $_GET['a'] ); + +$sAppDocUid = $oAppDocument->getAppDocUid(); +$info = pathinfo( $oAppDocument->getAppDocFilename() ); +if (! isset( $_GET['ext'] )) { + $ext = $info['extension']; +} else { + if ($_GET['ext'] != '') { + $ext = $_GET['ext']; + } else { + $ext = $info['extension']; + } +} + +$realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/outdocs/' . $info['basename'] . '.' . $ext; +G::streamFile( $realPath, true ); + diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 9967c0e22..ed8139087 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -1,81 +1,77 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - /* Permissions */ - switch ($RBAC->userCanAccess('PM_CASES')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - - if ( (int)$_SESSION['INDEX'] < 1 ) - { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; - } - global $_DBArray; - if (!isset($_DBArray)) { - $_DBArray = array(); - } - - /* Includes */ - G::LoadClass('case'); - G::LoadClass('derivation'); - - - /* GET , POST & $_SESSION Vars */ - if (isset($_GET['POSITION'])) { - $_SESSION['STEP_POSITION'] = (int)$_GET['POSITION']; - } - - if (isset($_SESSION['CASES_REFRESH'])) { - unset($_SESSION['CASES_REFRESH']); - G::evalJScript("if(typeof parent != 'undefined' && parent.refreshCountFolders) parent.refreshCountFolders();"); - } - - /* Menues */ - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_SUB_MENU = 'caseOptions'; - $G_ID_SUB_MENU_SELECTED = '_'; - - /* Prepare page before to show */ - $oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); - $oTemplatePower->prepare(); - $G_PUBLISH = new Publisher; - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptCode(' +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if ((int) $_SESSION['INDEX'] < 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); +} +global $_DBArray; +if (! isset( $_DBArray )) { + $_DBArray = array (); +} + +/* Includes */ +G::LoadClass( 'case' ); +G::LoadClass( 'derivation' ); + +/* GET , POST & $_SESSION Vars */ +if (isset( $_GET['POSITION'] )) { + $_SESSION['STEP_POSITION'] = (int) $_GET['POSITION']; +} + +if (isset( $_SESSION['CASES_REFRESH'] )) { + unset( $_SESSION['CASES_REFRESH'] ); + G::evalJScript( "if(typeof parent != 'undefined' && parent.refreshCountFolders) parent.refreshCountFolders();" ); +} + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_SUB_MENU = 'caseOptions'; +$G_ID_SUB_MENU_SELECTED = '_'; + +/* Prepare page before to show */ +$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); +$oTemplatePower->prepare(); +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -83,887 +79,814 @@ leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ - '.(isset($_SESSION['showCasesWindow'])?'try{'.$_SESSION['showCasesWindow'].'}catch(e){}':'').' + ' . (isset( $_SESSION['showCasesWindow'] ) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . ' }); - '); - $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); - - $oCase = new Cases(); - - $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); - $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); - $sStatus = $Fields['APP_STATUS']; - - $APP_NUMBER = $Fields['APP_NUMBER']; - $APP_TITLE = $Fields['TITLE']; - - $oProcess = new Process(); - $oProcessFieds = $oProcess->Load($_SESSION['PROCESS']); - - #trigger debug routines... - - if( isset($oProcessFieds['PRO_DEBUG']) && $oProcessFieds['PRO_DEBUG'] ) { #here we must verify if is a debugg session - $_SESSION['TRIGGER_DEBUG']['ISSET'] = 1; - $_SESSION['PMDEBUGGER']= true; - } - else { - $_SESSION['TRIGGER_DEBUG']['ISSET'] = 0; - $_SESSION['PMDEBUGGER']= false; - } - - //cleaning debug variables - if( !isset($_GET['breakpoint']) ) { - if( isset($_SESSION['TRIGGER_DEBUG']['info']) ) unset($_SESSION['TRIGGER_DEBUG']['info']); - - if (!isset($_SESSION['_NO_EXECUTE_TRIGGERS_'])) { - $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array(); - } - $_SESSION['TRIGGER_DEBUG']['DATA'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array(); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array(); - - $triggers = $oCase->loadTriggers( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE'); - - $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count($triggers); - $_SESSION['TRIGGER_DEBUG']['TIME'] = 'BEFORE'; - if($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; - } - - if (!isset($_SESSION['_NO_EXECUTE_TRIGGERS_'])) { - //Execute before triggers - Start - $Fields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE', $Fields['APP_DATA'] ); - $Fields['DEL_INDEX']= $_SESSION['INDEX']; - $Fields['TAS_UID'] = $_SESSION['TASK']; - //Execute before triggers - End - } - else { - unset($_SESSION['_NO_EXECUTE_TRIGGERS_']); - $Fields['DEL_INDEX']= $_SESSION['INDEX']; - $Fields['TAS_UID'] = $_SESSION['TASK']; - } - } - - if( isset($_GET['breakpoint']) ) { - $_POST['NextStep'] = $_SESSION['TRIGGER_DEBUG']['BREAKPAGE']; - } - - /** - * Here we throw the debug view - */ - if ( isset($_GET['breakpoint']) ) { - - $G_PUBLISH->AddContent('view', 'cases/showDebugFrameLoader'); - $G_PUBLISH->AddContent('view', 'cases/showDebugFrameBreaker'); - G::RenderPage('publish', 'blank'); - exit(); - } - #end trigger debug session....... - - //$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); - - //Save data - Start - $oCase->updateCase ( $_SESSION['APPLICATION'], $Fields ); - //Save data - End - - //Obtain previous and next step - Start - try { - $oCase = new Cases(); - $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); - $aPreviousStep = $oCase->getPreviousStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); - } - catch ( Exception $e ) { - } - //Obtain previous and next step - End - - try { - //Add content content step - Start - $oApp = ApplicationPeer::retrieveByPK( $_SESSION['APPLICATION'] ); - $array['APP_NUMBER'] = $APP_NUMBER; - $sTitleCase = $oApp->getAppTitle(); - $array['APP_TITLE'] = $sTitleCase; - $array['CASE'] = G::LoadTranslation('ID_CASE'); - $array['TITLE'] = G::LoadTranslation('ID_TITLE'); - - $noShowTitle = 0; - if(isset($oProcessFieds['PRO_SHOW_MESSAGE'])) { - $noShowTitle = $oProcessFieds['PRO_SHOW_MESSAGE']; - } - - switch ($_GET['TYPE']) - { - case 'DYNAFORM': - if($noShowTitle == 0) { - $G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array); - } - if (!$aPreviousStep) { - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; - } - else { - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP"); - } - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation('ID_NEXT_STEP'); - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PHPSESSID'] = @session_id(); - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_GET['UID']; - - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptCode(" + ' ); +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + +$oCase = new Cases(); + +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); +$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); +$sStatus = $Fields['APP_STATUS']; + +$APP_NUMBER = $Fields['APP_NUMBER']; +$APP_TITLE = $Fields['TITLE']; + +$oProcess = new Process(); +$oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] ); + +#trigger debug routines... + + +if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) { #here we must verify if is a debugg session + $_SESSION['TRIGGER_DEBUG']['ISSET'] = 1; + $_SESSION['PMDEBUGGER'] = true; +} else { + $_SESSION['TRIGGER_DEBUG']['ISSET'] = 0; + $_SESSION['PMDEBUGGER'] = false; +} + +//cleaning debug variables +if (! isset( $_GET['breakpoint'] )) { + if (isset( $_SESSION['TRIGGER_DEBUG']['info'] )) + unset( $_SESSION['TRIGGER_DEBUG']['info'] ); + + if (! isset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] )) { + $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); + } + $_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); + + $triggers = $oCase->loadTriggers( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE' ); + + $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TIME'] = 'BEFORE'; + if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; + } + + if (! isset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] )) { + //Execute before triggers - Start + $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE', $Fields['APP_DATA'] ); + $Fields['DEL_INDEX'] = $_SESSION['INDEX']; + $Fields['TAS_UID'] = $_SESSION['TASK']; + //Execute before triggers - End + } else { + unset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] ); + $Fields['DEL_INDEX'] = $_SESSION['INDEX']; + $Fields['TAS_UID'] = $_SESSION['TASK']; + } +} + +if (isset( $_GET['breakpoint'] )) { + $_POST['NextStep'] = $_SESSION['TRIGGER_DEBUG']['BREAKPAGE']; +} + +/** + * Here we throw the debug view + */ +if (isset( $_GET['breakpoint'] )) { + + $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' ); + $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameBreaker' ); + G::RenderPage( 'publish', 'blank' ); + exit(); +} +#end trigger debug session....... + + +//$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); + + +//Save data - Start +$oCase->updateCase( $_SESSION['APPLICATION'], $Fields ); +//Save data - End + + +//Obtain previous and next step - Start +try { + $oCase = new Cases(); + $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); + $aPreviousStep = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); +} catch (Exception $e) { +} +//Obtain previous and next step - End + + +try { + //Add content content step - Start + $oApp = ApplicationPeer::retrieveByPK( $_SESSION['APPLICATION'] ); + $array['APP_NUMBER'] = $APP_NUMBER; + $sTitleCase = $oApp->getAppTitle(); + $array['APP_TITLE'] = $sTitleCase; + $array['CASE'] = G::LoadTranslation( 'ID_CASE' ); + $array['TITLE'] = G::LoadTranslation( 'ID_TITLE' ); + + $noShowTitle = 0; + if (isset( $oProcessFieds['PRO_SHOW_MESSAGE'] )) { + $noShowTitle = $oProcessFieds['PRO_SHOW_MESSAGE']; + } + + switch ($_GET['TYPE']) { + case 'DYNAFORM': + if ($noShowTitle == 0) { + $G_PUBLISH->AddContent( 'smarty', 'cases/cases_title', '', '', $array ); + } + if (! $aPreviousStep) { + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; + } else { + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation( "ID_PREVIOUS_STEP" ); + } + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation( 'ID_NEXT_STEP' ); + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PHPSESSID'] = @session_id(); + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_GET['UID']; + + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.setNode) { - parent.setNode('".$_GET['UID']."'); + parent.setNode('" . $_GET['UID'] . "'); } - }"); - - $oStep = new Step(); - $oStep = $oStep->loadByProcessTaskPosition($_SESSION['PROCESS'], $_SESSION['TASK'], $_GET['POSITION']); - - /** Added By erik 16-05-08 - * Description: this was added for the additional database connections */ - G::LoadClass ('dbConnections'); - $oDbConnections = new dbConnections($_SESSION['PROCESS']); - $oDbConnections->loadAdditionalConnections(); - $_SESSION['CURRENT_DYN_UID'] = $_GET['UID']; - - $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS']. '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : '')); - break; - - case 'INPUT_DOCUMENT': - if($noShowTitle == 0) { - $G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array); - } - $oInputDocument = new InputDocument(); - $Fields = $oInputDocument->load($_GET['UID']); - if (!$aPreviousStep) { - $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; - $Fields['PREVIOUS_STEP_LABEL'] = ''; - } - else { - $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; - $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP"); - - $Fields['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; - $Fields['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP"); - } - $Fields['NEXT_STEP'] = $aNextStep['PAGE']; - $Fields['NEXT_STEP_LABEL'] = G::loadTranslation("ID_NEXT_STEP"); - switch ($_GET['ACTION']) - { - case 'ATTACH': - switch ($Fields['INP_DOC_FORM_NEEDED']) { - case 'REAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_NEW'); - $sXmlForm = 'cases/cases_AttachInputDocument2'; - break; - case 'VIRTUAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_ATTACH'); - $sXmlForm = 'cases/cases_AttachInputDocument1'; - break; - case 'VREAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_ATTACH'); - $sXmlForm = 'cases/cases_AttachInputDocument3'; - break; - } - $Fields['MESSAGE1'] = G::LoadTranslation('ID_PLEASE_ENTER_COMMENTS'); - $Fields['MESSAGE2'] = G::LoadTranslation('ID_PLEASE_SELECT_FILE'); - //START: If there is a Break Step registered from Plugin Similar as a Trigger debug - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT_BEFORE ) ) {//If a Plugin has registered a Break Page Evaluator - $oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT_BEFORE , array('USR_UID'=>$_SESSION['USER_LOGGED']) ); - } - //END: If there is a Break Step registered from Plugin - $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID']), array_merge(array('DOC_UID'=>$_GET['UID']),$Fields));//$aFields - - //call plugin - //if ( $oPluginRegistry->existsTrigger ( PM_CASE_DOCUMENT_LIST ) ) { - // $folderData = new folderData (null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED'] ); - // $oPluginRegistry =& PMPluginRegistry::getSingleton(); - // $oPluginRegistry->executeTriggers ( PM_CASE_DOCUMENT_LIST , $folderData ); - // //end plugin - //} - //else - // $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID']), array_merge(array('DOC_UID'=>$_GET['UID']),$Fields));//$aFields - - $oHeadPublisher =& headPublisher::getSingleton(); - $titleDocument="

".$Fields['INP_DOC_TITLE']."
".G::LoadTranslation('ID_INPUT_DOCUMENT')."

"; - if($Fields['INP_DOC_DESCRIPTION']) $titleDocument.= " ".str_replace("\n","",str_replace("'","\'",nl2br(htmlentities(utf8_decode($Fields['INP_DOC_DESCRIPTION']))))).""; - - $oHeadPublisher->addScriptCode("documentName='{$titleDocument}';"); - break; - - case 'VIEW': - require_once 'classes/model/AppDocument.php'; - require_once 'classes/model/Users.php'; - $oAppDocument = new AppDocument(); - $oAppDocument->Fields = $oAppDocument->load($_GET['DOC'],$_GET['VERSION']); - $Fields['POSITION'] = $_SESSION['STEP_POSITION']; - $oUser = new Users(); - $aUser = $oUser->load($oAppDocument->Fields['USR_UID']); - $Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; - switch ($Fields['INP_DOC_FORM_NEEDED']) - { - case 'REAL': - $sXmlForm = 'cases/cases_ViewInputDocument2'; - break; - case 'VIRTUAL': - $sXmlForm = 'cases/cases_ViewInputDocument1'; - break; - case 'VREAL': - $sXmlForm = 'cases/cases_ViewInputDocument3'; - break; - } - $oAppDocument->Fields['VIEW'] = G::LoadTranslation('ID_OPEN'); - $oAppDocument->Fields['FILE'] = 'cases_ShowDocument?a=' . $_GET['DOC'] . '&r=' . rand(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', G::array_merges($Fields, $oAppDocument->Fields), ''); - break; - } - break; - - case 'OUTPUT_DOCUMENT': - //$G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array); - - require_once 'classes/model/OutputDocument.php'; - $oOutputDocument = new OutputDocument(); - $aOD = $oOutputDocument->load( $_GET['UID'] ); - if (!$aPreviousStep) { - $aOD['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; - } - else { - $aOD['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; - $aOD['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP"); - } - $aOD['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; - $aOD['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation("ID_NEXT_STEP"); - switch ($_GET['ACTION']) - { - case 'GENERATE': - //START: If there is a Break Step registered from Plugin Similar as a Trigger debug - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT_BEFORE ) ) {//If a Plugin has registered a Break Page Evaluator - $oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT_BEFORE , array('USR_UID'=>$_SESSION['USER_LOGGED']) ); - } - //END: If there is a Break Step registered from Plugin - - - $sFilenameOriginal=$sFilename = preg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'])); - require_once 'classes/model/AppFolder.php'; - require_once 'classes/model/AppDocument.php'; - - //Get the Custom Folder ID (create if necessary) - $oFolder=new AppFolder(); - $folderId=$oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH']); - - //Tags - $fileTags=$oFolder->parseTags($aOD['OUT_DOC_TAGS']); - - //Get last Document Version and apply versioning if is enabled - - $oAppDocument= new AppDocument(); - $lastDocVersion=$oAppDocument->getLastDocVersion($_GET['UID'],$_SESSION['APPLICATION']); - - //if(($aOD['OUT_DOC_VERSIONING'])||($lastDocVersion==0)){ - // $lastDocVersion++; - //} - - $oCriteria = new Criteria('workflow'); - $oCriteria->add(AppDocumentPeer::APP_UID, $_SESSION['APPLICATION']); - //$oCriteria->add(AppDocumentPeer::DEL_INDEX, $_SESSION['INDEX']); - $oCriteria->add(AppDocumentPeer::DOC_UID, $_GET['UID']); - $oCriteria->add(AppDocumentPeer::DOC_VERSION, $lastDocVersion); - $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT'); - $oDataset = AppDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - if(($aOD['OUT_DOC_VERSIONING'])&&($lastDocVersion!=0)){//Create new Version of current output - $lastDocVersion++; - if ($aRow = $oDataset->getRow()) { - $aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'DOC_UID' => $_GET['UID'], - 'DOC_VERSION' => $lastDocVersion+1, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'APP_DOC_TYPE' => 'OUTPUT', - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_FILENAME' => $sFilename, - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - $oAppDocument = new AppDocument(); - $oAppDocument->create($aFields); - $sDocUID = $aRow['APP_DOC_UID']; - } - }else{//No versioning so Update a current Output or Create new if no exist - if ($aRow = $oDataset->getRow()) { //Update - $aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'DOC_UID' => $_GET['UID'], - 'DOC_VERSION' => $lastDocVersion, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'APP_DOC_TYPE' => 'OUTPUT', - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_FILENAME' => $sFilename, - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - $oAppDocument = new AppDocument(); - $oAppDocument->update($aFields); - $sDocUID = $aRow['APP_DOC_UID']; - }else{ //create - if($lastDocVersion==0) $lastDocVersion++; - $aFields = array('APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'], - 'DOC_UID' => $_GET['UID'], - 'DOC_VERSION' => $lastDocVersion, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'APP_DOC_TYPE' => 'OUTPUT', - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_FILENAME' => $sFilename, - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - $oAppDocument = new AppDocument(); - $aFields['APP_DOC_UID']=$sDocUID = $oAppDocument->create($aFields); - - } - } - - //$sFilename = ereg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'])); - //if ( $sFilename == '' ) $sFilename='_'; - - $sFilename = $aFields['APP_DOC_UID']. "_".$lastDocVersion; - - $pathOutput = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP ; - G::mk_dir ( $pathOutput ); - switch ( $aOD['OUT_DOC_TYPE'] ) { - case 'HTML' : - - $aProperties = array(); //maui - - if(!isset($aOD['OUT_DOC_MEDIA'])) - $aOD['OUT_DOC_MEDIA'] = 'Letter'; - if(!isset($aOD['OUT_DOC_LEFT_MARGIN'])) - $aOD['OUT_DOC_LEFT_MARGIN'] = '15'; - if(!isset($aOD['OUT_DOC_RIGHT_MARGIN'])) - $aOD['OUT_DOC_RIGHT_MARGIN'] = '15'; - if(!isset($aOD['OUT_DOC_TOP_MARGIN'])) - $aOD['OUT_DOC_TOP_MARGIN'] = '15'; - if(!isset($aOD['OUT_DOC_BOTTOM_MARGIN'])) - $aOD['OUT_DOC_BOTTOM_MARGIN'] = '15'; - - $aProperties['media']=$aOD['OUT_DOC_MEDIA']; - $aProperties['margins']=array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']); - if($aOD['OUT_DOC_PDF_SECURITY_ENABLED']=='1'){ - $aProperties['pdfSecurity']=array('openPassword'=>$aOD['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],'ownerPassword'=>$aOD['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],'permissions'=>$aOD['OUT_DOC_PDF_SECURITY_PERMISSIONS']); - } - $oOutputDocument->generate( $_GET['UID'], $Fields['APP_DATA'], $pathOutput, - $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'],$aProperties ); - //$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] ); - break; - case 'JRXML' : - //creating the xml with the application data; - $xmlData = "\n"; - foreach ( $Fields['APP_DATA'] as $key => $val ) { - $xmlData .= " <$key>$val\n"; - } - $xmlData .= "\n"; - $iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData ); - - G::LoadClass ('javaBridgePM'); - $JBPM = new JavaBridgePM(); - $JBPM->checkJavaExtension(); - - $util = new Java("com.processmaker.util.pmutils"); - $util->setInputPath( $javaInput ); - $util->setOutputPath( $javaOutput ); - - //$content = file_get_contents ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml' ); - //$iSize = file_put_contents ( $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml', $content ); - copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml', $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml' ); - - $outputFile = $javaOutput . $sFilename . '.pdf' ; - print $util->jrxml2pdf( $aOD['OUT_DOC_UID'] . '.jrxml' , basename($outputFile) ); - - //$content = file_get_contents ( $outputFile ); - //$iSize = file_put_contents ( $pathOutput . $sFilename . '.pdf' , $content ); - copy ( $outputFile, $pathOutput . $sFilename . '.pdf' ); - //die; - break; - case 'ACROFORM' : - //creating the xml with the application data; - $xmlData = "\n"; - foreach ( $Fields['APP_DATA'] as $key => $val ) { - $xmlData .= " <$key>$val\n"; - } - $xmlData .= "\n"; - //$iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData ); - - G::LoadClass ('javaBridgePM'); - $JBPM = new JavaBridgePM(); - $JBPM->checkJavaExtension(); - - $util = new Java("com.processmaker.util.pmutils"); - $util->setInputPath( $javaInput ); - $util->setOutputPath( $javaOutput ); - - copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.pdf', $javaInput . $aOD['OUT_DOC_UID'] . '.pdf' ); - - $outputFile = $javaOutput . $sFilename . '.pdf' ; - print $util->writeVarsToAcroFields( $aOD['OUT_DOC_UID'] . '.pdf' , $xmlData ); - - copy ( $javaOutput. $aOD['OUT_DOC_UID'] . '.pdf', $pathOutput . $sFilename . '.pdf' ); - - break; - default : - throw ( new Exception ('invalid output document' )); - } - - - //Execute after triggers - Start - $Fields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], 'OUTPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); - $Fields['DEL_INDEX']= $_SESSION['INDEX']; - $Fields['TAS_UID'] = $_SESSION['TASK']; - //Execute after triggers - End - - //Save data - Start - $oCase->updateCase ( $_SESSION['APPLICATION'], $Fields ); - //Save data - End - - //Plugin Hook PM_UPLOAD_DOCUMENT for upload document - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) { - $triggerDetail=$oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); - - - $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP; - - $oData['APP_UID'] = $_SESSION['APPLICATION']; - $oData['ATTACHMENT_FOLDER'] = true; - switch($aOD['OUT_DOC_GENERATE']){ - case "BOTH": - $documentData = new uploadDocumentData ( - $_SESSION['APPLICATION'], - $_SESSION['USER_LOGGED'], - $pathOutput . $sFilename . '.pdf', - $sFilenameOriginal. '.pdf', - $sDocUID, - $oAppDocument->getDocVersion() - ); - - $documentData->sFileType = "PDF"; - $documentData->bUseOutputFolder = true; - $uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - if($uploadReturn){//Only delete if the file was saved correctly - $aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace; - //$oAppDocument = new AppDocument(); - //$oAppDocument->update($aFields); - unlink ( $pathOutput . $sFilename. '.pdf' ); - } - - - - $documentData = new uploadDocumentData ( - $_SESSION['APPLICATION'], - $_SESSION['USER_LOGGED'], - $pathOutput . $sFilename . '.doc', - $sFilenameOriginal. '.doc', - $sDocUID, - $oAppDocument->getDocVersion() - ); - - $documentData->sFileType = "DOC"; - $documentData->bUseOutputFolder = true; - $uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - if($uploadReturn){//Only delete if the file was saved correctly - unlink ( $pathOutput . $sFilename. '.doc' ); - } - - break; - case "PDF": - $documentData = new uploadDocumentData ( - $_SESSION['APPLICATION'], - $_SESSION['USER_LOGGED'], - $pathOutput . $sFilename . '.pdf', - $sFilenameOriginal. '.pdf', - $sDocUID, - $oAppDocument->getDocVersion() - ); - - - $documentData->sFileType = "PDF"; - $documentData->bUseOutputFolder = true; - $uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - if($uploadReturn){//Only delete if the file was saved correctly - unlink ( $pathOutput . $sFilename. '.pdf' ); - } - break; - case "DOC": - $documentData = new uploadDocumentData ( - $_SESSION['APPLICATION'], - $_SESSION['USER_LOGGED'], - $pathOutput . $sFilename . '.doc', - $sFilenameOriginal. '.doc', - $sDocUID, - $oAppDocument->getDocVersion() - ); - - $documentData->sFileType = "DOC"; - $documentData->bUseOutputFolder = true; - $uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - if($uploadReturn){//Only delete if the file was saved correctly - unlink ( $pathOutput . $sFilename. '.doc' ); - } - break; - } - - } - - $outputNextStep = 'cases_Step?TYPE=OUTPUT_DOCUMENT&UID=' . $_GET['UID'] . '&POSITION=' . $_SESSION['STEP_POSITION'] . '&ACTION=VIEW&DOC=' . $sDocUID; - G::header('location: '.$outputNextStep); - die; - break; - case 'VIEW': - if($noShowTitle == 0) { - $G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array); - } - require_once 'classes/model/AppDocument.php'; - $oAppDocument = new AppDocument(); - $lastVersion=$oAppDocument->getLastAppDocVersion($_GET['DOC'],$_SESSION['APPLICATION']); - $aFields = $oAppDocument->load($_GET['DOC'],$lastVersion); - $listing=false; - $oPluginRegistry = & PMPluginRegistry::getSingleton(); - if($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) { - $folderData = new folderData(null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED']); - $folderData->PMType = "OUTPUT"; - $folderData->returnList = true; - $listing=$oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData); - } - - require_once 'classes/model/OutputDocument.php'; - $oOutputDocument = new OutputDocument(); - $aGields = $oOutputDocument->load($aFields['DOC_UID']); - - if(isset($aGields['OUT_DOC_VERSIONING']) && $aGields['OUT_DOC_VERSIONING']!=0){ - $oAppDocument= new AppDocument(); - $lastDocVersion=$oAppDocument->getLastDocVersion($_GET['UID'],$_SESSION['APPLICATION']); - }else { - $lastDocVersion=''; - } - $aFields['VIEW1'] = G::LoadTranslation('ID_OPEN'); - - $aFields['VIEW2'] = G::LoadTranslation('ID_OPEN'); - - $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&v='.$lastDocVersion . '&ext=doc&random=' . rand() . '&PHPSESSID=' . @session_id(); - - $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&v='.$lastDocVersion . '&ext=pdf&random=' . rand() . '&PHPSESSID=' . @session_id(); - - - if ( is_array ($listing) ){//If exist in Plugin Document List - foreach($listing as $folderitem) { - if(($folderitem->filename==$aFields['APP_DOC_UID'])&&($folderitem->type=='DOC')){ - $aFields['VIEW1'] = G::LoadTranslation('ID_GET_EXTERNAL_FILE'); - $aFields['FILE1'] = $folderitem->downloadScript; - continue; - } - if(($folderitem->filename==$aFields['APP_DOC_UID'])&&($folderitem->type=='PDF')){ - $aFields['VIEW2'] = G::LoadTranslation('ID_GET_EXTERNAL_FILE'); - $aFields['FILE2'] = $folderitem->downloadScript; - continue; - } - } - } - - if(($aGields['OUT_DOC_GENERATE']=='BOTH')||($aGields['OUT_DOC_GENERATE']=='')) - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument1', '', G::array_merges($aOD, $aFields), ''); - - if($aGields['OUT_DOC_GENERATE']=='DOC') - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument2', '', G::array_merges($aOD, $aFields), ''); - - if($aGields['OUT_DOC_GENERATE']=='PDF') - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument3', '', G::array_merges($aOD, $aFields), ''); - - - break; - } - break; - - case 'ASSIGN_TASK': - $oDerivation = new Derivation(); - $oProcess = new Process(); - $aData = $oCase->loadCase($_SESSION['APPLICATION']); - - $aFields['PROCESS'] = $oProcess->load($_SESSION['PROCESS']); - $aFields['PREVIOUS_PAGE'] = $aPreviousStep['PAGE']; - $aFields['PREVIOUS_PAGE_LABEL'] = G::LoadTranslation('ID_PREVIOUS_STEP'); - $aFields['ASSIGN_TASK'] = G::LoadTranslation('ID_ASSIGN_TASK'); - $aFields['END_OF_PROCESS'] = G::LoadTranslation('ID_END_OF_PROCESS'); - $aFields['NEXT_TASK_LABEL'] = G::LoadTranslation('ID_NEXT_TASK'); - $aFields['EMPLOYEE'] = G::LoadTranslation('ID_EMPLOYEE'); - $aFields['LAST_EMPLOYEE'] = G::LoadTranslation('ID_LAST_EMPLOYEE'); - $aFields['OPTION_LABEL'] = G::LoadTranslation('ID_OPTION'); - $aFields['CONTINUE'] = G::LoadTranslation('ID_CONTINUE'); - $aFields['FINISH'] = G::LoadTranslation('ID_FINISH'); - $aFields['CONTINUE_WITH_OPTION'] = G::LoadTranslation('ID_CONTINUE_WITH_OPTION'); - $aFields['FINISH_WITH_OPTION'] = G::LoadTranslation('ID_FINISH_WITH_OPTION'); - $aFields['TAS_TIMING_TITLE'] = G::LoadTranslation('ID_TIMING_CONTROL'); - $aFields['TAS_DURATION'] = G::LoadTranslation('ID_TASK_DURATION'); - $aFields['TAS_TIMEUNIT'] = G::LoadTranslation('ID_TIME_UNIT'); - $aFields['TAS_TYPE_DAY'] = G::LoadTranslation('ID_COUNT_DAYS'); - $aFields['TAS_CALENDAR'] = G::LoadTranslation('ID_CALENDAR'); - - $aFields['TASK'] = $oDerivation->prepareInformation(array( - 'USER_UID' => $_SESSION['USER_LOGGED'], - 'APP_UID' => $_SESSION['APPLICATION'], - 'DEL_INDEX' => $_SESSION['INDEX'] - )); - - if ( empty($aFields['TASK']) ) { - throw ( new Exception ( G::LoadTranslation( 'ID_NO_DERIVATION_RULE') ) ); - } - - //take the first derivation rule as the task derivation rule type. - $aFields['PROCESS']['ROU_TYPE'] = $aFields['TASK'][1]['ROU_TYPE']; - $aFields['PROCESS']['ROU_FINISH_FLAG'] = false; - - foreach ( $aFields['TASK'] as $sKey => &$aValues) - { - $sPriority = '';//set priority value - if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] != '') { - //TO DO: review this type of assignment - if (isset($aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'])])) - { - $sPriority = $aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'])]; - } - }//set priority value - - $sTask = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_UID']; - - //TAS_UID has a hidden field to store the TAS_UID - $hiddenName = "form[TASKS][" . $sKey . "][TAS_UID]"; - $hiddenField = ''; - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_HIDDEN_FIELD'] = $hiddenField; - //print "
".$aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']."
"; - switch ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']) { - case 'EVALUATE': - case 'REPORT_TO': - case 'BALANCED': - case 'SELF_SERVICE': - $hiddenName = "form[TASKS][" . $sKey . "][USR_UID]"; - $aFields['TASK'][$sKey]['NEXT_TASK']['USR_UID'] = $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']; - $aFields['TASK'][$sKey]['NEXT_TASK']['USR_HIDDEN_FIELD'] = ''; - //var_dump($aFields); - //there is a error with reportsTo, when the USR_UID is empty means there are no manager for this user, so we are disabling buttons - //but this validation is not for SELF_SERVICE - if ( $aValues['NEXT_TASK']['TAS_ASSIGN_TYPE'] != 'SELF_SERVICE' ) - if ( $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_UID'] == '' ) - $aFields['PROCESS']['ERROR'] = $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']; - break; - case 'MANUAL': - $Aux = array(); - foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) - { - $Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME']; - } - asort($Aux); - $sAux = ''; - - $aFields['TASK'][$sKey]['NEXT_TASK']['USR_UID'] = $sAux; - break; - case 'CANCEL_MI': - case 'STATIC_MI': - //count the Users in the group - $cntInstanceUsers = count($aValues['NEXT_TASK']['USER_ASSIGNED']); - - //set TAS_MI_INSTANCE_VARIABLE value - $sMIinstanceVar = ''; - if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'] != '') { - if (isset($aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'])])) - { - $sMIinstanceVar = $aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'])]; - if($sMIinstanceVar > $cntInstanceUsers) - throw (new Exception("Total Multiple Instance Task cannot be greater than number of users in the group.")); - else if($sMIinstanceVar == 0) - throw (new Exception("Total Multiple Instance Task cannot be zero.")); - } - else if(is_int((int)$aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'])) - { - $sMIinstanceVar = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE']; - if($sMIinstanceVar > $cntInstanceUsers) - throw (new Exception("Total Multiple Instance Task cannot be greater than number of users in the group.")); - } - else - throw (new Exception("Total Multiple Instance Task variable doesn't have valid value.")); - } - else - throw (new Exception("Total Multiple Instance Task variable doesn't have valid value.")); - ////set TAS_MI_INSTANCE_VARIABLE value - - //set TAS_MI_COMPLETE_VARIABLE value - $sMIcompleteVar = ''; - if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'] != '') { - if (isset($aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'])])) - { - $sMIcompleteVar = $aData['APP_DATA'][str_replace('@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'])]; - // - if($sMIcompleteVar > $sMIinstanceVar) - throw (new Exception("Total Multiple Instance Task to complete cannot be greater than Total number of Instances.")); - } - else if(is_int((int)$aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'])) - { - $sMIcompleteVar = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE']; - if($sMIcompleteVar > $sMIinstanceVar) - throw (new Exception("Total Multiple Instance Task to complete cannot be greater than Total number of Instances.")); - } - else - throw ( new Exception("Total Multiple Instance Task to complete variable doesn't have valid value.") ) ; - - } - else - throw ( new Exception("Total Multiple Instance Task to complete variable doesn't have valid value.") ) ; - //set TAS_MI_COMPLETE_VARIABLE value - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_NEXT'] = $aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']; - - //If the Users in the group is equal to the MI Instance variable then Show all the users without Dropdown - if($sMIinstanceVar == $cntInstanceUsers) - { - foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $key=>$aUser) - { - $hiddenName = "form[TASKS][" . $sKey . "][NEXT_TASK][USER_ASSIGNED][".$key."][USR_UID]"; - $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED'][$key]['USR_UID'] = $aUser['USR_FULLNAME']; - $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED'][$key]['USR_HIDDEN_FIELD'] = ''; - } - } - //If the Users in the group is not equal to the MI Instance variable then Show Only count users in dropdown - else - { - $Aux = array(); - foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) - { - $Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME']; - } - asort($Aux); - $aAux = ''; - foreach ($Aux as $akey => $value) - { - $aAux .= ''; - } - - for($key=0; $key < $sMIinstanceVar; $key++) - { - $hiddenName = "form[TASKS][" . $sKey . "][NEXT_TASK][USER_ASSIGNED][".$key."][USR_UID]"; - $sAux = "'; + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_HIDDEN_FIELD'] = $hiddenField; + //print "
".$aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']."
"; + switch ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']) { + case 'EVALUATE': + case 'REPORT_TO': + case 'BALANCED': + case 'SELF_SERVICE': + $hiddenName = "form[TASKS][" . $sKey . "][USR_UID]"; + $aFields['TASK'][$sKey]['NEXT_TASK']['USR_UID'] = $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']; + $aFields['TASK'][$sKey]['NEXT_TASK']['USR_HIDDEN_FIELD'] = ''; + //var_dump($aFields); + //there is a error with reportsTo, when the USR_UID is empty means there are no manager for this user, so we are disabling buttons + //but this validation is not for SELF_SERVICE + if ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE'] != 'SELF_SERVICE') + if ($aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_UID'] == '') + $aFields['PROCESS']['ERROR'] = $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']; + break; + case 'MANUAL': + $Aux = array (); + foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) { + $Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME']; + } + asort( $Aux ); + $sAux = ''; + + $aFields['TASK'][$sKey]['NEXT_TASK']['USR_UID'] = $sAux; + break; + case 'CANCEL_MI': + case 'STATIC_MI': + //count the Users in the group + $cntInstanceUsers = count( $aValues['NEXT_TASK']['USER_ASSIGNED'] ); + + //set TAS_MI_INSTANCE_VARIABLE value + $sMIinstanceVar = ''; + if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'] != '') { + if (isset( $aData['APP_DATA'][str_replace( '@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'] )] )) { + $sMIinstanceVar = $aData['APP_DATA'][str_replace( '@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'] )]; + if ($sMIinstanceVar > $cntInstanceUsers) + throw (new Exception( "Total Multiple Instance Task cannot be greater than number of users in the group." )); + else if ($sMIinstanceVar == 0) + throw (new Exception( "Total Multiple Instance Task cannot be zero." )); + } else if (is_int( (int) $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE'] )) { + $sMIinstanceVar = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_INSTANCE_VARIABLE']; + if ($sMIinstanceVar > $cntInstanceUsers) + throw (new Exception( "Total Multiple Instance Task cannot be greater than number of users in the group." )); + } else + throw (new Exception( "Total Multiple Instance Task variable doesn't have valid value." )); + } else + throw (new Exception( "Total Multiple Instance Task variable doesn't have valid value." )); + ////set TAS_MI_INSTANCE_VARIABLE value + + + //set TAS_MI_COMPLETE_VARIABLE value + $sMIcompleteVar = ''; + if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'] != '') { + if (isset( $aData['APP_DATA'][str_replace( '@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'] )] )) { + $sMIcompleteVar = $aData['APP_DATA'][str_replace( '@@', '', $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'] )]; + // + if ($sMIcompleteVar > $sMIinstanceVar) + throw (new Exception( "Total Multiple Instance Task to complete cannot be greater than Total number of Instances." )); + } else if (is_int( (int) $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE'] )) { + $sMIcompleteVar = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_MI_COMPLETE_VARIABLE']; + if ($sMIcompleteVar > $sMIinstanceVar) + throw (new Exception( "Total Multiple Instance Task to complete cannot be greater than Total number of Instances." )); + } else + throw (new Exception( "Total Multiple Instance Task to complete variable doesn't have valid value." )); + + } else + throw (new Exception( "Total Multiple Instance Task to complete variable doesn't have valid value." )); + //set TAS_MI_COMPLETE_VARIABLE value + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_NEXT'] = $aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']; + + //If the Users in the group is equal to the MI Instance variable then Show all the users without Dropdown + if ($sMIinstanceVar == $cntInstanceUsers) { + foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $key => $aUser) { + $hiddenName = "form[TASKS][" . $sKey . "][NEXT_TASK][USER_ASSIGNED][" . $key . "][USR_UID]"; + $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED'][$key]['USR_UID'] = $aUser['USR_FULLNAME']; + $aFields['TASK'][$sKey]['NEXT_TASK']['USER_ASSIGNED'][$key]['USR_HIDDEN_FIELD'] = ''; + } + } //If the Users in the group is not equal to the MI Instance variable then Show Only count users in dropdown + else { + $Aux = array (); + foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) { + $Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME']; + } + asort( $Aux ); + $aAux = ''; + foreach ($Aux as $akey => $value) { + $aAux .= ''; + } + + for ($key = 0; $key < $sMIinstanceVar; $key ++) { + $hiddenName = "form[TASKS][" . $sKey . "][NEXT_TASK][USER_ASSIGNED][" . $key . "][USR_UID]"; + $sAux = ""; - if($aValues['NEXT_TASK']['TAS_TRANSFER_FLY'] == 'true') - { - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DURATION'] = ''; - $hoursSelected = $daysSelected = ''; - if($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TIMEUNIT'] == 'HOURS') - $hoursSelected = "selected = 'selected'"; - else - $daysSelected = "selected = 'selected'"; - - $sAux = ''; - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TIMEUNIT'] = $sAux; - - $workSelected = $calendarSelected = ''; - if($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TYPE_DAY'] == '1') - $workSelected = "selected = 'selected'"; - else - $calendarSelected = "selected = 'selected'"; - - $sAux = ''; - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TYPE_DAY'] = $sAux; - - //Check for - G::LoadClass ( 'calendar' ); - $calendar = new Calendar ( ); - $calendarObj = $calendar->getCalendarList ( true, true ); - $availableCalendar = $calendarObj ['array']; - $aCalendar['CALENDAR_UID'] = '00000000000000000000000000000001'; - $aCalendar['CALENDAR_NAME'] = 'DEFAULT'; - $sAux = ''; - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_CALENDAR'] = $sAux; - - } - - - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_ASSIGN_TYPE'] = ''; - if (isset ($aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'])){ - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = ''; - } else { - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = ''; - } - $aFields['TASK'][$sKey]['NEXT_TASK']['DEL_PRIORITY'] = ''; - $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PARENT'] = ''; - } - } - $aFields['PROCESSING_MESSAGE'] = G::loadTranslation('ID_PROCESSING'); - - /** - * New Feature: Derivation Screen can be personalized - * @author Erik Amaru Ortiz - */ - $tplFile = 'cases/cases_ScreenDerivation'; - $task = TaskPeer::retrieveByPk($_SESSION['TASK']); - - $tasDerivationScreenTpl = $task->getTasDerivationScreenTpl(); - - if (!empty($tasDerivationScreenTpl)) { //erik: first, verify if the task has a personalized template (for derivation screen) - $tplFile = $tasDerivationScreenTpl; - $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; - } - else { //erik: verify if the process has a personalized template (for derivation screen) - if (!empty($aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL'])) { - $tplFile = $aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL']; - $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; - } - } - - $G_PUBLISH->AddContent('smarty', $tplFile, '', '', $aFields); -/* + */ + if ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE'] != '') //Check for End of Process +{ + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TRANSFER_FLY'] = strtolower( $aValues['NEXT_TASK']['TAS_TRANSFER_FLY'] ); + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] = ""; + if ($aValues['NEXT_TASK']['TAS_TRANSFER_FLY'] == 'true') { + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DURATION'] = ''; + $hoursSelected = $daysSelected = ''; + if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TIMEUNIT'] == 'HOURS') + $hoursSelected = "selected = 'selected'"; + else + $daysSelected = "selected = 'selected'"; + + $sAux = ''; + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TIMEUNIT'] = $sAux; + + $workSelected = $calendarSelected = ''; + if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TYPE_DAY'] == '1') + $workSelected = "selected = 'selected'"; + else + $calendarSelected = "selected = 'selected'"; + + $sAux = ''; + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TYPE_DAY'] = $sAux; + + //Check for + G::LoadClass( 'calendar' ); + $calendar = new Calendar(); + $calendarObj = $calendar->getCalendarList( true, true ); + $availableCalendar = $calendarObj['array']; + $aCalendar['CALENDAR_UID'] = '00000000000000000000000000000001'; + $aCalendar['CALENDAR_NAME'] = 'DEFAULT'; + $sAux = ''; + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_CALENDAR'] = $sAux; + + } + + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_ASSIGN_TYPE'] = ''; + if (isset( $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'] )) { + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = ''; + } else { + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = ''; + } + $aFields['TASK'][$sKey]['NEXT_TASK']['DEL_PRIORITY'] = ''; + $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PARENT'] = ''; + } + } + $aFields['PROCESSING_MESSAGE'] = G::loadTranslation( 'ID_PROCESSING' ); + + /** + * New Feature: Derivation Screen can be personalized + * + * @author Erik Amaru Ortiz + */ + $tplFile = 'cases/cases_ScreenDerivation'; + $task = TaskPeer::retrieveByPk( $_SESSION['TASK'] ); + + $tasDerivationScreenTpl = $task->getTasDerivationScreenTpl(); + + if (! empty( $tasDerivationScreenTpl )) { //erik: first, verify if the task has a personalized template (for derivation screen) + $tplFile = $tasDerivationScreenTpl; + $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; + } else { //erik: verify if the process has a personalized template (for derivation screen) + if (! empty( $aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL'] )) { + $tplFile = $aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL']; + $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; + } + } + + $G_PUBLISH->AddContent( 'smarty', $tplFile, '', '', $aFields ); + /* if (isset( $aFields['TASK'][1]['NEXT_TASK']['USER_ASSIGNED'])){ if($aFields['TASK'][1]['NEXT_TASK']['USER_ASSIGNED']!="ERROR" && is_array($aFields['TASK'][1]['NEXT_TASK']['USER_ASSIGNED'])){ $G_PUBLISH->AddContent('smarty', 'cases/cases_ScreenDerivation', '', '', $aFields); @@ -979,86 +902,85 @@ }else{ $G_PUBLISH->AddContent('smarty', 'cases/cases_ScreenDerivation', '', '', $aFields); } -*/ - break; - case 'EXTERNAL': - if($noShowTitle == 0) { - $G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array); - } - $oPluginRegistry = &PMPluginRegistry::getSingleton(); - $externalSteps = $oPluginRegistry->getSteps(); - - $sNamespace = ''; - $sStepName = ''; - foreach ( $externalSteps as $key=>$val ) { - if ( $val->sStepId == $_GET['UID'] ) { - $sNamespace = $val->sNamespace; - $sStepName = $val->sStepName; - - } - } - if ( class_exists($sNamespace."plugin")) { - if (!$aPreviousStep) { - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; - } - else { - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP"); - } - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; - $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation("ID_NEXT_STEP"); - - /** Added By erik date: 16-05-08 - * Description: this was added for the additional database connections */ - G::LoadClass ('dbConnections'); - $oDbConnections = new dbConnections($_SESSION['PROCESS']); - $oDbConnections->loadAdditionalConnections(); - $stepFilename = "$sNamespace/$sStepName"; - G::evalJScript(" +*/ + break; + case 'EXTERNAL': + if ($noShowTitle == 0) { + $G_PUBLISH->AddContent( 'smarty', 'cases/cases_title', '', '', $array ); + } + $oPluginRegistry = &PMPluginRegistry::getSingleton(); + $externalSteps = $oPluginRegistry->getSteps(); + + $sNamespace = ''; + $sStepName = ''; + foreach ($externalSteps as $key => $val) { + if ($val->sStepId == $_GET['UID']) { + $sNamespace = $val->sNamespace; + $sStepName = $val->sStepName; + + } + } + if (class_exists( $sNamespace . "plugin" )) { + if (! $aPreviousStep) { + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; + } else { + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE']; + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation( "ID_PREVIOUS_STEP" ); + } + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; + $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation( "ID_NEXT_STEP" ); + + /** + * Added By erik date: 16-05-08 + * Description: this was added for the additional database connections + */ + G::LoadClass( 'dbConnections' ); + $oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); + $oDbConnections->loadAdditionalConnections(); + $stepFilename = "$sNamespace/$sStepName"; + G::evalJScript( " if (parent.setCurrent) { - parent.setCurrent('".$_GET['UID']."'); - }"); - - $G_PUBLISH->AddContent('content', $stepFilename); - } - else { - $aMessage['MESSAGE'] = G::loadTranslation('ID_EXTERNAL_STEP_MISSING', SYS_LANG, array("plugin"=>$sNamespace) ); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - } - break; - } + parent.setCurrent('" . $_GET['UID'] . "'); + }" ); + + $G_PUBLISH->AddContent( 'content', $stepFilename ); + } else { + $aMessage['MESSAGE'] = G::loadTranslation( 'ID_EXTERNAL_STEP_MISSING', SYS_LANG, array ("plugin" => $sNamespace + ) ); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + } + break; + } //Add content content step - End - } - catch ( Exception $e ) { - G::SendTemporalMessage(G::LoadTranslation('ID_PROCESS_DEF_PROBLEM'), 'error', 'string', 3, 100); - $aMessage = array(); - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - die; - } - - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile("/jscore/cases/core/cases_Step.js"); - $oHeadPublisher->addScriptCode(" +} catch (Exception $e) { + G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 ); + $aMessage = array (); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); + die(); +} + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptFile( "/jscore/cases/core/cases_Step.js" ); +$oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('$sStatus'); } if (parent.setCurrent) { - parent.setCurrent('".$_GET['UID']."'); + parent.setCurrent('" . $_GET['UID'] . "'); } - }"); - - G::RenderPage('publish', 'blank'); - - if( $_SESSION['TRIGGER_DEBUG']['ISSET'] ){ - G::evalJScript(' + }" ); + +G::RenderPage( 'publish', 'blank' ); + +if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { + G::evalJScript( ' if (typeof showdebug != \'undefined\') { showdebug(); - }'); - } - - + }' ); +} + diff --git a/workflow/engine/methods/cases/cases_StepToRevise.php b/workflow/engine/methods/cases/cases_StepToRevise.php index 894feb861..9f7fe0320 100755 --- a/workflow/engine/methods/cases/cases_StepToRevise.php +++ b/workflow/engine/methods/cases/cases_StepToRevise.php @@ -1,77 +1,76 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ // die("first"); -/* Permissions */ -switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -if ((int)$_SESSION['INDEX'] < 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; -} -/* Includes */ -G::LoadClass('case'); -G::LoadClass('derivation'); - -/* GET , POST & $_SESSION Vars */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if ((int) $_SESSION['INDEX'] < 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); +} +/* Includes */ +G::LoadClass( 'case' ); +G::LoadClass( 'derivation' ); + +/* GET , POST & $_SESSION Vars */ //$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION']; - -/* Menues */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - - - /* Prepare page before to show */ -$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); -$oTemplatePower->prepare(); -$G_PUBLISH = new Publisher; -$oCase = new Cases(); -$Fields = $oCase->loadCase($_SESSION['APPLICATION']); - -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addScriptCode(" + + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +/* Prepare page before to show */ +$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); +$oTemplatePower->prepare(); +$G_PUBLISH = new Publisher(); +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); } -}"); +}" ); // DEPRECATED this script call is marked for removal since almost all the interface is extJS based -$oHeadPublisher->addScriptCode(' +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -83,52 +82,51 @@ $oHeadPublisher->addScriptCode(' leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ - '.(isset($_SESSION['showCasesWindow'])?'try{'.$_SESSION['showCasesWindow'].'}catch(e){}':'').' + ' . (isset( $_SESSION['showCasesWindow'] ) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . ' }); -'); +' ); // DEPRECATED this script call is marked for removal -$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); - -if (!isset($_GET['type'])) { - $_GET['type'] = 'DYNAFORM'; -} -if (!isset($_GET['position'])) { - $_GET['position'] = 1; -} - -$_SESSION['STEP_POSITION'] = (int)$_GET['position']; - +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + +if (! isset( $_GET['type'] )) { + $_GET['type'] = 'DYNAFORM'; +} +if (! isset( $_GET['position'] )) { + $_GET['position'] = 1; +} + +$_SESSION['STEP_POSITION'] = (int) $_GET['position']; + //Obtain previous and next step - Start -if (isset($_GET['type'])) { - $sType = $_GET['type']; -} else { - $sType = ''; -} - -$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; -$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; - - -/** Added By erik - * date: 16-05-08 - * Description: this was added for the additional database connections */ -G::LoadClass('dbConnections'); -$oDbConnections = new dbConnections($_SESSION['PROCESS']); -$oDbConnections->loadAdditionalConnections(); - - -$G_PUBLISH = new Publisher; -if ($_GET['DYN_UID'] != '') { - $_SESSION['CURRENT_DYN_UID'] = $_GET['DYN_UID']; - $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', - $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID='.$_GET['DYN_UID']); -} - -G::RenderPage('publish', 'blank'); - -if (!isset($_GET['ex'])) { - $_GET['ex']=$_GET['position']; -} +if (isset( $_GET['type'] )) { + $sType = $_GET['type']; +} else { + $sType = ''; +} + +$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; +$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; + +/** + * Added By erik + * date: 16-05-08 + * Description: this was added for the additional database connections + */ +G::LoadClass( 'dbConnections' ); +$oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); +$oDbConnections->loadAdditionalConnections(); + +$G_PUBLISH = new Publisher(); +if ($_GET['DYN_UID'] != '') { + $_SESSION['CURRENT_DYN_UID'] = $_GET['DYN_UID']; + $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] ); +} + +G::RenderPage( 'publish', 'blank' ); + +if (! isset( $_GET['ex'] )) { + $_GET['ex'] = $_GET['position']; +} ?> \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_StepToReviseInputs.php b/workflow/engine/methods/cases/cases_StepToReviseInputs.php index 1b13d480e..63e01b85f 100755 --- a/workflow/engine/methods/cases/cases_StepToReviseInputs.php +++ b/workflow/engine/methods/cases/cases_StepToReviseInputs.php @@ -1,68 +1,67 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ //die("second"); -/* Permissions */ -switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -if ((int)$_SESSION['INDEX'] < 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; -} -/* Includes */ -G::LoadClass('case'); -G::LoadClass('derivation'); - -/* GET , POST & $_SESSION Vars */ +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if ((int) $_SESSION['INDEX'] < 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); +} +/* Includes */ +G::LoadClass( 'case' ); +G::LoadClass( 'derivation' ); + +/* GET , POST & $_SESSION Vars */ //$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION']; - -/* Menues */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - - - /* Prepare page before to show */ - $oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); - $oTemplatePower->prepare(); - $G_PUBLISH = new Publisher; -$oHeadPublisher =& headPublisher::getSingleton(); + + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +/* Prepare page before to show */ +$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); +$oTemplatePower->prepare(); +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); // Check if these code needs to be removed since the interface ar now moving to ExtJS -$oHeadPublisher->addScriptCode(' +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -74,64 +73,62 @@ $oHeadPublisher->addScriptCode(' leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ - '.(isset($_SESSION['showCasesWindow'])?'try{'.$_SESSION['showCasesWindow'].'}catch(e){}':'').' + ' . (isset( $_SESSION['showCasesWindow'] ) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . ' }); - '); + ' ); // Check if these code needs to be removed since the interface ar now moving to ExtJS -$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); - -if (!isset($_GET['position'])) { - $_GET['position'] = 1; -} - -$_SESSION['STEP_POSITION'] = (int)$_GET['position']; -$oCase = new Cases(); -$Fields = $oCase->loadCase($_SESSION['APPLICATION']); - -$G_PUBLISH = new Publisher; - -if (!isset($_GET['ex'])) { - $_GET['ex']=0; -} - -if (!isset($_GET['INP_DOC_UID'])) { - G::LoadClass('case'); - $oCase = new Cases(); - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_InputdocsListToRevise', - $oCase->getInputDocumentsCriteriaToRevise($_SESSION['APPLICATION']), ''); -} else { - $oInputDocument = new InputDocument(); - $Fields = $oInputDocument->load($_GET['INP_DOC_UID']); - switch ($Fields['INP_DOC_FORM_NEEDED']) { - case 'REAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_NEW'); - $sXmlForm = 'cases/cases_AttachInputDocument2'; - break; - case 'VIRTUAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_ATTACH'); - $sXmlForm = 'cases/cases_AttachInputDocument1'; - break; - case 'VREAL': - $Fields['TYPE_LABEL'] = G::LoadTranslation('ID_ATTACH'); - $sXmlForm = 'cases/cases_AttachInputDocument3'; - break; - } - $Fields['MESSAGE1'] = G::LoadTranslation('ID_PLEASE_ENTER_COMMENTS'); - $Fields['MESSAGE2'] = G::LoadTranslation('ID_PLEASE_SELECT_FILE'); - $docName = $Fields['INP_DOC_TITLE']; - $oHeadPublisher->addScriptCode('var documentName=\'Reviewing Input Document
'.$docName.'\';'); +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); + +if (! isset( $_GET['position'] )) { + $_GET['position'] = 1; +} + +$_SESSION['STEP_POSITION'] = (int) $_GET['position']; +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + +$G_PUBLISH = new Publisher(); + +if (! isset( $_GET['ex'] )) { + $_GET['ex'] = 0; +} + +if (! isset( $_GET['INP_DOC_UID'] )) { + G::LoadClass( 'case' ); + $oCase = new Cases(); + $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_InputdocsListToRevise', $oCase->getInputDocumentsCriteriaToRevise( $_SESSION['APPLICATION'] ), '' ); +} else { + $oInputDocument = new InputDocument(); + $Fields = $oInputDocument->load( $_GET['INP_DOC_UID'] ); + switch ($Fields['INP_DOC_FORM_NEEDED']) { + case 'REAL': + $Fields['TYPE_LABEL'] = G::LoadTranslation( 'ID_NEW' ); + $sXmlForm = 'cases/cases_AttachInputDocument2'; + break; + case 'VIRTUAL': + $Fields['TYPE_LABEL'] = G::LoadTranslation( 'ID_ATTACH' ); + $sXmlForm = 'cases/cases_AttachInputDocument1'; + break; + case 'VREAL': + $Fields['TYPE_LABEL'] = G::LoadTranslation( 'ID_ATTACH' ); + $sXmlForm = 'cases/cases_AttachInputDocument3'; + break; + } + $Fields['MESSAGE1'] = G::LoadTranslation( 'ID_PLEASE_ENTER_COMMENTS' ); + $Fields['MESSAGE2'] = G::LoadTranslation( 'ID_PLEASE_SELECT_FILE' ); + $docName = $Fields['INP_DOC_TITLE']; + $oHeadPublisher->addScriptCode( 'var documentName=\'Reviewing Input Document
' . $docName . '\';' ); // $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $Fields, 'cases_SupervisorSaveDocument?UID=' . //$_GET['INP_DOC_UID'] . '&APP_UID=' . $_GET['APP_UID'] . '&position=' . $_GET['position']); - $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', - $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), - array_merge(array('DOC_UID'=>$_GET['INP_DOC_UID']),$Fields)); + $G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID'] ), array_merge( array ('DOC_UID' => $_GET['INP_DOC_UID'] + ), $Fields ) ); //$aFields // $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', //$oCase->getInputDocumentsCriteria($_SESSION['APPLICATION']));//$aFields -} - -G::RenderPage('publish', 'blank'); - +} + +G::RenderPage( 'publish', 'blank' ); + ?> \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_StepToReviseOutputs.php b/workflow/engine/methods/cases/cases_StepToReviseOutputs.php index 9b9814746..b15086069 100755 --- a/workflow/engine/methods/cases/cases_StepToReviseOutputs.php +++ b/workflow/engine/methods/cases/cases_StepToReviseOutputs.php @@ -1,59 +1,57 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/* Permissions */ -switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -G::LoadClass('case'); - -/* Menues */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - - -/* Prepare page before to show */ -$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); -$oTemplatePower->prepare(); -$G_PUBLISH = new Publisher; -$oHeadPublisher =& headPublisher::getSingleton(); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +/* Prepare page before to show */ +$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); +$oTemplatePower->prepare(); +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); // check if the code for the addScriptCode is necessary since the interface is now based in ExtJs -$oHeadPublisher->addScriptCode(' +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -65,17 +63,16 @@ leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ - '.(isset($_SESSION['showCasesWindow'])?'try{'.$_SESSION['showCasesWindow'].'}catch(e){}':'').'}); -'); -$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); -$oCase = new Cases(); -$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_OutputdocsListToRevise', - $oCase->getOutputDocumentsCriteriaToRevise($_SESSION['APPLICATION']), ''); -G::RenderPage('publish', 'blank'); - -if (!isset($_GET['ex'])) { - $_GET['ex']=0; -} + ' . (isset( $_SESSION['showCasesWindow'] ) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . '}); +' ); +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); +$oCase = new Cases(); +$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_OutputdocsListToRevise', $oCase->getOutputDocumentsCriteriaToRevise( $_SESSION['APPLICATION'] ), '' ); +G::RenderPage( 'publish', 'blank' ); + +if (! isset( $_GET['ex'] )) { + $_GET['ex'] = 0; +} ?> @@ -97,4 +94,5 @@ function setSelect() return 0; } } - \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php b/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php index a361c527b..1e9335e7e 100755 --- a/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php +++ b/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php @@ -1,86 +1,72 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - try { +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { //save info - G::LoadClass('case'); - - $oAppDocument = new AppDocument(); - $aFields = array('APP_UID' => $_GET['APP_UID'], - 'DEL_INDEX' => 100000, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $_GET['UID'], - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : ''); - $oAppDocument->create($aFields); - $sAppDocUid = $oAppDocument->getAppDocUid(); - $info = pathinfo( $oAppDocument->getAppDocFilename() ); - $ext = (isset($info['extension']) ? $info['extension'] : ''); + G::LoadClass( 'case' ); + + $oAppDocument = new AppDocument(); + $aFields = array ('APP_UID' => $_GET['APP_UID'],'DEL_INDEX' => 100000,'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $_GET['UID'],'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '' + ); + $oAppDocument->create( $aFields ); + $sAppDocUid = $oAppDocument->getAppDocUid(); + $info = pathinfo( $oAppDocument->getAppDocFilename() ); + $ext = (isset( $info['extension'] ) ? $info['extension'] : ''); //save the file - if (!empty($_FILES['form'])) { - if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { - $sPathName = PATH_DOCUMENT . $_GET['APP_UID'] . PATH_SEP; - $sFileName = $sAppDocUid . '.' . $ext; - G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); - - //Plugin Hook PM_UPLOAD_DOCUMENT for upload document - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) { - $oData['APP_UID'] = $_GET['APP_UID']; - $documentData = new uploadDocumentData ( - $_GET['APP_UID'], - $_SESSION['USER_LOGGED'], - $sPathName . $sFileName, - $aFields['APP_DOC_FILENAME'], - $sAppDocUid - ); - $oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - unlink ( $sPathName . $sFileName ); - } - //end plugin - } - } - //go to the next step - if (!isset($_POST['form']['MORE'])) { - $oCase = new Cases(); - $aFields = $oCase->loadCase($_GET['APP_UID']); - $aNextStep = $oCase->getNextSupervisorStep($aFields['PRO_UID'], $_GET['position'], 'INPUT_DOCUMENT'); - G::header('location: ' . 'cases_StepToReviseInputs?type=INPUT_DOCUMENT&INP_DOC_UID='.$aNextStep['UID'].'&position='.$aNextStep['POSITION'].'&APP_UID='.$_GET['APP_UID'].'&DEL_INDEX='); - die; - } - else { - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; - } - } catch ( Exception $e ) { - /* Render Error page */ - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish' ); - } \ No newline at end of file + if (! empty( $_FILES['form'] )) { + if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { + $sPathName = PATH_DOCUMENT . $_GET['APP_UID'] . PATH_SEP; + $sFileName = $sAppDocUid . '.' . $ext; + G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); + + //Plugin Hook PM_UPLOAD_DOCUMENT for upload document + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) { + $oData['APP_UID'] = $_GET['APP_UID']; + $documentData = new uploadDocumentData( $_GET['APP_UID'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid ); + $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); + unlink( $sPathName . $sFileName ); + } + //end plugin + } + } + //go to the next step + if (! isset( $_POST['form']['MORE'] )) { + $oCase = new Cases(); + $aFields = $oCase->loadCase( $_GET['APP_UID'] ); + $aNextStep = $oCase->getNextSupervisorStep( $aFields['PRO_UID'], $_GET['position'], 'INPUT_DOCUMENT' ); + G::header( 'location: ' . 'cases_StepToReviseInputs?type=INPUT_DOCUMENT&INP_DOC_UID=' . $aNextStep['UID'] . '&position=' . $aNextStep['POSITION'] . '&APP_UID=' . $_GET['APP_UID'] . '&DEL_INDEX=' ); + die(); + } else { + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); + } +} catch (Exception $e) { + /* Render Error page */ + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish' ); +} + diff --git a/workflow/engine/methods/cases/cases_ToReviseInputDocView.php b/workflow/engine/methods/cases/cases_ToReviseInputDocView.php index 4785bdf55..280844a91 100755 --- a/workflow/engine/methods/cases/cases_ToReviseInputDocView.php +++ b/workflow/engine/methods/cases/cases_ToReviseInputDocView.php @@ -1,82 +1,79 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/* Permissions */ -switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -if ((int)$_SESSION['INDEX'] < 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ' . $_SERVER['HTTP_REFERER']); - die; -} -/* Includes */ -G::LoadClass('case'); -G::LoadClass('derivation'); - -/* GET , POST & $_SESSION Vars */ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if ((int) $_SESSION['INDEX'] < 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); + die(); +} +/* Includes */ +G::LoadClass( 'case' ); +G::LoadClass( 'derivation' ); + +/* GET , POST & $_SESSION Vars */ //$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION']; - -/* Menues */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - -$oCase = new Cases(); -$Fields = $oCase->loadCase($_SESSION['APPLICATION']); - -require_once 'classes/model/AppDocument.php'; -require_once 'classes/model/Users.php'; - -$G_PUBLISH = new Publisher; - -$oAppDocument = new AppDocument(); -$oAppDocument->Fields = $oAppDocument->load($_GET['DOC']); -$oo = $oAppDocument->load($_GET['DOC']); - -$oUser = new Users(); -$aUser = $oUser->load($oAppDocument->Fields['USR_UID']); -$Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; - -$oAppDocument->Fields['VIEW'] = G::LoadTranslation('ID_OPEN'); -$oAppDocument->Fields['FILE'] = 'cases_ShowDocument?a=' . $_GET['DOC'] . '&r=' . rand(); -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewInputDocumentToRevise', '', G::array_merges($Fields, $oAppDocument->Fields), ''); - -G::RenderPage( 'publish' ); - -?> - - + + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +$oCase = new Cases(); +$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); + +require_once 'classes/model/AppDocument.php'; +require_once 'classes/model/Users.php'; + +$G_PUBLISH = new Publisher(); + +$oAppDocument = new AppDocument(); +$oAppDocument->Fields = $oAppDocument->load( $_GET['DOC'] ); +$oo = $oAppDocument->load( $_GET['DOC'] ); + +$oUser = new Users(); +$aUser = $oUser->load( $oAppDocument->Fields['USR_UID'] ); +$Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; + +$oAppDocument->Fields['VIEW'] = G::LoadTranslation( 'ID_OPEN' ); +$oAppDocument->Fields['FILE'] = 'cases_ShowDocument?a=' . $_GET['DOC'] . '&r=' . rand(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ViewInputDocumentToRevise', '', G::array_merges( $Fields, $oAppDocument->Fields ), '' ); + +G::RenderPage( 'publish' ); + diff --git a/workflow/engine/methods/cases/cases_ToReviseOutputDocView.php b/workflow/engine/methods/cases/cases_ToReviseOutputDocView.php index 2ef9c6be1..a7f081892 100755 --- a/workflow/engine/methods/cases/cases_ToReviseOutputDocView.php +++ b/workflow/engine/methods/cases/cases_ToReviseOutputDocView.php @@ -1,59 +1,57 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/* Permissions */ -switch ($RBAC->userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -/* Includes */ -G::LoadClass('case'); - -/* Menues */ -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'cases'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - - -/* Prepare page before to show */ -$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); -$oTemplatePower->prepare(); -$G_PUBLISH = new Publisher; - -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addScriptCode(' +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +/* Permissions */ +switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +/* Includes */ +G::LoadClass( 'case' ); + +/* Menues */ +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +/* Prepare page before to show */ +$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); +$oTemplatePower->prepare(); +$G_PUBLISH = new Publisher(); + +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); @@ -65,37 +63,38 @@ leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ - '.(isset($_SESSION['showCasesWindow'])?'try{'.$_SESSION['showCasesWindow'].'}catch(e){}':'').'}); -'); -$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); + ' . (isset( $_SESSION['showCasesWindow'] ) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . '}); +' ); +$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); // -require_once 'classes/model/OutputDocument.php'; -$oOutputDocument = new OutputDocument(); -$aOD = $oOutputDocument->load($_GET['UID']); -require_once 'classes/model/AppDocument.php'; -$oAppDocument = new AppDocument(); -$aFields = $oAppDocument->load($_GET['DOC']); -$aFields['VIEW'] = G::LoadTranslation('ID_OPEN'); -switch ($aOD ['OUT_DOC_GENERATE']) { - case 'DOC': - $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand(); - break; - case 'PDF': - $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand(); - break; - case 'BOTH': - $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand(); - $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand(); - break; -} - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocumentToRevise', '', G::array_merges($aOD, $aFields), ''); +require_once 'classes/model/OutputDocument.php'; +$oOutputDocument = new OutputDocument(); +$aOD = $oOutputDocument->load( $_GET['UID'] ); +require_once 'classes/model/AppDocument.php'; +$oAppDocument = new AppDocument(); +$aFields = $oAppDocument->load( $_GET['DOC'] ); +$aFields['VIEW'] = G::LoadTranslation( 'ID_OPEN' ); +switch ($aOD['OUT_DOC_GENERATE']) { + case 'DOC': + $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand(); + break; + case 'PDF': + $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand(); + break; + case 'BOTH': + $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand(); + $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand(); + break; +} + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ViewOutputDocumentToRevise', '', G::array_merges( $aOD, $aFields ), '' ); // -G::RenderPage('publish', 'blank'); - -if(!isset($_GET['ex'])) $_GET['ex']=0; - +G::RenderPage( 'publish', 'blank' ); + +if (! isset( $_GET['ex'] )) + $_GET['ex'] = 0; + ?> \ No newline at end of file + + diff --git a/workflow/engine/methods/cases/cases_UsersReassign.php b/workflow/engine/methods/cases/cases_UsersReassign.php index efdf9f183..80804a142 100755 --- a/workflow/engine/methods/cases/cases_UsersReassign.php +++ b/workflow/engine/methods/cases/cases_UsersReassign.php @@ -1,75 +1,74 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_REASSIGNCASE')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - G::LoadClass('case'); - $oCase = new Cases(); - $aCases = array(); - $aUsers = array(); - if (isset($_POST['USERS']) && is_array($_POST['USERS'])) { - foreach ($_POST['USERS'] as $sKey => $sUser) { - if ($sUser != '') { - $oCase->reassignCase($_POST['APPLICATIONS'][$sKey], $_POST['INDEXES'][$sKey], $_POST['USR_UID'], $sUser); - $aCases[] = $_POST['APPLICATIONS'][$sKey]; - $aUsers[] = $sUser; - } - } - } - G::LoadClass('case'); - $oCase = new Cases(); - require_once 'classes/model/Users.php'; - $oUser = new Users(); - $sText = ''; - foreach ($aCases as $sKey => $sCase) { - $aCase = $oCase->loadCase($sCase); - $aUser = $oUser->load($aUsers[$sKey]); - $sText .= '(' . $aCase['APP_NUMBER'] . ') ' . $aCase['TITLE'] . ' => ' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')' . '
'; - } - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $sText; - $aMessage['URL'] = 'cases_ReassignByUser?REASSIGN_USER=' . $_POST['USR_UID']; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ReassignShowInfo', '', $aMessage); - G::RenderPage('publish'); -} -catch (Exception $oException) { - die($oException->getMessage()); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } + G::LoadClass( 'case' ); + $oCase = new Cases(); + $aCases = array (); + $aUsers = array (); + if (isset( $_POST['USERS'] ) && is_array( $_POST['USERS'] )) { + foreach ($_POST['USERS'] as $sKey => $sUser) { + if ($sUser != '') { + $oCase->reassignCase( $_POST['APPLICATIONS'][$sKey], $_POST['INDEXES'][$sKey], $_POST['USR_UID'], $sUser ); + $aCases[] = $_POST['APPLICATIONS'][$sKey]; + $aUsers[] = $sUser; + } + } + } + G::LoadClass( 'case' ); + $oCase = new Cases(); + require_once 'classes/model/Users.php'; + $oUser = new Users(); + $sText = ''; + foreach ($aCases as $sKey => $sCase) { + $aCase = $oCase->loadCase( $sCase ); + $aUser = $oUser->load( $aUsers[$sKey] ); + $sText .= '(' . $aCase['APP_NUMBER'] . ') ' . $aCase['TITLE'] . ' => ' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')' . '
'; + } + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'cases'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN'; + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $sText; + $aMessage['URL'] = 'cases_ReassignByUser?REASSIGN_USER=' . $_POST['USR_UID']; + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignShowInfo', '', $aMessage ); + G::RenderPage( 'publish' ); +} catch (Exception $oException) { + die( $oException->getMessage() ); +} + diff --git a/workflow/engine/methods/cases/cases_toRevise.php b/workflow/engine/methods/cases/cases_toRevise.php index de8c360b1..013d8f912 100755 --- a/workflow/engine/methods/cases/cases_toRevise.php +++ b/workflow/engine/methods/cases/cases_toRevise.php @@ -1,29 +1,29 @@ -userCanAccess('PM_SUPERVISOR')) { - case - 2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case - 1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; -} - -if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) - return $RBAC_Response; - - - $G_MAIN_MENU = 'processmaker'; - $G_SUB_MENU = 'cases'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; - - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('view', 'cases/cases_toRevise'); - $G_PUBLISH->AddContent('smarty', 'cases/cases_toReviseIn', '', '', array()); - - G::RenderPage("publish-treeview"); +userCanAccess( 'PM_SUPERVISOR' )) { + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; +} + +if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) + return $RBAC_Response; + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'cases'; +$G_ID_MENU_SELECTED = 'CASES'; +$G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'view', 'cases/cases_toRevise' ); +$G_PUBLISH->AddContent( 'smarty', 'cases/cases_toReviseIn', '', '', array () ); + +G::RenderPage( "publish-treeview" ); + diff --git a/workflow/engine/methods/cases/data_casesSchedulerLog.php b/workflow/engine/methods/cases/data_casesSchedulerLog.php index 155793c2f..a98430257 100755 --- a/workflow/engine/methods/cases/data_casesSchedulerLog.php +++ b/workflow/engine/methods/cases/data_casesSchedulerLog.php @@ -1,89 +1,86 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -require_once 'classes/model/LogCasesSchedulerPeer.php'; -require_once 'classes/model/LogCasesScheduler.php'; -G::LoadClass('configuration'); - -$co = new Configurations(); -$config = $co->getConfiguration('casesSchedulerLogList', 'pageSize','',$_SESSION['USER_LOGGED']); -$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; - -$start = isset($_REQUEST['start'])? $_REQUEST['start'] : 0; -$limit = isset($_REQUEST['limit'])? $_REQUEST['limit'] : $limit_size; -$filter = (isset($_POST['textFilter'])) ? $_POST['textFilter'] : ''; - -$oCriteria = new Criteria('workflow'); -$oCriteria->clearSelectColumns(); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::LOG_CASE_UID); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::PRO_UID); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::TAS_UID); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::USR_NAME); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::EXEC_DATE); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::EXEC_HOUR); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::RESULT); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::SCH_UID); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::WS_CREATE_CASE_STATUS); -$oCriteria->addSelectColumn(LogCasesSchedulerPeer::WS_ROUTE_CASE_STATUS); - -if ($filter != ''){ - $c_or = $oCriteria->getNewCriterion(LogCasesSchedulerPeer::WS_CREATE_CASE_STATUS, '%'.$filter.'%', Criteria::LIKE)->addOr( - $oCriteria->getNewCriterion(LogCasesSchedulerPeer::WS_ROUTE_CASE_STATUS,'%'.$filter.'%', Criteria::LIKE)); - $oCriteria->add($c_or); -} - -$oDataset = LogCasesSchedulerPeer::doSelectRS ( $oCriteria ); -$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); - -$addTables = Array(); -while( $oDataset->next() ) { - $addTables[] = $oDataset->getRow(); -} -$results = count($addTables); - -$oCriteria->setOffset($start); -$oCriteria->setLimit($limit); - -$oCriteria->addDescendingOrderByColumn(LogCasesSchedulerPeer::EXEC_DATE); -$oCriteria->addDescendingOrderByColumn(LogCasesSchedulerPeer::EXEC_HOUR); - -$oDataset = LogCasesSchedulerPeer::doSelectRS ( $oCriteria ); -$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); - - - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +require_once 'classes/model/LogCasesSchedulerPeer.php'; +require_once 'classes/model/LogCasesScheduler.php'; +G::LoadClass( 'configuration' ); + +$co = new Configurations(); +$config = $co->getConfiguration( 'casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); +$limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20; + +$start = isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0; +$limit = isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : $limit_size; +$filter = (isset( $_POST['textFilter'] )) ? $_POST['textFilter'] : ''; + +$oCriteria = new Criteria( 'workflow' ); +$oCriteria->clearSelectColumns(); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::LOG_CASE_UID ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::PRO_UID ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::TAS_UID ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::USR_NAME ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::EXEC_DATE ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::EXEC_HOUR ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::RESULT ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::SCH_UID ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::WS_CREATE_CASE_STATUS ); +$oCriteria->addSelectColumn( LogCasesSchedulerPeer::WS_ROUTE_CASE_STATUS ); + +if ($filter != '') { + $c_or = $oCriteria->getNewCriterion( LogCasesSchedulerPeer::WS_CREATE_CASE_STATUS, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( LogCasesSchedulerPeer::WS_ROUTE_CASE_STATUS, '%' . $filter . '%', Criteria::LIKE ) ); + $oCriteria->add( $c_or ); +} + +$oDataset = LogCasesSchedulerPeer::doSelectRS( $oCriteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + +$addTables = Array (); +while ($oDataset->next()) { + $addTables[] = $oDataset->getRow(); +} +$results = count( $addTables ); + +$oCriteria->setOffset( $start ); +$oCriteria->setLimit( $limit ); + +$oCriteria->addDescendingOrderByColumn( LogCasesSchedulerPeer::EXEC_DATE ); +$oCriteria->addDescendingOrderByColumn( LogCasesSchedulerPeer::EXEC_HOUR ); + +$oDataset = LogCasesSchedulerPeer::doSelectRS( $oCriteria ); +$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + //$oDataset = LogCasesSchedulerPeer::doSelectRS ( $oCriteria ); //$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); - -$addTables = Array(); -while( $oDataset->next() ) { - $addTables[] = $oDataset->getRow(); -} - + + +$addTables = Array (); +while ($oDataset->next()) { + $addTables[] = $oDataset->getRow(); +} + //$oLogCasesScheduler = new LogCasesScheduler(); //$arrData = $oLogCasesScheduler->getAll(); - - -echo '{results: '.$results.', rows: '.G::json_encode($addTables).'}'; \ No newline at end of file + +echo '{results: ' . $results . ', rows: ' . G::json_encode( $addTables ) . '}'; + diff --git a/workflow/engine/methods/cases/debug_triggers.php b/workflow/engine/methods/cases/debug_triggers.php index 9862358bd..8e8adaacb 100755 --- a/workflow/engine/methods/cases/debug_triggers.php +++ b/workflow/engine/methods/cases/debug_triggers.php @@ -1,72 +1,73 @@ -$name) { - - $triggersList[$i]['name'] = $name; - $triggersList[$i]['execution_time'] = strtolower($aTrigger['TIME']); - //$t_code = $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT']; - //$t_code = str_replace('"', '\'',$t_code); - //$t_code = addslashes($t_code); - //$t_code = Only1br($t_code); - - //highlighting the trigger code using the geshi third party library - G::LoadThirdParty('geshi', 'geshi'); - $geshi = new GeSHi($aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php'); - $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2); - $geshi->set_line_style('background: #f0f0f0;'); - - $triggersList[$i]['code'] = $geshi->parse_code(); //$aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT']; - $i++; - } - } else { - - } -} - +$triggersList = Array (); + +$i = 0; +foreach ($aTriggers as $aTrigger) { + + if ($aTrigger['NUM_TRIGGERS'] != 0) { + + foreach ($aTrigger['TRIGGERS_NAMES'] as $index => $name) { + + $triggersList[$i]['name'] = $name; + $triggersList[$i]['execution_time'] = strtolower( $aTrigger['TIME'] ); + //$t_code = $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT']; + //$t_code = str_replace('"', '\'',$t_code); + //$t_code = addslashes($t_code); + //$t_code = Only1br($t_code); + + + //highlighting the trigger code using the geshi third party library + G::LoadThirdParty( 'geshi', 'geshi' ); + $geshi = new GeSHi( $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php' ); + $geshi->enable_line_numbers( GESHI_FANCY_LINE_NUMBERS, 2 ); + $geshi->set_line_style( 'background: #f0f0f0;' ); + + $triggersList[$i]['code'] = $geshi->parse_code(); //$aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT']; + $i ++; + } + } else { + + } +} + //print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']); die; -$DEBUG_ERRORS = array_unique($_SESSION['TRIGGER_DEBUG']['ERRORS']); - -foreach($DEBUG_ERRORS as $error){ - if(isset($error['ERROR']) and $error['ERROR'] != ''){ - $triggersList[$i]['name'] = 'Error'; - $triggersList[$i]['execution_time'] = 'error'; - $triggersList[$i]['code'] = $error['ERROR']; - $i++; - } - - if(isset($error['FATAL']) and $error['FATAL'] != ''){ - $error['FATAL'] = str_replace("
", "\n", $error['FATAL']); - $tmp = explode("\n", $error['FATAL']); - $triggersList[$i]['name'] = isset($tmp[0])? $tmp[0]: 'Fatal Error in trigger'; - $triggersList[$i]['execution_time'] = 'Fatal error'; - $triggersList[$i]['code'] = $error['FATAL']; - $i++; - } -} - - +$DEBUG_ERRORS = array_unique( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ); + +foreach ($DEBUG_ERRORS as $error) { + if (isset( $error['ERROR'] ) and $error['ERROR'] != '') { + $triggersList[$i]['name'] = 'Error'; + $triggersList[$i]['execution_time'] = 'error'; + $triggersList[$i]['code'] = $error['ERROR']; + $i ++; + } + + if (isset( $error['FATAL'] ) and $error['FATAL'] != '') { + $error['FATAL'] = str_replace( "
", "\n", $error['FATAL'] ); + $tmp = explode( "\n", $error['FATAL'] ); + $triggersList[$i]['name'] = isset( $tmp[0] ) ? $tmp[0] : 'Fatal Error in trigger'; + $triggersList[$i]['execution_time'] = 'Fatal error'; + $triggersList[$i]['code'] = $error['FATAL']; + $i ++; + } +} + /*echo '{total:5, data:[ {name:"trigger1", execution_time:"after"}, {name:"trigger2", execution_time:"before"}, {name:"trigger13", execution_time:"before"}, ]}'; - - */ - -$triggersRet->total = count($triggersList); -$triggersRet->data = $triggersList; -echo G::json_encode($triggersRet); \ No newline at end of file + */ + +$triggersRet->total = count( $triggersList ); +$triggersRet->data = $triggersList; + +echo G::json_encode( $triggersRet ); + diff --git a/workflow/engine/methods/cases/debug_vars.php b/workflow/engine/methods/cases/debug_vars.php index 0af45b480..980e70dfa 100755 --- a/workflow/engine/methods/cases/debug_vars.php +++ b/workflow/engine/methods/cases/debug_vars.php @@ -1,98 +1,104 @@ -loadCase($_SESSION['APPLICATION']); - - $aVars = Array(); - for ($i = 0; $i < count($_SESSION['TRIGGER_DEBUG']['DATA']); $i++) { - $aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; - } - - $aVars = array_merge($aFields['APP_DATA'], $aVars); - - $field = $aVars[$fieldname]; - $response->headers = Array(); - $response->columns = Array(); - $response->rows = Array(); - - $sw = true; - $j = 0; - if (is_array($field)) { - foreach ($field as $row) { - if ($sw) { - foreach ($row as $key => $value) { - $response->headers[] = Array('name' => $key); - $response->columns[] = Array('header' => $key, 'width' => 100, 'dataIndex' => $key); - } - $sw = false; - } - - - $tmp = Array(); - foreach ($row as $key => $value) { - $tmp[] = $value; - } - $response->rows[$j++] = $tmp; - } - } else { - if (is_object($field)) { - $response->headers = Array(Array('name' => 'name'), Array('name' => 'value')); - $response->columns = Array(Array('header' => 'Property', 'width' => 100, 'dataIndex' => 'name'), - Array('header' => 'Value', 'width' => 100, 'dataIndex' => 'value')); - - foreach ($field as $key => $value) { - $response->rows[] = Array($key, $value); - } - } - } - - echo G::json_encode($response); - break; - default: - G::LoadClass('case'); - $oApp = new Cases(); - $aFields = $oApp->loadCase($_SESSION['APPLICATION']); - - $aVars = Array(); - for ($i = 0; $i < count($_SESSION['TRIGGER_DEBUG']['DATA']); $i++) { - $aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; - } - - $aVars = array_merge($aFields['APP_DATA'], $aVars); - - - if (isset($_POST['filter']) && $_POST['filter'] == 'dyn') { - $sysVars = array_keys(G::getSystemConstants()); - $varNames = array_keys($aVars); - foreach ($varNames as $var) { - if (in_array($var, $sysVars)) { - unset($aVars[$var]); - } - } - } - if (isset($_POST['filter']) && $_POST['filter'] == 'sys') { - $aVars = G::getSystemConstants(); - } - - ksort($aVars); - $return_object->totalCount = 1; - - foreach ($aVars as $i => $var) { - if (is_array($var) || is_object($var)) { - $aVars[$i] = print_r($var, true); - } - } - - $return_object->data[0] = $aVars; - - echo G::json_encode($return_object); - break; -} - \ No newline at end of file +loadCase( $_SESSION['APPLICATION'] ); + + $aVars = Array (); + for ($i = 0; $i < count( $_SESSION['TRIGGER_DEBUG']['DATA'] ); $i ++) { + $aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; + } + + $aVars = array_merge( $aFields['APP_DATA'], $aVars ); + + $field = $aVars[$fieldname]; + $response->headers = Array (); + $response->columns = Array (); + $response->rows = Array (); + + $sw = true; + $j = 0; + if (is_array( $field )) { + foreach ($field as $row) { + if ($sw) { + foreach ($row as $key => $value) { + $response->headers[] = Array ('name' => $key + ); + $response->columns[] = Array ('header' => $key,'width' => 100,'dataIndex' => $key + ); + } + $sw = false; + } + + $tmp = Array (); + foreach ($row as $key => $value) { + $tmp[] = $value; + } + $response->rows[$j ++] = $tmp; + } + } else { + if (is_object( $field )) { + $response->headers = Array (Array ('name' => 'name' + ),Array ('name' => 'value' + ) + ); + $response->columns = Array (Array ('header' => 'Property','width' => 100,'dataIndex' => 'name' + ),Array ('header' => 'Value','width' => 100,'dataIndex' => 'value' + ) + ); + + foreach ($field as $key => $value) { + $response->rows[] = Array ($key,$value + ); + } + } + } + + echo G::json_encode( $response ); + break; + default: + G::LoadClass( 'case' ); + $oApp = new Cases(); + $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); + + $aVars = Array (); + for ($i = 0; $i < count( $_SESSION['TRIGGER_DEBUG']['DATA'] ); $i ++) { + $aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; + } + + $aVars = array_merge( $aFields['APP_DATA'], $aVars ); + + if (isset( $_POST['filter'] ) && $_POST['filter'] == 'dyn') { + $sysVars = array_keys( G::getSystemConstants() ); + $varNames = array_keys( $aVars ); + foreach ($varNames as $var) { + if (in_array( $var, $sysVars )) { + unset( $aVars[$var] ); + } + } + } + if (isset( $_POST['filter'] ) && $_POST['filter'] == 'sys') { + $aVars = G::getSystemConstants(); + } + + ksort( $aVars ); + $return_object->totalCount = 1; + + foreach ($aVars as $i => $var) { + if (is_array( $var ) || is_object( $var )) { + $aVars[$i] = print_r( $var, true ); + } + } + + $return_object->data[0] = $aVars; + + echo G::json_encode( $return_object ); + break; +} + diff --git a/workflow/engine/methods/cases/index.php b/workflow/engine/methods/cases/index.php index 68141865d..12163259d 100755 --- a/workflow/engine/methods/cases/index.php +++ b/workflow/engine/methods/cases/index.php @@ -1,29 +1,27 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - //$newFile = str_replace ( 'index.php', 'cases_List.php' , __FILE__ ) ; - $newFile = str_replace ( 'index.php', 'main.php' , __FILE__ ) ; - return $newFile; - - \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +//$newFile = str_replace ( 'index.php', 'cases_List.php' , __FILE__ ) ; +$newFile = str_replace( 'index.php', 'main.php', __FILE__ ); +return $newFile; + diff --git a/workflow/engine/methods/cases/main.php b/workflow/engine/methods/cases/main.php index 6b7640db2..554bb5551 100755 --- a/workflow/engine/methods/cases/main.php +++ b/workflow/engine/methods/cases/main.php @@ -1,36 +1,35 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -$RBAC->requirePermissions('PM_CASES'); - -$G_MAIN_MENU = 'processmaker'; -$G_ID_MENU_SELECTED = 'CASES'; - -$_POST['qs'] = isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : ''; - -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('view', 'cases/cases_Load'); -G::RenderPage('publish'); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +$RBAC->requirePermissions( 'PM_CASES' ); + +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'CASES'; + +$_POST['qs'] = isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : ''; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'view', 'cases/cases_Load' ); +G::RenderPage( 'publish' ); + diff --git a/workflow/engine/methods/cases/main_init.php b/workflow/engine/methods/cases/main_init.php index 79c972d06..93a5d911c 100755 --- a/workflow/engine/methods/cases/main_init.php +++ b/workflow/engine/methods/cases/main_init.php @@ -12,85 +12,81 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -G::LoadClass("configuration"); - - - - +G::LoadClass( "configuration" ); $conf = new Configurations(); $oHeadPublisher = &headPublisher::getSingleton(); -$oHeadPublisher->addExtJsScript("cases/main", false); //Adding a javascript file .js -$oHeadPublisher->addContent("cases/main"); //Adding a html file .html. +$oHeadPublisher->addExtJsScript( "cases/main", false ); //Adding a javascript file .js +$oHeadPublisher->addContent( "cases/main" ); //Adding a html file .html. + $keyMem = "USER_PREFERENCES" . $_SESSION["USER_LOGGED"]; -$memcache = &PMmemcached::getSingleton(SYS_SYS); +$memcache = &PMmemcached::getSingleton( SYS_SYS ); -if (($arrayConfig = $memcache->get($keyMem)) === false) { - $conf->loadConfig($x, "USER_PREFERENCES", "", "", $_SESSION["USER_LOGGED"], ""); +if (($arrayConfig = $memcache->get( $keyMem )) === false) { + $conf->loadConfig( $x, "USER_PREFERENCES", "", "", $_SESSION["USER_LOGGED"], "" ); $arrayConfig = $conf->aConfig; - $memcache->set($keyMem, $arrayConfig, PMmemcached::ONE_HOUR); + $memcache->set( $keyMem, $arrayConfig, PMmemcached::ONE_HOUR ); } $confDefaultOption = ""; -if (isset($arrayConfig["DEFAULT_CASES_MENU"])) { //this user has a configuration record +if (isset( $arrayConfig["DEFAULT_CASES_MENU"] )) { //this user has a configuration record $confDefaultOption = $arrayConfig["DEFAULT_CASES_MENU"]; global $G_TMP_MENU; $oMenu = new Menu(); - $oMenu->load("cases"); + $oMenu->load( "cases" ); $defaultOption = ""; foreach ($oMenu->Id as $i => $id) { if ($id == $confDefaultOption) { - $defaultOption = $oMenu->Options[$i]; - break; + $defaultOption = $oMenu->Options[$i]; + break; } } - $defaultOption = ($defaultOption != "")? $defaultOption : "casesListExtJs"; -} else { + $defaultOption = ($defaultOption != "") ? $defaultOption : "casesListExtJs"; +} else { $defaultOption = "casesListExtJs"; $confDefaultOption = "CASES_INBOX"; } -if (isset($_GET["id"]) && isset($_GET["id"])) { +if (isset( $_GET["id"] ) && isset( $_GET["id"] )) { $defaultOption = "../cases/open?APP_UID=" . $_GET["id"] . "&DEL_INDEX=" . $_GET["i"]; - if (isset($_GET["a"])) { + if (isset( $_GET["a"] )) { $defaultOption .= "&action=" . $_GET["a"]; } } - $oServerConf =& serverConf::getSingleton(); - if ($oServerConf->isRtl(SYS_LANG)) { +$oServerConf = & serverConf::getSingleton(); +if ($oServerConf->isRtl( SYS_LANG )) { $regionTreePanel = 'east'; $regionDebug = 'west'; - } else { +} else { $regionTreePanel = 'west'; $regionDebug = 'east'; - } -$oHeadPublisher->assign('regionTreePanel', $regionTreePanel); -$oHeadPublisher->assign('regionDebug', $regionDebug); -$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions -$oHeadPublisher->assign("_nodeId", isset($confDefaultOption)? $confDefaultOption : "PM_USERS"); //User menu permissions -$oHeadPublisher->assign("FORMATS", $conf->getFormats()); +} +$oHeadPublisher->assign( 'regionTreePanel', $regionTreePanel ); +$oHeadPublisher->assign( 'regionDebug', $regionDebug ); +$oHeadPublisher->assign( "defaultOption", $defaultOption ); //User menu permissions +$oHeadPublisher->assign( "_nodeId", isset( $confDefaultOption ) ? $confDefaultOption : "PM_USERS" ); //User menu permissions +$oHeadPublisher->assign( "FORMATS", $conf->getFormats() ); $_SESSION["current_ux"] = "NORMAL"; -G::RenderPage("publish", "extJs"); +G::RenderPage( "publish", "extJs" ); diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 625f4ef8e..8ce6740aa 100755 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -1,93 +1,88 @@ -. - * - * 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 - */ - - if (!isset($_GET['APP_UID']) || !isset($_GET['DEL_INDEX'])) { - if (isset($_GET['APP_NUMBER'])) { - G::LoadClass('case'); - $oCase = new Cases(); - $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']); - $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); - if( is_null($_GET['APP_UID']) ) { - throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); - } - if( is_null($_GET['DEL_INDEX']) ) { - throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER')); - } - } - else { - throw new Exception("Application ID or Delegation Index is missing!. The System can't open the case."); - } - } - - - require_once ("classes/model/Step.php"); - G::LoadClass("configuration"); - G::LoadClass("case"); - $oCase = new Cases(); - $conf = new Configurations; - - $oHeadPublisher =& headPublisher::getSingleton(); - - $oHeadPublisher->addExtJsScript('app/main', true); - $oHeadPublisher->addExtJsScript('cases/open', true); - $oHeadPublisher->assign('FORMATS',$conf->getFormats()); - $uri = ''; - foreach($_GET as $k=>$v) { - $uri .= ($uri == '')? "$k=$v": "&$k=$v"; - } - - $case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX']); - - if (!isset($_GET['to_revise'])){ - $script = 'cases_Open?'; - } - else { - $script = 'cases_OpenToRevise?'; - $delIndex = $_GET['DEL_INDEX']; - $appUid = $_GET['APP_UID']; - $oHeadPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST')); - $casesPanelUrl = 'casesToReviseTreeContent?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex; - $oHeadPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations - echo "
"; - } - - $oStep = new Step; - $oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); - - $oHeadPublisher->assign('uri', $script . $uri); - $oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); - $oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); - $oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d')); - $oHeadPublisher->assign('idfirstform', is_null($oStep)?'':$oStep->getStepUidObj()); - - - G::RenderPage('publish', 'extJs'); - - +. + * + * 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 + */ + +if (! isset( $_GET['APP_UID'] ) || ! isset( $_GET['DEL_INDEX'] )) { + if (isset( $_GET['APP_NUMBER'] )) { + G::LoadClass( 'case' ); + $oCase = new Cases(); + $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] ); + $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); + if (is_null( $_GET['APP_UID'] )) { + throw new Exception( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ) ); + } + if (is_null( $_GET['DEL_INDEX'] )) { + throw new Exception( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ) ); + } + } else { + throw new Exception( "Application ID or Delegation Index is missing!. The System can't open the case." ); + } +} + +require_once ("classes/model/Step.php"); +G::LoadClass( "configuration" ); +G::LoadClass( "case" ); +$oCase = new Cases(); +$conf = new Configurations(); + +$oHeadPublisher = & headPublisher::getSingleton(); + +$oHeadPublisher->addExtJsScript( 'app/main', true ); +$oHeadPublisher->addExtJsScript( 'cases/open', true ); +$oHeadPublisher->assign( 'FORMATS', $conf->getFormats() ); +$uri = ''; +foreach ($_GET as $k => $v) { + $uri .= ($uri == '') ? "$k=$v" : "&$k=$v"; +} + +$case = $oCase->loadCase( $_GET['APP_UID'], $_GET['DEL_INDEX'] ); + +if (! isset( $_GET['to_revise'] )) { + $script = 'cases_Open?'; +} else { + $script = 'cases_OpenToRevise?'; + $delIndex = $_GET['DEL_INDEX']; + $appUid = $_GET['APP_UID']; + $oHeadPublisher->assign( 'treeToReviseTitle', G::loadtranslation( 'ID_STEP_LIST' ) ); + $casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; + $oHeadPublisher->assign( 'casesPanelUrl', $casesPanelUrl ); //translations + echo "
"; +} + +$oStep = new Step(); +$oStep = $oStep->loadByProcessTaskPosition( $case['PRO_UID'], $case['TAS_UID'], 1 ); + +$oHeadPublisher->assign( 'uri', $script . $uri ); +$oHeadPublisher->assign( '_APP_NUM', '#: ' . $case['APP_NUMBER'] ); +$oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d' ) ) ); +$oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d' ) ); +$oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() ); + +G::RenderPage( 'publish', 'extJs' ); + diff --git a/workflow/engine/methods/cases/proxyCasesList.php b/workflow/engine/methods/cases/proxyCasesList.php index 501828b13..c723b56ad 100755 --- a/workflow/engine/methods/cases/proxyCasesList.php +++ b/workflow/engine/methods/cases/proxyCasesList.php @@ -1,91 +1,47 @@ -getAppGridData( - $userUid, - $start, - $limit, - $action, - $filter, - $search, - $process, - $user, - $status, - $type, - $dateFrom, - $dateTo, - $callback, - $dir, - $sort - ); - - $result = G::json_encode($data); - } else { - G::LoadClass("applications"); - - $apps = new Applications(); - $data = $apps->getAll( - $userUid, - $start, - $limit, - $action, - $filter, - $search, - $process, - $user, - $status, - $type, - $dateFrom, - $dateTo, - $callback, - $dir, - $sort, - $category - ); - - $result = G::json_encode($data); - } - - echo $result; -} catch (Exception $e) { - $msg = array("error" => $e->getMessage()); - - echo G::json_encode($msg); -} - +$callback = isset( $_POST["callback"] ) ? $_POST["callback"] : "stcCallback1001"; +$dir = isset( $_POST["dir"] ) ? $_POST["dir"] : "DESC"; +$sort = isset( $_POST["sort"] ) ? $_POST["sort"] : ""; +$start = isset( $_POST["start"] ) ? $_POST["start"] : "0"; +$limit = isset( $_POST["limit"] ) ? $_POST["limit"] : "25"; +$filter = isset( $_POST["filter"] ) ? $_POST["filter"] : ""; +$process = isset( $_POST["process"] ) ? $_POST["process"] : ""; +$category = isset( $_POST["category"] ) ? $_POST["category"] : ""; +$status = isset( $_POST["status"] ) ? strtoupper( $_POST["status"] ) : ""; +$user = isset( $_POST["user"] ) ? $_POST["user"] : ""; +$search = isset( $_POST["search"] ) ? $_POST["search"] : ""; +$action = isset( $_GET["action"] ) ? $_GET["action"] : (isset( $_POST["action"] ) ? $_POST["action"] : "todo"); +$type = isset( $_GET["type"] ) ? $_GET["type"] : (isset( $_POST["type"] ) ? $_POST["type"] : "extjs"); +$dateFrom = isset( $_POST["dateFrom"] ) ? substr( $_POST["dateFrom"], 0, 10 ) : ""; +$dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : ""; + +try { + $result = ""; + + $userUid = (isset( $_SESSION["USER_LOGGED"] ) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null; + $user = ($user == "CURRENT_USER") ? $userUid : $user; + + if (($action == "todo" || $action == "draft" || $action == "sent" || $action == "selfservice" || $action == "unassigned" || $action == "search") && (($solrConf = System::solrEnv()) !== false)) { + G::LoadClass( "AppSolr" ); + + $ApplicationSolrIndex = new AppSolr( $solrConf["solr_enabled"], $solrConf["solr_host"], $solrConf["solr_instance"] ); + + $data = $ApplicationSolrIndex->getAppGridData( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort ); + + $result = G::json_encode( $data ); + } else { + G::LoadClass( "applications" ); + + $apps = new Applications(); + $data = $apps->getAll( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort, $category ); + + $result = G::json_encode( $data ); + } + + echo $result; +} catch (Exception $e) { + $msg = array ("error" => $e->getMessage() ); + echo G::json_encode( $msg ); +} + diff --git a/workflow/engine/methods/cases/proxyProcessList.php b/workflow/engine/methods/cases/proxyProcessList.php index c0d85ac06..d2ec4330d 100755 --- a/workflow/engine/methods/cases/proxyProcessList.php +++ b/workflow/engine/methods/cases/proxyProcessList.php @@ -1,67 +1,70 @@ -clearSelectColumns ( ); - $Criteria->setDistinct(); - $Criteria->addSelectColumn ( AppCacheViewPeer::PRO_UID ); - $Criteria->addSelectColumn ( AppCacheViewPeer::APP_PRO_TITLE ); - - if ( $query != '' ) { - $Criteria->add (AppCacheViewPeer::APP_PRO_TITLE, $query . '%', Criteria::LIKE); - } - - $Criteria->add (AppCacheViewPeer::APP_STATUS, "TO_DO" , CRITERIA::EQUAL ); - $Criteria->add (AppCacheViewPeer::USR_UID, $sUIDUserLogged); - - - //$totalCount = AppCacheViewPeer::doCount( $Criteria ); - - if ( isset($limit) ) $Criteria->setLimit( $limit ); - if ( isset($start) ) $Criteria->setOffset( $start ); - - if ( $sort != '' ) { - if ( $dir == 'DESC' ) - $Criteria->addDescendingOrderByColumn( $sort ); - else - $Criteria->addAscendingOrderByColumn( $sort ); - } - $oDataset = AppCacheViewPeer::doSelectRS($Criteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - - $result = array(); - $rows = array(); - $index = isset($start) ? $start : 0; - while($aRow = $oDataset->getRow()){ - $aRow['index'] = ++$index; - $rows[] = $aRow; - - $oDataset->next(); - } - $result['totalCount'] = count($rows); - $result['data'] = $rows; - - print G::json_encode( $result ) ; - - } - catch ( Exception $e ) { - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - } +clearSelectColumns(); + $Criteria->setDistinct(); + $Criteria->addSelectColumn( AppCacheViewPeer::PRO_UID ); + $Criteria->addSelectColumn( AppCacheViewPeer::APP_PRO_TITLE ); + + if ($query != '') { + $Criteria->add( AppCacheViewPeer::APP_PRO_TITLE, $query . '%', Criteria::LIKE ); + } + + $Criteria->add( AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL ); + $Criteria->add( AppCacheViewPeer::USR_UID, $sUIDUserLogged ); + + //$totalCount = AppCacheViewPeer::doCount( $Criteria ); + + + if (isset( $limit )) + $Criteria->setLimit( $limit ); + if (isset( $start )) + $Criteria->setOffset( $start ); + + if ($sort != '') { + if ($dir == 'DESC') + $Criteria->addDescendingOrderByColumn( $sort ); + else + $Criteria->addAscendingOrderByColumn( $sort ); + } + $oDataset = AppCacheViewPeer::doSelectRS( $Criteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + + $result = array (); + $rows = array (); + $index = isset( $start ) ? $start : 0; + while ($aRow = $oDataset->getRow()) { + $aRow['index'] = ++ $index; + $rows[] = $aRow; + + $oDataset->next(); + } + $result['totalCount'] = count( $rows ); + $result['data'] = $rows; + + print G::json_encode( $result ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'blank' ); +} + diff --git a/workflow/engine/methods/cases/proxyReassignCasesList.php b/workflow/engine/methods/cases/proxyReassignCasesList.php index 31831b91b..ee9bc953f 100755 --- a/workflow/engine/methods/cases/proxyReassignCasesList.php +++ b/workflow/engine/methods/cases/proxyReassignCasesList.php @@ -1,110 +1,98 @@ - $aItem[0] , 'TAS_UID' => $aItem[1], 'DEL_INDEX' => $aItem[2]); - } - - $sReassignFromUser = isset($_POST['user']) ? $_POST['user'] : ''; - $sProcessUid = isset($_POST['process']) ? $_POST['process'] : ''; - - G::LoadClass( 'tasks' ); - G::LoadClass( 'groups' ); - G::LoadClass( 'case' ); - G::LoadClass( 'users' ); - require_once ( "classes/model/AppCacheView.php" ); - - $oTasks = new Tasks (); - $oGroups = new Groups (); - $oUser = new Users (); - $oCases = new Cases (); - - $aCasesList = Array(); - $vard = 0; - foreach ( $allUidsRecords as $aRecord ) { - $vard = $vard + 1; - $APP_UID = $aRecord['APP_UID']; - $delIndex = $aRecord['DEL_INDEX']; - $aCase = $oCases->loadCaseByDelegation($APP_UID,$delIndex); - - $aUsersInvolved = Array(); - $aCaseGroups = $oTasks->getGroupsOfTask($aCase['TAS_UID'], 1); - - foreach ( $aCaseGroups as $aCaseGroup ) { - $aCaseUsers = $oGroups->getUsersOfGroup($aCaseGroup['GRP_UID']); - foreach ( $aCaseUsers as $aCaseUser ) { - if ( $aCaseUser['USR_UID'] != $sReassignFromUser ) { - $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']); - $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] - } - } - } - - $aCaseUsers = $oTasks->getUsersOfTask($aCase['TAS_UID'], 1); - foreach ( $aCaseUsers as $aCaseUser ) { - if ( $aCaseUser['USR_UID'] != $sReassignFromUser ) { - $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']); - $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); - } - } - $oTmp = $aUsersInvolved; - $aCase['USERS'] = $oTmp; - array_push($aCasesList, $aCase); - } - - $filedNames = Array ( - "APP_UID", - "APP_NUMBER", - "APP_UPDATE_DATE", - "DEL_PRIORITY", - "DEL_INDEX", - "TAS_UID", - "DEL_INIT_DATE", - "DEL_FINISH_DATE", - "USR_UID", - "APP_STATUS", - "DEL_TASK_DUE_DATE", - "APP_CURRENT_USER", - "APP_TITLE", - "APP_PRO_TITLE", - "APP_TAS_TITLE", - "APP_DEL_PREVIOUS_USER", - "USERS" - ); - - $aCasesList = array_merge(Array($filedNames), $aCasesList); - $rows = array(); - $i = $start; - for ($j=0;$j<$limit;$j++){ - $i++; - if (isset($aCasesList[$i])){ - $rows[] = $aCasesList[$i]; - } - } - $totalCount = count($aCasesList)-1; - $result = array(); - $result['totalCount'] = $totalCount; - - $index = $start; - $result['data'] = $rows; - //print the result in json format - print G::json_encode( $result ) ; + $aItem[0],'TAS_UID' => $aItem[1],'DEL_INDEX' => $aItem[2] + ); +} + +$sReassignFromUser = isset( $_POST['user'] ) ? $_POST['user'] : ''; +$sProcessUid = isset( $_POST['process'] ) ? $_POST['process'] : ''; + +G::LoadClass( 'tasks' ); +G::LoadClass( 'groups' ); +G::LoadClass( 'case' ); +G::LoadClass( 'users' ); +require_once ("classes/model/AppCacheView.php"); + +$oTasks = new Tasks(); +$oGroups = new Groups(); +$oUser = new Users(); +$oCases = new Cases(); + +$aCasesList = Array (); +$vard = 0; +foreach ($allUidsRecords as $aRecord) { + $vard = $vard + 1; + $APP_UID = $aRecord['APP_UID']; + $delIndex = $aRecord['DEL_INDEX']; + $aCase = $oCases->loadCaseByDelegation( $APP_UID, $delIndex ); + + $aUsersInvolved = Array (); + $aCaseGroups = $oTasks->getGroupsOfTask( $aCase['TAS_UID'], 1 ); + + foreach ($aCaseGroups as $aCaseGroup) { + $aCaseUsers = $oGroups->getUsersOfGroup( $aCaseGroup['GRP_UID'] ); + foreach ($aCaseUsers as $aCaseUser) { + if ($aCaseUser['USR_UID'] != $sReassignFromUser) { + $aCaseUserRecord = $oUser->load( $aCaseUser['USR_UID'] ); + $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME'] + ); // . ' (' . $aCaseUserRecord['USR_USERNAME'] + } + } + } + + $aCaseUsers = $oTasks->getUsersOfTask( $aCase['TAS_UID'], 1 ); + foreach ($aCaseUsers as $aCaseUser) { + if ($aCaseUser['USR_UID'] != $sReassignFromUser) { + $aCaseUserRecord = $oUser->load( $aCaseUser['USR_UID'] ); + $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME'] + ); + } + } + $oTmp = $aUsersInvolved; + $aCase['USERS'] = $oTmp; + array_push( $aCasesList, $aCase ); +} + +$filedNames = Array ("APP_UID","APP_NUMBER","APP_UPDATE_DATE","DEL_PRIORITY","DEL_INDEX","TAS_UID","DEL_INIT_DATE","DEL_FINISH_DATE","USR_UID","APP_STATUS","DEL_TASK_DUE_DATE","APP_CURRENT_USER","APP_TITLE","APP_PRO_TITLE","APP_TAS_TITLE","APP_DEL_PREVIOUS_USER","USERS" +); + +$aCasesList = array_merge( Array ($filedNames +), $aCasesList ); +$rows = array (); +$i = $start; +for ($j = 0; $j < $limit; $j ++) { + $i ++; + if (isset( $aCasesList[$i] )) { + $rows[] = $aCasesList[$i]; + } +} +$totalCount = count( $aCasesList ) - 1; +$result = array (); +$result['totalCount'] = $totalCount; + +$index = $start; +$result['data'] = $rows; +//print the result in json format +print G::json_encode( $result ); + diff --git a/workflow/engine/methods/cases/proxyReassignUsersList.php b/workflow/engine/methods/cases/proxyReassignUsersList.php index a1ff66226..6cbbb776d 100755 --- a/workflow/engine/methods/cases/proxyReassignUsersList.php +++ b/workflow/engine/methods/cases/proxyReassignUsersList.php @@ -1,108 +1,110 @@ - 0) { - foreach ($array as $k => $v) { - if (is_array($v)) { - foreach ($v as $k2 => $v2) { - if ($k2 == $on) { - $sortable_array[$k] = $v2; - } - } - } else { - $sortable_array[$k] = $v; - } - } - - switch ($order) { - case SORT_ASC: - asort($sortable_array); - break; - case SORT_DESC: - arsort($sortable_array); - break; - } - - foreach ($sortable_array as $k => $v) { - if ($query==''){ - $new_array[] = $array[$k]; - } - else { - if ( preg_match("/".$query."/i", $array[$k]['userFullname']) ) { - $new_array[] = $array[$k]; - } - } - } - } - return $new_array; -} + 0) { + foreach ($array as $k => $v) { + if (is_array( $v )) { + foreach ($v as $k2 => $v2) { + if ($k2 == $on) { + $sortable_array[$k] = $v2; + } + } + } else { + $sortable_array[$k] = $v; + } + } + + switch ($order) { + case SORT_ASC: + asort( $sortable_array ); + break; + case SORT_DESC: + arsort( $sortable_array ); + break; + } + + foreach ($sortable_array as $k => $v) { + if ($query == '') { + $new_array[] = $array[$k]; + } else { + if (preg_match( "/" . $query . "/i", $array[$k]['userFullname'] )) { + $new_array[] = $array[$k]; + } + } + } + } + return $new_array; +} // $APP_UIDS = explode(',', $_POST['APP_UID']); - - $appUid = isset($_POST['application']) ? $_POST['application'] : ''; + + +$appUid = isset( $_POST['application'] ) ? $_POST['application'] : ''; // $processUid = isset($_POST['process']) ? $_POST['process'] : ''; - $TaskUid = isset($_POST['task']) ? $_POST['task'] : ''; - $sReassignFromUser = isset($_POST['currentUser']) ? $_POST['currentUser'] : ''; - - G::LoadClass('tasks'); - G::LoadClass('groups'); - G::LoadClass('case'); - G::LoadClass('users'); - - $oTasks = new Tasks(); - $oGroups = new Groups(); - $oUser = new Users(); - $oCases = new Cases(); - - $aCasesList = Array(); - - $aUsersInvolved = Array(); - $aCaseGroups = $oTasks->getGroupsOfTask($TaskUid, 1); - $oConf = new Configurations; - $ConfEnv= $oConf->getFormats(); - foreach ( $aCaseGroups as $aCaseGroup ) { - $aCaseUsers = $oGroups->getUsersOfGroup($aCaseGroup['GRP_UID']); - foreach ( $aCaseUsers as $aCaseUser ) { - if ( $aCaseUser['USR_UID'] != $sReassignFromUser ) { - $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']); - $sCaseUser = G::getFormatUserList ($ConfEnv['format'],$aCaseUserRecord); -// $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; - $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $sCaseUser); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; - } - } - } - - $aCaseUsers = $oTasks->getUsersOfTask($TaskUid, 1); - foreach ( $aCaseUsers as $aCaseUser ) { - if ( $aCaseUser['USR_UID'] != $sReassignFromUser ) { - $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']); - $sCaseUser = G::getFormatUserList ($ConfEnv['format'],$aCaseUserRecord); -// $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; - $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $sCaseUser); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; - } - } +$TaskUid = isset( $_POST['task'] ) ? $_POST['task'] : ''; +$sReassignFromUser = isset( $_POST['currentUser'] ) ? $_POST['currentUser'] : ''; + +G::LoadClass( 'tasks' ); +G::LoadClass( 'groups' ); +G::LoadClass( 'case' ); +G::LoadClass( 'users' ); + +$oTasks = new Tasks(); +$oGroups = new Groups(); +$oUser = new Users(); +$oCases = new Cases(); + +$aCasesList = Array (); + +$aUsersInvolved = Array (); +$aCaseGroups = $oTasks->getGroupsOfTask( $TaskUid, 1 ); +$oConf = new Configurations(); +$ConfEnv = $oConf->getFormats(); +foreach ($aCaseGroups as $aCaseGroup) { + $aCaseUsers = $oGroups->getUsersOfGroup( $aCaseGroup['GRP_UID'] ); + foreach ($aCaseUsers as $aCaseUser) { + if ($aCaseUser['USR_UID'] != $sReassignFromUser) { + $aCaseUserRecord = $oUser->load( $aCaseUser['USR_UID'] ); + $sCaseUser = G::getFormatUserList( $ConfEnv['format'], $aCaseUserRecord ); + // $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; + $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $sCaseUser + ); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; + } + } +} + +$aCaseUsers = $oTasks->getUsersOfTask( $TaskUid, 1 ); +foreach ($aCaseUsers as $aCaseUser) { + if ($aCaseUser['USR_UID'] != $sReassignFromUser) { + $aCaseUserRecord = $oUser->load( $aCaseUser['USR_UID'] ); + $sCaseUser = G::getFormatUserList( $ConfEnv['format'], $aCaseUserRecord ); + // $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; + $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $sCaseUser + ); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')'; + } +} // $oTmp = new stdClass(); // $oTmp->items = $aUsersInvolved; - $result = array(); - $aUsersInvolved = array_sort($aUsersInvolved,'userFullname',SORT_ASC, $query); - $result['data'] = $aUsersInvolved; - print G::json_encode( $result ) ; +$result = array (); +$aUsersInvolved = array_sort( $aUsersInvolved, 'userFullname', SORT_ASC, $query ); +$result['data'] = $aUsersInvolved; +print G::json_encode( $result ); diff --git a/workflow/engine/methods/cases/proxySaveReassignCasesList.php b/workflow/engine/methods/cases/proxySaveReassignCasesList.php index 3b1d4cb2b..dc3657acd 100755 --- a/workflow/engine/methods/cases/proxySaveReassignCasesList.php +++ b/workflow/engine/methods/cases/proxySaveReassignCasesList.php @@ -1,97 +1,95 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - $aData = G::json_decode($_POST['data']); - $appSelectedUids = array (); - $items = explode(",",$_POST['APP_UIDS']); - foreach ($items as $item) { - $dataUids = explode("|",$item); - $appSelectedUids[] = $dataUids[0]; - } - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +$aData = G::json_decode( $_POST['data'] ); +$appSelectedUids = array (); +$items = explode( ",", $_POST['APP_UIDS'] ); +foreach ($items as $item) { + $dataUids = explode( "|", $item ); + $appSelectedUids[] = $dataUids[0]; +} + // var_dump($aData); //var_dump($appSelectedUids); - $casesReassignedCount = 0; - $serverResponse = array(); - G::LoadClass ('case'); - $oCases = new Cases(); - require_once ('classes/model/Task.php'); - require_once ('classes/model/AppCacheView.php'); - $oAppCacheView = new AppCacheView(); - $oCasesReassignList = $oAppCacheView->getToReassignListCriteria(); - if (isset($_POST['selected'])&&$_POST['selected']=='true'){ - $oCasesReassignList->add(AppCacheViewPeer::APP_UID,$appSelectedUids,Criteria::IN); - } - // if there are no records to save return -1 - if (empty($aData)){ - $serverResponse['TOTAL']=-1; - echo G::json_encode($serverResponse); - die(); - } +$casesReassignedCount = 0; +$serverResponse = array (); +G::LoadClass( 'case' ); +$oCases = new Cases(); +require_once ('classes/model/Task.php'); +require_once ('classes/model/AppCacheView.php'); +$oAppCacheView = new AppCacheView(); +$oCasesReassignList = $oAppCacheView->getToReassignListCriteria(); +if (isset( $_POST['selected'] ) && $_POST['selected'] == 'true') { + $oCasesReassignList->add( AppCacheViewPeer::APP_UID, $appSelectedUids, Criteria::IN ); +} +// if there are no records to save return -1 +if (empty( $aData )) { + $serverResponse['TOTAL'] = - 1; + echo G::json_encode( $serverResponse ); + die(); +} // $params = array (); // $sql = BasePeer::createSelectSql($oCasesReassignList, $params); // var_dump($sql); - if ( is_array($aData) ) { - $currentCasesReassigned=0; - foreach ($aData as $data){ - $oTmpReassignCriteria = $oCasesReassignList; - $oTmpReassignCriteria->add(AppCacheViewPeer::TAS_UID,$data->TAS_UID); - $rs = AppCacheViewPeer::doSelectRS($oTmpReassignCriteria); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $aCase = $oCases->loadCaseInCurrentDelegation($data->APP_UID); - $oCases->reassignCase($aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $data->APP_REASSIGN_USER_UID); - $currentCasesReassigned++; - $casesReassignedCount++; - $serverResponse[] = array ('APP_REASSIGN_USER' => $data->APP_REASSIGN_USER, - 'APP_TITLE' => $data->APP_TITLE, - 'TAS_TITLE' => $data->APP_TAS_TITLE, - 'REASSIGNED_CASES' => $currentCasesReassigned); - } - } - else { - $oTmpReassignCriteria = $oCasesReassignList; - $oTmpReassignCriteria->add(AppCacheViewPeer::TAS_UID,$aData->TAS_UID); - $rs = AppCacheViewPeer::doSelectRS($oTmpReassignCriteria); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $currentCasesReassigned=0; - while (is_array($row)) { - $APP_UID = $row['APP_UID']; - $aCase = $oCases->loadCaseInCurrentDelegation($APP_UID); - $oCases->reassignCase($aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $aData->APP_REASSIGN_USER_UID); - $currentCasesReassigned++; - $casesReassignedCount++; -// var_dump($aCase); -// echo ("
"); - $rs->next(); - $row = $rs->getRow(); - } - $serverResponse[] = array ('TAS_TITLE'=>$aData->APP_TAS_TITLE,'REASSIGNED_CASES'=>$currentCasesReassigned); - } - - $serverResponse['TOTAL'] = $casesReassignedCount; - echo G::json_encode($serverResponse); +if (is_array( $aData )) { + $currentCasesReassigned = 0; + foreach ($aData as $data) { + $oTmpReassignCriteria = $oCasesReassignList; + $oTmpReassignCriteria->add( AppCacheViewPeer::TAS_UID, $data->TAS_UID ); + $rs = AppCacheViewPeer::doSelectRS( $oTmpReassignCriteria ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + $row = $rs->getRow(); + $aCase = $oCases->loadCaseInCurrentDelegation( $data->APP_UID ); + $oCases->reassignCase( $aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $data->APP_REASSIGN_USER_UID ); + $currentCasesReassigned ++; + $casesReassignedCount ++; + $serverResponse[] = array ('APP_REASSIGN_USER' => $data->APP_REASSIGN_USER,'APP_TITLE' => $data->APP_TITLE,'TAS_TITLE' => $data->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned + ); + } +} else { + $oTmpReassignCriteria = $oCasesReassignList; + $oTmpReassignCriteria->add( AppCacheViewPeer::TAS_UID, $aData->TAS_UID ); + $rs = AppCacheViewPeer::doSelectRS( $oTmpReassignCriteria ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + $row = $rs->getRow(); + $currentCasesReassigned = 0; + while (is_array( $row )) { + $APP_UID = $row['APP_UID']; + $aCase = $oCases->loadCaseInCurrentDelegation( $APP_UID ); + $oCases->reassignCase( $aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $aData->APP_REASSIGN_USER_UID ); + $currentCasesReassigned ++; + $casesReassignedCount ++; + // var_dump($aCase); + // echo ("
"); + $rs->next(); + $row = $rs->getRow(); + } + $serverResponse[] = array ('TAS_TITLE' => $aData->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned + ); +} + +$serverResponse['TOTAL'] = $casesReassignedCount; +echo G::json_encode( $serverResponse ); + diff --git a/workflow/engine/methods/cases/summary.php b/workflow/engine/methods/cases/summary.php index 1678dcfb7..c9e151de5 100755 --- a/workflow/engine/methods/cases/summary.php +++ b/workflow/engine/methods/cases/summary.php @@ -1,80 +1,77 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -try { - global $RBAC; - switch ($RBAC->userCanAccess('PM_CASES')) { - case -2: - throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM')); - break; - case -1: - throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE')); - break; - } - - if (!isset($_REQUEST['APP_UID']) || !isset($_REQUEST['DEL_INDEX']) || !isset($_REQUEST['DYN_UID'])) { - throw new Exception(G::LoadTranslation('ID_REQUIRED_FIELDS_ERROR') . ' (APP_UID, DEL_INDEX, DYN_UID)'); - } - - if ($_REQUEST['APP_UID'] == '' || $_REQUEST['DEL_INDEX'] == '' || $_REQUEST['DYN_UID'] == '') { - throw new Exception(G::LoadTranslation('ID_REQUIRED_FIELDS_ERROR') . ' (APP_UID, DEL_INDEX, DYN_UID)'); - } - - G::LoadClass('case'); - $case = new Cases(); - if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $case->userParticipatedInCase($_REQUEST['APP_UID'], $_SESSION['USER_LOGGED']) == 0) { - throw new Exception(G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED')); - } - - $applicationFields = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); - - if (file_exists(PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml')) { - $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; - $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = '#'; - $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; - $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = '#'; - - G::LoadClass ('dbConnections'); - $_SESSION['PROCESS'] = $applicationFields['PRO_UID']; - $dbConnections = new dbConnections($_SESSION['PROCESS']); - $dbConnections->loadAdditionalConnections(); - $_SESSION['CURRENT_DYN_UID'] = $_REQUEST['DYN_UID']; - - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('dynaform', 'xmlform', $applicationFields['PRO_UID'] . '/' . $_REQUEST['DYN_UID'], '', $applicationFields['APP_DATA'], '', '', 'view'); - G::RenderPage('publish', 'blank'); - } - else { - throw new Exception(G::LoadTranslation('INVALID_FILE') . ': ' . $_REQUEST['DYN_UID']); - } -} -catch (Exception $error) { - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage())); - G::RenderPage('publish', 'blank'); - die(); -} \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { + global $RBAC; + switch ($RBAC->userCanAccess( 'PM_CASES' )) { + case - 2: + throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' ) ); + break; + case - 1: + throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_PAGE' ) ); + break; + } + + if (! isset( $_REQUEST['APP_UID'] ) || ! isset( $_REQUEST['DEL_INDEX'] ) || ! isset( $_REQUEST['DYN_UID'] )) { + throw new Exception( G::LoadTranslation( 'ID_REQUIRED_FIELDS_ERROR' ) . ' (APP_UID, DEL_INDEX, DYN_UID)' ); + } + + if ($_REQUEST['APP_UID'] == '' || $_REQUEST['DEL_INDEX'] == '' || $_REQUEST['DYN_UID'] == '') { + throw new Exception( G::LoadTranslation( 'ID_REQUIRED_FIELDS_ERROR' ) . ' (APP_UID, DEL_INDEX, DYN_UID)' ); + } + G::LoadClass( 'case' ); + $case = new Cases(); + if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $case->userParticipatedInCase( $_REQUEST['APP_UID'], $_SESSION['USER_LOGGED'] ) == 0) { + throw new Exception( G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ) ); + } + $applicationFields = $case->loadCase( $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'] ); + + if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) { + $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; + $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = '#'; + $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; + $applicationFields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = '#'; + + G::LoadClass( 'dbConnections' ); + $_SESSION['PROCESS'] = $applicationFields['PRO_UID']; + $dbConnections = new dbConnections( $_SESSION['PROCESS'] ); + $dbConnections->loadAdditionalConnections(); + $_SESSION['CURRENT_DYN_UID'] = $_REQUEST['DYN_UID']; + + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $applicationFields['PRO_UID'] . '/' . $_REQUEST['DYN_UID'], '', $applicationFields['APP_DATA'], '', '', 'view' ); + G::RenderPage( 'publish', 'blank' ); + } else { + throw new Exception( G::LoadTranslation( 'INVALID_FILE' ) . ': ' . $_REQUEST['DYN_UID'] ); + } +} catch (Exception $error) { + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => $error->getMessage() + ) ); + G::RenderPage( 'publish', 'blank' ); + die(); +} + From 8873ca4a95ac1a3455b171b24bd6531fba6dc73c Mon Sep 17 00:00:00 2001 From: Ralph Asendeteufrer Date: Thu, 18 Oct 2012 12:09:50 -0400 Subject: [PATCH 4/5] changes: sizeof got a $, fix. --- gulliver/system/class.xmlform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 327e4f764..38185148c 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -560,7 +560,7 @@ class XmlForm_Field $events[$attribute] = $value; } } - if ($sizeof( $events ) < 1) { + if (sizeof( $events ) < 1) { return '{}'; } return $json->encode( $events ); From 2d90e0653dc4b8cd9e77b03c7a822ea0c126ffda Mon Sep 17 00:00:00 2001 From: norahmollo Date: Thu, 18 Oct 2012 16:33:24 +0000 Subject: [PATCH 5/5] CODE STYLE Formating workflow/engine/methods/cases Change format files in workflow/engine/methods/cases --- workflow/engine/methods/cases/casesDemo.php | 344 +++++++++--------- .../cases/casesGenerateDocumentPage_Ajax.php | 2 - .../cases/casesHistoryDynaformPage_Ajax.php | 2 - .../engine/methods/cases/casesListExtJs.php | 39 +- .../cases/casesListExtJsRedirector.php | 4 - .../engine/methods/cases/casesList_Ajax.php | 10 +- .../engine/methods/cases/casesMenuLoader.php | 3 - .../methods/cases/casesSaveDataView.php | 5 - .../methods/cases/casesSchedulerLog_Ajax.php | 1 + .../engine/methods/cases/casesStartPage.php | 3 - .../methods/cases/casesStartPage_Ajax.php | 13 +- .../methods/cases/casesToRevisePanelExtJs.php | 3 +- .../cases/casesToReviseTreeContent.php | 3 - .../methods/cases/data_casesSchedulerLog.php | 5 - .../engine/methods/cases/debug_triggers.php | 5 - workflow/engine/methods/cases/debug_vars.php | 5 - workflow/engine/methods/cases/index.php | 1 + workflow/engine/methods/cases/open.php | 1 - .../engine/methods/cases/proxyCasesList.php | 1 - .../engine/methods/cases/proxyProcessList.php | 1 - .../methods/cases/proxyReassignCasesList.php | 7 +- .../methods/cases/proxyReassignUsersList.php | 2 - .../cases/proxySaveReassignCasesList.php | 5 +- workflow/engine/methods/cases/summary.php | 3 +- workflow/engine/methods/dashboard/main.php | 18 +- 25 files changed, 210 insertions(+), 276 deletions(-) diff --git a/workflow/engine/methods/cases/casesDemo.php b/workflow/engine/methods/cases/casesDemo.php index 644ddff14..49d16a868 100755 --- a/workflow/engine/methods/cases/casesDemo.php +++ b/workflow/engine/methods/cases/casesDemo.php @@ -1,170 +1,178 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -try { - -$rows[] = array ( 'uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' ); -$rows[] = array ( 'uid' => 11, 'name' => 'john', 'age' => 44, 'balance' => 123423 ); -$rows[] = array ( 'uid' => 22, 'name' => 'bobby', 'age' => 33, 'balance' => 23456 ); -$rows[] = array ( 'uid' => 33, 'name' => 'Dan', 'age' => 22, 'balance' => 34567 ); -$rows[] = array ( 'uid' => 33, 'name' => 'Mike', 'age' => 21, 'balance' => 4567 ); -$rows[] = array ( 'uid' => 44, 'name' => 'Paul', 'age' => 22, 'balance' => 567 ); -$rows[] = array ( 'uid' => 55, 'name' => 'Will', 'age' => 23, 'balance' => 67 ); -$rows[] = array ( 'uid' => 66, 'name' => 'Ernest', 'age' => 24, 'balance' => 7 ); -$rows[] = array ( 'uid' => 77, 'name' => 'Albert', 'age' => 25, 'balance' => 84567 ); -$rows[] = array ( 'uid' => 88, 'name' => 'Sue', 'age' => 26, 'balance' => 94567 ); -$rows[] = array ( 'uid' => 99, 'name' => 'Freddy', 'age' => 22, 'balance' => 04567 ); - -$_DBArray['user'] = $rows; -$_SESSION['_DBArray'] = $_DBArray; -//krumo ( $_DBArray ); - - G::LoadClass( 'ArrayPeer'); - $c = new Criteria ('dbarray'); - $c->setDBArrayTable('user'); -// $c->add ( 'user.age', 22 , Criteria::GREATER_EQUAL ); -// $c->add ( 'user.age', 22 , Criteria::EQUAL ); - $c->add ( 'user.name', '%au%' , Criteria::LIKE ); -// $c->add ( 'user.balance', 3456 , Criteria::GREATER_EQUAL ); - $c->addAscendingOrderByColumn ('name'); - - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_PUBLISH = new Publisher; -// $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/casesDemo', $c ); - //$G_PUBLISH->AddContent('smarty', 'cases/casesDemo', '', '', $Fields); -// G::RenderPage( "publish" ); -//die; - -/* Includes */ -G::LoadClass('pmScript'); -G::LoadClass('case'); -G::LoadClass('derivation'); -$oCase = new Cases (); -$appUid = isset ($_SESSION['APPLICATION']) ? $_SESSION['APPLICATION'] : ''; -$appFields = $oCase->loadCase( $appUid ); - -$Fields['APP_UID'] = $appFields['APP_UID']; -$Fields['APP_NUMBER'] = $appFields['APP_NUMBER']; -$Fields['APP_STATUS'] = $appFields['APP_STATUS']; -$Fields['STATUS'] = $appFields['STATUS']; -$Fields['APP_TITLE'] = $appFields['TITLE']; -$Fields['PRO_UID'] = $appFields['PRO_UID']; -$Fields['APP_PARALLEL'] = $appFields['APP_PARALLEL']; -$Fields['APP_INIT_USER'] = $appFields['APP_INIT_USER']; -$Fields['APP_CUR_USER'] = $appFields['APP_CUR_USER']; -$Fields['APP_DATA'] = $appFields['APP_DATA']; -$Fields['CREATOR'] = $appFields['CREATOR']; -$Fields['APP_PIN'] = $appFields['APP_PIN']; -$Fields['APP_PROC_CODE'] = $appFields['APP_PROC_CODE']; - -$Fields['PRO_TITLE'] = Content::load ( 'PRO_TITLE', '', $appFields['PRO_UID'], SYS_LANG ); -$oUser = new Users(); -$oUser->load( $appFields['APP_CUR_USER'] ); -$Fields['CUR_USER'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); - -$threads = $oCase->GetAllThreads ($appFields['APP_UID']); -$Fields['THREADS'] = $threads; -$Fields['CANT_THREADS'] = count($threads); - -$Fields['CANT_APP_DATA'] = count($Fields['APP_DATA']); -$delegations = $oCase->GetAllDelegations ($appFields['APP_UID']); -foreach ( $delegations as $key => $val ) { - $delegations[$key]['TAS_TITLE'] = Content::load ( 'TAS_TITLE', '', $val['TAS_UID'], SYS_LANG ); - if ($val['USR_UID'] != -1) { - $oUser->load( $val['USR_UID'] ); - $delegations[$key]['USR_NAME'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); - } - else { - $delegations[$key]['USR_NAME'] = 'Unknow user (Sub-Process User)'; - } -} -$Fields['CANT_DELEGATIONS'] = count($delegations); -$Fields['DELEGATIONS'] = $delegations; - -require_once 'classes/model/AppDelay.php'; -$oCriteria = new Criteria('workflow'); -$oCriteria->addSelectColumn(AppDelayPeer::APP_THREAD_INDEX); -$oCriteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX); -$oCriteria->addSelectColumn(AppDelayPeer::APP_TYPE); -$oCriteria->addSelectColumn(AppDelayPeer::APP_STATUS); -$oCriteria->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_USER); -$oCriteria->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE); -$oCriteria->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_USER); -$oCriteria->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE); -$oCriteria->add(AppDelayPeer::APP_UID, $appUid); -$oCriteria->addAscendingOrderByColumn(AppDelayPeer::APP_TYPE); -$oCriteria->addAscendingOrderByColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE); -$oDataset = AppDelayPeer::doSelectRS($oCriteria); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$oDataset->next(); -$aDelays = array(); -while ($aRow = $oDataset->getRow()) { - $aDelays[] = $aRow; - $oDataset->next(); -} -$Fields['DELAYS'] = $aDelays; -$Fields['CANT_DELAYS'] = count($aDelays); - -require_once 'classes/model/SubApplication.php'; -$oCriteria = new Criteria('workflow'); -$oCriteria->addSelectColumn(SubApplicationPeer::APP_UID ); -$oCriteria->addSelectColumn(SubApplicationPeer::APP_PARENT ); -$oCriteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT ); -$oCriteria->addSelectColumn(SubApplicationPeer::DEL_THREAD_PARENT); -$oCriteria->addSelectColumn(SubApplicationPeer::SA_STATUS ); -$oCriteria->addSelectColumn(SubApplicationPeer::SA_INIT_DATE ); -$oCriteria->addSelectColumn(SubApplicationPeer::SA_FINISH_DATE); -$oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER); -$oCriteria->add(SubApplicationPeer::APP_UID, $appUid); -$oCriteria->addJoin(ApplicationPeer::APP_UID, SubApplicationPeer::APP_PARENT, Criteria::LEFT_JOIN); -$oCriteria->addAscendingOrderByColumn(SubApplicationPeer::APP_UID); -$oDataset = SubApplicationPeer::doSelectRS($oCriteria); -$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$oDataset->next(); -$aSubprocess = array(); -while ($aRow = $oDataset->getRow()) { - $aSubprocess[] = $aRow; - $oDataset->next(); -} -$Fields['SUBAPPLICATIONS'] = $aSubprocess; -$Fields['CANT_SUBAPPLICATIONS'] = count($aSubprocess); - - /* Render page */ - $G_MAIN_MENU = 'processmaker'; - $G_ID_MENU_SELECTED = 'CASES'; - $G_PUBLISH = new Publisher; - //$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/casesDemo', $c ); - $G_PUBLISH->AddContent('smarty', 'cases/casesDemo', '', '', $Fields); - G::RenderPage( "publish" ); - -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage('publish'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +try { + + $rows[] = array ('uid' => 'char','name' => 'char','age' => 'integer','balance' => 'float' + ); + $rows[] = array ('uid' => 11,'name' => 'john','age' => 44,'balance' => 123423 + ); + $rows[] = array ('uid' => 22,'name' => 'bobby','age' => 33,'balance' => 23456 + ); + $rows[] = array ('uid' => 33,'name' => 'Dan','age' => 22,'balance' => 34567 + ); + $rows[] = array ('uid' => 33,'name' => 'Mike','age' => 21,'balance' => 4567 + ); + $rows[] = array ('uid' => 44,'name' => 'Paul','age' => 22,'balance' => 567 + ); + $rows[] = array ('uid' => 55,'name' => 'Will','age' => 23,'balance' => 67 + ); + $rows[] = array ('uid' => 66,'name' => 'Ernest','age' => 24,'balance' => 7 + ); + $rows[] = array ('uid' => 77,'name' => 'Albert','age' => 25,'balance' => 84567 + ); + $rows[] = array ('uid' => 88,'name' => 'Sue','age' => 26,'balance' => 94567 + ); + $rows[] = array ('uid' => 99,'name' => 'Freddy','age' => 22,'balance' => 04567 + ); + + $_DBArray['user'] = $rows; + $_SESSION['_DBArray'] = $_DBArray; + //krumo ( $_DBArray ); + G::LoadClass( 'ArrayPeer' ); + $c = new Criteria( 'dbarray' ); + $c->setDBArrayTable( 'user' ); + // $c->add ( 'user.age', 22 , Criteria::GREATER_EQUAL ); + // $c->add ( 'user.age', 22 , Criteria::EQUAL ); + $c->add( 'user.name', '%au%', Criteria::LIKE ); + // $c->add ( 'user.balance', 3456 , Criteria::GREATER_EQUAL ); + $c->addAscendingOrderByColumn( 'name' ); + + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_PUBLISH = new Publisher(); + // $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/casesDemo', $c ); + //$G_PUBLISH->AddContent('smarty', 'cases/casesDemo', '', '', $Fields); + // G::RenderPage( "publish" ); + //die; + + + /* Includes */ + G::LoadClass( 'pmScript' ); + G::LoadClass( 'case' ); + G::LoadClass( 'derivation' ); + $oCase = new Cases(); + $appUid = isset( $_SESSION['APPLICATION'] ) ? $_SESSION['APPLICATION'] : ''; + $appFields = $oCase->loadCase( $appUid ); + + $Fields['APP_UID'] = $appFields['APP_UID']; + $Fields['APP_NUMBER'] = $appFields['APP_NUMBER']; + $Fields['APP_STATUS'] = $appFields['APP_STATUS']; + $Fields['STATUS'] = $appFields['STATUS']; + $Fields['APP_TITLE'] = $appFields['TITLE']; + $Fields['PRO_UID'] = $appFields['PRO_UID']; + $Fields['APP_PARALLEL'] = $appFields['APP_PARALLEL']; + $Fields['APP_INIT_USER'] = $appFields['APP_INIT_USER']; + $Fields['APP_CUR_USER'] = $appFields['APP_CUR_USER']; + $Fields['APP_DATA'] = $appFields['APP_DATA']; + $Fields['CREATOR'] = $appFields['CREATOR']; + $Fields['APP_PIN'] = $appFields['APP_PIN']; + $Fields['APP_PROC_CODE'] = $appFields['APP_PROC_CODE']; + + $Fields['PRO_TITLE'] = Content::load( 'PRO_TITLE', '', $appFields['PRO_UID'], SYS_LANG ); + $oUser = new Users(); + $oUser->load( $appFields['APP_CUR_USER'] ); + $Fields['CUR_USER'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); + + $threads = $oCase->GetAllThreads( $appFields['APP_UID'] ); + $Fields['THREADS'] = $threads; + $Fields['CANT_THREADS'] = count( $threads ); + + $Fields['CANT_APP_DATA'] = count( $Fields['APP_DATA'] ); + $delegations = $oCase->GetAllDelegations( $appFields['APP_UID'] ); + foreach ($delegations as $key => $val) { + $delegations[$key]['TAS_TITLE'] = Content::load( 'TAS_TITLE', '', $val['TAS_UID'], SYS_LANG ); + if ($val['USR_UID'] != - 1) { + $oUser->load( $val['USR_UID'] ); + $delegations[$key]['USR_NAME'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); + } else { + $delegations[$key]['USR_NAME'] = 'Unknow user (Sub-Process User)'; + } + } + $Fields['CANT_DELEGATIONS'] = count( $delegations ); + $Fields['DELEGATIONS'] = $delegations; + + require_once 'classes/model/AppDelay.php'; + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_THREAD_INDEX ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_TYPE ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_STATUS ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_ENABLE_ACTION_USER ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_DISABLE_ACTION_USER ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_DISABLE_ACTION_DATE ); + $oCriteria->add( AppDelayPeer::APP_UID, $appUid ); + $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_TYPE ); + $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); + $oDataset = AppDelayPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aDelays = array (); + while ($aRow = $oDataset->getRow()) { + $aDelays[] = $aRow; + $oDataset->next(); + } + $Fields['DELAYS'] = $aDelays; + $Fields['CANT_DELAYS'] = count( $aDelays ); + + require_once 'classes/model/SubApplication.php'; + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( SubApplicationPeer::APP_UID ); + $oCriteria->addSelectColumn( SubApplicationPeer::APP_PARENT ); + $oCriteria->addSelectColumn( SubApplicationPeer::DEL_INDEX_PARENT ); + $oCriteria->addSelectColumn( SubApplicationPeer::DEL_THREAD_PARENT ); + $oCriteria->addSelectColumn( SubApplicationPeer::SA_STATUS ); + $oCriteria->addSelectColumn( SubApplicationPeer::SA_INIT_DATE ); + $oCriteria->addSelectColumn( SubApplicationPeer::SA_FINISH_DATE ); + $oCriteria->addSelectColumn( ApplicationPeer::APP_NUMBER ); + $oCriteria->add( SubApplicationPeer::APP_UID, $appUid ); + $oCriteria->addJoin( ApplicationPeer::APP_UID, SubApplicationPeer::APP_PARENT, Criteria::LEFT_JOIN ); + $oCriteria->addAscendingOrderByColumn( SubApplicationPeer::APP_UID ); + $oDataset = SubApplicationPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aSubprocess = array (); + while ($aRow = $oDataset->getRow()) { + $aSubprocess[] = $aRow; + $oDataset->next(); + } + $Fields['SUBAPPLICATIONS'] = $aSubprocess; + $Fields['CANT_SUBAPPLICATIONS'] = count( $aSubprocess ); + + /* Render page */ + $G_MAIN_MENU = 'processmaker'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_PUBLISH = new Publisher(); + //$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/casesDemo', $c ); + $G_PUBLISH->AddContent( 'smarty', 'cases/casesDemo', '', '', $Fields ); + G::RenderPage( "publish" ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish' ); } diff --git a/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php b/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php index 58db609e5..9952e4472 100644 --- a/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php +++ b/workflow/engine/methods/cases/casesGenerateDocumentPage_Ajax.php @@ -74,7 +74,6 @@ function casesShowOuputDocumentExist ($url) if ($actionAjax == 'casesGenerateDocumentPage') { global $G_PUBLISH; - $oHeadPublisher = & headPublisher::getSingleton(); G::loadClass( 'configuration' ); $conf = new Configurations(); @@ -128,7 +127,6 @@ if ($actionAjax == 'generateDocumentGrid_Ajax') { if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { $dateFormat = $generalConfCasesList['casesListDateFormat']; } - $newDir = '/tmp/test/directory'; $r = G::verifyPath( $newDir ); $r->data = $aProcesses; diff --git a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php index b89da3608..89ec3695f 100644 --- a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php +++ b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php @@ -121,7 +121,6 @@ body { } if ($actionAjax == 'showDynaformListHistory') { - //!dataIndex $_POST["APP_UID"] = $_REQUEST["APP_UID"]; $_POST["DYN_UID"] = $_REQUEST["DYN_UID"]; @@ -141,7 +140,6 @@ body { diff --git a/workflow/engine/methods/cases/casesList_Ajax.php b/workflow/engine/methods/cases/casesList_Ajax.php index 8b454572e..378e69b90 100755 --- a/workflow/engine/methods/cases/casesList_Ajax.php +++ b/workflow/engine/methods/cases/casesList_Ajax.php @@ -27,7 +27,6 @@ require_once 'classes/model/AppThread.php'; require_once 'classes/model/AppDelay.php'; require_once 'classes/model/Process.php'; require_once 'classes/model/Task.php'; - require_once ("classes/model/AppCacheView.php"); require_once ("classes/model/AppDelegation.php"); require_once ("classes/model/AdditionalTables.php"); @@ -74,12 +73,9 @@ if ($actionAjax == "processListExtJs") { } $del = DBAdapter::getStringDelimiter(); $conds = array (); - $conds[] = array (ProcessPeer::PRO_UID,ContentPeer::CON_ID - ); - $conds[] = array (ContentPeer::CON_CATEGORY,$del . 'PRO_TITLE' . $del - ); - $conds[] = array (ContentPeer::CON_LANG,$del . $lang . $del - ); + $conds[] = array (ProcessPeer::PRO_UID,ContentPeer::CON_ID); + $conds[] = array (ContentPeer::CON_CATEGORY,$del . 'PRO_TITLE' . $del); + $conds[] = array (ContentPeer::CON_LANG,$del . $lang . $del); $cProcess->addJoinMC( $conds, Criteria::LEFT_JOIN ); $cProcess->add( ProcessPeer::PRO_STATUS, 'ACTIVE' ); $oDataset = ProcessPeer::doSelectRS( $cProcess ); diff --git a/workflow/engine/methods/cases/casesMenuLoader.php b/workflow/engine/methods/cases/casesMenuLoader.php index 6641b6cb9..def25208e 100755 --- a/workflow/engine/methods/cases/casesMenuLoader.php +++ b/workflow/engine/methods/cases/casesMenuLoader.php @@ -1,9 +1,7 @@ validatePost (); - /* @author Alvaro Campos Sanchez */ /* Includes */ G::LoadClass( 'case' ); @@ -39,11 +38,7 @@ $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], (array) $_POST['form'] ) #here we must verify if is a debug session $trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session - - #trigger debug routines... - - //cleaning debug variables $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); $_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); diff --git a/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php b/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php index 8b879cd01..4428bfa96 100755 --- a/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php +++ b/workflow/engine/methods/cases/casesSchedulerLog_Ajax.php @@ -10,6 +10,7 @@ * published by the Free Software Foundation, either version 3 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 diff --git a/workflow/engine/methods/cases/casesStartPage.php b/workflow/engine/methods/cases/casesStartPage.php index 7b8529e05..9cee81578 100755 --- a/workflow/engine/methods/cases/casesStartPage.php +++ b/workflow/engine/methods/cases/casesStartPage.php @@ -13,8 +13,6 @@ global $RBAC; switch ($page) { case "startCase": $oHeadPublisher->addExtJsScript( 'cases/casesStartCase', true ); //adding a javascript file .js - - $oHeadPublisher->addContent( 'cases/casesStartCase' ); //adding a html file .html. G::LoadClass( 'configuration' ); $c = new Configurations(); @@ -43,6 +41,5 @@ switch ($page) { break; } - G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/methods/cases/casesStartPage_Ajax.php b/workflow/engine/methods/cases/casesStartPage_Ajax.php index 37eefa9fb..65ea77ced 100755 --- a/workflow/engine/methods/cases/casesStartPage_Ajax.php +++ b/workflow/engine/methods/cases/casesStartPage_Ajax.php @@ -92,10 +92,7 @@ function getProcessList () $tempTreeChild['otherAttributes'] = array_merge( $processInfoChild, $proData[$processInfoChild['pro_uid']], $calendar->getCalendarFor( $processInfoChild['uid'], $processInfoChild['uid'], $processInfoChild['uid'] ) ); $tempTreeChild['otherAttributes']['PRO_TAS_TITLE'] = str_replace( ")", "", str_replace( "(", "", trim( str_replace( $tempTreeChild['otherAttributes']['PRO_TITLE'], "", $tempTreeChild['otherAttributes']["value"] ) ) ) ); $tempTreeChild['qtip'] = $tempTreeChild['otherAttributes']['PRO_DESCRIPTION']; - //$tempTree['cls']='file'; - - $tempTreeChildren[] = $tempTreeChild; } } @@ -289,16 +286,10 @@ function getSimpleDashboardData () $Criteria->addSelectColumn( AppCacheViewPeer::USR_UID ); $Criteria->addSelectColumn( AppCacheViewPeer::APP_THREAD_STATUS ); - $Criteria->add( AppCacheViewPeer::APP_STATUS, array ("TO_DO","DRAFT" - ), CRITERIA::IN ); - $Criteria->add( AppCacheViewPeer::USR_UID, array ($sUIDUserLogged,"" - ), CRITERIA::IN ); - + $Criteria->add( AppCacheViewPeer::APP_STATUS, array ("TO_DO","DRAFT"), CRITERIA::IN ); + $Criteria->add( AppCacheViewPeer::USR_UID, array ($sUIDUserLogged,""), CRITERIA::IN ); $Criteria->add( AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); - //$Criteria->add ( AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN' ); - - $Criteria->add( AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN' ); //execute the query diff --git a/workflow/engine/methods/cases/casesToRevisePanelExtJs.php b/workflow/engine/methods/cases/casesToRevisePanelExtJs.php index 8a7514daa..7ddda8a4e 100755 --- a/workflow/engine/methods/cases/casesToRevisePanelExtJs.php +++ b/workflow/engine/methods/cases/casesToRevisePanelExtJs.php @@ -1,6 +1,7 @@ assign( 'TRANSLATIONS', $TRANSLATIONS); //translations diff --git a/workflow/engine/methods/cases/casesToReviseTreeContent.php b/workflow/engine/methods/cases/casesToReviseTreeContent.php index ea7631550..7f89f3a75 100755 --- a/workflow/engine/methods/cases/casesToReviseTreeContent.php +++ b/workflow/engine/methods/cases/casesToReviseTreeContent.php @@ -1,5 +1,4 @@ addDescendingOrderByColumn( LogCasesSchedulerPeer::EXEC_HOUR ); $oDataset = LogCasesSchedulerPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - //$oDataset = LogCasesSchedulerPeer::doSelectRS ( $oCriteria ); //$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); - - $addTables = Array (); while ($oDataset->next()) { $addTables[] = $oDataset->getRow(); } - //$oLogCasesScheduler = new LogCasesScheduler(); //$arrData = $oLogCasesScheduler->getAll(); - echo '{results: ' . $results . ', rows: ' . G::json_encode( $addTables ) . '}'; diff --git a/workflow/engine/methods/cases/debug_triggers.php b/workflow/engine/methods/cases/debug_triggers.php index 8e8adaacb..2d1ecfeba 100755 --- a/workflow/engine/methods/cases/debug_triggers.php +++ b/workflow/engine/methods/cases/debug_triggers.php @@ -4,7 +4,6 @@ if (isset( $_SESSION['TRIGGER_DEBUG']['info'] )) { } else { $aTriggers[0] = $_SESSION['TRIGGER_DEBUG']; } - //print_r($aTriggers);die; $triggersList = Array (); @@ -21,8 +20,6 @@ foreach ($aTriggers as $aTrigger) { //$t_code = str_replace('"', '\'',$t_code); //$t_code = addslashes($t_code); //$t_code = Only1br($t_code); - - //highlighting the trigger code using the geshi third party library G::LoadThirdParty( 'geshi', 'geshi' ); $geshi = new GeSHi( $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php' ); @@ -65,9 +62,7 @@ foreach ($DEBUG_ERRORS as $error) { ]}'; */ - $triggersRet->total = count( $triggersList ); $triggersRet->data = $triggersList; - echo G::json_encode( $triggersRet ); diff --git a/workflow/engine/methods/cases/debug_vars.php b/workflow/engine/methods/cases/debug_vars.php index 980e70dfa..5c4a3a0fa 100755 --- a/workflow/engine/methods/cases/debug_vars.php +++ b/workflow/engine/methods/cases/debug_vars.php @@ -1,15 +1,12 @@ loadCase( $_SESSION['APPLICATION'] ); - $aVars = Array (); for ($i = 0; $i < count( $_SESSION['TRIGGER_DEBUG']['DATA'] ); $i ++) { $aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value']; @@ -86,10 +83,8 @@ switch ($request) { if (isset( $_POST['filter'] ) && $_POST['filter'] == 'sys') { $aVars = G::getSystemConstants(); } - ksort( $aVars ); $return_object->totalCount = 1; - foreach ($aVars as $i => $var) { if (is_array( $var ) || is_object( $var )) { $aVars[$i] = print_r( $var, true ); diff --git a/workflow/engine/methods/cases/index.php b/workflow/engine/methods/cases/index.php index 12163259d..c020c4a37 100755 --- a/workflow/engine/methods/cases/index.php +++ b/workflow/engine/methods/cases/index.php @@ -20,6 +20,7 @@ * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * */ //$newFile = str_replace ( 'index.php', 'cases_List.php' , __FILE__ ) ; $newFile = str_replace( 'index.php', 'main.php', __FILE__ ); diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 8ce6740aa..ca624cfef 100755 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -83,6 +83,5 @@ $oHeadPublisher->assign( '_APP_NUM', '#: ' . $case['APP_NUMBER'] ); $oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d' ) ) ); $oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d' ) ); $oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() ); - G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/methods/cases/proxyCasesList.php b/workflow/engine/methods/cases/proxyCasesList.php index c723b56ad..bbc7f837d 100755 --- a/workflow/engine/methods/cases/proxyCasesList.php +++ b/workflow/engine/methods/cases/proxyCasesList.php @@ -18,7 +18,6 @@ $dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : ""; try { $result = ""; - $userUid = (isset( $_SESSION["USER_LOGGED"] ) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null; $user = ($user == "CURRENT_USER") ? $userUid : $user; diff --git a/workflow/engine/methods/cases/proxyProcessList.php b/workflow/engine/methods/cases/proxyProcessList.php index d2ec4330d..365a2affb 100755 --- a/workflow/engine/methods/cases/proxyProcessList.php +++ b/workflow/engine/methods/cases/proxyProcessList.php @@ -8,7 +8,6 @@ $option = ''; if (isset( $_GET['t'] )) $option = $_GET['t']; try { - G::LoadClass( "BasePeer" ); require_once ("classes/model/Process.php"); require_once ("classes/model/AppCacheView.php"); diff --git a/workflow/engine/methods/cases/proxyReassignCasesList.php b/workflow/engine/methods/cases/proxyReassignCasesList.php index ee9bc953f..163aa866e 100755 --- a/workflow/engine/methods/cases/proxyReassignCasesList.php +++ b/workflow/engine/methods/cases/proxyReassignCasesList.php @@ -21,8 +21,7 @@ $allTasUids = array (); // getting all App Uids and task Uids foreach ($sentUids as $sentUid) { $aItem = explode( '|', $sentUid ); - $allUidsRecords[] = array ('APP_UID' => $aItem[0],'TAS_UID' => $aItem[1],'DEL_INDEX' => $aItem[2] - ); + $allUidsRecords[] = array ('APP_UID' => $aItem[0],'TAS_UID' => $aItem[1],'DEL_INDEX' => $aItem[2]); } $sReassignFromUser = isset( $_POST['user'] ) ? $_POST['user'] : ''; @@ -55,8 +54,8 @@ foreach ($allUidsRecords as $aRecord) { foreach ($aCaseUsers as $aCaseUser) { if ($aCaseUser['USR_UID'] != $sReassignFromUser) { $aCaseUserRecord = $oUser->load( $aCaseUser['USR_UID'] ); - $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME'] - ); // . ' (' . $aCaseUserRecord['USR_USERNAME'] + $aUsersInvolved[] = array ('userUid' => $aCaseUser['USR_UID'],'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); + // . ' (' . $aCaseUserRecord['USR_USERNAME'] } } } diff --git a/workflow/engine/methods/cases/proxyReassignUsersList.php b/workflow/engine/methods/cases/proxyReassignUsersList.php index 6cbbb776d..372c3122a 100755 --- a/workflow/engine/methods/cases/proxyReassignUsersList.php +++ b/workflow/engine/methods/cases/proxyReassignUsersList.php @@ -1,7 +1,5 @@ next(); $row = $rs->getRow(); } - $serverResponse[] = array ('TAS_TITLE' => $aData->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned - ); + $serverResponse[] = array ('TAS_TITLE' => $aData->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned); } - $serverResponse['TOTAL'] = $casesReassignedCount; echo G::json_encode( $serverResponse ); diff --git a/workflow/engine/methods/cases/summary.php b/workflow/engine/methods/cases/summary.php index c9e151de5..b22371795 100755 --- a/workflow/engine/methods/cases/summary.php +++ b/workflow/engine/methods/cases/summary.php @@ -69,8 +69,7 @@ try { } catch (Exception $error) { global $G_PUBLISH; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => $error->getMessage() - ) ); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => $error->getMessage()) ); G::RenderPage( 'publish', 'blank' ); die(); } diff --git a/workflow/engine/methods/dashboard/main.php b/workflow/engine/methods/dashboard/main.php index 209c0b172..f334d0e69 100644 --- a/workflow/engine/methods/dashboard/main.php +++ b/workflow/engine/methods/dashboard/main.php @@ -12,22 +12,22 @@ * * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ -$RBAC->requirePermissions('PM_DASHBOARD'); +$RBAC->requirePermissions( 'PM_DASHBOARD' ); -$G_MAIN_MENU = 'processmaker'; -$G_ID_MENU_SELECTED = 'DASHBOARD'; +$G_MAIN_MENU = 'processmaker'; +$G_ID_MENU_SELECTED = 'DASHBOARD'; + +$G_PUBLISH = new Publisher(); +$G_PUBLISH->AddContent( 'view', 'dashboard/load' ); +G::RenderPage( 'publish' ); -$G_PUBLISH = new Publisher; -$G_PUBLISH->AddContent('view', 'dashboard/load'); -G::RenderPage('publish');