Merge pull request #838 from ralpheav/master

Code Style change  workflow/engine/methods/cases/
This commit is contained in:
ferOnti
2012-10-19 11:51:22 -07:00
14 changed files with 2140 additions and 2130 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,65 +1,65 @@
<?php <?php
/** /**
* cases_CatchExecute.php * cases_CatchExecute.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
if (isset( $_POST['form']['BTN_CANCEL'] )) { if (isset( $_POST['form']['BTN_CANCEL'] )) {
header( "Location: ../cases/main" ); header( "Location: ../cases/main" );
die(); die();
} }
/* Includes */ /* Includes */
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$sAppUid = $_SESSION['APPLICATION']; $sAppUid = $_SESSION['APPLICATION'];
$iDelIndex = $_SESSION['INDEX']; $iDelIndex = $_SESSION['INDEX'];
$oAppDelegation = new AppDelegation(); $oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
//if there are no user in the delegation row, this case is still in selfservice //if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") { if ($aDelegation['USR_UID'] == "") {
$oCase->setCatchUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'] ); $oCase->setCatchUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'] );
} else { } else {
G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' ); G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
} }
$validation = (SYS_SKIN != 'uxs') ? 'true' : 'false'; $validation = (SYS_SKIN != 'uxs') ? 'true' : 'false';
die( '<script type="text/javascript"> die( '<script type="text/javascript">
if (' . $validation . ') { if (' . $validation . ') {
if (window.parent.frames.length != 0) { if (window.parent.frames.length != 0) {
@@ -70,5 +70,5 @@ die( '<script type="text/javascript">
} else { } else {
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned"; window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
} }
</script>' ); </script>' );

View File

@@ -1,90 +1,90 @@
<?php <?php
/** /**
* cases_Resume.php * cases_Resume.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
/* Includes */ /* Includes */
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
/* Render page */ /* Render page */
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php'; require_once 'classes/model/Task.php';
$objProc = new Process(); $objProc = new Process();
$aProc = $objProc->load( $Fields['PRO_UID'] ); $aProc = $objProc->load( $Fields['PRO_UID'] );
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; $Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
$objTask = new Task(); $objTask = new Task();
$aTask = $objTask->load( $Fields['TAS_UID'] ); $aTask = $objTask->load( $Fields['TAS_UID'] );
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; $Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
$Fields['STATUS'] .= ' ( ' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ' )'; $Fields['STATUS'] .= ' ( ' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ' )';
//now getting information about the PREVIOUS task. If is the first task then no preious, use 1 //now getting information about the PREVIOUS task. If is the first task then no preious, use 1
$oAppDel = new AppDelegation(); $oAppDel = new AppDelegation();
$oAppDel->Load( $Fields['APP_UID'], ($Fields['DEL_PREVIOUS'] == 0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS']) ); $oAppDel->Load( $Fields['APP_UID'], ($Fields['DEL_PREVIOUS'] == 0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS']) );
$aAppDel = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME ); $aAppDel = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
try { try {
$oCurUser = new Users(); $oCurUser = new Users();
$oCurUser->load( $aAppDel['USR_UID'] ); $oCurUser->load( $aAppDel['USR_UID'] );
$Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); $Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
} catch (Exception $oError) { } catch (Exception $oError) {
$Fields['PREVIOUS_USER'] = ''; $Fields['PREVIOUS_USER'] = '';
} }
$objTask = new Task(); $objTask = new Task();
$aTask = $objTask->load( $aAppDel['TAS_UID'] ); $aTask = $objTask->load( $aAppDel['TAS_UID'] );
$Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE']; $Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE'];
//To enable information (dynaforms, steps) before claim a case //To enable information (dynaforms, steps) before claim a case
$_SESSION['bNoShowSteps'] = true; $_SESSION['bNoShowSteps'] = true;
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'caseOptions'; $G_SUB_MENU = 'caseOptions';
$G_ID_MENU_SELECTED = 'CASES'; $G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = '_'; $G_ID_SUB_MENU_SELECTED = '_';
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptCode( " $oHeadPublisher->addScriptCode( "
if (typeof parent != 'undefined') { if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) { if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}');
} }
}" ); }" );
$oHeadPublisher->addScriptCode( ' $oHeadPublisher->addScriptCode( '
var Cse = {}; var Cse = {};
Cse.panels = {}; Cse.panels = {};
@@ -96,11 +96,11 @@ $oHeadPublisher->addScriptCode( '
leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"}); 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.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"});
leimnud.exec(leimnud.fix.memoryLeak); leimnud.exec(leimnud.fix.memoryLeak);
' ); ' );
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/cases/core/cases_Step.js' ); $oHeadPublisher->addScriptFile( '/jscore/cases/core/cases_Step.js' );
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute' );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );

View File

@@ -1,57 +1,59 @@
<?php <?php
/** /**
* cases_Delete.php * cases_Delete.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
/* Includes */ /* Includes */
G::LoadClass( 'case' ); G::LoadClass( 'case' );
/* Process the info */ /* Process the info */
try { try {
$oCase = new Cases(); $oCase = new Cases();
if (isset( $_POST['APP_UIDS'] )) { if (isset( $_POST['APP_UIDS'] )) {
$ids = explode( ',', $_POST['APP_UIDS'] ); $ids = explode( ',', $_POST['APP_UIDS'] );
foreach ($ids as $id) foreach ($ids as $id) {
$oCase->removeCase( $id ); $oCase->removeCase( $id );
}
if (count( $_POST['APP_UIDS'] ) > 1)
echo 'The Case was deleted successfully'; if (count( $_POST['APP_UIDS'] ) > 1) {
else echo 'The Case was deleted successfully';
echo 'All Cases were deleted successfully'; } else {
} echo 'All Cases were deleted successfully';
} catch (Exception $e) { }
echo $e->getMessage(); }
} catch (Exception $e) {
echo $e->getMessage();
} }

View File

@@ -1,59 +1,59 @@
<?php <?php
/** /**
* cases_DeleteDocument.php * cases_DeleteDocument.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
/* Includes */ /* Includes */
require_once ("classes/model/AppDocumentPeer.php"); require_once ("classes/model/AppDocumentPeer.php");
G::LoadClass( 'case' ); G::LoadClass( 'case' );
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* Process the info */ /* Process the info */
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
$oAppDocument->remove( $_GET['DOC'] ); $oAppDocument->remove( $_GET['DOC'] );
$oCase = new Cases(); $oCase = new Cases();
$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' ); $oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' );
if ($_GET['TYPE'] == 'INPUT') { if ($_GET['TYPE'] == 'INPUT') {
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 ); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 );
} }
if ($_GET['TYPE'] == 'OUTPUT') { if ($_GET['TYPE'] == 'OUTPUT') {
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
} }
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
/* Redirect */ /* Redirect */
G::header( 'location: ' . $aNextStep['PAGE'] ); G::header( 'location: ' . $aNextStep['PAGE'] );

View File

@@ -1,50 +1,50 @@
<?php <?php
/** /**
* cases_DeleteDocumentToRevise.php * cases_DeleteDocumentToRevise.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
/* Includes */ /* Includes */
require_once ("classes/model/AppDocumentPeer.php"); require_once ("classes/model/AppDocumentPeer.php");
G::LoadClass( 'case' ); G::LoadClass( 'case' );
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* Process the info */ /* Process the info */
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
$oAppDocument->remove( $_GET['DOC'] ); $oAppDocument->remove( $_GET['DOC'] );
/* Redirect */ /* Redirect */
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );

View File

@@ -1,185 +1,185 @@
<?php <?php
/** /**
* cases_Derivate.php * cases_Derivate.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1: case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
/* Includes */ /* Includes */
G::LoadClass( 'pmScript' ); G::LoadClass( 'pmScript' );
G::LoadClass( 'case' ); G::LoadClass( 'case' );
G::LoadClass( 'derivation' ); G::LoadClass( 'derivation' );
require_once 'classes/model/Event.php'; require_once 'classes/model/Event.php';
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* Process the info */ /* Process the info */
$sStatus = 'TO_DO'; $sStatus = 'TO_DO';
foreach ($_POST['form']['TASKS'] as $aValues) { foreach ($_POST['form']['TASKS'] as $aValues) {
} }
try { try {
//load data //load data
$oCase = new Cases(); $oCase = new Cases();
//warning: we are not using the result value of function thisIsTheCurrentUser, so I'm commenting to optimize speed. //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'); //$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List');
$appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $appFields = $oCase->loadCase( $_SESSION['APPLICATION'] );
$appFields['APP_DATA'] = array_merge( $appFields['APP_DATA'], G::getSystemConstants() ); $appFields['APP_DATA'] = array_merge( $appFields['APP_DATA'], G::getSystemConstants() );
//cleaning debug variables //cleaning debug variables
$_SESSION['TRIGGER_DEBUG']['DATA'] = Array (); $_SESSION['TRIGGER_DEBUG']['DATA'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array (); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array (); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array ();
$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE' ); $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE' );
//if there are some triggers to execute //if there are some triggers to execute
if (sizeof( $triggers ) > 0) { if (sizeof( $triggers ) > 0) {
//Execute triggers before derivation //Execute triggers before derivation
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE', $appFields['APP_DATA'] ); $appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE', $appFields['APP_DATA'] );
//save trigger variables for debugger //save trigger variables for debugger
$_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof( $triggers ); $_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = 'BEFORE'; $_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = 'BEFORE';
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers;
} }
$appFields['DEL_INDEX'] = $_SESSION['INDEX']; $appFields['DEL_INDEX'] = $_SESSION['INDEX'];
$appFields['TAS_UID'] = $_SESSION['TASK']; $appFields['TAS_UID'] = $_SESSION['TASK'];
$oCase->updateCase( $_SESSION['APPLICATION'], $appFields ); //Save data $oCase->updateCase( $_SESSION['APPLICATION'], $appFields ); //Save data
//derivate case //derivate case
$oDerivation = new Derivation(); $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'] $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'] ); $oDerivation->derivate( $aCurrentDerivation, $_POST['form']['TASKS'] );
$appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); //refresh appFields, because in derivations should change some values $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 $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER' ); //load the triggers after derivation
if (sizeof( $triggers ) > 0) { if (sizeof( $triggers ) > 0) {
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER', $appFields['APP_DATA'] ); //Execute triggers after derivation $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]['NUM_TRIGGERS'] = sizeof( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = 'AFTER'; $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = 'AFTER';
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers;
} }
$oCase->updateCase( $_SESSION['APPLICATION'], $appFields ); $oCase->updateCase( $_SESSION['APPLICATION'], $appFields );
// Send notifications - Start // Send notifications - Start
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] ); $aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
if (trim( $aUser['USR_EMAIL'] ) == '') { if (trim( $aUser['USR_EMAIL'] ) == '') {
$aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST']; $aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST'];
} }
$sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>'; $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>';
try { try {
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName ); $oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
} catch (Exception $e) { } catch (Exception $e) {
G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' ); G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' );
} }
// Send notifications - End // Send notifications - End
// Events - Start // Events - Start
$oEvent = new Event(); $oEvent = new Event();
$oEvent->closeAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] ); $oEvent->closeAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] );
$oCurrentAppDel = AppDelegationPeer::retrieveByPk( $_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1 ); $oCurrentAppDel = AppDelegationPeer::retrieveByPk( $_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1 );
$multipleDelegation = false; $multipleDelegation = false;
// check if there are multiple derivations // check if there are multiple derivations
if (count( $_POST['form']['TASKS'] ) > 1) { if (count( $_POST['form']['TASKS'] ) > 1) {
$multipleDelegation = true; $multipleDelegation = true;
} }
// If the case has been delegated // If the case has been delegated
if (isset( $oCurrentAppDel )) { if (isset( $oCurrentAppDel )) {
// if there is just a single derivation the TASK_UID can be set by the delegation data // if there is just a single derivation the TASK_UID can be set by the delegation data
if (! $multipleDelegation) { if (! $multipleDelegation) {
$aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME ); $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID'] ); $oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID'] );
} else { } else {
// else we need to check every task and create the events if it have any // else we need to check every task and create the events if it have any
foreach ($_POST['form']['TASKS'] as $taskDelegated) { foreach ($_POST['form']['TASKS'] as $taskDelegated) {
$aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME ); $aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID'] ); $oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID'] );
} }
} }
} }
//Events - End //Events - End
$debuggerAvailable = true; $debuggerAvailable = true;
if (isset( $_SESSION['user_experience'] )) { if (isset( $_SESSION['user_experience'] )) {
$aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience']; $aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience'];
$debuggerAvailable = false; $debuggerAvailable = false;
} else { } else {
$aNextStep['PAGE'] = 'casesListExtJsRedirector'; $aNextStep['PAGE'] = 'casesListExtJsRedirector';
} }
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) { if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$loc = 'cases_Step?' . 'breakpoint=triggerdebug'; $loc = 'cases_Step?' . 'breakpoint=triggerdebug';
} else { } else {
$loc = $aNextStep['PAGE']; $loc = $aNextStep['PAGE'];
} }
//Triggers After //Triggers After
if (isset( $_SESSION['TRIGGER_DEBUG']['ISSET'] )) { if (isset( $_SESSION['TRIGGER_DEBUG']['ISSET'] )) {
if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1) { if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1) {
$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); $oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' );
$oTemplatePower->prepare(); $oTemplatePower->prepare();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
$_POST['NextStep'] = $loc; $_POST['NextStep'] = $loc;
$G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' ); $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' );
$G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameBreaker' ); $G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameBreaker' );
$_SESSION['TRIGGER_DEBUG']['ISSET'] == 0; $_SESSION['TRIGGER_DEBUG']['ISSET'] == 0;
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
exit(); exit();
} else { } else {
unset( $_SESSION['TRIGGER_DEBUG'] ); unset( $_SESSION['TRIGGER_DEBUG'] );
} }
} }
G::header( "location: $loc" ); G::header( "location: $loc" );
} catch (Exception $e) { } catch (Exception $e) {
$aMessage = array (); $aMessage = array ();
$aMessage['MESSAGE'] = $e->getMessage() . '<br>' . $e->getTraceAsString(); $aMessage['MESSAGE'] = $e->getMessage() . '<br>' . $e->getTraceAsString();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} }

View File

@@ -1,111 +1,113 @@
<?php <?php
/** /**
* cases_List.php * cases_List.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/** /**
* Cases list (Refactored) * Cases list (Refactored)
* By Erik A. * By Erik A.
* O. <erik@colosa.com, aortiz.erik@gmail.com> * O. <erik@colosa.com, aortiz.erik@gmail.com>
*/ */
/* Permissions */ /* Permissions */
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
}
/* Includes */
G::LoadClass( 'case' ); /* Includes */
G::LoadClass( 'configuration' ); G::LoadClass( 'case' );
G::LoadClass( 'configuration' );
// $_GET['l'] has the type of cases list like todo,pause,cancel, all // $_GET['l'] has the type of cases list like todo,pause,cancel, all
$conf = new Configurations(); $conf = new Configurations();
if (! isset( $_GET['l'] )) { if (! isset( $_GET['l'] )) {
$confCasesList = $conf->loadObject( 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' ); $confCasesList = $conf->loadObject( 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' );
if (is_array( $confCasesList )) { if (is_array( $confCasesList )) {
$sTypeList = $confCasesList['sTypeList']; $sTypeList = $confCasesList['sTypeList'];
} else { } else {
$sTypeList = 'to_do'; $sTypeList = 'to_do';
} }
} else { } else {
$sTypeList = $_GET['l']; $sTypeList = $_GET['l'];
$confCasesList = array ('sTypeList' => $sTypeList $confCasesList = array ('sTypeList' => $sTypeList
); );
$conf->saveObject( $confCasesList, 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' ); $conf->saveObject( $confCasesList, 'ProcessMaker', 'cases_List', '', $_SESSION['USER_LOGGED'], '' );
} }
$sUIDUserLogged = $_SESSION['USER_LOGGED']; $sUIDUserLogged = $_SESSION['USER_LOGGED'];
$_SESSION['CASES_MENU_OPTION'] = $sTypeList; $_SESSION['CASES_MENU_OPTION'] = $sTypeList;
$oCases = new Cases(); $oCases = new Cases();
/** /**
* here we verify if there is a any case with a unpause on this day * 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') { if ($sTypeList === 'to_do' or $sTypeList === 'draft' or $sTypeList === 'paused') {
$oCases->ThrowUnpauseDaemon( date( 'Y-m-d' ) ); $oCases->ThrowUnpauseDaemon( date( 'Y-m-d' ) );
} }
/* * /* *
* Prepare the addtional filters before to show * Prepare the addtional filters before to show
* By Erik * By Erik
*/ */
$aAdditionalFilter = Array (); $aAdditionalFilter = Array ();
if (isset( $_GET['PROCESS_UID'] ) and $_GET['PROCESS_UID'] != "0" && $_GET['PROCESS_UID'] != "") { if (isset( $_GET['PROCESS_UID'] ) and $_GET['PROCESS_UID'] != "0" && $_GET['PROCESS_UID'] != "") {
$PRO_UID = $_GET['PROCESS_UID']; $PRO_UID = $_GET['PROCESS_UID'];
$aAdditionalFilter['PRO_UID'] = $PRO_UID; $aAdditionalFilter['PRO_UID'] = $PRO_UID;
} else { } else {
$PRO_UID = "0"; $PRO_UID = "0";
} }
if (isset( $_GET['READ'] ) and $_GET['READ'] == "1") { if (isset( $_GET['READ'] ) and $_GET['READ'] == "1") {
$aAdditionalFilter['READ'] = $_GET['READ']; $aAdditionalFilter['READ'] = $_GET['READ'];
} }
if (isset( $_GET['UNREAD'] ) and $_GET['UNREAD'] == "1") { if (isset( $_GET['UNREAD'] ) and $_GET['UNREAD'] == "1") {
$aAdditionalFilter['UNREAD'] = $_GET['UNREAD']; $aAdditionalFilter['UNREAD'] = $_GET['UNREAD'];
} }
if (isset( $_GET['APP_STATUS_FILTER'] ) and $_GET['APP_STATUS_FILTER'] != "ALL") { if (isset( $_GET['APP_STATUS_FILTER'] ) and $_GET['APP_STATUS_FILTER'] != "ALL") {
$aAdditionalFilter['APP_STATUS_FILTER'] = $_GET['APP_STATUS_FILTER']; $aAdditionalFilter['APP_STATUS_FILTER'] = $_GET['APP_STATUS_FILTER'];
} }
if (isset( $_GET['MINE'] ) and $_GET['MINE'] == "1") { if (isset( $_GET['MINE'] ) and $_GET['MINE'] == "1") {
$aAdditionalFilter['MINE'] = $_GET['MINE']; $aAdditionalFilter['MINE'] = $_GET['MINE'];
} }
switch ($sTypeList) { switch ($sTypeList) {
case 'to_do': case 'to_do':
if (defined( 'ENABLE_CASE_LIST_OPTIMIZATION' )) { if (defined( 'ENABLE_CASE_LIST_OPTIMIZATION' )) {
$aCriteria = $oCases->prepareCriteriaForToDo( $sUIDUserLogged ); $aCriteria = $oCases->prepareCriteriaForToDo( $sUIDUserLogged );
$xmlfile = 'cases/cases_ListTodoNew'; $xmlfile = 'cases/cases_ListTodoNew';
} else } else {
list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter ); list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter );
break; }
default: break;
list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter ); default:
} list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter );
}
/* /*
$rs = ApplicationPeer::doSelectRS($aCriteria); $rs = ApplicationPeer::doSelectRS($aCriteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -118,52 +120,52 @@ $rs = ApplicationPeer::doSelectRS($aCriteria);
g::pr($aRows1);die;*/ g::pr($aRows1);die;*/
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
if (! isset( $_GET['PROCESS_UID'] )) { if (! isset( $_GET['PROCESS_UID'] )) {
$oCase = new Cases(); $oCase = new Cases();
$rs = ApplicationPeer::doSelectRS( $aCriteria ); $rs = ApplicationPeer::doSelectRS( $aCriteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $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;
}
?>
$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;
}
?>
<script> <script>
try{ try{
oPropelTable = document.getElementById('publisherContent[0]'); oPropelTable = document.getElementById('publisherContent[0]');
@@ -175,5 +177,6 @@ function InAssocArray ($a, $k, $v)
parent.PANEL_EAST_OPEN = false; parent.PANEL_EAST_OPEN = false;
if(parent.refreshCountFolders) parent.refreshCountFolders(); if(parent.refreshCountFolders) parent.refreshCountFolders();
}catch(e){} }catch(e){}
</script> </script>
<?php

View File

@@ -1,162 +1,166 @@
<?php <?php
/** /**
* cases_New.php * cases_New.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
//we're looking for the type of view //we're looking for the type of view
function putTypeView () function putTypeView ()
{ {
require_once 'classes/model/Configuration.php'; require_once 'classes/model/Configuration.php';
$oConfiguration = new Configuration(); $oConfiguration = new Configuration();
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); $oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' );
$oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] );
if (ConfigurationPeer::doCount( $oCriteria )) { if (ConfigurationPeer::doCount( $oCriteria )) {
$conf = ConfigurationPeer::doSelect( $oCriteria ); $conf = ConfigurationPeer::doSelect( $oCriteria );
return $conf[0]->getCfgValue(); return $conf[0]->getCfgValue();
} else { } else {
return 'dropdown'; return 'dropdown';
} }
} }
$_GET['change'] = (isset( $_GET['change'] )) ? $_GET['change'] : putTypeView(); $_GET['change'] = (isset( $_GET['change'] )) ? $_GET['change'] : putTypeView();
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
case - 1:
case - 1: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::header( 'location: ../login/login' );
G::header( 'location: ../login/login' ); die();
die(); break;
break; }
}
/* Includes */
/* Includes */ G::LoadClass( 'case' );
G::LoadClass( 'case' );
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* Menues */ /* Menues */
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases'; $G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES'; $G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_DRAFT'; $G_ID_SUB_MENU_SELECTED = 'CASES_DRAFT';
/* Prepare page before to show */ /* Prepare page before to show */
$aFields = array (); $aFields = array ();
$oCase = new Cases(); $oCase = new Cases();
$bCanStart = $oCase->canStartCase( $_SESSION['USER_LOGGED'] ); $bCanStart = $oCase->canStartCase( $_SESSION['USER_LOGGED'] );
if ($bCanStart) { if ($bCanStart) {
$aFields['LANG'] = SYS_LANG; $aFields['LANG'] = SYS_LANG;
$aFields['USER'] = $_SESSION['USER_LOGGED']; $aFields['USER'] = $_SESSION['USER_LOGGED'];
$sXmlForm = 'cases/cases_New.xml'; $sXmlForm = 'cases/cases_New.xml';
//$_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] ); //$_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] );
$_DBArray['NewCase'] = $oCase->getStartCasesPerType( $_SESSION['USER_LOGGED'], $_GET['change'] ); $_DBArray['NewCase'] = $oCase->getStartCasesPerType( $_SESSION['USER_LOGGED'], $_GET['change'] );
} else { } else {
$sXmlForm = 'cases/cases_CannotInitiateCase.xml'; $sXmlForm = 'cases/cases_CannotInitiateCase.xml';
} }
if (isset( $_SESSION['G_MESSAGE'] ) && strlen( $_SESSION['G_MESSAGE'] ) > 0) { if (isset( $_SESSION['G_MESSAGE'] ) && strlen( $_SESSION['G_MESSAGE'] ) > 0) {
$aMessage = array (); $aMessage = array ();
$aMessage['MESSAGE'] = $_SESSION['G_MESSAGE']; $aMessage['MESSAGE'] = $_SESSION['G_MESSAGE'];
//$_SESSION['G_MESSAGE_TYPE']; //$_SESSION['G_MESSAGE_TYPE'];
unset( $_SESSION['G_MESSAGE'] ); unset( $_SESSION['G_MESSAGE'] );
unset( $_SESSION['G_MESSAGE_TYPE'] ); unset( $_SESSION['G_MESSAGE_TYPE'] );
} }
//get the config parameter to show in dropdown or list //get the config parameter to show in dropdown or list
require_once 'classes/model/Configuration.php'; require_once 'classes/model/Configuration.php';
$oConfiguration = new Configuration(); $oConfiguration = new Configuration();
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); $oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' );
$oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) { if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$aData['CFG_UID'] = 'StartNewCase'; $aData['CFG_UID'] = 'StartNewCase';
$aData['OBJ_UID'] = ''; $aData['OBJ_UID'] = '';
$aData['CFG_VALUE'] = 'dropdown'; $aData['CFG_VALUE'] = 'dropdown';
$aData['PRO_UID'] = ''; $aData['PRO_UID'] = '';
$aData['USR_UID'] = $_SESSION['USER_LOGGED']; $aData['USR_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_UID'] = ''; $aData['APP_UID'] = '';
$oConfig = new Configuration(); $oConfig = new Configuration();
$oConfig->create( $aData ); $oConfig->create( $aData );
$listType = 'dropdown'; $listType = 'dropdown';
} else { } else {
$oConfiguration = new Configuration(); $oConfiguration = new Configuration();
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' ); $oCriteria->add( ConfigurationPeer::CFG_UID, 'StartNewCase' );
$oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] );
$conf = ConfigurationPeer::doSelect( $oCriteria ); $conf = ConfigurationPeer::doSelect( $oCriteria );
$listType = $conf[0]->getCfgValue(); $listType = $conf[0]->getCfgValue();
} }
if (isset( $_GET['change'] )) { if (isset( $_GET['change'] )) {
$listType = $_GET['change']; $listType = $_GET['change'];
$aData['CFG_UID'] = 'StartNewCase'; $aData['CFG_UID'] = 'StartNewCase';
$aData['OBJ_UID'] = ''; $aData['OBJ_UID'] = '';
$aData['CFG_VALUE'] = $listType; $aData['CFG_VALUE'] = $listType;
$aData['PRO_UID'] = ''; $aData['PRO_UID'] = '';
$aData['USR_UID'] = $_SESSION['USER_LOGGED']; $aData['USR_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_UID'] = ''; $aData['APP_UID'] = '';
$oConfig = new Configuration(); $oConfig = new Configuration();
$oConfig->update( $aData ); $oConfig->update( $aData );
} }
/* Render page */ /* Render page */
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$aFields['CHANGE_LINK'] = G::LoadTranslation( 'ID_CHANGE_VIEW' ); $aFields['CHANGE_LINK'] = G::LoadTranslation( 'ID_CHANGE_VIEW' );
if (isset( $aMessage )) { if (isset( $aMessage )) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
} }
if ($listType == 'dropdown') if ($listType == 'dropdown') {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' );
}
if ($listType == 'link') {
if ($bCanStart) if ($listType == 'link') {
$sXmlForm = 'cases/cases_NewRadioGroup.xml'; if ($bCanStart) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' ); $sXmlForm = 'cases/cases_NewRadioGroup.xml';
} }
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' );
if ($listType == 'category') { }
if ($bCanStart)
$sXmlForm = 'cases/cases_NewCategory.xml'; if ($listType == 'category') {
$G_PUBLISH->AddContent( 'view', 'cases/cases_NewCategory' ); if ($bCanStart) {
} $sXmlForm = 'cases/cases_NewCategory.xml';
}
G::RenderPage( 'publish', 'blank' ); $G_PUBLISH->AddContent( 'view', 'cases/cases_NewCategory' );
}
G::RenderPage( 'publish', 'blank' );
?> ?>
<script> <script>
parent.outerLayout.hide('east'); parent.outerLayout.hide('east');
parent.PANEL_EAST_OPEN = false; parent.PANEL_EAST_OPEN = false;
</script> </script>
<?php

View File

@@ -1,32 +1,33 @@
<?php <?php
/** /**
* cases_NextStep.php * cases_NextStep.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
}
//go to the next step //go to the next step
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
G::header( 'location: ' . $aNextStep['PAGE'] ); G::header( 'location: ' . $aNextStep['PAGE'] );

View File

@@ -1,203 +1,202 @@
<?php <?php
/** /**
* cases_Open.php * cases_Open.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc. * Copyright (C) 2004 - 2008 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) { if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) {
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
break; break;
case - 1: case - 1:
default: default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
break; break;
} }
} }
/* Includes */ /* Includes */
require_once 'classes/model/AppDelay.php'; require_once 'classes/model/AppDelay.php';
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
//cleaning the case session data //cleaning the case session data
Cases::clearCaseSessionData(); Cases::clearCaseSessionData();
try { try {
//Loading data for a Jump request //Loading data for a Jump request
if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) { if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) {
$_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] ); $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
$_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] );
//if the application doesn't exist //if the application doesn't exist
if (is_null( $_GET['APP_UID'] )) { if (is_null( $_GET['APP_UID'] )) {
G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' ); G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' );
G::header( 'location: casesListExtJs' ); G::header( 'location: casesListExtJs' );
exit(); exit();
} }
//if the application exists but the //if the application exists but the
if (is_null( $_GET['DEL_INDEX'] )) { if (is_null( $_GET['DEL_INDEX'] )) {
G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' ); G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' );
G::header( 'location: casesListExtJs' ); G::header( 'location: casesListExtJs' );
exit(); exit();
} }
//wrong implemented, need refactored //wrong implemented, need refactored
//$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ??????? //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ???????
} }
$sAppUid = $_GET['APP_UID']; $sAppUid = $_GET['APP_UID'];
$iDelIndex = $_GET['DEL_INDEX']; $iDelIndex = $_GET['DEL_INDEX'];
$_action = isset( $_GET['action'] ) ? $_GET['action'] : ''; $_action = isset( $_GET['action'] ) ? $_GET['action'] : '';
//loading application data //loading application data
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); $aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
// g::pr($aFields); // g::pr($aFields);
// die; // die;
switch ($aFields['APP_STATUS']) { switch ($aFields['APP_STATUS']) {
case 'DRAFT': case 'DRAFT':
case 'TO_DO': case 'TO_DO':
//check if the case is in pause, check a valid record in table APP_DELAY //check if the case is in pause, check a valid record in table APP_DELAY
if (AppDelay::isPaused( $sAppUid, $iDelIndex )) { if (AppDelay::isPaused( $sAppUid, $iDelIndex )) {
//the case is paused show only the resume //the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = - 1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
exit(); exit();
} }
/** /**
* these routine is to verify if the case was acceded from advaced search list * these routine is to verify if the case was acceded from advaced search list
*/ */
if ($_action == 'search') { if ($_action == 'search') {
//verify if the case is with teh current user //verify if the case is with teh current user
$c = new Criteria( 'workflow' ); $c = new Criteria( 'workflow' );
$c->add( AppDelegationPeer::APP_UID, $sAppUid ); $c->add( AppDelegationPeer::APP_UID, $sAppUid );
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
$oDataset = AppDelegationPeer::doSelectRs( $c ); $oDataset = AppDelegationPeer::doSelectRs( $c );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aData = $oDataset->getRow(); $aData = $oDataset->getRow();
if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") //distinct "" for selfservice if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") {
{ //distinct "" for selfservice
//so we show just the resume //so we show just the resume
$_SESSION['alreadyDerivated'] = true; $_SESSION['alreadyDerivated'] = true;
//the case is paused show only the resume //the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = - 1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
exit(); exit();
} }
} }
//proceed and try to open the case //proceed and try to open the case
$oAppDelegation = new AppDelegation(); $oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
//if there are no user in the delegation row, this case is in selfservice //if there are no user in the delegation row, this case is in selfservice
if ($aDelegation['USR_UID'] == "" /*&& $aDelegation['DEL_THREAD_STATUS'] == 'SELFSERVICE'*/ ) { if ($aDelegation['USR_UID'] == "" /*&& $aDelegation['DEL_THREAD_STATUS'] == 'SELFSERVICE'*/ ) {
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = - 1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; $_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 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 )) { if ($oCase->isSelfService( $_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid )) {
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
} else { } else {
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
} }
exit(); exit();
} }
//if the current users is in the AppDelegation row, then open the case //if the current users is in the AppDelegation row, then open the case
if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') { if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') {
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $iDelIndex;
if (is_null( $aFields['DEL_INIT_DATE'] )) { if (is_null( $aFields['DEL_INIT_DATE'] )) {
$oCase->setDelInitDate( $sAppUid, $iDelIndex ); $oCase->setDelInitDate( $sAppUid, $iDelIndex );
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); $aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
} }
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = $aFields['TAS_UID']; $_SESSION['TASK'] = $aFields['TAS_UID'];
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
/* Redirect to next step */ /* Redirect to next step */
unset( $_SESSION['bNoShowSteps'] ); unset( $_SESSION['bNoShowSteps'] );
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
$sPage = $aNextStep['PAGE']; $sPage = $aNextStep['PAGE'];
G::header( 'location: ' . $sPage ); G::header( 'location: ' . $sPage );
} else { } else {
//when the case have another user or current user doesnt have rights to this selfservice, //when the case have another user or current user doesnt have rights to this selfservice,
//just view the case Resume //just view the case Resume
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = - 1;
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
$_SESSION['CURRENT_TASK'] = $Fields['TAS_UID']; $_SESSION['CURRENT_TASK'] = $Fields['TAS_UID'];
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
} }
break; break;
default: //APP_STATUS <> DRAFT and TO_DO
default: //APP_STATUS <> DRAFT and TO_DO $_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['INDEX'] = $iDelIndex != "" ? $iDelIndex : $oCase->getCurrentDelegationCase( $_GET['APP_UID'] );
$_SESSION['INDEX'] = $iDelIndex != "" ? $iDelIndex : $oCase->getCurrentDelegationCase( $_GET['APP_UID'] ); $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['TASK'] = - 1;
$_SESSION['TASK'] = - 1; $_SESSION['STEP_POSITION'] = 0;
$_SESSION['STEP_POSITION'] = 0;
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); }
} } catch (Exception $e) {
} catch (Exception $e) { $aMessage = array ();
$aMessage = array (); $aMessage['MESSAGE'] = $e->getMessage();
$aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage( 'publishBlank', 'blank' );
G::RenderPage( 'publishBlank', 'blank' );
} }

View File

@@ -1,75 +1,76 @@
<?php <?php
/** /**
* cases_Open.php * cases_Open.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
/* Permissions */ /* Permissions */
if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1) if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1) {
switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) { switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) {
case - 2: case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
default: default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' ); G::header( 'location: ../login/login' );
die(); die();
break; break;
} }
}
/* Includes */
G::LoadClass( 'case' ); /* Includes */
G::LoadClass( 'case' );
/* GET , POST & $_SESSION Vars */
if (isset( $_SESSION['APPLICATION'] )) { /* GET , POST & $_SESSION Vars */
unset( $_SESSION['APPLICATION'] ); if (isset( $_SESSION['APPLICATION'] )) {
} unset( $_SESSION['APPLICATION'] );
if (isset( $_SESSION['PROCESS'] )) { }
unset( $_SESSION['PROCESS'] ); if (isset( $_SESSION['PROCESS'] )) {
} unset( $_SESSION['PROCESS'] );
if (isset( $_SESSION['INDEX'] )) { }
unset( $_SESSION['INDEX'] ); if (isset( $_SESSION['INDEX'] )) {
} unset( $_SESSION['INDEX'] );
if (isset( $_SESSION['STEP_POSITION'] )) { }
unset( $_SESSION['STEP_POSITION'] ); if (isset( $_SESSION['STEP_POSITION'] )) {
} unset( $_SESSION['STEP_POSITION'] );
}
/* Process the info */
$oCase = new Cases(); /* Process the info */
$sAppUid = $_GET['APP_UID']; $oCase = new Cases();
$iDelIndex = $_GET['DEL_INDEX']; $sAppUid = $_GET['APP_UID'];
$iDelIndex = $_GET['DEL_INDEX'];
$_SESSION['APPLICATION'] = $_GET['APP_UID'];
$_SESSION['INDEX'] = $_GET['DEL_INDEX']; $_SESSION['APPLICATION'] = $_GET['APP_UID'];
$_SESSION['INDEX'] = $_GET['DEL_INDEX'];
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['TASK'] = $aFields['TAS_UID']; $_SESSION['PROCESS'] = $aFields['PRO_UID'];
$_SESSION['STEP_POSITION'] = 0; $_SESSION['TASK'] = $aFields['TAS_UID'];
$_SESSION['STEP_POSITION'] = 0;
/* Redirect to next step */
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], 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']; $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 ); G::header( 'location: ' . $sPage );

View File

@@ -1,96 +1,96 @@
<?php <?php
/** /**
* Cases_PrintPreview.php * Cases_PrintPreview.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
try { try {
require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Dynaform.php';
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
$currentDynUid = ''; $currentDynUid = '';
if (isset( $_GET['DYNUIDPRINT'] ) && $_GET['DYNUIDPRINT'] != '') { if (isset( $_GET['DYNUIDPRINT'] ) && $_GET['DYNUIDPRINT'] != '') {
$currentDynUid = $_GET['DYNUIDPRINT']; $currentDynUid = $_GET['DYNUIDPRINT'];
} elseif (isset( $_SESSION['DYN_UID_PRINT'] )) { } elseif (isset( $_SESSION['DYN_UID_PRINT'] )) {
$currentDynUid = $_SESSION['DYN_UID_PRINT']; $currentDynUid = $_SESSION['DYN_UID_PRINT'];
} elseif (isset( $_SESSION['CURRENT_DYN_UID'] )) { } elseif (isset( $_SESSION['CURRENT_DYN_UID'] )) {
$currentDynUid = $_SESSION['CURRENT_DYN_UID']; $currentDynUid = $_SESSION['CURRENT_DYN_UID'];
} }
$oDynaform = new Dynaform(); $oDynaform = new Dynaform();
$aDyn = $oDynaform->load( $currentDynUid ); $aDyn = $oDynaform->load( $currentDynUid );
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
if (isset( $_SESSION['APPLICATION'] )) { if (isset( $_SESSION['APPLICATION'] )) {
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() );
} else { } else {
$Fields['APP_DATA'] = Array (); $Fields['APP_DATA'] = Array ();
} }
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'USERS'; $G_ID_MENU_SELECTED = 'USERS';
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$idProcess = (isset( $Fields['APP_DATA']['PROCESS'] )) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS']; $idProcess = (isset( $Fields['APP_DATA']['PROCESS'] )) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS'];
$oProcess = new Process(); $oProcess = new Process();
$aProcessFieds = $oProcess->load( $idProcess ); $aProcessFieds = $oProcess->load( $idProcess );
$sProcess = $oProcess->getProTitle(); $sProcess = $oProcess->getProTitle();
$noShowTitle = 0; $noShowTitle = 0;
if (isset( $aProcessFieds['PRO_SHOW_MESSAGE'] )) { if (isset( $aProcessFieds['PRO_SHOW_MESSAGE'] )) {
$noShowTitle = $aProcessFieds['PRO_SHOW_MESSAGE']; $noShowTitle = $aProcessFieds['PRO_SHOW_MESSAGE'];
} }
//Add content content step - Start //Add content content step - Start
if (isset( $_SESSION['APPLICATION'] )) { if (isset( $_SESSION['APPLICATION'] )) {
$array['CASE'] = G::LoadTranslation( 'ID_CASE' ); $array['CASE'] = G::LoadTranslation( 'ID_CASE' );
$array['USER'] = G::LoadTranslation( 'ID_USER' ); $array['USER'] = G::LoadTranslation( 'ID_USER' );
$array['WORKSPACE'] = G::LoadTranslation( 'ID_WORKSPACE' ); $array['WORKSPACE'] = G::LoadTranslation( 'ID_WORKSPACE' );
$array['APP_NUMBER'] = $Fields['APP_NUMBER']; $array['APP_NUMBER'] = $Fields['APP_NUMBER'];
$array['APP_TITLE'] = $Fields['TITLE']; $array['APP_TITLE'] = $Fields['TITLE'];
$array['USR_USERNAME'] = $Fields['APP_DATA']['USR_USERNAME']; $array['USR_USERNAME'] = $Fields['APP_DATA']['USR_USERNAME'];
$array['USER_ENV'] = $Fields['APP_DATA']['SYS_SYS']; $array['USER_ENV'] = $Fields['APP_DATA']['SYS_SYS'];
$array['DATEPRINT'] = date( 'Y-m-d H:m:s' ); $array['DATEPRINT'] = date( 'Y-m-d H:m:s' );
} }
$array['APP_PROCESS'] = $sProcess; $array['APP_PROCESS'] = $sProcess;
if (isset( $Fields['TITLE'] ) && strlen( $Fields['TITLE'] ) > 0) { if (isset( $Fields['TITLE'] ) && strlen( $Fields['TITLE'] ) > 0) {
$array['TITLE'] = G::LoadTranslation( 'ID_TITLE' ); $array['TITLE'] = G::LoadTranslation( 'ID_TITLE' );
} else { } else {
$array['TITLE'] = ''; $array['TITLE'] = '';
} }
$array['PROCESS'] = G::LoadTranslation( 'ID_PROCESS' ); $array['PROCESS'] = G::LoadTranslation( 'ID_PROCESS' );
$array['DATELABEL'] = G::LoadTranslation( 'DATE_LABEL' ); $array['DATELABEL'] = G::LoadTranslation( 'DATE_LABEL' );
$aDyn['DYN_UID'] = $currentDynUid; $aDyn['DYN_UID'] = $currentDynUid;
if ($noShowTitle == 0) { if ($noShowTitle == 0) {
$G_PUBLISH->AddContent( 'smarty', 'cases/cases_PrintViewTitle', '', '', $array ); $G_PUBLISH->AddContent( 'smarty', 'cases/cases_PrintViewTitle', '', '', $array );
} }
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $aDyn['PRO_UID'] . '/' . $aDyn['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' ); $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $aDyn['PRO_UID'] . '/' . $aDyn['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }
?> ?>
<script> <script>
@@ -121,5 +121,7 @@ try {
window.print(); window.print();
} catch(e){} } catch(e){}
</script> </script>
<?php

View File

@@ -1,100 +1,98 @@
<?php <?php
/** /**
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
require_once ("classes/model/AdditionalTables.php"); require_once ("classes/model/AdditionalTables.php");
require_once ("classes/model/Fields.php"); require_once ("classes/model/Fields.php");
// passing the parameters // passing the parameters
$pmTableName = (isset( $_POST['tableName'] )) ? $_POST['tableName'] : 'contenders'; $pmTableName = (isset( $_POST['tableName'] )) ? $_POST['tableName'] : 'contenders';
$pmTableFields = (isset( $_POST['tableFields'] )) ? G::json_decode( $_POST['tableFields'] ) : array (); $pmTableFields = (isset( $_POST['tableFields'] )) ? G::json_decode( $_POST['tableFields'] ) : array ();
// default parameters // default parameters
//$pmTableName = 'Sender'; //$pmTableName = 'Sender';
$pmTableFields = array (array ('FLD_NAME' => 'APP_UID' $pmTableFields = array (array ('FLD_NAME' => 'APP_UID'
),array ('FLD_NAME' => 'CON_NAME' ),array ('FLD_NAME' => 'CON_NAME'
),array ('FLD_NAME' => 'CON_ADDR' ),array ('FLD_NAME' => 'CON_ADDR'
),array ('FLD_NAME' => '_cedula' ),array ('FLD_NAME' => '_cedula'
) )
); );
// setting the data to assemble the table // setting the data to assemble the table
$aData = array (); $aData = array ();
$aData['ADD_TAB_NAME'] = $pmTableName; $aData['ADD_TAB_NAME'] = $pmTableName;
// creating the objects to create the table and records // creating the objects to create the table and records
$oFields = new Fields(); $oFields = new Fields();
$oAdditionalTables = new AdditionalTables(); $oAdditionalTables = new AdditionalTables();
$sAddTabUid = $oAdditionalTables->create( $aData, $pmTableFields ); $sAddTabUid = $oAdditionalTables->create( $aData, $pmTableFields );
foreach ($pmTableFields as $iRow => $aRow) { foreach ($pmTableFields as $iRow => $aRow) {
$pmTableFields[$iRow]['FLD_NAME'] = strtoupper( $aRow['FLD_NAME'] ); $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_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_TYPE'] = isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR';
$pmTableFields[$iRow]['FLD_SIZE'] = isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32'; $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_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_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_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'] = 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'] : ''; $pmTableFields[$iRow]['FLD_FOREIGN_KEY_TABLE'] = isset( $aRow['FLD_FOREIGN_KEY_TABLE'] ) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : '';
} }
foreach ($pmTableFields as $iRow => $aRow) { 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'] : '' $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));
$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 );
$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/Application.php"); require_once ("classes/model/Fields.php");
require_once ("classes/model/AdditionalTables.php");
require_once ("classes/model/Fields.php"); $Criteria = new Criteria( 'workflow' );
$Criteria->addSelectColumn( ApplicationPeer::APP_UID );
$Criteria = new Criteria( 'workflow' ); $Criteria->addSelectColumn( ApplicationPeer::APP_DATA );
$Criteria->addSelectColumn( ApplicationPeer::APP_UID );
$Criteria->addSelectColumn( ApplicationPeer::APP_DATA );
// $Criteria->add (AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN'); // $Criteria->add (AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
$oDataset = ApplicationPeer::doSelectRS( $Criteria ); $oDataset = ApplicationPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aProcesses = array (); $aProcesses = array ();
$i = 0; $i = 0;
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$appuid = $aRow['APP_UID']; $appuid = $aRow['APP_UID'];
$data = unserialize( $aRow['APP_DATA'] ); $data = unserialize( $aRow['APP_DATA'] );
$cedula = '234' . rand( 1000, 999999 ); $cedula = '234' . rand( 1000, 999999 );
$nombre = 'nombre ' . rand( 1000, 999999 ); $nombre = 'nombre ' . rand( 1000, 999999 );
$direccion = 'direccion ' . rand( 1000, 999999 ); $direccion = 'direccion ' . rand( 1000, 999999 );
if (isset( $data['_cedula'] )) { if (isset( $data['_cedula'] )) {
$cedula = $data['_cedula']; $cedula = $data['_cedula'];
$nombre = isset( $data['_nombre'] ) ? $data['_nombre'] : ''; $nombre = isset( $data['_nombre'] ) ? $data['_nombre'] : '';
$direccion = isset( $data['_direccion'] ) ? $data['_direccion'] : ''; $direccion = isset( $data['_direccion'] ) ? $data['_direccion'] : '';
print "$i $appuid $cedula <br>"; print "$i $appuid $cedula <br>";
} }
// print_r ( $aRow); // print_r ( $aRow);
$sql = "insert CONTENDERS VALUES ( '$appuid', '$nombre', '$direccion', '$cedula' )"; $sql = "insert CONTENDERS VALUES ( '$appuid', '$nombre', '$direccion', '$cedula' )";
$con = Propel::getConnection( 'workflow' ); $con = Propel::getConnection( 'workflow' );
$stmt = $con->createStatement(); $stmt = $con->createStatement();
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC ); $rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
$i ++; $i ++;
// if ( $i == 100 ) die; // if ( $i == 100 ) die;
/* if ( strpos ( $aRow['APP_DATA'], 'cedula' ) !== false ) { /* if ( strpos ( $aRow['APP_DATA'], 'cedula' ) !== false ) {
print_r ( $aRow ); print_r ( $aRow );
print "<hr>"; print "<hr>";
$i++; $i++;
if ( $i == 10 ) die; if ( $i == 10 ) die;
} }
*/ */
$oDataset->next(); $oDataset->next();
} }
print "--$i--"; print "--$i--";