Merge pull request #842 from ralpheav/master

Code Style change  workflow/engine/methods/cases/
This commit is contained in:
julceslauhub
2012-10-19 14:16:05 -07:00
21 changed files with 2248 additions and 2234 deletions

View File

@@ -1,120 +1,122 @@
<?php <?php
/** /**
* cases_Reassign.php * cases_Reassign.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 {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) {
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;
} }
G::LoadSystem( 'templatePower' ); G::LoadSystem( 'templatePower' );
$tpl = new TemplatePower( PATH_TPL . "cases/cases_Reassign.html" ); $tpl = new TemplatePower( PATH_TPL . "cases/cases_Reassign.html" );
$tpl->prepare(); $tpl->prepare();
require_once 'classes/model/AppDelegation.php'; require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDelegationPeer::APP_UID, $_GET['APP_UID'] ); $oCriteria->add( AppDelegationPeer::APP_UID, $_GET['APP_UID'] );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $_GET['DEL_INDEX'] ); $oCriteria->add( AppDelegationPeer::DEL_INDEX, $_GET['DEL_INDEX'] );
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null ); $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null );
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$c = 0; $c = 0;
G::LoadClass( 'tasks' ); G::LoadClass( 'tasks' );
$oTasks = new Tasks(); $oTasks = new Tasks();
G::LoadClass( 'groups' ); G::LoadClass( 'groups' );
$oGroups = new Groups(); $oGroups = new Groups();
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$name = ''; $name = '';
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$c ++; $c ++;
$aUsr = array (); $aUsr = array ();
$aUsrUid = array (); $aUsrUid = array ();
$aAux1 = $oTasks->getGroupsOfTask( $aRow['TAS_UID'], 1 ); $aAux1 = $oTasks->getGroupsOfTask( $aRow['TAS_UID'], 1 );
foreach ($aAux1 as $value1) { foreach ($aAux1 as $value1) {
$aAux2 = $oGroups->getUsersOfGroup( $value1['GRP_UID'] ); $aAux2 = $oGroups->getUsersOfGroup( $value1['GRP_UID'] );
foreach ($aAux2 as $value2) { foreach ($aAux2 as $value2) {
if ($aRow['USR_UID'] != $value2['USR_UID']) { if ($aRow['USR_UID'] != $value2['USR_UID']) {
if (! in_array( $value2['USR_UID'], $aUsrUid )) { //var_dump($aRow['USR_UID'], $value2['USR_UID']);echo '<br /><br />'; if (! in_array( $value2['USR_UID'], $aUsrUid )) {
$aAux = $oUser->load( $value2['USR_UID'] ); //var_dump($aRow['USR_UID'], $value2['USR_UID']);echo '<br /><br />';
$aUsr[$aAux['USR_FIRSTNAME'] . ' ' . $aAux['USR_LASTNAME']] = $aAux; $aAux = $oUser->load( $value2['USR_UID'] );
$aUsrUid[] = $value2['USR_UID']; $aUsr[$aAux['USR_FIRSTNAME'] . ' ' . $aAux['USR_LASTNAME']] = $aAux;
} $aUsrUid[] = $value2['USR_UID'];
} }
} }
} }
}
$aUsers = $oTasks->getUsersOfTask( $aRow['TAS_UID'], 1 );
foreach ($aUsers as $key => $value) { $aUsers = $oTasks->getUsersOfTask( $aRow['TAS_UID'], 1 );
if ($aRow['USR_UID'] != $value['USR_UID']) { foreach ($aUsers as $key => $value) {
if (! in_array( $value['USR_UID'], $aUsrUid )) if ($aRow['USR_UID'] != $value['USR_UID']) {
$aUsr[$value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME']] = $value; if (! in_array( $value['USR_UID'], $aUsrUid )) {
} $aUsr[$value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME']] = $value;
} }
ksort( $aUsr ); }
}
ksort( $aUsr );
//$users=''; //$users='';
//$users='<select name="USERS"><option value="">Seleccione</option>'; //$users='<select name="USERS"><option value="">Seleccione</option>';
foreach ($aUsr as $key => $value) { foreach ($aUsr as $key => $value) {
$tpl->newBlock( "users" ); $tpl->newBlock( "users" );
$name = $value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME'] . ' (' . $value['USR_USERNAME'] . ')'; $name = $value['USR_FIRSTNAME'] . ' ' . $value['USR_LASTNAME'] . ' (' . $value['USR_USERNAME'] . ')';
//$users=$users."<option value='".$value['USR_UID']."'>". $name ."</option>"; //$users=$users."<option value='".$value['USR_UID']."'>". $name ."</option>";
$tpl->assign( "USR_UID", $value['USR_UID'] ); $tpl->assign( "USR_UID", $value['USR_UID'] );
$tpl->assign( "USERS", $name ); $tpl->assign( "USERS", $name );
} }
//$users=$users.' </select>'; //$users=$users.' </select>';
//$tpl->assign( "USERS", $users ); //$tpl->assign( "USERS", $users );
$oDataset->next(); $oDataset->next();
} }
$tpl->gotoBlock( '_ROOT' ); $tpl->gotoBlock( '_ROOT' );
$tpl->assign( "US", $name ); $tpl->assign( "US", $name );
$tpl->assign( "ID_NO_REASSIGN", '-' ); $tpl->assign( "ID_NO_REASSIGN", '-' );
$tpl->assign( "APP_UID", $_GET['APP_UID'] ); $tpl->assign( "APP_UID", $_GET['APP_UID'] );
$tpl->assign( "DEL_INDEX", $_GET['DEL_INDEX'] ); $tpl->assign( "DEL_INDEX", $_GET['DEL_INDEX'] );
$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_TO_REASSIGN'; $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN';
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $tpl ); $G_PUBLISH->AddContent( 'template', '', '', '', $tpl );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,150 +1,152 @@
<?php <?php
/** /**
* cases_ReassignByUser.php * cases_ReassignByUser.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.
*/ */
/** /**
* Reassign ByUser routines * Reassign ByUser routines
* Author Erik Amaru Ortiz <erik@colosa.com> * Author Erik Amaru Ortiz <erik@colosa.com>
*/ */
try { try {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) {
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( $_GET['REASSIGN_USER'] )) { if (! isset( $_GET['REASSIGN_USER'] )) {
$_GET['REASSIGN_USER'] = ''; $_GET['REASSIGN_USER'] = '';
} }
$_GET['REASSIGN_BY'] = 2; $_GET['REASSIGN_BY'] = 2;
$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_TO_REASSIGN'; $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN';
////////////////// //////////////////
///SELECT USR_UID, CONCAT(USR_FIRSTNAME, ' ', USR_LASTNAME, ' (', USR_USERNAME, ')') AS USER_FULLNAME FROM USERS WHERE USR_STATUS <> 'CLOSED'////// ///SELECT USR_UID, CONCAT(USR_FIRSTNAME, ' ', USR_LASTNAME, ' (', USR_USERNAME, ')') AS USER_FULLNAME FROM USERS WHERE USR_STATUS <> 'CLOSED'//////
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oCriteria = new Criteria(); $oCriteria = new Criteria();
$oCriteria->addSelectColumn( UsersPeer::USR_UID ); $oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME ); $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME ); $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_EMAIL ); $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL );
$oCriteria->add( UsersPeer::USR_STATUS, '', Criteria::NOT_EQUAL ); $oCriteria->add( UsersPeer::USR_STATUS, '', Criteria::NOT_EQUAL );
$oDataset = UsersPeer::doSelectRS( $oCriteria ); $oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
/////////////////////// ///////////////////////
G::loadClass( 'configuration' ); G::loadClass( 'configuration' );
$oConf = new Configurations(); $oConf = new Configurations();
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); $oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : ''; $defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : '';
$aUserInfo = array (); $aUserInfo = array ();
$aUserInfo[] = array ('USR_UID' => 'char','USER_FULLNAME' => 'char' $aUserInfo[] = array ('USR_UID' => 'char','USER_FULLNAME' => 'char'
); );
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow1 = $oDataset->getRow(); $aRow1 = $oDataset->getRow();
$infoUser = G::getFormatUserList( $defaultOption, $aRow1 ); $infoUser = G::getFormatUserList( $defaultOption, $aRow1 );
$aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser $aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser
); );
} }
global $_DBArray; global $_DBArray;
$_DBArray['aUserInfo'] = $aUserInfo; $_DBArray['aUserInfo'] = $aUserInfo;
$_SESSION['_DBArray'] = $_DBArray; $_SESSION['_DBArray'] = $_DBArray;
////////////////// //////////////////
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', $_GET ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ReassignBy', '', $_GET );
$sUserToReassign = trim( $_GET['REASSIGN_USER'] ); $sUserToReassign = trim( $_GET['REASSIGN_USER'] );
if ($_GET['REASSIGN_USER'] != '') { if ($_GET['REASSIGN_USER'] != '') {
G::LoadClass( 'tasks' ); G::LoadClass( 'tasks' );
G::LoadClass( 'groups' ); G::LoadClass( 'groups' );
$oTasks = new Tasks(); $oTasks = new Tasks();
$oGroups = new Groups(); $oGroups = new Groups();
$oUser = new Users(); $oUser = new Users();
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCases = new Cases(); $oCases = new Cases();
list ($oCriteriaToDo, $sXMLFile) = $oCases->getConditionCasesList( 'to_do', $sUserToReassign ); list ($oCriteriaToDo, $sXMLFile) = $oCases->getConditionCasesList( 'to_do', $sUserToReassign );
list ($oCriteriaDraft, $sXMLFile) = $oCases->getConditionCasesList( 'draft', $sUserToReassign ); list ($oCriteriaDraft, $sXMLFile) = $oCases->getConditionCasesList( 'draft', $sUserToReassign );
$aCasesList = Array (); $aCasesList = Array ();
$oDataset = ApplicationPeer::doSelectRS( $oCriteriaToDo ); $oDataset = ApplicationPeer::doSelectRS( $oCriteriaToDo );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($oDataset->next()) { while ($oDataset->next()) {
array_push( $aCasesList, $oDataset->getRow() ); array_push( $aCasesList, $oDataset->getRow() );
} }
$oDataset = ApplicationPeer::doSelectRS( $oCriteriaDraft ); $oDataset = ApplicationPeer::doSelectRS( $oCriteriaDraft );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($oDataset->next()) { while ($oDataset->next()) {
array_push( $aCasesList, $oDataset->getRow() ); array_push( $aCasesList, $oDataset->getRow() );
} }
$filedNames = Array ("APP_UID","APP_NUMBER","APP_UPDATE_DATE","DEL_PRIORITY","DEL_INDEX","TAS_UID","DEL_INIT_DATE","DEL_FINISH_DATE","USR_UID","APP_STATUS","DEL_TASK_DUE_DATE","APP_CURRENT_USER","APP_TITLE","APP_PRO_TITLE","APP_TAS_TITLE","APP_DEL_PREVIOUS_USER" $filedNames = Array ("APP_UID","APP_NUMBER","APP_UPDATE_DATE","DEL_PRIORITY","DEL_INDEX","TAS_UID","DEL_INIT_DATE","DEL_FINISH_DATE","USR_UID","APP_STATUS","DEL_TASK_DUE_DATE","APP_CURRENT_USER","APP_TITLE","APP_PRO_TITLE","APP_TAS_TITLE","APP_DEL_PREVIOUS_USER"
); );
$aCasesList = array_merge( Array ($filedNames $aCasesList = array_merge( Array ($filedNames
), $aCasesList ); ), $aCasesList );
// G::pr($aCasesList); die; // G::pr($aCasesList); die;
require_once ('classes/class.xmlfield_InputPM.php'); require_once ('classes/class.xmlfield_InputPM.php');
global $_DBArray; global $_DBArray;
$_DBArray['reassign_byuser'] = $aCasesList; $_DBArray['reassign_byuser'] = $aCasesList;
$_SESSION['_DBArray'] = $_DBArray; $_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer' ); G::LoadClass( 'ArrayPeer' );
$oCriteria = new Criteria( 'dbarray' ); $oCriteria = new Criteria( 'dbarray' );
$oCriteria->setDBArrayTable( 'reassign_byuser' ); $oCriteria->setDBArrayTable( 'reassign_byuser' );
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/cases/reassignByUser.js' ); $oHeadPublisher->addScriptFile( '/jscore/cases/reassignByUser.js' );
$G_PUBLISH->ROWS_PER_PAGE = 12; $G_PUBLISH->ROWS_PER_PAGE = 12;
$G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-reassigByUser', 'cases/cases_ToReassignByUserList', $oCriteria, Array ('FROM_USR_UID' => $sUserToReassign $G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-reassigByUser', 'cases/cases_ToReassignByUserList', $oCriteria, Array ('FROM_USR_UID' => $sUserToReassign
) ); ) );
} }
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }
?> ?>
<div id="publisherContent[10]" style="display: none"></div> <div id="publisherContent[10]" style="display: none"></div>
<?php

View File

@@ -1,75 +1,75 @@
<?php <?php
/** /**
* cases_Reassign_save.php * cases_Reassign_save.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 {
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) { switch ($RBAC->userCanAccess( 'PM_REASSIGNCASE' )) {
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;
} }
//print_r($_POST); die; //print_r($_POST); die;
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
if ($_POST['USERS'] != '') { if ($_POST['USERS'] != '') {
$oCase->reassignCase( $_POST['APP_UID'], $_POST['DEL_INDEX'], $_SESSION['USER_LOGGED'], $_POST['USERS'] ); $oCase->reassignCase( $_POST['APP_UID'], $_POST['DEL_INDEX'], $_SESSION['USER_LOGGED'], $_POST['USERS'] );
} }
require_once 'classes/model/Users.php'; require_once 'classes/model/Users.php';
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load( $_POST['USERS'] ); $aUser = $oUser->load( $_POST['USERS'] );
$Fields = array (); $Fields = array ();
$Fields['USERS'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')'; $Fields['USERS'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')';
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCases = new Cases(); $oCases = new Cases();
$aCases = $oCases->loadCase( $_POST['APP_UID'], $_POST['DEL_INDEX'] ); $aCases = $oCases->loadCase( $_POST['APP_UID'], $_POST['DEL_INDEX'] );
$Fields['APP_NUMBER'] = $aCases['APP_NUMBER']; $Fields['APP_NUMBER'] = $aCases['APP_NUMBER'];
$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_TO_REASSIGN'; $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REASSIGN';
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Reassign.xml', '', $Fields, '' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Reassign.xml', '', $Fields, '' );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
//G::SendMessageText(G::LoadTranslation('ID_FINISHED'), 'info'); //G::SendMessageText(G::LoadTranslation('ID_FINISHED'), 'info');
//G::header('Location: cases_List'); //G::header('Location: cases_List');
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,39 +1,39 @@
<?php <?php
/** /**
* cases_Redirect.php * cases_Redirect.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.
*/ */
/* /*
* Created on 19-03-2009 * Created on 19-03-2009
* *
* @author Everth S . Berrios <everth@colosa.com> * @author Everth S . Berrios <everth@colosa.com>
*/ */
require_once 'classes/model/AppDocument.php'; require_once 'classes/model/AppDocument.php';
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
$aFields = $oAppDocument->load( $_GET['a'] ); $aFields = $oAppDocument->load( $_GET['a'] );
require_once 'classes/model/OutputDocument.php'; require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument(); $oOutputDocument = new OutputDocument();
$aOD = $oOutputDocument->load( $aFields['DOC_UID'] ); $aOD = $oOutputDocument->load( $aFields['DOC_UID'] );
$a = $_GET['a']; $a = $_GET['a'];
$ext = strtolower( $aOD['OUT_DOC_GENERATE'] ); $ext = strtolower( $aOD['OUT_DOC_GENERATE'] );
G::header( 'location: cases_ShowOutputDocument?a=' . $a . '&ext=' . $ext ); G::header( 'location: cases_ShowOutputDocument?a=' . $a . '&ext=' . $ext );

View File

@@ -1,94 +1,95 @@
<?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' );
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* Menues */ /* Menues */
$_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 = '_';
/* Prepare page before to show */ /* Prepare page before to show */
$oCase = new Cases(); $oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
$participated = $oCase->userParticipatedInCase( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); $participated = $oCase->userParticipatedInCase( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] );
if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) { if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) {
/*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') { /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE'); $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
}*/ }*/
$aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ); $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' );
$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' );
die(); die();
} }
if (isset( $aRow['APP_TYPE'] )) { if (isset( $aRow['APP_TYPE'] )) {
switch ($aRow['APP_TYPE']) { switch ($aRow['APP_TYPE']) {
case 'PAUSE': case 'PAUSE':
$Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_PAUSED' ) ) ); $Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_PAUSED' ) ) );
break; break;
case 'CANCEL': case 'CANCEL':
$Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_CANCELLED' ) ) ); $Fields['STATUS'] = ucfirst( strtolower( G::LoadTranslation( 'ID_CANCELLED' ) ) );
break; break;
} }
//$Fields['STATUS'] = $aRow['APP_TYPE']; //$Fields['STATUS'] = $aRow['APP_TYPE'];
} }
$actions = 'false'; $actions = 'false';
if ($_GET['action'] == 'paused') if ($_GET['action'] == 'paused') {
$actions = 'true'; $actions = 'true';
}
/* Render page */
$oHeadPublisher = & headPublisher::getSingleton(); /* Render page */
$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 = {};
@@ -100,21 +101,21 @@ $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);
' ); ' );
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.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'];
$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_Resume.xml', '', $Fields, '' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );

View File

@@ -1,78 +1,82 @@
<?php <?php
/** /**
* cases_Save.php * cases_Save.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' );
/* GET , POST & $_SESSION Vars */ /* GET , POST & $_SESSION Vars */
/* unset any variable, because we are starting a new case */ /* unset any variable, because we are starting a new case */
if (isset( $_SESSION['APPLICATION'] )) if (isset( $_SESSION['APPLICATION'] )) {
unset( $_SESSION['APPLICATION'] ); unset( $_SESSION['APPLICATION'] );
if (isset( $_SESSION['PROCESS'] )) }
unset( $_SESSION['PROCESS'] ); if (isset( $_SESSION['PROCESS'] )) {
if (isset( $_SESSION['TASK'] )) unset( $_SESSION['PROCESS'] );
unset( $_SESSION['TASK'] ); }
if (isset( $_SESSION['INDEX'] )) if (isset( $_SESSION['TASK'] )) {
unset( $_SESSION['INDEX'] ); unset( $_SESSION['TASK'] );
if (isset( $_SESSION['STEP_POSITION'] )) }
unset( $_SESSION['STEP_POSITION'] ); if (isset( $_SESSION['INDEX'] )) {
unset( $_SESSION['INDEX'] );
/* Process */ }
try { if (isset( $_SESSION['STEP_POSITION'] )) {
$oCase = new Cases(); unset( $_SESSION['STEP_POSITION'] );
$aData = $oCase->startCase( $_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED'] ); }
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
$_SESSION['INDEX'] = $aData['INDEX']; /* Process */
$_SESSION['PROCESS'] = $aData['PROCESS']; try {
$_SESSION['TASK'] = $_POST['form']['TAS_UID']; $oCase = new Cases();
$_SESSION['STEP_POSITION'] = 0; $aData = $oCase->startCase( $_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED'] );
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
$_SESSION['CASES_REFRESH'] = true; $_SESSION['INDEX'] = $aData['INDEX'];
$_SESSION['PROCESS'] = $aData['PROCESS'];
$oCase = new Cases(); $_SESSION['TASK'] = $_POST['form']['TAS_UID'];
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $_SESSION['STEP_POSITION'] = 0;
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
$_SESSION['CASES_REFRESH'] = true;
G::header( 'location: ' . $aNextStep['PAGE'] );
} catch (Exception $e) { $oCase = new Cases();
$_SESSION['G_MESSAGE'] = $e->getMessage(); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
$_SESSION['G_MESSAGE_TYPE'] = 'error'; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
G::header( 'location: cases_New' );
} G::header( 'location: ' . $aNextStep['PAGE'] );
} catch (Exception $e) {
$_SESSION['G_MESSAGE'] = $e->getMessage();
$_SESSION['G_MESSAGE_TYPE'] = 'error';
G::header( 'location: cases_New' );
}

View File

@@ -1,320 +1,321 @@
<?php <?php
/** /**
* cases_SaveData.php * cases_SaveData.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.
*/ */
//validate the data post //validate the data post
try { try {
if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) {
throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' ) throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' )
) ) ); ) ) );
} }
$oForm = new Form( $_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM ); $oForm = new Form( $_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM );
$oForm->validatePost(); $oForm->validatePost();
//Includes //Includes
G::LoadClass( "case" ); G::LoadClass( "case" );
//Load the variables //Load the variables
$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" );
$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() );
$Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] ); $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] );
#here we must verify if is a debug session #here we must verify if is a debug session
$trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session $trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session
#trigger debug routines... #trigger debug routines...
//cleaning debug variables //cleaning debug variables
$_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array ();
$_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'], 'DYNAFORM', $_GET['UID'], 'AFTER' ); $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER' );
$_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers );
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers;
} }
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
//Execute after triggers - Start //Execute after triggers - Start
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] );
//Execute after triggers - End //Execute after triggers - End
} }
//save data in PM Tables if necessary //save data in PM Tables if necessary
$newValues = array (); $newValues = array ();
foreach ($_POST['form'] as $sField => $sAux) { foreach ($_POST['form'] as $sField => $sAux) {
if (isset( $oForm->fields[$sField]->pmconnection ) && isset( $oForm->fields[$sField]->pmfield )) { if (isset( $oForm->fields[$sField]->pmconnection ) && isset( $oForm->fields[$sField]->pmfield )) {
if (($oForm->fields[$sField]->pmconnection != '') && ($oForm->fields[$sField]->pmfield != '')) { if (($oForm->fields[$sField]->pmconnection != '') && ($oForm->fields[$sField]->pmfield != '')) {
if (isset( $oForm->fields[$oForm->fields[$sField]->pmconnection] )) { if (isset( $oForm->fields[$oForm->fields[$sField]->pmconnection] )) {
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php'; require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php';
$oAdditionalTables = new AdditionalTables(); $oAdditionalTables = new AdditionalTables();
try { try {
$aData = $oAdditionalTables->load( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, true ); $aData = $oAdditionalTables->load( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, true );
} catch (Exception $oError) { } catch (Exception $oError) {
$aData = array ('FIELDS' => array () $aData = array ('FIELDS' => array ()
); );
} }
$aKeys = array (); $aKeys = array ();
$aAux = explode( '|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys ); $aAux = explode( '|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys );
$i = 0; $i = 0;
$aValues = array (); $aValues = array ();
foreach ($aData['FIELDS'] as $aField) { foreach ($aData['FIELDS'] as $aField) {
if ($aField['FLD_KEY'] == '1') { if ($aField['FLD_KEY'] == '1') {
$aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : ''); $aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : '');
$i ++; $i ++;
} }
if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) { if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) {
$aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField]; $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField];
} else { } else {
$aValues[$aField['FLD_NAME']] = ''; $aValues[$aField['FLD_NAME']] = '';
} }
} }
try { try {
$aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys ); $aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys );
} catch (Exception $oError) { } catch (Exception $oError) {
$aRow = false; $aRow = false;
} }
if ($aRow) { if ($aRow) {
foreach ($aValues as $sKey => $sValue) { foreach ($aValues as $sKey => $sValue) {
if ($sKey != $oForm->fields[$sField]->pmfield) { if ($sKey != $oForm->fields[$sField]->pmfield) {
$aValues[$sKey] = $aRow[$sKey]; $aValues[$sKey] = $aRow[$sKey];
} }
} }
try { try {
$oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aValues ); $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aValues );
} catch (Exception $oError) { } catch (Exception $oError) {
//Nothing //Nothing
} }
} else { } else {
try { try {
// assembling the field list in order to save the data ina new record of a pm table // assembling the field list in order to save the data ina new record of a pm table
if (empty( $newValues )) { if (empty( $newValues )) {
$newValues = $aValues; $newValues = $aValues;
} else { } else {
foreach ($aValues as $aValueKey => $aValueCont) { foreach ($aValues as $aValueKey => $aValueCont) {
if (trim( $newValues[$aValueKey] ) == '') { if (trim( $newValues[$aValueKey] ) == '') {
$newValues[$aValueKey] = $aValueCont; $newValues[$aValueKey] = $aValueCont;
} }
} }
} }
//$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues ); //$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues );
} catch (Exception $oError) { } catch (Exception $oError) {
//Nothing //Nothing
} }
} }
} }
} }
} }
} }
//save data //save data
$aData = array (); $aData = array ();
$aData['APP_NUMBER'] = $Fields['APP_NUMBER']; $aData['APP_NUMBER'] = $Fields['APP_NUMBER'];
$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS'];
$aData['APP_DATA'] = $Fields['APP_DATA']; $aData['APP_DATA'] = $Fields['APP_DATA'];
$aData['DEL_INDEX'] = $_SESSION['INDEX']; $aData['DEL_INDEX'] = $_SESSION['INDEX'];
$aData['TAS_UID'] = $_SESSION['TASK']; $aData['TAS_UID'] = $_SESSION['TASK'];
$aData['CURRENT_DYNAFORM'] = $_GET['UID']; $aData['CURRENT_DYNAFORM'] = $_GET['UID'];
$aData['USER_UID'] = $_SESSION['USER_LOGGED']; $aData['USER_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_STATUS'] = $Fields['APP_STATUS']; $aData['APP_STATUS'] = $Fields['APP_STATUS'];
$aData['PRO_UID'] = $_SESSION['PROCESS']; $aData['PRO_UID'] = $_SESSION['PROCESS'];
$oCase->updateCase( $_SESSION['APPLICATION'], $aData ); $oCase->updateCase( $_SESSION['APPLICATION'], $aData );
// saving the data ina pm table in case that is a new record // saving the data ina pm table in case that is a new record
if (! empty( $newValues )) { if (! empty( $newValues )) {
$id = key( $newValues ); $id = key( $newValues );
if (! $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues )) { //<--This is to know if it is a new registry on the PM Table if (! $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues )) {
$oAdditionalTables->saveDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues ); //<--This is to know if it is a new registry on the PM Table
} $oAdditionalTables->saveDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues );
} }
}
//Save files
require_once ("classes/model/AppDocument.php"); //Save files
require_once ("classes/model/AppDocument.php");
if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$arrayField = array (); if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$arrayFileName = array (); $arrayField = array ();
$arrayFileTmpName = array (); $arrayFileName = array ();
$arrayFileError = array (); $arrayFileTmpName = array ();
$i = 0; $arrayFileError = array ();
$i = 0;
foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) {
if (is_array( $fieldValue )) { foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) {
foreach ($fieldValue as $index => $value) { if (is_array( $fieldValue )) {
if (is_array( $value )) { foreach ($fieldValue as $index => $value) {
foreach ($value as $grdFieldIndex => $grdFieldValue) { if (is_array( $value )) {
$arrayField[$i]["grdName"] = $fieldIndex; foreach ($value as $grdFieldIndex => $grdFieldValue) {
$arrayField[$i]["grdFieldName"] = $grdFieldIndex; $arrayField[$i]["grdName"] = $fieldIndex;
$arrayField[$i]["index"] = $index; $arrayField[$i]["grdFieldName"] = $grdFieldIndex;
$arrayField[$i]["index"] = $index;
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex];
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex]; $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex];
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex]; $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex];
$i = $i + 1; $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex];
} $i = $i + 1;
} }
} }
} else { }
$arrayField[$i] = $fieldIndex; } else {
$arrayField[$i] = $fieldIndex;
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex];
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex]; $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex];
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex]; $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex];
$i = $i + 1; $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex];
} $i = $i + 1;
} }
}
if (count( $arrayField ) > 0) {
for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) { if (count( $arrayField ) > 0) {
if ($arrayFileError[$i] == 0) { for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) {
$indocUid = null; if ($arrayFileError[$i] == 0) {
$fieldName = null; $indocUid = null;
$fieldName = null;
if (is_array( $arrayField[$i] )) {
if (isset( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] )) { if (is_array( $arrayField[$i] )) {
$indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]; if (isset( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] )) {
} $indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]];
}
$fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"];
} else { $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"];
if (isset( $_POST["INPUTS"][$arrayField[$i]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]] )) { } else {
$indocUid = $_POST["INPUTS"][$arrayField[$i]]; if (isset( $_POST["INPUTS"][$arrayField[$i]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]] )) {
} $indocUid = $_POST["INPUTS"][$arrayField[$i]];
}
$fieldName = $arrayField[$i];
} $fieldName = $arrayField[$i];
}
if ($indocUid != null) {
require_once ("classes/model/AppFolder.php"); if ($indocUid != null) {
require_once ("classes/model/InputDocument.php"); require_once ("classes/model/AppFolder.php");
require_once ("classes/model/InputDocument.php");
$oInputDocument = new InputDocument();
$aID = $oInputDocument->load( $indocUid ); $oInputDocument = new InputDocument();
$aID = $oInputDocument->load( $indocUid );
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder(); //Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName
); $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName
} else { );
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName } else {
); $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName
} );
}
$oAppDocument = new AppDocument();
$oAppDocument->create( $aFields ); $oAppDocument = new AppDocument();
$oAppDocument->create( $aFields );
$iDocVersion = $oAppDocument->getDocVersion();
$sAppDocUid = $oAppDocument->getAppDocUid(); $iDocVersion = $oAppDocument->getDocVersion();
$aInfo = pathinfo( $oAppDocument->getAppDocFilename() ); $sAppDocUid = $oAppDocument->getAppDocUid();
$sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : ""); $aInfo = pathinfo( $oAppDocument->getAppDocFilename() );
$sPathName = PATH_DOCUMENT . $_SESSION["APPLICATION"] . PATH_SEP; $sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : "");
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension; $sPathName = PATH_DOCUMENT . $_SESSION["APPLICATION"] . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton(); //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$documentData = new uploadDocumentData( $_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion ); $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); $documentData = new uploadDocumentData( $_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion );
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace; if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid; if (! isset( $aFields["APP_DOC_UID"] )) {
} $aFields["APP_DOC_UID"] = $sAppDocUid;
}
if (! isset( $aFields["DOC_VERSION"] )) {
$aFields["DOC_VERSION"] = $iDocVersion; if (! isset( $aFields["DOC_VERSION"] )) {
} $aFields["DOC_VERSION"] = $iDocVersion;
}
$oAppDocument->update( $aFields );
$oAppDocument->update( $aFields );
unlink( $sPathName . $sFileName );
} unlink( $sPathName . $sFileName );
} }
} }
} }
} }
} }
}
//Go to the next step
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); //Go to the next step
if (isset( $_GET['_REFRESH_'] )) { $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); if (isset( $_GET['_REFRESH_'] )) {
die(); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
} die();
}
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep['PAGE']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
$debuggerAvailable = true; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep['PAGE'];
$debuggerAvailable = true;
if (isset( $_SESSION['current_ux'] ) && $_SESSION['current_ux'] == 'SIMPLIFIED') {
$debuggerAvailable = false; if (isset( $_SESSION['current_ux'] ) && $_SESSION['current_ux'] == 'SIMPLIFIED') {
} $debuggerAvailable = false;
}
if ($trigger_debug_session && $debuggerAvailable) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; if ($trigger_debug_session && $debuggerAvailable) {
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug'; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
} $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
$oForm->validatePost();
$oJSON = new Services_JSON(); $oForm->validatePost();
$_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields']; $oJSON = new Services_JSON();
if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], $oJSON->decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) { $_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields'];
$_POST['next_step'] = $aNextStep; if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], $oJSON->decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) {
$_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $_POST['next_step'] = $aNextStep;
$_POST['req_val'] = $missing_req_values; $_POST['previous_step'] = $oCase->getPreviousStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
$G_PUBLISH = new Publisher(); $_POST['req_val'] = $missing_req_values;
$G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' ); $G_PUBLISH = new Publisher();
G::RenderPage( 'publish', 'blank' ); $G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' );
exit( 0 ); G::RenderPage( 'publish', 'blank' );
} exit( 0 );
}
G::header( 'location: ' . $aNextStep['PAGE'] );
G::header( 'location: ' . $aNextStep['PAGE'] );
} catch (Exception $e) {
$G_PUBLISH = new Publisher(); } catch (Exception $e) {
$aMessage = array (); $G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage = array ();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $aMessage['MESSAGE'] = $e->getMessage();
G::RenderPage( 'publish', 'blank' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
die(); G::RenderPage( 'publish', 'blank' );
} die();
}

View File

@@ -1,55 +1,55 @@
<?php <?php
/** /**
* cases_SaveData.php * cases_SaveData.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.
*/ */
//validate the data post //validate the data post
$oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM ); $oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM );
$oForm->validatePost(); $oForm->validatePost();
/* Includes */ /* Includes */
G::LoadClass( 'case' ); G::LoadClass( 'case' );
//load the variables //load the variables
$oCase = new Cases(); $oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] ); $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] );
//save data //save data
$aData = array (); $aData = array ();
$aData['APP_NUMBER'] = $Fields['APP_NUMBER']; $aData['APP_NUMBER'] = $Fields['APP_NUMBER'];
$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS'];
$aData['APP_DATA'] = $Fields['APP_DATA']; $aData['APP_DATA'] = $Fields['APP_DATA'];
$aData['DEL_INDEX'] = $_SESSION['INDEX']; $aData['DEL_INDEX'] = $_SESSION['INDEX'];
$aData['TAS_UID'] = $_SESSION['TASK']; $aData['TAS_UID'] = $_SESSION['TASK'];
$aData['CURRENT_DYNAFORM'] = $_GET['UID']; $aData['CURRENT_DYNAFORM'] = $_GET['UID'];
$aData['PRO_UID'] = $Fields['PRO_UID']; $aData['PRO_UID'] = $Fields['PRO_UID'];
$aData['USER_UID'] = $_SESSION['USER_LOGGED']; $aData['USER_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_STATUS'] = $Fields['APP_STATUS']; $aData['APP_STATUS'] = $Fields['APP_STATUS'];
//$aData = $oCase->loadCase( $_SESSION['APPLICATION'] ); //$aData = $oCase->loadCase( $_SESSION['APPLICATION'] );
$oCase->updateCase( $_SESSION['APPLICATION'], $aData ); $oCase->updateCase( $_SESSION['APPLICATION'], $aData );
//go to the next step //go to the next step
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] ); $aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
G::header( 'location: cases_StepToRevise?DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] ); G::header( 'location: cases_StepToRevise?DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );

View File

@@ -1,244 +1,243 @@
<?php <?php
/** /**
* cases_SaveDocument.php * cases_SaveDocument.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 {
//First review if there is no error with the uploaded document //First review if there is no error with the uploaded document
if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) { if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) {
$code = $_FILES['form']['error']['APP_DOC_FILENAME']; $code = $_FILES['form']['error']['APP_DOC_FILENAME'];
switch ($code) { switch ($code) {
case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_INI_SIZE:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
break; break;
case UPLOAD_ERR_FORM_SIZE: case UPLOAD_ERR_FORM_SIZE:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
break; break;
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_PARTIAL:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
break; break;
case UPLOAD_ERR_NO_FILE: case UPLOAD_ERR_NO_FILE:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
break; break;
case UPLOAD_ERR_NO_TMP_DIR: case UPLOAD_ERR_NO_TMP_DIR:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
break; break;
case UPLOAD_ERR_CANT_WRITE: case UPLOAD_ERR_CANT_WRITE:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
break; break;
case UPLOAD_ERR_EXTENSION: case UPLOAD_ERR_EXTENSION:
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' ); $message = G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
break; break;
default:
default: $message = G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' ); break;
break; }
} G::SendMessageText( $message, "ERROR" );
G::SendMessageText( $message, "ERROR" ); $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); die();
die(); }
}
$docUid = $_POST['form']['DOC_UID'];
$docUid = $_POST['form']['DOC_UID']; $appDocUid = $_POST['form']['APP_DOC_UID'];
$appDocUid = $_POST['form']['APP_DOC_UID']; $docVersion = $_POST['form']['docVersion'];
$docVersion = $_POST['form']['docVersion']; $actionType = $_POST['form']['actionType'];
$actionType = $_POST['form']['actionType'];
//load the variables //load the variables
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$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' );
$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() );
#trigger debug routines... #trigger debug routines...
//cleaning debug variables //cleaning debug variables
$_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array (); $_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array ();
$_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'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER' ); $triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER' );
$_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers );
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers;
} }
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
//Execute after triggers - Start //Execute after triggers - Start
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] ); $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] );
//Execute after triggers - End //Execute after triggers - End
} }
//save data //save data
$aData = array (); $aData = array ();
$aData['APP_NUMBER'] = $Fields['APP_NUMBER']; $aData['APP_NUMBER'] = $Fields['APP_NUMBER'];
$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS'];
$aData['APP_DATA'] = $Fields['APP_DATA']; $aData['APP_DATA'] = $Fields['APP_DATA'];
$aData['DEL_INDEX'] = $_SESSION['INDEX']; $aData['DEL_INDEX'] = $_SESSION['INDEX'];
$aData['TAS_UID'] = $_SESSION['TASK']; $aData['TAS_UID'] = $_SESSION['TASK'];
//$aData = $oCase->loadCase($_SESSION['APPLICATION']); //$aData = $oCase->loadCase($_SESSION['APPLICATION']);
$oCase->updateCase( $_SESSION['APPLICATION'], $aData ); $oCase->updateCase( $_SESSION['APPLICATION'], $aData );
//save info //save info
require_once ("classes/model/AppDocument.php"); require_once ("classes/model/AppDocument.php");
require_once ('classes/model/AppFolder.php'); require_once ('classes/model/AppFolder.php');
require_once ('classes/model/InputDocument.php'); require_once ('classes/model/InputDocument.php');
$oInputDocument = new InputDocument(); $oInputDocument = new InputDocument();
$aID = $oInputDocument->load( $_GET['UID'] ); $aID = $oInputDocument->load( $_GET['UID'] );
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
//Get the Custom Folder ID (create if necessary) //Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder(); $oFolder = new AppFolder();
$folderId = $oFolder->createFromPath( $aID['INP_DOC_DESTINATION_PATH'] ); $folderId = $oFolder->createFromPath( $aID['INP_DOC_DESTINATION_PATH'] );
//Tags //Tags
$fileTags = $oFolder->parseTags( $aID['INP_DOC_TAGS'] ); $fileTags = $oFolder->parseTags( $aID['INP_DOC_TAGS'] );
switch ($actionType) { switch ($actionType) {
case "R": //replace case "R": //replace
$aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DOC_VERSION' => $docVersion,'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DOC_VERSION' => $docVersion,'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
); );
$oAppDocument->update( $aFields ); $oAppDocument->update( $aFields );
break; break;
case "NV": //New Version case "NV": //New Version
$aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
); );
$oAppDocument->create( $aFields ); $oAppDocument->create( $aFields );
break; break;
default: //New default: //New
$aFields = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags $aFields = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
); );
$oAppDocument->create( $aFields ); $oAppDocument->create( $aFields );
break; break;
} }
$sAppDocUid = $oAppDocument->getAppDocUid(); $sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion(); $iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo( $oAppDocument->getAppDocFilename() ); $info = pathinfo( $oAppDocument->getAppDocFilename() );
$ext = (isset( $info['extension'] ) ? $info['extension'] : ''); $ext = (isset( $info['extension'] ) ? $info['extension'] : '');
//save the file //save the file
if (! empty( $_FILES['form'] )) { if (! empty( $_FILES['form'] )) {
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP; $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext; $sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext;
G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) { if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$oData['APP_UID'] = $_SESSION['APPLICATION']; $oData['APP_UID'] = $_SESSION['APPLICATION'];
$documentData = new uploadDocumentData( $_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid, $iDocVersion ); $documentData = new uploadDocumentData( $_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid, $iDocVersion );
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) { if ($uploadReturn) {
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace; $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
if (! isset( $aFields['APP_DOC_UID'] )) { if (! isset( $aFields['APP_DOC_UID'] )) {
$aFields['APP_DOC_UID'] = $sAppDocUid; $aFields['APP_DOC_UID'] = $sAppDocUid;
} }
if (! isset( $aFields['DOC_VERSION'] )) { if (! isset( $aFields['DOC_VERSION'] )) {
$aFields['DOC_VERSION'] = $iDocVersion; $aFields['DOC_VERSION'] = $iDocVersion;
} }
//$oAppDocument1 = new AppDocument(); //$oAppDocument1 = new AppDocument();
//G::pr($aFields);die; //G::pr($aFields);die;
$oAppDocument->update( $aFields ); $oAppDocument->update( $aFields );
unlink( $sPathName . $sFileName ); unlink( $sPathName . $sFileName );
} }
} }
//end plugin //end plugin
} }
} }
//go to the next step //go to the next step
//if (!isset($_POST['form']['MORE'])) { //if (!isset($_POST['form']['MORE'])) {
if (false) { if (false) {
$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'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' );
die(); die();
} }
G::header( 'location: ' . $aNextStep['PAGE'] ); G::header( 'location: ' . $aNextStep['PAGE'] );
die(); die();
} else { } else {
if (isset( $_SERVER['HTTP_REFERER'] )) { if (isset( $_SERVER['HTTP_REFERER'] )) {
if ($_SERVER['HTTP_REFERER'] != '') { if ($_SERVER['HTTP_REFERER'] != '') {
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $_SERVER['HTTP_REFERER']; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $_SERVER['HTTP_REFERER'];
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] . '&breakpoint=triggerdebug' ); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] . '&breakpoint=triggerdebug' );
die(); die();
} }
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
die(); die();
} else { } else {
$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 );
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' );
die(); die();
} }
G::header( 'location: ' . $aNextStep['PAGE'] ); G::header( 'location: ' . $aNextStep['PAGE'] );
die(); die();
} }
} else { } else {
$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 );
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; $_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' ); G::header( 'location: ' . $aNextStep['PAGE'] . '&breakpoint=triggerdebug' );
die(); die();
} }
G::header( 'location: ' . $aNextStep['PAGE'] ); G::header( 'location: ' . $aNextStep['PAGE'] );
die(); die();
} }
} }
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
/* /*
} catch ( Exception $e ) { } catch ( Exception $e ) {
@@ -247,5 +246,5 @@ $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
$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' ); G::RenderPage( 'publish' );
}*/ }*/

View File

@@ -1,77 +1,80 @@
<?php <?php
if (! isset( $_REQUEST['action'] )) { if (! isset( $_REQUEST['action'] )) {
$return['success'] = 'failure'; $return['success'] = 'failure';
$return['message'] = 'You may request an action'; $return['message'] = 'You may request an action';
print G::json_encode( $return ); print G::json_encode( $return );
die(); die();
} }
if (! function_exists( $_REQUEST['action'] )) { if (! function_exists( $_REQUEST['action'] )) {
$return['success'] = 'failure'; $return['success'] = 'failure';
$return['message'] = 'The requested action doesn\'t exists'; $return['message'] = 'The requested action doesn\'t exists';
print G::json_encode( $return ); print G::json_encode( $return );
die(); die();
} }
$functionName = $_REQUEST['action']; $functionName = $_REQUEST['action'];
//var_dump($functionName); //var_dump($functionName);
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array (); $functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionName( $functionParams ); $functionName( $functionParams );
function searchSavedJob ($schUid) function searchSavedJob ($schUid)
{ {
} }
function pluginsList () function pluginsList ()
{ {
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
$selectedPlugin = ""; $selectedPlugin = "";
if ((isset( $_REQUEST['plg_uid'] )) && ($_REQUEST['plg_uid'] != "")) if ((isset( $_REQUEST['plg_uid'] )) && ($_REQUEST['plg_uid'] != "")) {
$selectedPlugin = $_REQUEST['plg_uid']; $selectedPlugin = $_REQUEST['plg_uid'];
if (! empty( $activePluginsForCaseScheduler )) { }
echo '<select style="width: 300px;" name="form[CASE_SH_PLUGIN_UID]" id="form[CASE_SH_PLUGIN_UID]" class="module_app_input___gray" required="1" onChange="showPluginSelection(this.options[this.selectedIndex].value,getField(\'PRO_UID\').value)">'; if (! empty( $activePluginsForCaseScheduler )) {
echo "<option value=\"\">- Select -</option>"; echo '<select style="width: 300px;" name="form[CASE_SH_PLUGIN_UID]" id="form[CASE_SH_PLUGIN_UID]" class="module_app_input___gray" required="1" onChange="showPluginSelection(this.options[this.selectedIndex].value,getField(\'PRO_UID\').value)">';
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { echo "<option value=\"\">- Select -</option>";
$sActionId = $caseSchedulerPluginDetail->sActionId; foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
$sNamespace = $caseSchedulerPluginDetail->sNamespace; $sActionId = $caseSchedulerPluginDetail->sActionId;
$optionId = $sNamespace . "--" . $sActionId; $sNamespace = $caseSchedulerPluginDetail->sNamespace;
$selectedOption = ""; $optionId = $sNamespace . "--" . $sActionId;
if ($selectedPlugin == $optionId) $selectedOption = "";
$selectedOption = "selected"; if ($selectedPlugin == $optionId) {
echo "<option value=\"$optionId\" $selectedOption>" . $sActionId . "</option>"; $selectedOption = "selected";
} }
echo '</select>'; echo "<option value=\"$optionId\" $selectedOption>" . $sActionId . "</option>";
}
echo '</select>';
//G::pr($activePlugnsForCaseScheduler); //G::pr($activePlugnsForCaseScheduler);
} }
} }
function pluginCaseSchedulerForm () function pluginCaseSchedulerForm ()
{ {
if (! isset( $_REQUEST['selectedOption'] )) if (! isset( $_REQUEST['selectedOption'] )) {
die(); die();
$G_PUBLISH = new Publisher(); }
$params = explode( "--", $_REQUEST['selectedOption'] ); $G_PUBLISH = new Publisher();
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $params = explode( "--", $_REQUEST['selectedOption'] );
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
$caseSchedulerSelected = $caseSchedulerPluginDetail; if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
} $caseSchedulerSelected = $caseSchedulerPluginDetail;
} }
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { }
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
//Render the form //Render the form
if ((isset( $_REQUEST['sch_uid'] )) && ($_REQUEST['sch_uid'] != "")) { if ((isset( $_REQUEST['sch_uid'] )) && ($_REQUEST['sch_uid'] != "")) {
//$oData=$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionGetFields, array("SCH_UID"=>$_REQUEST['sch_uid']) ); //$oData=$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionGetFields, array("SCH_UID"=>$_REQUEST['sch_uid']) );
$oData = array ("SCH_UID" => $_REQUEST['sch_uid'],"PRO_UID" => $_REQUEST['pro_uid'] $oData = array ("SCH_UID" => $_REQUEST['sch_uid'],"PRO_UID" => $_REQUEST['pro_uid']
); );
} else { } else {
$oData = array ("PRO_UID" => $_REQUEST['pro_uid'] $oData = array ("PRO_UID" => $_REQUEST['pro_uid']
); );
} }
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData ); $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData );
} }
} }

View File

@@ -1,33 +1,33 @@
<?php <?php
//$oUserId = '2963666854afbb1cea372c4011254883'; //$oUserId = '2963666854afbb1cea372c4011254883';
$oUserId = $_POST['USR_UID']; $oUserId = $_POST['USR_UID'];
$process = isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : $_SESSION['PROCESS']; $process = isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : $_SESSION['PROCESS'];
//echo '<select style="width: 300px;" readOnly name="form[PRO_UID]" id="form[PRO_UID]" class="module_app_input___gray" required="1" onChange="loadTasksDropdown(this.value,\''.$oUserId.'\');">'; //echo '<select style="width: 300px;" readOnly name="form[PRO_UID]" id="form[PRO_UID]" class="module_app_input___gray" required="1" onChange="loadTasksDropdown(this.value,\''.$oUserId.'\');">';
require_once ("classes/model/TaskPeer.php"); require_once ("classes/model/TaskPeer.php");
require_once ("classes/model/ProcessPeer.php"); require_once ("classes/model/ProcessPeer.php");
require_once ("classes/model/TaskUserPeer.php"); require_once ("classes/model/TaskUserPeer.php");
G::LoadClass( 'Content' ); G::LoadClass( 'Content' );
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID ); $oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
$oCriteria->setDistinct(); $oCriteria->setDistinct();
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE ); $oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addJoin( ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN ); $oCriteria->addJoin( ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN );
$oCriteria->addJoin( ProcessPeer::PRO_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN ); $oCriteria->addJoin( ProcessPeer::PRO_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN );
$oCriteria->addJoin( TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN ); $oCriteria->addJoin( TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN );
$oCriteria->add( TaskUserPeer::USR_UID, $oUserId ); $oCriteria->add( TaskUserPeer::USR_UID, $oUserId );
$oCriteria->add( TaskPeer::TAS_START, 'true' ); $oCriteria->add( TaskPeer::TAS_START, 'true' );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); $oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG ); $oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->addAnd( ProcessPeer::PRO_UID, $process ); $oCriteria->addAnd( ProcessPeer::PRO_UID, $process );
$resultSet = TaskUserPeer::doSelectRS( $oCriteria ); $resultSet = TaskUserPeer::doSelectRS( $oCriteria );
while ($resultSet->next()) { while ($resultSet->next()) {
$row = $resultSet->getRow(); $row = $resultSet->getRow();
echo $row[1]; echo $row[1];
echo "<input name=\"form[PRO_UID]\" id=\"form[PRO_UID]\" type=\"hidden\" value=\"" . $row[0] . "\"></input>"; echo "<input name=\"form[PRO_UID]\" id=\"form[PRO_UID]\" type=\"hidden\" value=\"" . $row[0] . "\"></input>";
//var_dump($row); //var_dump($row);
} }
//echo "</select>"; //echo "</select>";

View File

@@ -1,6 +1,6 @@
<select style="width: 300px;" name="form[TAS_UID]" id="form[TAS_UID]" <select style="width: 300px;" name="form[TAS_UID]" id="form[TAS_UID]"
class="module_app_input___gray" required="1"> class="module_app_input___gray" required="1">
<?php <?php
//$oUserId = '2963666854afbb1cea372c4011254883'; //$oUserId = '2963666854afbb1cea372c4011254883';
//$oProcessId = '9977730834afd2a0deecaf3040551794'; //$oProcessId = '9977730834afd2a0deecaf3040551794';
$oUserId = $_POST['USR_UID']; $oUserId = $_POST['USR_UID'];
@@ -20,4 +20,5 @@ foreach ($startTasks as $task) {
// echo "<option value=\"".$value."\">".$label."</option>"; // echo "<option value=\"".$value."\">".$label."</option>";
?> ?>
</select> </select>
<?php

View File

@@ -1,70 +1,70 @@
<?php <?php
/** /**
* cases_SchedulerValidateUser.php * cases_SchedulerValidateUser.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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.
*/ */
/** /**
* process_SchedulerValidate_User * process_SchedulerValidate_User
* validates if the username and password are valid data and if the user assigned * validates if the username and password are valid data and if the user assigned
* to the process and task has the rights and persmissions required to create a cron task * to the process and task has the rights and persmissions required to create a cron task
*/ */
$sWS_USER = trim( $_REQUEST['USERNAME'] ); $sWS_USER = trim( $_REQUEST['USERNAME'] );
$sWS_PASS = trim( $_REQUEST['PASSWORD'] ); $sWS_PASS = trim( $_REQUEST['PASSWORD'] );
if (G::is_https()) { if (G::is_https()) {
$http = 'https://'; $http = 'https://';
} else { } else {
$http = 'http://'; $http = 'http://';
} }
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@$client = new SoapClient( $endpoint ); @$client = new SoapClient( $endpoint );
$user = $sWS_USER; $user = $sWS_USER;
$pass = $sWS_PASS; $pass = $sWS_PASS;
$params = array ('userid' => $user,'password' => $pass); $params = array ('userid' => $user,'password' => $pass);
$result = $client->__SoapCall( 'login', array ($params) ); $result = $client->__SoapCall( 'login', array ($params) );
if ($result->status_code == 0) { if ($result->status_code == 0) {
if (! class_exists( 'Users' )) { if (! class_exists( 'Users' )) {
require ("classes/model/UsersPeer.php"); require ("classes/model/UsersPeer.php");
} }
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'USR_UID' ); $oCriteria->addSelectColumn( 'USR_UID' );
$oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER );
$resultSet = UsersPeer::doSelectRS( $oCriteria ); $resultSet = UsersPeer::doSelectRS( $oCriteria );
$resultSet->next(); $resultSet->next();
$user_id = $resultSet->getRow(); $user_id = $resultSet->getRow();
$result->message = $user_id[0]; $result->message = $user_id[0];
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$caseInstance = new Cases(); $caseInstance = new Cases();
if (! $caseInstance->canStartCase( $result->message, $_REQUEST['PRO_UID'] )) { if (! $caseInstance->canStartCase( $result->message, $_REQUEST['PRO_UID'] )) {
$result->status_code = - 1000; $result->status_code = - 1000;
$result->message = G::LoadTranslation( 'ID_USER_CASES_NOT_START' ); $result->message = G::LoadTranslation( 'ID_USER_CASES_NOT_START' );
} }
} }
die( G::json_encode( $result ) ); die( G::json_encode( $result ) );

View File

@@ -1,27 +1,27 @@
<?php <?php
/** /**
* cases_Scheduler_ChangeStatus.php * cases_Scheduler_ChangeStatus.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.
*/ */
global $RBAC; global $RBAC;
/* /*
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess('PM_FACTORY'))
{ {
@@ -45,10 +45,10 @@ switch ($RBAC->userCanAccess('PM_FACTORY'))
G::header('location: ' . $_SERVER['HTTP_REFERER']); G::header('location: ' . $_SERVER['HTTP_REFERER']);
*/ */
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
// G::LoadClass('CaseScheduler'); // G::LoadClass('CaseScheduler');
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$oCaseScheduler->changeStatus( $_GET['SCH_UID'] ); $oCaseScheduler->changeStatus( $_GET['SCH_UID'] );
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] ); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );

View File

@@ -1,135 +1,135 @@
<?php <?php
/** /**
* cases_SchedulerNew.php * cases_SchedulerNew.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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 {
global $RBAC; global $RBAC;
/* /*
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess('PM_FACTORY'))
{ {
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;
} }
*/ */
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php'; require_once 'classes/model/Task.php';
// $G_MAIN_MENU = 'processmaker'; // $G_MAIN_MENU = 'processmaker';
// $G_ID_MENU_SELECTED = 'CASES'; // $G_ID_MENU_SELECTED = 'CASES';
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
G::LoadClass( 'case' ); G::LoadClass( 'case' );
/* Prepare page before to show */ /* Prepare page before to show */
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$aFields = $oCaseScheduler->load( $_GET['SCH_UID'] ); $aFields = $oCaseScheduler->load( $_GET['SCH_UID'] );
$aFields['UID_SCHEDULER'] = "scheduler"; $aFields['UID_SCHEDULER'] = "scheduler";
// load according the scheduler option selected daily/weekly/monthly/one time // load according the scheduler option selected daily/weekly/monthly/one time
$nOpt = $aFields['SCH_OPTION']; $nOpt = $aFields['SCH_OPTION'];
switch ($nOpt) { switch ($nOpt) {
case 1: case 1:
$aStartDay = explode( '|', $aFields['SCH_DAYS_PERFORM_TASK'] ); $aStartDay = explode( '|', $aFields['SCH_DAYS_PERFORM_TASK'] );
if ($aStartDay[0] != 3) { if ($aStartDay[0] != 3) {
$aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0];
} else { } else {
$aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0]; $aFields['SCH_DAYS_PERFORM_TASK'] = $aStartDay[0];
$aFields['SCH_DAYS_PERFORM_TASK_OPT_3'] = $aStartDay[1]; $aFields['SCH_DAYS_PERFORM_TASK_OPT_3'] = $aStartDay[1];
} }
break; break;
case 2: case 2:
$aFields['SCH_WEEK_DAYS_2'] = $aFields['SCH_WEEK_DAYS']; $aFields['SCH_WEEK_DAYS_2'] = $aFields['SCH_WEEK_DAYS'];
break; break;
case 3: // $nStartDay = $aFields['SCH_START_DAY']; case 3: // $nStartDay = $aFields['SCH_START_DAY'];
$aStartDay = explode( '|', $aFields['SCH_START_DAY'] ); $aStartDay = explode( '|', $aFields['SCH_START_DAY'] );
if ($aStartDay[0] == 1) { if ($aStartDay[0] == 1) {
$aFields['SCH_START_DAY_OPT_1'] = $aStartDay[1]; $aFields['SCH_START_DAY_OPT_1'] = $aStartDay[1];
} else { } else {
$aFields['SCH_START_DAY_OPT_2_WEEKS'] = $aStartDay[1]; $aFields['SCH_START_DAY_OPT_2_WEEKS'] = $aStartDay[1];
$aFields['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $aStartDay[2]; $aFields['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $aStartDay[2];
} }
$aFields['SCH_START_DAY'] = $aStartDay[0]; $aFields['SCH_START_DAY'] = $aStartDay[0];
$aFields['SCH_MONTHS_2'] = $aFields['SCH_MONTHS']; $aFields['SCH_MONTHS_2'] = $aFields['SCH_MONTHS'];
$aFields['SCH_MONTHS_3'] = $aFields['SCH_MONTHS']; $aFields['SCH_MONTHS_3'] = $aFields['SCH_MONTHS'];
break; break;
case 4: case 4:
break; break;
} }
$aFields['SCH_START_TIME'] = date( 'H:i', strtotime( $aFields['SCH_START_TIME'] ) ); $aFields['SCH_START_TIME'] = date( 'H:i', strtotime( $aFields['SCH_START_TIME'] ) );
$aFields['PREV_SCH_START_TIME'] = $aFields['SCH_START_TIME']; $aFields['PREV_SCH_START_TIME'] = $aFields['SCH_START_TIME'];
$aFields['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_START_DATE'] ) ); $aFields['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_START_DATE'] ) );
$aFields['PREV_SCH_START_DATE'] = $aFields['SCH_START_DATE']; $aFields['PREV_SCH_START_DATE'] = $aFields['SCH_START_DATE'];
if (! empty( $aFields['SCH_END_DATE'] )) { if (! empty( $aFields['SCH_END_DATE'] )) {
$aFields['SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) ); $aFields['SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) );
$aFields['PREV_SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) ); $aFields['PREV_SCH_END_DATE'] = date( 'Y-m-d', strtotime( $aFields['SCH_END_DATE'] ) );
} }
if ($aFields['SCH_REPEAT_STOP_IF_RUNNING'] == 0 || $aFields['SCH_REPEAT_STOP_IF_RUNNING'] == null) { if ($aFields['SCH_REPEAT_STOP_IF_RUNNING'] == 0 || $aFields['SCH_REPEAT_STOP_IF_RUNNING'] == null) {
$aFields['SCH_REPEAT_STOP_IF_RUNNING'] = null; $aFields['SCH_REPEAT_STOP_IF_RUNNING'] = null;
} else { } else {
$aFields['SCH_REPEAT_STOP_IF_RUNNING'] = 'On'; $aFields['SCH_REPEAT_STOP_IF_RUNNING'] = 'On';
} }
$aFields['SCH_USER_NAME'] = $aFields['SCH_DEL_USER_NAME']; $aFields['SCH_USER_NAME'] = $aFields['SCH_DEL_USER_NAME'];
$aFields['SCH_USER_PASSWORD'] = 'DefaultPM'; $aFields['SCH_USER_PASSWORD'] = 'DefaultPM';
$aFields['SCH_USER_UID'] = $aFields['SCH_DEL_USER_UID']; $aFields['SCH_USER_UID'] = $aFields['SCH_DEL_USER_UID'];
$aFields['SCH_START_DATE'] = date( "Y-m-d", strtotime( $aFields['SCH_START_DATE'] ) ); $aFields['SCH_START_DATE'] = date( "Y-m-d", strtotime( $aFields['SCH_START_DATE'] ) );
// validating if any of the advanced fields is non empty // validating if any of the advanced fields is non empty
// var_dump($aFields['SCH_END_DATE']); // var_dump($aFields['SCH_END_DATE']);
// var_dump($aFields['SCH_REPEAT_EVERY']); // var_dump($aFields['SCH_REPEAT_EVERY']);
// die(); // die();
if ($aFields['SCH_END_DATE'] != NULL || trim( $aFields['SCH_REPEAT_EVERY'] ) != '') { if ($aFields['SCH_END_DATE'] != null || trim( $aFields['SCH_REPEAT_EVERY'] ) != '') {
$aFields['SCH_ADVANCED'] = 'true'; $aFields['SCH_ADVANCED'] = 'true';
} else { } else {
$aFields['SCH_ADVANCED'] = 'false'; $aFields['SCH_ADVANCED'] = 'false';
} }
$aFields['PRO_UID_TMP'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS']; $aFields['PRO_UID_TMP'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS'];
$aFields['PHP_START_DATE'] = date( 'Y-m-d' ); $aFields['PHP_START_DATE'] = date( 'Y-m-d' );
$aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) ); $aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Edit.xml', '', $aFields, 'cases_Scheduler_Update' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Edit.xml', '', $aFields, 'cases_Scheduler_Update' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,31 +1,31 @@
<?php <?php
/** /**
* cases_Scheduler_List.php * cases_Scheduler_List.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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_LOGIN" )) != 1) { if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
} }
global $RBAC; global $RBAC;
/*switch ($RBAC->userCanAccess('PM_USERS')) /*switch ($RBAC->userCanAccess('PM_USERS'))
{ {
case -2: case -2:
@@ -38,57 +38,57 @@ global $RBAC;
G::header('location: ../login/login'); G::header('location: ../login/login');
die; die;
break; break;
}*/ }*/
$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_SCHEDULER'; $G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER';
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
$process = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS']; $process = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS'];
$sDelimiter = DBAdapter::getStringDelimiter(); $sDelimiter = DBAdapter::getStringDelimiter();
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$aRows = $oCaseScheduler->getAllByProcess( $process ); $aRows = $oCaseScheduler->getAllByProcess( $process );
//$oCaseScheduler->caseSchedulerCron(); //$oCaseScheduler->caseSchedulerCron();
// g::pr($aRows); die; // g::pr($aRows); die;
$fieldNames = Array ('SCH_UID' => 'char','SCH_NAME' => 'char','PRO_UID' => 'char','TAS_UID' => 'char','SCH_TIME_NEXT_RUN' => 'char','SCH_LAST_RUN_TIME' => 'char','SCH_STATE' => 'char','SCH_LAST_STATE' => 'char','USR_UID' => 'char','SCH_OPTION' => 'char','SCH_START_TIME' => 'char','SCH_START_DATE' => 'char','SCH_DAYS_PERFORM_TASK' => 'char','SCH_EVERY_DAYS' => 'char','SCH_WEEK_DAYS' => 'char','SCH_START_DAY' => 'char','SCH_MONTHS' => 'char','SCH_END_DATE' => 'char','SCH_REPEAT_EVERY' => 'char','SCH_REPEAT_UNTIL' => 'char','SCH_REPEAT_STOP_IF_RUNNING' => 'char','PRO_PARENT' => 'char','PRO_TIME' => 'char','PRO_TIMEUNIT' => 'char','PRO_STATUS' => 'char','PRO_TYPE_DAY' => 'char','PRO_TYPE' => 'char','PRO_ASSIGNMENT' => 'char','PRO_SHOW_MAP' => 'char','PRO_SHOW_MESSAGE' => 'char', $fieldNames = Array ('SCH_UID' => 'char','SCH_NAME' => 'char','PRO_UID' => 'char','TAS_UID' => 'char','SCH_TIME_NEXT_RUN' => 'char','SCH_LAST_RUN_TIME' => 'char','SCH_STATE' => 'char','SCH_LAST_STATE' => 'char','USR_UID' => 'char','SCH_OPTION' => 'char','SCH_START_TIME' => 'char','SCH_START_DATE' => 'char','SCH_DAYS_PERFORM_TASK' => 'char','SCH_EVERY_DAYS' => 'char','SCH_WEEK_DAYS' => 'char','SCH_START_DAY' => 'char','SCH_MONTHS' => 'char','SCH_END_DATE' => 'char','SCH_REPEAT_EVERY' => 'char','SCH_REPEAT_UNTIL' => 'char','SCH_REPEAT_STOP_IF_RUNNING' => 'char','PRO_PARENT' => 'char','PRO_TIME' => 'char','PRO_TIMEUNIT' => 'char','PRO_STATUS' => 'char','PRO_TYPE_DAY' => 'char','PRO_TYPE' => 'char','PRO_ASSIGNMENT' => 'char','PRO_SHOW_MAP' => 'char','PRO_SHOW_MESSAGE' => 'char',
'PRO_SUBPROCESS' => 'char','PRO_TRI_DELETED' => 'char','PRO_TRI_CANCELED' => 'char','PRO_TRI_PAUSED' => 'char','PRO_TRI_REASSIGNED' => 'char','PRO_SHOW_DELEGATE' => 'char','PRO_SHOW_DYNAFORM' => 'char','PRO_CATEGORY' => 'char','PRO_SUB_CATEGORY' => 'char','PRO_INDUSTRY' => 'char','PRO_UPDATE_DATE' => 'char','PRO_CREATE_DATE' => 'char','PRO_CREATE_USER' => 'char','PRO_HEIGHT' => 'char','PRO_WIDTH' => 'char','PRO_TITLE_X' => 'char','PRO_TITLE_Y' => 'char','PRO_DEBUG' => 'char','PRO_TITLE' => 'char','PRO_DESCRIPTION' => 'char','TAS_TYPE' => 'char','TAS_DURATION' => 'char','TAS_DELAY_TYPE' => 'char','TAS_TEMPORIZER' => 'char','TAS_TYPE_DAY' => 'char','TAS_TIMEUNIT' => 'char','TAS_ALERT' => 'char','TAS_PRIORITY_VARIABLE' => 'char','TAS_ASSIGN_TYPE' => 'char', 'PRO_SUBPROCESS' => 'char','PRO_TRI_DELETED' => 'char','PRO_TRI_CANCELED' => 'char','PRO_TRI_PAUSED' => 'char','PRO_TRI_REASSIGNED' => 'char','PRO_SHOW_DELEGATE' => 'char','PRO_SHOW_DYNAFORM' => 'char','PRO_CATEGORY' => 'char','PRO_SUB_CATEGORY' => 'char','PRO_INDUSTRY' => 'char','PRO_UPDATE_DATE' => 'char','PRO_CREATE_DATE' => 'char','PRO_CREATE_USER' => 'char','PRO_HEIGHT' => 'char','PRO_WIDTH' => 'char','PRO_TITLE_X' => 'char','PRO_TITLE_Y' => 'char','PRO_DEBUG' => 'char','PRO_TITLE' => 'char','PRO_DESCRIPTION' => 'char','TAS_TYPE' => 'char','TAS_DURATION' => 'char','TAS_DELAY_TYPE' => 'char','TAS_TEMPORIZER' => 'char','TAS_TYPE_DAY' => 'char','TAS_TIMEUNIT' => 'char','TAS_ALERT' => 'char','TAS_PRIORITY_VARIABLE' => 'char','TAS_ASSIGN_TYPE' => 'char',
'TAS_ASSIGN_VARIABLE' => 'char','TAS_ASSIGN_LOCATION' => 'char','TAS_ASSIGN_LOCATION_ADHOC' => 'char','TAS_TRANSFER_FLY' => 'char','TAS_LAST_ASSIGNED' => 'char','TAS_USER' => 'char','TAS_CAN_UPLOAD' => 'char','TAS_VIEW_UPLOAD' => 'char','TAS_VIEW_ADDITIONAL_DOCUMENTATION' => 'char','TAS_CAN_CANCEL' => 'char','TAS_OWNER_APP' => 'char','STG_UID' => 'char','TAS_CAN_PAUSE' => 'char','TAS_CAN_SEND_MESSAGE' => 'char','TAS_CAN_DELETE_DOCS' => 'char','TAS_SELF_SERVICE' => 'char','TAS_START' => 'char','TAS_TO_LAST_USER' => 'char','TAS_SEND_LAST_EMAIL' => 'char','TAS_DERIVATION' => 'char','TAS_POSX' => 'char','TAS_POSY' => 'char','TAS_COLOR' => 'char','TAS_TITLE' => 'char','TAS_DESCRIPTION' => 'char','TAS_DEF_TITLE' => 'char','TAS_DEF_DESCRIPTION' => 'char', 'TAS_ASSIGN_VARIABLE' => 'char','TAS_ASSIGN_LOCATION' => 'char','TAS_ASSIGN_LOCATION_ADHOC' => 'char','TAS_TRANSFER_FLY' => 'char','TAS_LAST_ASSIGNED' => 'char','TAS_USER' => 'char','TAS_CAN_UPLOAD' => 'char','TAS_VIEW_UPLOAD' => 'char','TAS_VIEW_ADDITIONAL_DOCUMENTATION' => 'char','TAS_CAN_CANCEL' => 'char','TAS_OWNER_APP' => 'char','STG_UID' => 'char','TAS_CAN_PAUSE' => 'char','TAS_CAN_SEND_MESSAGE' => 'char','TAS_CAN_DELETE_DOCS' => 'char','TAS_SELF_SERVICE' => 'char','TAS_START' => 'char','TAS_TO_LAST_USER' => 'char','TAS_SEND_LAST_EMAIL' => 'char','TAS_DERIVATION' => 'char','TAS_POSX' => 'char','TAS_POSY' => 'char','TAS_COLOR' => 'char','TAS_TITLE' => 'char','TAS_DESCRIPTION' => 'char','TAS_DEF_TITLE' => 'char','TAS_DEF_DESCRIPTION' => 'char',
'TAS_DEF_PROC_CODE' => 'char','TAS_DEF_MESSAGE' => 'char' 'TAS_DEF_PROC_CODE' => 'char','TAS_DEF_MESSAGE' => 'char'
); );
$aRows = array_merge( Array ($fieldNames $aRows = array_merge( Array ($fieldNames
), $aRows ); ), $aRows );
//krumo ($aRows); //krumo ($aRows);
for ($j = 0; $j < count( $aRows ); $j ++) { for ($j = 0; $j < count( $aRows ); $j ++) {
if ($aRows[$j]['SCH_STATE'] == 'PROCESSED') { if ($aRows[$j]['SCH_STATE'] == 'PROCESSED') {
$aRows[$j]['SCH_TIME_NEXT_RUN'] = ''; $aRows[$j]['SCH_TIME_NEXT_RUN'] = '';
} }
} }
// g::pr($aRows); die; // g::pr($aRows); die;
global $_DBArray; global $_DBArray;
$_DBArray['cases_scheduler'] = $aRows; $_DBArray['cases_scheduler'] = $aRows;
$_SESSION['_DBArray'] = $_DBArray; $_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer' ); G::LoadClass( 'ArrayPeer' );
$oCriteria = new Criteria( 'dbarray' ); $oCriteria = new Criteria( 'dbarray' );
$oCriteria->setDBArrayTable( 'cases_scheduler' ); $oCriteria->setDBArrayTable( 'cases_scheduler' );
//krumo ($oCriteria); //krumo ($oCriteria);
//var_dump ($oCriteria); //var_dump ($oCriteria);
//$oCriteria->add('PRO_UID', $_SESSION['PROCESS']); //$oCriteria->add('PRO_UID', $_SESSION['PROCESS']);
//krumo($_SESSION); //krumo($_SESSION);
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->ROWS_PER_PAGE = 10; $G_PUBLISH->ROWS_PER_PAGE = 10;
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_Scheduler_List', $oCriteria, array ('CONFIRM' => G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER' ) $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_Scheduler_List', $oCriteria, array ('CONFIRM' => G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER' )
) ); ) );
$G_PUBLISH->oPropelTable->rowsPerPage = 10; $G_PUBLISH->oPropelTable->rowsPerPage = 10;
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,43 +1,44 @@
<?php <?php
/** /**
* cases_Scheduler_Log.php * cases_Scheduler_Log.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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_LOGIN" )) != 1) if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
}
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' ); $G_PUBLISH = new Publisher();
$c = new Configurations(); G::LoadClass( 'configuration' );
$configPage = $c->getConfiguration( 'casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); $c = new Configurations();
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20; $configPage = $c->getConfiguration( 'casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'cases/casesSchedulerLog', false ); //adding a javascript file .js $oHeadPublisher->addExtJsScript( 'cases/casesSchedulerLog', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'cases/casesSchedulerLog' ); //adding a html file .html. $oHeadPublisher->addContent( 'cases/casesSchedulerLog' ); //adding a html file .html.
$oHeadPublisher->assign( 'CONFIG', $Config ); $oHeadPublisher->assign( 'CONFIG', $Config );
G::RenderPage( 'publish', 'extJs' ); G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,87 +1,87 @@
<?php <?php
/** /**
* cases_Scheduler_Log_Detail.php * cases_Scheduler_Log_Detail.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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 {
global $RBAC; global $RBAC;
/*
switch ($RBAC->userCanAccess('PM_FACTORY'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
*/
/* /*
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; switch ($RBAC->userCanAccess('PM_FACTORY'))
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); {
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); case -2:
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); G::header('location: ../login/login');
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); die;
// the default role variable sets the value that will be showed as the default for the role field. break;
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR'; case -1:
$aFields['START_DATE'] = date('Y-m-d'); G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); G::header('location: ../login/login');
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); die;
*/ break;
if (! class_exists( 'LogCasesSchedulerPeer' )) { }
require_once ('classes/model/LogCasesScheduler.php'); */
}
/*
$G_PUBLISH = new Publisher(); $aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!';
$oCriteria = new Criteria( 'workflow' ); $aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME'));
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE'));
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'));
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
// the default role variable sets the value that will be showed as the default for the role field.
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR';
$aFields['START_DATE'] = date('Y-m-d');
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5));
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));
*/
if (! class_exists( 'LogCasesSchedulerPeer' )) {
require_once ('classes/model/LogCasesScheduler.php');
}
$G_PUBLISH = new Publisher();
$oCriteria = new Criteria( 'workflow' );
// var_dump(htmlspecialchars($_GET['WS_ROUTE'])); // var_dump(htmlspecialchars($_GET['WS_ROUTE']));
// var_dump(htmlentities($_GET['WS_ROUTE'])); // var_dump(htmlentities($_GET['WS_ROUTE']));
$oCriteria->add( LogCasesSchedulerPeer::LOG_CASE_UID, $_REQUEST['LOG_CASE_UID'] ); $oCriteria->add( LogCasesSchedulerPeer::LOG_CASE_UID, $_REQUEST['LOG_CASE_UID'] );
$result = LogCasesSchedulerPeer::doSelectRS( $oCriteria ); $result = LogCasesSchedulerPeer::doSelectRS( $oCriteria );
$result->next(); $result->next();
$row = $result->getRow(); $row = $result->getRow();
$aFields['PRO_UID'] = $row[1]; $aFields['PRO_UID'] = $row[1];
$aFields['TAS_UID'] = $row[2]; $aFields['TAS_UID'] = $row[2];
$aFields['SCH_UID'] = $row[7]; $aFields['SCH_UID'] = $row[7];
$aFields['USR_NAME'] = $row[3]; $aFields['USR_NAME'] = $row[3];
$aFields['EXEC_DATE'] = $row[4]; $aFields['EXEC_DATE'] = $row[4];
$aFields['EXEC_HOUR'] = $row[5]; $aFields['EXEC_HOUR'] = $row[5];
$aFields['RESULT'] = $row[6]; $aFields['RESULT'] = $row[6];
$aFields['WS_CREATE_CASE_STATUS'] = $row[8]; $aFields['WS_CREATE_CASE_STATUS'] = $row[8];
$aFields['WS_ROUTE_CASE_STATUS'] = htmlentities( $row[9] ); $aFields['WS_ROUTE_CASE_STATUS'] = htmlentities( $row[9] );
//var_dump($aFields); //var_dump($aFields);
//$aFields = $_GET; //$aFields = $_GET;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Log_Detail.xml', '', $aFields, '' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Log_Detail.xml', '', $aFields, '' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,77 +1,76 @@
<?php <?php
/** /**
* cases_SchedulerNew.php * cases_SchedulerNew.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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 {
global $RBAC; global $RBAC;
/* /*
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess('PM_FACTORY'))
{ {
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;
} }
*/ */
/*
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!';
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME'));
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE'));
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'));
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
// the default role variable sets the value that will be showed as the default for the role field.
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR';
$aFields['START_DATE'] = date('Y-m-d');
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5));
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));
*/
/* require_once 'classes/model/CaseScheduler.php';
$aFields['MESSAGE0'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; require_once 'classes/model/Process.php';
$aFields['MESSAGE1'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); require_once 'classes/model/Task.php';
$aFields['MESSAGE2'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE'));
$aFields['MESSAGE3'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); $G_MAIN_MENU = 'processmaker';
$aFields['MESSAGE4'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); $G_SUB_MENU = 'cases';
$aFields['MESSAGE5'] = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
// the default role variable sets the value that will be showed as the default for the role field. $G_ID_MENU_SELECTED = 'CASES';
$aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR'; $G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER';
$aFields['START_DATE'] = date('Y-m-d');
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); $G_PUBLISH = new Publisher();
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));
*/ G::LoadClass( 'case' );
$aFields['PHP_START_DATE'] = date( 'Y-m-d' );
$aFields['PRO_UID'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS'];
$aFields['PHP_CURRENT_DATE'] = $aFields['PHP_START_DATE'];
$aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
require_once 'classes/model/CaseScheduler.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_SCHEDULER';
$G_PUBLISH = new Publisher();
G::LoadClass( 'case' );
$aFields['PHP_START_DATE'] = date( 'Y-m-d' );
$aFields['PRO_UID'] = isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : $_SESSION['PROCESS'];
$aFields['PHP_CURRENT_DATE'] = $aFields['PHP_START_DATE'];
$aFields['PHP_END_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 5 ) );
/* Prepare page before to show */ /* Prepare page before to show */
/*-- Base /*-- Base
@@ -80,17 +79,17 @@ try {
$_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] ); $_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] );
*/ */
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
//$_DBArray['NewProcess'] = $oCaseScheduler->getProcessDescription(); //$_DBArray['NewProcess'] = $oCaseScheduler->getProcessDescription();
//$_DBArray['NewTask'] = $oCaseScheduler->getTaskDescription(); //$_DBArray['NewTask'] = $oCaseScheduler->getTaskDescription();
// var_dump($oCaseScheduler->getAllProcess()); die; // var_dump($oCaseScheduler->getAllProcess()); die;
$aFields['UID_SCHEDULER'] = "scheduler"; $aFields['UID_SCHEDULER'] = "scheduler";
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_New.xml', '', $aFields, 'cases_Scheduler_Save' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_New.xml', '', $aFields, 'cases_Scheduler_Save' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,245 +1,243 @@
<?php <?php
/** /**
* cases_Scheduler_Save.php * cases_Scheduler_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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 {
/* /*
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess('PM_FACTORY'))
{ {
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;
} }
*/ */
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
if (empty( $_POST )) { if (empty( $_POST )) {
die( 'The information sended is empty!' ); die( 'The information sended is empty!' );
} }
$aData['SCH_UID'] = G::generateUniqueID(); $aData['SCH_UID'] = G::generateUniqueID();
$aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; $aData['SCH_NAME'] = $_POST['form']['SCH_NAME'];
$aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME'];
$aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] );
$aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID'];
$aData['PRO_UID'] = $_POST['form']['PRO_UID']; $aData['PRO_UID'] = $_POST['form']['PRO_UID'];
$aData['TAS_UID'] = $_POST['form']['TAS_UID']; $aData['TAS_UID'] = $_POST['form']['TAS_UID'];
$aData['SCH_STATE'] = 'ACTIVE'; $aData['SCH_STATE'] = 'ACTIVE';
$aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE';
$aData['USR_UID'] = $_SESSION['USER_LOGGED']; $aData['USR_UID'] = $_SESSION['USER_LOGGED'];
$sOption = $_POST['form']['SCH_OPTION']; $sOption = $_POST['form']['SCH_OPTION'];
$aData['SCH_OPTION'] = $sOption; $aData['SCH_OPTION'] = $sOption;
if ($_POST['form']['SCH_START_DATE'] != '') { if ($_POST['form']['SCH_START_DATE'] != '') {
$sDateTmp = $_POST['form']['SCH_START_DATE']; $sDateTmp = $_POST['form']['SCH_START_DATE'];
} else { } else {
$sDateTmp = date( 'Y-m-d' ); $sDateTmp = date( 'Y-m-d' );
} }
$sTimeTmp = $_POST['form']['SCH_START_TIME']; $sTimeTmp = $_POST['form']['SCH_START_TIME'];
$aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
$aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
$nActualTime = $_POST['form']['SCH_START_TIME']; // time(); $nActualTime = $_POST['form']['SCH_START_TIME']; // time();
// $nActualDate = date("Y-m-d H:i:s", $nActualTime); // $nActualDate = date("Y-m-d H:i:s", $nActualTime);
$sValue = ''; $sValue = '';
$sDaysPerformTask = ''; $sDaysPerformTask = '';
$sWeeks = ''; $sWeeks = '';
$sMonths = ''; $sMonths = '';
$sMonths = ''; $sMonths = '';
$sStartDay = ''; $sStartDay = '';
$nSW = 0; $nSW = 0;
$aData['SCH_START_DAY'] = ''; $aData['SCH_START_DAY'] = '';
$aData['SCH_REPEAT_EVERY'] = ''; $aData['SCH_REPEAT_EVERY'] = '';
$aData['SCH_REPEAT_UNTIL'] = ''; $aData['SCH_REPEAT_UNTIL'] = '';
$aData['SCH_DAYS_PERFORM_TASK'] = ''; $aData['SCH_DAYS_PERFORM_TASK'] = '';
switch ($sOption) { switch ($sOption) {
case '1': // Option 1 case '1': // Option 1
$sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK'];
switch ($sValue) { switch ($sValue) {
case '1': case '1':
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1';
break; break;
case '2': case '2':
$aData['SCH_OPTION'] = '2'; $aData['SCH_OPTION'] = '2';
$aData['SCH_EVERY_DAYS'] = '1'; $aData['SCH_EVERY_DAYS'] = '1';
$aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|';
break; break;
case '3': // Every [n] Days case '3': // Every [n] Days
$sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
break; break;
} }
break; break;
case '2': // If the option is zero, set by default 1 case '2': // If the option is zero, set by default 1
if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) {
$nEveryDays = 1; $nEveryDays = 1;
else } else {
$nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; $nEveryDays = $_POST['form']['SCH_EVERY_DAYS'];
$aData['SCH_EVERY_DAYS'] = $nEveryDays; }
$sWeeks = ''; $aData['SCH_EVERY_DAYS'] = $nEveryDays;
if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) { $sWeeks = '';
$aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) {
foreach ($aWeekDays as $value) { $aWeekDays = $_POST['form']['SCH_WEEK_DAYS'];
$sWeeks = $sWeeks . $value . '|'; foreach ($aWeekDays as $value) {
} $sWeeks = $sWeeks . $value . '|';
} }
if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) { }
$aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) {
foreach ($aWeekDays2 as $value) { $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2'];
$sWeeks = $sWeeks . $value . '|'; foreach ($aWeekDays2 as $value) {
} $sWeeks = $sWeeks . $value . '|';
} }
$sStartTime = $_POST['form']['SCH_START_TIME']; }
$aData['SCH_WEEK_DAYS'] = $sWeeks; $sStartTime = $_POST['form']['SCH_START_TIME'];
$aData['SCH_WEEK_DAYS'] = $sWeeks;
break; break;
case '3': case '3':
$nStartDay = $_POST['form']['SCH_START_DAY']; $nStartDay = $_POST['form']['SCH_START_DAY'];
if ($nStartDay == 1) { if ($nStartDay == 1) {
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1'];
} else { } else {
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK'];
} }
$sMonths = ''; $sMonths = '';
if (! empty( $_POST['form']['SCH_MONTHS'] )) { if (! empty( $_POST['form']['SCH_MONTHS'] )) {
$aMonths = $_POST['form']['SCH_MONTHS']; $aMonths = $_POST['form']['SCH_MONTHS'];
foreach ($aMonths as $value) { foreach ($aMonths as $value) {
$sMonths = $sMonths . $value . '|'; $sMonths = $sMonths . $value . '|';
} }
} }
if (! empty( $_POST['form']['SCH_MONTHS_2'] )) { if (! empty( $_POST['form']['SCH_MONTHS_2'] )) {
$aMonths2 = $_POST['form']['SCH_MONTHS_2']; $aMonths2 = $_POST['form']['SCH_MONTHS_2'];
foreach ($aMonths2 as $value) { foreach ($aMonths2 as $value) {
$sMonths = $sMonths . $value . '|'; $sMonths = $sMonths . $value . '|';
} }
} }
if (! empty( $_POST['form']['SCH_MONTHS_3'] )) { if (! empty( $_POST['form']['SCH_MONTHS_3'] )) {
$aMonths3 = $_POST['form']['SCH_MONTHS_3']; $aMonths3 = $_POST['form']['SCH_MONTHS_3'];
foreach ($aMonths3 as $value) { foreach ($aMonths3 as $value) {
$sMonths = $sMonths . $value . '|'; $sMonths = $sMonths . $value . '|';
} }
} }
$aData['SCH_MONTHS'] = $sMonths; $aData['SCH_MONTHS'] = $sMonths;
$sStartDay = $aData['SCH_START_DAY']; $sStartDay = $aData['SCH_START_DAY'];
$sValue = $nStartDay; $sValue = $nStartDay;
break; break;
}
} echo "<br>sOption: " . $sOption;
echo "<br>sOption: " . $sOption; if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) {
if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { if ($sStartDay == '') {
if ($sStartDay == '') { $sStartDay = date( 'Y-m-d' );
$sStartDay = date( 'Y-m-d' ); }
}
// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>"; // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>";
$dCurrentDay = date( "d" ); $dCurrentDay = date( "d" );
$dCurrentMonth = date( "m" ); $dCurrentMonth = date( "m" );
$aStartDay = explode( "|", $aData['SCH_START_DAY'] ); $aStartDay = explode( "|", $aData['SCH_START_DAY'] );
if ($sOption == '3' && $aStartDay[0] == '1') { if ($sOption == '3' && $aStartDay[0] == '1') {
$monthsArray = explode( "|", $sMonths ); $monthsArray = explode( "|", $sMonths );
foreach ($monthsArray as $row) { foreach ($monthsArray as $row) {
if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) {
$startTime = $_POST['form']['SCH_START_TIME'] . ":00"; $startTime = $_POST['form']['SCH_START_TIME'] . ":00";
$aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime;
break; break;
} else { } else {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
} }
} }
} else { } else {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
} }
// print_r ($aData['SCH_TIME_NEXT_RUN']); // print_r ($aData['SCH_TIME_NEXT_RUN']);
// die; // die;
} else { } else {
if ($sOption == '4') { if ($sOption == '4') {
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; $aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
} }
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
if ($sOption == 5) { if ($sOption == 5) {
$aData['SCH_START_TIME'] = time(); $aData['SCH_START_TIME'] = time();
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME']; $aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
$nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60; $nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60;
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
$date = $aData['SCH_START_TIME']; $date = $aData['SCH_START_TIME'];
$date += $nextRun; $date += $nextRun;
$date = date( "Y-m-d H:i", $date ); $date = date( "Y-m-d H:i", $date );
$aData['SCH_TIME_NEXT_RUN'] = $date; $aData['SCH_TIME_NEXT_RUN'] = $date;
} }
} }
if (trim( $_POST['form']['SCH_END_DATE'] ) != '') { if (trim( $_POST['form']['SCH_END_DATE'] ) != '') {
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
} }
if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) { if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) {
$nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT'];
if ($nOptEvery == 2) if ($nOptEvery == 2) {
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60;
else } else {
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
}
}
}
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
$aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID']; if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
} $aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID'];
}
//$aData['SCH_END_DATE'] = "2020-12-30"; //$aData['SCH_END_DATE'] = "2020-12-30";
$oCaseScheduler->create( $aData ); $oCaseScheduler->create( $aData );
$sch_uid = $oCaseScheduler->getSchUid(); $sch_uid = $oCaseScheduler->getSchUid();
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) { if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
$params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] ); $params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] );
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
$caseSchedulerSelected = $caseSchedulerPluginDetail; $caseSchedulerSelected = $caseSchedulerPluginDetail;
}
} }
} if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
//Save the form //Save the form
$oData = $_POST['pluginFields']; $oData = $_POST['pluginFields'];
$oData['SCH_UID'] = $aData['SCH_UID']; $oData['SCH_UID'] = $aData['SCH_UID'];
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
} }
} }
// //Added by Qennix // //Added by Qennix
// //Update Start Time Event in BPMN // //Update Start Time Event in BPMN
// //
@@ -259,11 +257,11 @@ try {
// $event->update($editEvent); // $event->update($editEvent);
// //End Adding // //End Adding
// } // }
G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] ); G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }

View File

@@ -1,281 +1,284 @@
<?php <?php
/** /**
* cases_Scheduler_Save.php * cases_Scheduler_Save.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23 * Copyright (C) 2004 - 2010 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 {
/* /*
global $RBAC; global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) switch ($RBAC->userCanAccess('PM_FACTORY'))
{ {
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;
} }
*/ */
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
if (empty( $_POST )) { if (empty( $_POST )) {
die( 'The information sended is empty!' ); die( 'The information sended is empty!' );
} }
$aData['SCH_UID'] = $_POST['form']['SCH_UID']; $aData['SCH_UID'] = $_POST['form']['SCH_UID'];
$aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; $aData['SCH_NAME'] = $_POST['form']['SCH_NAME'];
$aData['PRO_UID'] = $_POST['form']['PRO_UID']; $aData['PRO_UID'] = $_POST['form']['PRO_UID'];
$aData['TAS_UID'] = $_POST['form']['TAS_UID']; $aData['TAS_UID'] = $_POST['form']['TAS_UID'];
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$oCaseScheduler->Load( $aData['SCH_UID'] ); $oCaseScheduler->Load( $aData['SCH_UID'] );
$aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME'];
if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM') { if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM') {
$aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] );
} }
$aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID'];
// $aData['SCH_TIME_NEXT_RUN'] = time(); // $aData['SCH_TIME_NEXT_RUN'] = time();
//$aData['SCH_LAST_RUN_TIME'] = time(); //$aData['SCH_LAST_RUN_TIME'] = time();
// $aData['SCH_STATE'] = 'ACTIVE'; // $aData['SCH_STATE'] = 'ACTIVE';
// $aData['SCH_LAST_STATE'] = 'ACTIVE'; // $aData['SCH_LAST_STATE'] = 'ACTIVE';
$aData['USR_UID'] = $_SESSION['USER_LOGGED']; $aData['USR_UID'] = $_SESSION['USER_LOGGED'];
$sOption = $_POST['form']['SCH_OPTION']; $sOption = $_POST['form']['SCH_OPTION'];
$aData['SCH_OPTION'] = $sOption; $aData['SCH_OPTION'] = $sOption;
$sDateTmp = $_POST['form']['SCH_START_DATE']; $sDateTmp = $_POST['form']['SCH_START_DATE'];
$sTimeTmp = $_POST['form']['SCH_START_TIME']; $sTimeTmp = $_POST['form']['SCH_START_TIME'];
$aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
$aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
$previousStartTime = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) ); $previousStartTime = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) );
$previousStartDate = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) ); $previousStartDate = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) );
$sValue = ''; $sValue = '';
$sDaysPerformTask = ''; $sDaysPerformTask = '';
$sWeeks = ''; $sWeeks = '';
$sMonths = ''; $sMonths = '';
$sMonths = ''; $sMonths = '';
$sStartDay = ''; $sStartDay = '';
$nSW = 0; $nSW = 0;
switch ($sOption) { switch ($sOption) {
case '1': // Option 1 case '1':
$sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK']; // Option 1
switch ($sValue) { $sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK'];
case '1': switch ($sValue) {
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1'; case '1':
break; $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1';
case '2': break;
$aData['SCH_OPTION'] = '2'; case '2':
$aData['SCH_EVERY_DAYS'] = '1'; $aData['SCH_OPTION'] = '2';
$aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; $aData['SCH_EVERY_DAYS'] = '1';
break; $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|';
break;
case '3': // Every [n] Days case '3': // Every [n] Days
$sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; $sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3']; $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
break; break;
} }
break; break;
case '2': // If the option is zero, set by default 1 case '2':
if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) // If the option is zero, set by default 1
$nEveryDays = 1; if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) {
else $nEveryDays = 1;
$nEveryDays = $_POST['form']['SCH_EVERY_DAYS']; } else {
$aData['SCH_EVERY_DAYS'] = $nEveryDays; $nEveryDays = $_POST['form']['SCH_EVERY_DAYS'];
$sWeeks = ''; }
if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) { $aData['SCH_EVERY_DAYS'] = $nEveryDays;
$aWeekDays = $_POST['form']['SCH_WEEK_DAYS']; $sWeeks = '';
foreach ($aWeekDays as $value) { if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) {
$sWeeks = $sWeeks . $value . '|'; $aWeekDays = $_POST['form']['SCH_WEEK_DAYS'];
} foreach ($aWeekDays as $value) {
} $sWeeks = $sWeeks . $value . '|';
if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) { }
$aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2']; }
foreach ($aWeekDays2 as $value) { if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) {
$sWeeks = $sWeeks . $value . '|'; $aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2'];
} foreach ($aWeekDays2 as $value) {
} $sWeeks = $sWeeks . $value . '|';
$sStartTime = $_POST['form']['SCH_START_TIME']; }
$aData['SCH_WEEK_DAYS'] = $sWeeks; }
break; $sStartTime = $_POST['form']['SCH_START_TIME'];
$aData['SCH_WEEK_DAYS'] = $sWeeks;
case '3': break;
$nStartDay = $_POST['form']['SCH_START_DAY']; case '3':
if ($nStartDay == 1) { $nStartDay = $_POST['form']['SCH_START_DAY'];
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1']; if ($nStartDay == 1) {
} else { $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1'];
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK']; } else {
} $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK'];
}
$sMonths = '';
if (! empty( $_POST['form']['SCH_MONTHS'] )) { $sMonths = '';
$aMonths = $_POST['form']['SCH_MONTHS']; if (! empty( $_POST['form']['SCH_MONTHS'] )) {
foreach ($aMonths as $value) { $aMonths = $_POST['form']['SCH_MONTHS'];
$sMonths = $sMonths . $value . '|'; foreach ($aMonths as $value) {
} $sMonths = $sMonths . $value . '|';
} }
if (! empty( $_POST['form']['SCH_MONTHS_2'] )) { }
$aMonths2 = $_POST['form']['SCH_MONTHS_2']; if (! empty( $_POST['form']['SCH_MONTHS_2'] )) {
foreach ($aMonths2 as $value) { $aMonths2 = $_POST['form']['SCH_MONTHS_2'];
$sMonths = $sMonths . $value . '|'; foreach ($aMonths2 as $value) {
} $sMonths = $sMonths . $value . '|';
} }
if (! empty( $_POST['form']['SCH_MONTHS_3'] )) { }
$aMonths3 = $_POST['form']['SCH_MONTHS_3']; if (! empty( $_POST['form']['SCH_MONTHS_3'] )) {
foreach ($aMonths3 as $value) { $aMonths3 = $_POST['form']['SCH_MONTHS_3'];
$sMonths = $sMonths . $value . '|'; foreach ($aMonths3 as $value) {
} $sMonths = $sMonths . $value . '|';
} }
$aData['SCH_MONTHS'] = $sMonths; }
$sStartDay = $aData['SCH_START_DAY']; $aData['SCH_MONTHS'] = $sMonths;
$sValue = $nStartDay; $sStartDay = $aData['SCH_START_DAY'];
break; $sValue = $nStartDay;
break;
}
if (trim( $_POST['form']['SCH_END_DATE'] ) != '') { }
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE']; if (trim( $_POST['form']['SCH_END_DATE'] ) != '') {
} $aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
}
// if the start date has changed then recalculate the next run time // if the start date has changed then recalculate the next run time
if ($_POST['form']['SCH_START_DATE'] == $_POST['form']['PREV_SCH_START_DATE']) { if ($_POST['form']['SCH_START_DATE'] == $_POST['form']['PREV_SCH_START_DATE']) {
$recalculateDate = false; $recalculateDate = false;
} else { } else {
$recalculateDate = true; $recalculateDate = true;
} }
if (date( 'H:i:s', strtotime( $_POST['form']['SCH_START_TIME'] ) ) == date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) )) { if (date( 'H:i:s', strtotime( $_POST['form']['SCH_START_TIME'] ) ) == date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) )) {
$recalculateTime = false; $recalculateTime = false;
} else { } else {
$recalculateTime = true; $recalculateTime = true;
} }
// if the start date has changed then recalculate the next run time // if the start date has changed then recalculate the next run time
// var_dump($recalculateTime); // var_dump($recalculateTime);
// die(); // die();
$nActualTime = $_POST['form']['SCH_START_TIME']; $nActualTime = $_POST['form']['SCH_START_TIME'];
if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) {
if ($sStartDay == '') { if ($sStartDay == '') {
$sStartDay = date( 'Y-m-d' ); $sStartDay = date( 'Y-m-d' );
} }
// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>"; // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>";
$dCurrentDay = date( "d" ); $dCurrentDay = date( "d" );
$dCurrentMonth = date( "m" ); $dCurrentMonth = date( "m" );
$aStartDay = explode( "|", $aData['SCH_START_DAY'] ); $aStartDay = explode( "|", $aData['SCH_START_DAY'] );
if ($sOption == '3' && $aStartDay[0] == '1') { if ($sOption == '3' && $aStartDay[0] == '1') {
$monthsArray = explode( "|", $sMonths ); $monthsArray = explode( "|", $sMonths );
foreach ($monthsArray as $row) { foreach ($monthsArray as $row) {
if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) {
$startTime = $_POST['form']['SCH_START_TIME'] . ":00"; $startTime = $_POST['form']['SCH_START_TIME'] . ":00";
if ($recalculateDate) { if ($recalculateDate) {
$aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime;
} else if ($recalculateTime) { } elseif ($recalculateTime) {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
} }
break; break;
} else { } else {
if ($recalculateDate) { if ($recalculateDate) {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
} else if ($recalculateTime) { } elseif ($recalculateTime) {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
} }
} }
} }
} else { } else {
if ($recalculateDate) { if ($recalculateDate) {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
} else if ($recalculateTime) { } elseif ($recalculateTime) {
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
} }
} }
// print_r ($aData['SCH_TIME_NEXT_RUN']); // print_r ($aData['SCH_TIME_NEXT_RUN']);
// die; // die;
} else { } else {
if ($sOption == '4') { if ($sOption == '4') {
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; $aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
} }
if ($recalculateDate) { if ($recalculateDate) {
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
} else if ($recalculateTime) { } elseif ($recalculateTime) {
// $Fields = $oCaseScheduler->Load($aData['SCH_UID']); // $Fields = $oCaseScheduler->Load($aData['SCH_UID']);
// $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE']; // $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
// $Fields['SCH_STATE'] = 'PROCESSED'; // $Fields['SCH_STATE'] = 'PROCESSED';
// $this->Update($Fields); // $this->Update($Fields);
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
} }
// var_dump($recalculateTime); // var_dump($recalculateTime);
// var_dump($aData['SCH_TIME_NEXT_RUN']); // var_dump($aData['SCH_TIME_NEXT_RUN']);
// die; // die;
if ($sOption == '5') { if ($sOption == '5') {
$date = $oCaseScheduler->getSchLastRunTime(); $date = $oCaseScheduler->getSchLastRunTime();
if ($date == null) { if ($date == null) {
$date = $oCaseScheduler->getSchStartTime(); $date = $oCaseScheduler->getSchStartTime();
} }
$date = strtotime( $date ); $date = strtotime( $date );
$nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60; $nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60;
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
$date += $nextRun; $date += $nextRun;
$date = date( "Y-m-d H:i", $date ); $date = date( "Y-m-d H:i", $date );
$aData['SCH_TIME_NEXT_RUN'] = $date; $aData['SCH_TIME_NEXT_RUN'] = $date;
} }
} }
if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) { if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) {
$nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT']; $nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT'];
if ($nOptEvery == 2) if ($nOptEvery == 2) {
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60;
else } else {
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY']; $aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
}
}
}
// var_dump ($aData['SCH_TIME_NEXT_RUN']); // var_dump ($aData['SCH_TIME_NEXT_RUN']);
// die; // die;
$oCaseScheduler->Update( $aData ); $oCaseScheduler->Update( $aData );
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) { if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
$params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] ); $params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] );
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) { if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
$caseSchedulerSelected = $caseSchedulerPluginDetail; $caseSchedulerSelected = $caseSchedulerPluginDetail;
} }
} }
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
//Save the form //Save the form
$oData = $_POST['pluginFields']; $oData = $_POST['pluginFields'];
$oData['SCH_UID'] = $aData['SCH_UID']; $oData['SCH_UID'] = $aData['SCH_UID'];
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData ); $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
} }
} }
G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] ); G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] );
} catch (Exception $oException) { } catch (Exception $oException) {
die( $oException->getMessage() ); die( $oException->getMessage() );
} }