2010-12-02 23:34:41 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
2011-11-11 17:28:22 -04:00
|
|
|
* class.wsBase.php
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2011-11-11 17:28:22 -04:00
|
|
|
* @package workflow.engine.classes
|
2010-12-02 23:34:41 +00:00
|
|
|
*
|
|
|
|
|
* ProcessMaker Open Source Edition
|
2011-11-11 17:28:22 -04:00
|
|
|
* Copyright (C) 2004 - 2011 Colosa Inc.
|
2010-12-02 23:34:41 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-10-09 13:29:25 -04:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-12-02 23:34:41 +00:00
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2012-10-09 13:29:25 -04:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-12-02 23:34:41 +00:00
|
|
|
*
|
|
|
|
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
|
|
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
//It works with the table CONFIGURATION in a WF dataBase
|
|
|
|
|
require_once ("classes/model/Application.php");
|
|
|
|
|
require_once ("classes/model/AppCacheView.php");
|
|
|
|
|
require_once ("classes/model/AppDelegation.php");
|
|
|
|
|
require_once ("classes/model/AppDocument.php");
|
|
|
|
|
require_once ("classes/model/AppDelay.php");
|
|
|
|
|
require_once ("classes/model/AppThread.php");
|
|
|
|
|
require_once ("classes/model/Department.php");
|
|
|
|
|
require_once ("classes/model/Dynaform.php");
|
|
|
|
|
require_once ("classes/model/Groupwf.php");
|
|
|
|
|
require_once ("classes/model/InputDocument.php");
|
|
|
|
|
require_once ("classes/model/Language.php");
|
|
|
|
|
require_once ("classes/model/OutputDocument.php");
|
|
|
|
|
require_once ("classes/model/Process.php");
|
|
|
|
|
require_once ("classes/model/ReportTable.php");
|
|
|
|
|
require_once ("classes/model/ReportVar.php");
|
|
|
|
|
require_once ("classes/model/Route.php");
|
|
|
|
|
require_once ("classes/model/Step.php");
|
|
|
|
|
require_once ("classes/model/StepTrigger.php");
|
|
|
|
|
require_once ("classes/model/Task.php");
|
|
|
|
|
require_once ("classes/model/TaskUser.php");
|
|
|
|
|
require_once ("classes/model/Triggers.php");
|
|
|
|
|
require_once ("classes/model/Users.php");
|
|
|
|
|
require_once ("classes/model/Session.php");
|
|
|
|
|
require_once ("classes/model/Content.php");
|
|
|
|
|
G::LoadClass( "ArrayPeer" );
|
|
|
|
|
G::LoadClass( "BasePeer" );
|
|
|
|
|
G::LoadClass( 'case' );
|
|
|
|
|
G::LoadClass( 'derivation' );
|
|
|
|
|
G::LoadClass( 'groups' );
|
|
|
|
|
G::LoadClass( 'sessions' );
|
|
|
|
|
G::LoadClass( 'processes' );
|
|
|
|
|
G::LoadClass( 'processMap' );
|
|
|
|
|
G::LoadClass( 'pmScript' );
|
|
|
|
|
G::LoadClass( 'spool' );
|
|
|
|
|
G::LoadClass( 'tasks' );
|
|
|
|
|
G::LoadClass( 'wsResponse' );
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
2011-11-11 17:28:22 -04:00
|
|
|
* Copyright (C) 2009 COLOSA
|
|
|
|
|
* License: LGPL, see LICENSE
|
|
|
|
|
* Last Modify: 26.06.2008 10:05:00
|
|
|
|
|
* Last modify by: Erik Amaru Ortiz <erik@colosa.com>
|
|
|
|
|
* Last Modify comment(26.06.2008): the session expired verification was removed from here to soap class
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2011-11-11 17:28:22 -04:00
|
|
|
* @package workflow.engine.classes
|
2010-12-02 23:34:41 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-11-11 17:28:22 -04:00
|
|
|
class wsBase
|
|
|
|
|
{
|
2012-07-09 16:26:17 -04:00
|
|
|
public $stored_system_variables; //boolean
|
|
|
|
|
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
|
2012-10-12 14:57:51 -04:00
|
|
|
private $originalValues = array (); // SESSION temporary array store.
|
2012-10-09 13:29:25 -04:00
|
|
|
|
|
|
|
|
public function __construct ($params = null)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
$this->stored_system_variables = false;
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
if ($params != null) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$this->stored_system_variables = (isset( $params->stored_system_variables ) ? $params->stored_system_variables : false);
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$this->wsSessionId = isset( $params->wsSessionId ) ? $params->wsSessionId : '';
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* function to start a web services session in ProcessMaker
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userid
|
|
|
|
|
* @param string $password
|
|
|
|
|
* @return $wsResponse will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function login ($userid, $password)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
global $RBAC;
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$uid = $RBAC->VerifyLogin( $userid, $password );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
switch ($uid) {
|
2012-09-05 13:01:19 -04:00
|
|
|
case '':
|
2012-10-09 13:29:25 -04:00
|
|
|
case - 1: //The user doesn't exist
|
|
|
|
|
$wsResponse = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED' ) );
|
|
|
|
|
break;
|
|
|
|
|
case - 2: //The password is incorrect
|
|
|
|
|
$wsResponse = new wsResponse( 4, G::loadTranslation( 'ID_WRONG_PASS' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
break;
|
2012-10-09 13:29:25 -04:00
|
|
|
case - 3: //The user is inactive
|
|
|
|
|
$wsResponse = new wsResponse( 5, G::loadTranslation( 'ID_USER_INACTIVE' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
break;
|
2012-10-09 13:29:25 -04:00
|
|
|
case - 4: //The Due date is finished
|
|
|
|
|
$wsResponse = new wsResponse( 5, G::loadTranslation( 'ID_USER_INACTIVE' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-05 13:01:19 -04:00
|
|
|
if ($uid < 0 || $uid == '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
throw (new Exception( serialize( $wsResponse ) ));
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//check access to PM
|
2012-10-09 13:29:25 -04:00
|
|
|
$RBAC->loadUserRolePermission( $RBAC->sSystem, $uid );
|
|
|
|
|
$res = $RBAC->userCanAccess( "PM_LOGIN" );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($res != 1) {
|
|
|
|
|
//if ($res == -2)
|
|
|
|
|
// $wsResponse = new wsResponse(1, G::loadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
|
|
|
|
|
//else
|
2012-10-09 13:29:25 -04:00
|
|
|
$wsResponse = new wsResponse( 2, G::loadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' ) );
|
|
|
|
|
throw (new Exception( serialize( $wsResponse ) ));
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$sessionId = G::generateUniqueID();
|
|
|
|
|
$wsResponse = new wsResponse( '0', $sessionId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$session = new Session();
|
2012-10-09 13:29:25 -04:00
|
|
|
$session->setSesUid( $sessionId );
|
|
|
|
|
$session->setSesStatus( 'ACTIVE' );
|
|
|
|
|
$session->setUsrUid( $uid );
|
|
|
|
|
$session->setSesRemoteIp( $_SERVER['REMOTE_ADDR'] );
|
|
|
|
|
$session->setSesInitDate( date( 'Y-m-d H:i:s' ) );
|
|
|
|
|
$session->setSesDueDate( date( 'Y-m-d H:i:s', mktime( date( 'H' ), date( 'i' ) + 15, date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) );
|
|
|
|
|
$session->setSesEndDate( '' );
|
2012-07-09 16:26:17 -04:00
|
|
|
$session->Save();
|
|
|
|
|
|
|
|
|
|
//save the session in DataBase
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $wsResponse;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$wsResponse = unserialize( $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $wsResponse;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get all groups
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function processList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
2012-07-09 16:26:17 -04:00
|
|
|
//$oCriteria->add(ProcessPeer::PRO_STATUS , 'ACTIVE');
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->add( ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL );
|
|
|
|
|
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
|
|
|
|
$oProcess = new Process();
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayProcess = $oProcess->Load( $aRow['PRO_UID'] );
|
|
|
|
|
$result[] = array ('guid' => $aRow['PRO_UID'],'name' => $arrayProcess['PRO_TITLE']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get all roles, to see all roles
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function roleList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
2011-11-11 17:28:22 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$RBAC = & RBAC::getSingleton();
|
2012-07-09 16:26:17 -04:00
|
|
|
$RBAC->initRBAC();
|
|
|
|
|
$oCriteria = $RBAC->listAllRoles();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDataset = GulliverBasePeer::doSelectRs( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $aRow['ROL_UID'],'name' => $aRow['ROL_CODE']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* get all groups
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function groupList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
2011-11-11 17:28:22 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( GroupwfPeer::GRP_STATUS, 'ACTIVE' );
|
|
|
|
|
$oDataset = GroupwfPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
|
|
|
|
$oGroupwf = new Groupwf();
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayGroupwf = $oGroupwf->Load( $aRow['GRP_UID'] );
|
|
|
|
|
$result[] = array ('guid' => $aRow['GRP_UID'],'name' => $arrayGroupwf['GRP_TITLE']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* get all department
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function departmentList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( DepartmentPeer::DEP_STATUS, 'ACTIVE' );
|
|
|
|
|
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
|
|
|
|
$oDepartment = new Department();
|
2012-10-09 13:29:25 -04:00
|
|
|
$aDepartment = $oDepartment->Load( $aRow['DEP_UID'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$node['guid'] = $aRow['DEP_UID'];
|
|
|
|
|
$node['name'] = $aDepartment['DEPO_TITLE'];
|
|
|
|
|
$node['parentUID'] = $aDepartment['DEP_PARENT'];
|
|
|
|
|
$node['dn'] = $aDepartment['DEP_LDAP_DN'];
|
|
|
|
|
|
|
|
|
|
//get the users from this department
|
|
|
|
|
$c = new Criteria();
|
|
|
|
|
$c->clearSelectColumns();
|
2012-10-09 13:29:25 -04:00
|
|
|
$c->addSelectColumn( 'COUNT(*)' );
|
|
|
|
|
$c->add( UsersPeer::DEP_UID, $aRow['DEP_UID'] );
|
|
|
|
|
$rs = UsersPeer::doSelectRS( $c );
|
2012-07-09 16:26:17 -04:00
|
|
|
$rs->next();
|
|
|
|
|
$row = $rs->getRow();
|
|
|
|
|
$count = $row[0];
|
|
|
|
|
|
|
|
|
|
$node['users'] = $count;
|
|
|
|
|
$result[] = $node;
|
|
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* Get case list
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function caseList ($userId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$del = DBAdapter::getStringDelimiter();
|
|
|
|
|
$oCriteria->addSelectColumn( ApplicationPeer::APP_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( ApplicationPeer::APP_NUMBER );
|
|
|
|
|
$oCriteria->addSelectColumn( ApplicationPeer::APP_STATUS );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
2012-10-12 12:52:50 -04:00
|
|
|
$oCriteria->addSelectColumn( ApplicationPeer::PRO_UID );
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->addAsColumn( 'CASE_TITLE', 'C1.CON_VALUE' );
|
|
|
|
|
$oCriteria->addAlias( "C1", 'CONTENT' );
|
|
|
|
|
$caseTitleConds = array ();
|
|
|
|
|
$caseTitleConds[] = array (ApplicationPeer::APP_UID,'C1.CON_ID'
|
|
|
|
|
);
|
|
|
|
|
$caseTitleConds[] = array ('C1.CON_CATEGORY',$del . 'APP_TITLE' . $del
|
|
|
|
|
);
|
|
|
|
|
$caseTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
|
|
|
|
|
);
|
|
|
|
|
$oCriteria->addJoinMC( $caseTitleConds, Criteria::LEFT_JOIN );
|
|
|
|
|
|
|
|
|
|
$oCriteria->addJoin( ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN );
|
|
|
|
|
|
|
|
|
|
$oCriteria->add( ApplicationPeer::APP_STATUS, array ('TO_DO','DRAFT'
|
|
|
|
|
), Criteria::IN );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::USR_UID, $userId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
|
|
|
|
$oCriteria->addDescendingOrderByColumn( ApplicationPeer::APP_NUMBER );
|
|
|
|
|
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
|
|
|
|
/*
|
|
|
|
|
$result[] = array(
|
|
|
|
|
'guid' => $aRow['APP_UID'],
|
|
|
|
|
'name' => $aRow['CASE_TITLE'],
|
|
|
|
|
'status' => $aRow['APP_STATUS'],
|
|
|
|
|
'delIndex' => $aRow['DEL_INDEX']
|
|
|
|
|
);
|
|
|
|
|
*/
|
2012-10-12 12:52:50 -04:00
|
|
|
$result[] = array('guid' => $aRow['APP_UID'],
|
|
|
|
|
'name' => $aRow['APP_NUMBER'],
|
|
|
|
|
'status' => $aRow['APP_STATUS'],
|
|
|
|
|
'delIndex' => $aRow['DEL_INDEX'],
|
|
|
|
|
'processId' => $aRow['PRO_UID']);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-12 12:52:50 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),
|
|
|
|
|
'name' => $e->getMessage(),
|
|
|
|
|
'status' => $e->getMessage(),
|
|
|
|
|
'status' => $e->getMessage(),
|
|
|
|
|
'processId' => $e->getMessage());
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* Get unassigned case list
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function unassignedCaseList ($userId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
$oAppCache = new AppCacheView();
|
2012-10-09 13:29:25 -04:00
|
|
|
$Criteria = $oAppCache->getUnassignedListCriteria( $userId );
|
|
|
|
|
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-12 12:52:50 -04:00
|
|
|
$result[] = array ('guid' => $aRow['APP_UID'],
|
|
|
|
|
'name' => $aRow['APP_NUMBER'],
|
|
|
|
|
'delIndex' => $aRow['DEL_INDEX'],
|
|
|
|
|
'processId' => $aRow['PRO_UID']);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDataset->next();
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-12 12:52:50 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),
|
|
|
|
|
'name' => $e->getMessage(),
|
|
|
|
|
'status' => $e->getMessage(),
|
|
|
|
|
'status' => $e->getMessage(),
|
|
|
|
|
'processId' => $e->getMessage());
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2012-07-09 13:21:20 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get all groups
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function userList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
|
|
|
|
$oDataset = UsersPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
|
|
|
|
//$oProcess = new User();
|
|
|
|
|
//$arrayProcess = $oUser->Load($aRow['PRO_UID']);
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $aRow['USR_UID'],'name' => $aRow['USR_USERNAME']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
|
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get list of all the available triggers in a workspace
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param none
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function triggerList ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$del = DBAdapter::getStringDelimiter();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( TriggersPeer::TRI_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( TriggersPeer::PRO_UID );
|
|
|
|
|
$oCriteria->addAsColumn( 'TITLE', 'C1.CON_VALUE' );
|
|
|
|
|
$oCriteria->addAlias( "C1", 'CONTENT' );
|
|
|
|
|
|
|
|
|
|
$caseTitleConds = array ();
|
|
|
|
|
$caseTitleConds[] = array (TriggersPeer::TRI_UID,'C1.CON_ID'
|
|
|
|
|
);
|
|
|
|
|
$caseTitleConds[] = array ('C1.CON_CATEGORY',$del . 'TRI_TITLE' . $del
|
|
|
|
|
);
|
|
|
|
|
$caseTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
|
|
|
|
|
);
|
|
|
|
|
$oCriteria->addJoinMC( $caseTitleConds, Criteria::LEFT_JOIN );
|
2012-07-09 16:26:17 -04:00
|
|
|
//$oCriteria->add(TriggersPeer::USR_STATUS, 'ACTIVE');
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDataset = TriggersPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $aRow['TRI_UID'],'name' => $aRow['TITLE'],'processId' => $aRow['PRO_UID']
|
2012-07-09 16:26:17 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get list of the uploaded documents for a given case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $sApplicationUID
|
|
|
|
|
* @param string $sUserUID
|
|
|
|
|
* @return $result
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function inputDocumentList ($sApplicationUID, $sUserUID)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$fields = $oCase->loadCase( $sApplicationUID );
|
2012-07-09 16:26:17 -04:00
|
|
|
$sProcessUID = $fields['PRO_UID'];
|
|
|
|
|
$sTaskUID = '';
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = $oCase->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
global $_DBArray;
|
|
|
|
|
|
|
|
|
|
foreach ($_DBArray['inputDocuments'] as $key => $row) {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $row['DOC_VERSION'] )) {
|
|
|
|
|
$docrow = array ();
|
|
|
|
|
$docrow['guid'] = $row['APP_DOC_UID'];
|
|
|
|
|
$docrow['filename'] = $row['APP_DOC_FILENAME'];
|
|
|
|
|
$docrow['docId'] = $row['DOC_UID'];
|
|
|
|
|
$docrow['version'] = $row['DOC_VERSION'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$docrow['createDate'] = $row['CREATE_DATE'];
|
2012-10-09 13:29:25 -04:00
|
|
|
$docrow['createBy'] = $row['CREATED_BY'];
|
|
|
|
|
$docrow['type'] = $row['TYPE'];
|
|
|
|
|
$docrow['index'] = $row['APP_DOC_INDEX'];
|
|
|
|
|
$docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$result[] = $docrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* input document process list
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $sProcessUID
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function inputDocumentProcessList ($sProcessUID)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
global $_DBArray;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$_DBArray = (isset( $_SESSION['_DBArray'] ) ? $_SESSION['_DBArray'] : '');
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$oMap = new processMap();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = $oMap->getInputDocumentsCriteria( $sProcessUID );
|
|
|
|
|
$oDataset = InputDocumentPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//not necesary for SOAP message
|
|
|
|
|
$result[] = array(
|
|
|
|
|
'guid' => 'char',
|
|
|
|
|
'name' => 'name',
|
|
|
|
|
'description' => 'description'
|
|
|
|
|
);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($aRow['INP_DOC_TITLE'] == null) {
|
2012-07-09 16:26:17 -04:00
|
|
|
//There is no transaltion for this Document name, try to get/regenerate the label
|
2012-10-09 13:29:25 -04:00
|
|
|
$inputDocument = new InputDocument();
|
|
|
|
|
$inputDocumentObj = $inputDocument->load( $aRow['INP_DOC_UID'] );
|
|
|
|
|
$aRow['INP_DOC_TITLE'] = $inputDocumentObj['INP_DOC_TITLE'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION'];
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$docrow = array ();
|
|
|
|
|
$docrow['guid'] = $aRow['INP_DOC_UID'];
|
|
|
|
|
$docrow['name'] = $aRow['INP_DOC_TITLE'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$docrow['description'] = $aRow['INP_DOC_DESCRIPTION'];
|
|
|
|
|
$result[] = $docrow;
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDataset->next();
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//$_DBArray['inputDocArray'] = $inputDocArray;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* output document list
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $sApplicationUID
|
|
|
|
|
* @param string $sUserUID
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function outputDocumentList ($sApplicationUID, $sUserUID)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$fields = $oCase->loadCase( $sApplicationUID );
|
2012-07-09 16:26:17 -04:00
|
|
|
$sProcessUID = $fields['PRO_UID'];
|
|
|
|
|
$sTaskUID = '';
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = $oCase->getAllGeneratedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
global $_DBArray;
|
|
|
|
|
|
|
|
|
|
foreach ($_DBArray['outputDocuments'] as $key => $row) {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $row['DOC_VERSION'] )) {
|
|
|
|
|
$docrow = array ();
|
|
|
|
|
$docrow['guid'] = $row['APP_DOC_UID'];
|
|
|
|
|
$docrow['filename'] = $row['DOWNLOAD_FILE'];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$docrow['docId'] = $row['DOC_UID'];
|
|
|
|
|
$docrow['version'] = $row['DOC_VERSION'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$docrow['createDate'] = $row['CREATE_DATE'];
|
2012-10-09 13:29:25 -04:00
|
|
|
$docrow['createBy'] = $row['CREATED_BY'];
|
|
|
|
|
$docrow['type'] = $row['TYPE'];
|
|
|
|
|
$docrow['index'] = $row['APP_DOC_INDEX'];
|
|
|
|
|
$docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$result[] = $docrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* remove document
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $appDocUid
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function removeDocument ($appDocUid)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oAppDocument = new AppDocument();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oAppDocument->remove( $appDocUid, 1 ); //always send version 1
|
|
|
|
|
$result = new wsResponse( 0, " $appDocUid" );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get task list
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function taskList ($userId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
g::loadClass( 'groups' );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oGroup = new Groups();
|
2012-10-09 13:29:25 -04:00
|
|
|
$aGroups = $oGroup->getActiveGroupsForAnUser( $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
2012-07-09 16:26:17 -04:00
|
|
|
$del = DBAdapter::getStringDelimiter();
|
2012-10-12 12:52:50 -04:00
|
|
|
$oCriteria->addSelectColumn( TaskPeer::PRO_UID );
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
|
2012-10-12 12:52:50 -04:00
|
|
|
$oCriteria->addSelectColumn( TaskPeer::TAS_START );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oCriteria->setDistinct();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' );
|
|
|
|
|
$oCriteria->addAlias( "C1", 'CONTENT' );
|
|
|
|
|
$tasTitleConds = array ();
|
|
|
|
|
$tasTitleConds[] = array (TaskPeer::TAS_UID,'C1.CON_ID'
|
|
|
|
|
);
|
|
|
|
|
$tasTitleConds[] = array ('C1.CON_CATEGORY',$del . 'TAS_TITLE' . $del
|
|
|
|
|
);
|
|
|
|
|
$tasTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
|
|
|
|
|
);
|
|
|
|
|
$oCriteria->addJoinMC( $tasTitleConds, Criteria::LEFT_JOIN );
|
|
|
|
|
|
|
|
|
|
$oCriteria->addJoin( TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN );
|
|
|
|
|
$oCriteria->addOr( TaskUserPeer::USR_UID, $userId );
|
|
|
|
|
$oCriteria->addOr( TaskUserPeer::USR_UID, $aGroups, Criteria::IN );
|
|
|
|
|
|
|
|
|
|
$oDataset = TaskPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-12 12:52:50 -04:00
|
|
|
$result[] = array ('guid' => $aRow['TAS_UID'],
|
|
|
|
|
'name' => $aRow['TAS_TITLE'],
|
|
|
|
|
'processId' => $aRow['PRO_UID'],
|
|
|
|
|
'initialTask' => $aRow['TAS_START'] == 'TRUE' ? '1' : '0');
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* send message
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $sFrom
|
|
|
|
|
* @param string $sTo
|
|
|
|
|
* @param string $sCc
|
|
|
|
|
* @param string $sBcc
|
|
|
|
|
* @param string $sSubject
|
|
|
|
|
* @param string $sTemplate
|
|
|
|
|
* @param $appFields = null
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-29 11:45:05 -04:00
|
|
|
public function sendMessage ($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true)
|
2012-10-09 13:29:25 -04:00
|
|
|
{
|
2012-07-09 16:26:17 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
G::loadClass( 'system' );
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$aSetup = System::getEmailConfiguration();
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$passwd = $aSetup['MESS_PASSWORD'];
|
|
|
|
|
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
|
|
|
|
|
$auxPass = explode( 'hash:', $passwdDec );
|
|
|
|
|
if (count( $auxPass ) > 1) {
|
|
|
|
|
if (count( $auxPass ) == 2) {
|
2012-07-25 18:47:13 -04:00
|
|
|
$passwd = $auxPass[1];
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
array_shift( $auxPass );
|
|
|
|
|
$passwd = implode( '', $auxPass );
|
2012-07-25 18:47:13 -04:00
|
|
|
}
|
2012-10-09 13:29:25 -04:00
|
|
|
}
|
2012-07-25 18:47:13 -04:00
|
|
|
$aSetup['MESS_PASSWORD'] = $passwd;
|
2012-11-14 17:05:42 -04:00
|
|
|
if ($aSetup['MESS_RAUTH'] == false || (is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false')) {
|
|
|
|
|
$aSetup['MESS_RAUTH'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$aSetup['MESS_RAUTH'] = 1;
|
|
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oSpool = new spoolRun();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oSpool->setConfig( array ('MESS_ENGINE' => $aSetup['MESS_ENGINE'],'MESS_SERVER' => $aSetup['MESS_SERVER'],'MESS_PORT' => $aSetup['MESS_PORT'],'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],'SMTPAuth' => $aSetup['MESS_RAUTH']
|
|
|
|
|
) );
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oCase = new Cases();
|
|
|
|
|
$oldFields = $oCase->loadCase( $caseId );
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
|
|
|
|
|
$fileTemplate = $pathEmail . $sTemplate;
|
2012-10-09 13:29:25 -04:00
|
|
|
G::mk_dir( $pathEmail, 0777, true );
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! file_exists( $fileTemplate )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['FILE_TEMPLATE'] = $fileTemplate;
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 28, G::LoadTranslation( 'ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data ) );
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
if ($appFields == null) {
|
|
|
|
|
$Fields = $oldFields['APP_DATA'];
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$Fields = array_merge( $oldFields['APP_DATA'], $appFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-10 17:28:09 -04:00
|
|
|
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $hasEmailFrom || strpos( $sFrom, $aSetup['MESS_ACCOUNT'] ) === false) {
|
|
|
|
|
$sFrom = '"' . stripslashes( $sFrom ) . '" <' . $aSetup['MESS_ACCOUNT'] . ">";
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2012-10-29 11:45:05 -04:00
|
|
|
$showMessage = ($showMessage) ? 1 : 0 ;
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-29 11:45:05 -04:00
|
|
|
$messageArray = array ('msg_uid' => '','app_uid' => $caseId,'del_index' => 0,'app_msg_type' => 'TRIGGER','app_msg_subject' => $sSubject,'app_msg_from' => $sFrom,'app_msg_to' => $sTo,'app_msg_body' => $sBody,'app_msg_cc' => $sCc,'app_msg_bcc' => $sBcc,'app_msg_attach' => $aAttachment,'app_msg_template' => '','app_msg_status' => 'pending', 'app_msg_show_message' => $showMessage
|
2012-07-09 16:26:17 -04:00
|
|
|
);
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oSpool->create( $messageArray );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oSpool->sendMail();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($oSpool->status == 'sent') {
|
|
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_MESSAGE_SENT' ) . ": " . $sTo );
|
2012-07-09 16:26:17 -04:00
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 29, $oSpool->status . ' ' . $oSpool->error . print_r( $aSetup, 1 ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2011-11-11 17:28:22 -04:00
|
|
|
return $result;
|
2012-07-09 16:26:17 -04:00
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
return new wsResponse( 100, $e->getMessage() );
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get case information
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $iDelIndex
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function getCaseInfo ($caseId, $iDelIndex)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$aRows = $oCase->loadCase( $caseId, $iDelIndex );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (count( $aRows ) == 0) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['CASE_NUMBER'] = $caseNumber;
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 16, G::loadTranslation( 'ID_CASE_DOES_NOT_EXIST', SYS_LANG, $data ) );
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oProcess = new Process();
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$uFields = $oProcess->load( $aRows['PRO_UID'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$processName = $uFields['PRO_TITLE'];
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$processName = '';
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );
|
|
|
|
|
$result->caseId = $aRows['APP_UID'];
|
|
|
|
|
$result->caseNumber = $aRows['APP_NUMBER'];
|
|
|
|
|
$result->caseName = $aRows['TITLE'];
|
|
|
|
|
$result->caseStatus = $aRows['APP_STATUS'];
|
|
|
|
|
$result->caseParalell = $aRows['APP_PARALLEL'];
|
|
|
|
|
$result->caseCreatorUser = $aRows['APP_INIT_USER'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->caseCreatorUserName = $aRows['CREATOR'];
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->processId = $aRows['PRO_UID'];
|
|
|
|
|
$result->processName = $processName;
|
|
|
|
|
$result->createDate = $aRows['CREATE_DATE'];
|
|
|
|
|
$result->updateDate = $aRows['UPDATE_DATE'];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//now fill the array of AppDelegationPeer
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
|
|
|
|
|
|
|
|
|
$oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
|
|
|
|
|
|
|
|
|
$aCurrentUsers = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
while ($oDataset->next()) {
|
|
|
|
|
$aAppDel = $oDataset->getRow();
|
|
|
|
|
|
|
|
|
|
$oUser = new Users();
|
|
|
|
|
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oUser->load( $aAppDel['USR_UID'] );
|
|
|
|
|
$uFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
|
2012-07-09 16:26:17 -04:00
|
|
|
$currentUserName = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$currentUserName = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oTask = new Task();
|
|
|
|
|
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$uFields = $oTask->load( $aAppDel['TAS_UID'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$taskName = $uFields['TAS_TITLE'];
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$taskName = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$currentUser = new stdClass();
|
2012-10-09 13:29:25 -04:00
|
|
|
$currentUser->userId = $aAppDel['USR_UID'];
|
|
|
|
|
$currentUser->userName = $currentUserName;
|
|
|
|
|
$currentUser->taskId = $aAppDel['TAS_UID'];
|
|
|
|
|
$currentUser->taskName = $taskName;
|
|
|
|
|
$currentUser->delIndex = $aAppDel['DEL_INDEX'];
|
|
|
|
|
$currentUser->delThread = $aAppDel['DEL_THREAD'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];
|
|
|
|
|
$aCurrentUsers[] = $currentUser;
|
|
|
|
|
}
|
2012-04-25 17:19:54 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->currentUsers = $aCurrentUsers;
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
2012-07-25 18:27:48 -04:00
|
|
|
* Create an new user
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-11 12:52:43 -04:00
|
|
|
* @param string sessionId : The session ID.
|
2012-10-09 13:29:25 -04:00
|
|
|
* @param string userName : The username for the new user.
|
2012-07-25 18:27:48 -04:00
|
|
|
* @param string firstName : The user's first name.
|
2012-10-09 13:29:25 -04:00
|
|
|
* @param string lastName : The user's last name.
|
|
|
|
|
* @param string email : The user's email address.
|
|
|
|
|
* @param string role : The user's role, such as "PROCESSMAKER_ADMIN" or "PROCESSMAKER_OPERATOR".
|
|
|
|
|
* @param string password : The user's password such as "Be@gle2" (It will be automatically encrypted
|
|
|
|
|
* with an MD5 hash).
|
|
|
|
|
* @param string dueDate : Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
|
|
|
|
* @param string status : Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
2012-07-09 16:26:17 -04:00
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function createUser ($userName, $firstName, $lastName, $email, $role, $password, $dueDate = null, $status = null)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-07-25 18:27:48 -04:00
|
|
|
global $RBAC;
|
|
|
|
|
|
|
|
|
|
$RBAC->initRBAC();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userName )) {
|
|
|
|
|
$result = new wsCreateUserResponse( 25, G::loadTranslation( "ID_USERNAME_REQUIRED" ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $firstName )) {
|
|
|
|
|
$result = new wsCreateUserResponse( 27, G::loadTranslation( "ID_MSG_ERROR_USR_FIRSTNAME" ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2012-03-09 16:12:30 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $password )) {
|
|
|
|
|
$result = new wsCreateUserResponse( 26, G::loadTranslation( "ID_PASSWD_REQUIRED" ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
$mktimeDueDate = 0;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $dueDate )) {
|
|
|
|
|
if (! preg_match( "/^(\d{4})-(\d{2})-(\d{2})$/", $dueDate, $arrayMatch )) {
|
|
|
|
|
$result = new wsCreateUserResponse( - 1, G::loadTranslation( "ID_INVALID_DATA" ) . " $dueDate", null );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$mktimeDueDate = mktime( 0, 0, 0, intval( $arrayMatch[2] ), intval( $arrayMatch[3] ), intval( $arrayMatch[1] ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$mktimeDueDate = mktime( 0, 0, 0, date( "m" ), date( "d" ), date( "Y" ) + 1 );
|
2012-07-25 18:27:48 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $status )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
if ($status != "ACTIVE" && $status != "INACTIVE" && $status != "VACATION") {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsCreateUserResponse( - 1, G::loadTranslation( "ID_INVALID_DATA" ) . " $status", null );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$status = "ACTIVE";
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayRole = $RBAC->loadById( $role );
|
2012-07-25 18:27:48 -04:00
|
|
|
$strRole = null;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $arrayRole )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$strRole = $arrayRole["ROL_CODE"];
|
|
|
|
|
} else {
|
|
|
|
|
$strRole = $role;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($RBAC->verifyByCode( $role ) == 0) {
|
|
|
|
|
$data = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
$data["ROLE"] = $role;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsCreateUserResponse( 6, G::loadTranslation( "ID_INVALID_ROLE", SYS_LANG, $data ), null );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (strlen( $password ) > 20) {
|
|
|
|
|
$result = new wsCreateUserResponse( - 1, G::loadTranslation( "ID_PASSWORD_SURPRASES" ), null );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($RBAC->verifyUser( $userName ) == 1) {
|
|
|
|
|
$data = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
$data["USER_ID"] = $userName;
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsCreateUserResponse( 7, G::loadTranslation( "ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
//Set fields
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData = array ();
|
|
|
|
|
|
|
|
|
|
$arrayData["USR_USERNAME"] = $userName;
|
|
|
|
|
$arrayData["USR_PASSWORD"] = md5( $password );
|
|
|
|
|
$arrayData["USR_FIRSTNAME"] = $firstName;
|
|
|
|
|
$arrayData["USR_LASTNAME"] = $lastName;
|
|
|
|
|
$arrayData["USR_EMAIL"] = $email;
|
|
|
|
|
$arrayData["USR_DUE_DATE"] = $mktimeDueDate;
|
|
|
|
|
$arrayData["USR_CREATE_DATE"] = date( "Y-m-d H:i:s" );
|
|
|
|
|
$arrayData["USR_UPDATE_DATE"] = date( "Y-m-d H:i:s" );
|
|
|
|
|
$arrayData["USR_BIRTHDAY"] = date( "Y-m-d" );
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_AUTH_USER_DN"] = "";
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_STATUS"] = ($status == "ACTIVE") ? 1 : 0;
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$userUid = $RBAC->createUser( $arrayData, $strRole );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_UID"] = $userUid;
|
|
|
|
|
$arrayData["USR_STATUS"] = $status;
|
2012-07-25 18:27:48 -04:00
|
|
|
//$arrayData["USR_PASSWORD"] = md5($userUid);
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_COUNTRY"] = "";
|
|
|
|
|
$arrayData["USR_CITY"] = "";
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_LOCATION"] = "";
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_ADDRESS"] = "";
|
|
|
|
|
$arrayData["USR_PHONE"] = "";
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_ZIP_CODE"] = "";
|
|
|
|
|
$arrayData["USR_POSITION"] = "";
|
|
|
|
|
//$arrayData["USR_RESUME"]
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_ROLE"] = $strRole;
|
2012-07-25 18:27:48 -04:00
|
|
|
//$arrayData["USR_REPLACED_BY"]
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
$user = new Users();
|
2012-10-09 13:29:25 -04:00
|
|
|
$user->create( $arrayData );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
//Response
|
2012-10-09 13:29:25 -04:00
|
|
|
$data = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
$data["FIRSTNAME"] = $firstName;
|
|
|
|
|
$data["LASTNAME"] = $lastName;
|
|
|
|
|
$data["USER_ID"] = $userName;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::loadTranslation( "ID_USER_CREATED_SUCCESSFULLY", SYS_LANG, $data ) );
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"userUID" => $userUid,"timestamp" => $res->timestamp
|
2012-07-25 18:27:48 -04:00
|
|
|
);
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = wsCreateUserResponse( 100, $e->getMessage(), null );
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
/**
|
|
|
|
|
* Update user
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string userUid : The user UID.
|
|
|
|
|
* @param string userName : The username for the user.
|
2012-07-25 18:27:48 -04:00
|
|
|
* @param string firstName : Optional parameter. The user's first name.
|
2012-10-09 13:29:25 -04:00
|
|
|
* @param string lastName : Optional parameter. The user's last name.
|
|
|
|
|
* @param string email : Optional parameter. The user's email address.
|
|
|
|
|
* @param string dueDate : Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
|
|
|
|
* @param string status : Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
|
|
|
|
* @param string role : Optional parameter. The user's role, such
|
|
|
|
|
* as "PROCESSMAKER_ADMIN" or "PROCESSMAKER_OPERATOR".
|
|
|
|
|
* @param string password : Optional parameter. The user's password such as "Be@gle2" (It will be automatically
|
|
|
|
|
* encrypted with an MD5 hash).
|
2012-07-25 18:27:48 -04:00
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function updateUser ($userUid, $userName, $firstName = null, $lastName = null, $email = null, $dueDate = null, $status = null, $role = null, $password = null)
|
|
|
|
|
{
|
2012-07-25 18:27:48 -04:00
|
|
|
try {
|
|
|
|
|
global $RBAC;
|
|
|
|
|
|
|
|
|
|
$RBAC->initRBAC();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userUid )) {
|
|
|
|
|
$result = new wsResponse( 25, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userName )) {
|
|
|
|
|
$result = new wsResponse( 25, G::LoadTranslation( "ID_USERNAME_REQUIRED" ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($RBAC->verifyUserId( $userUid ) == 0) {
|
|
|
|
|
$result = new wsResponse( 3, G::loadTranslation( "ID_USER_NOT_REGISTERED_SYSTEM" ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
$mktimeDueDate = 0;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $dueDate )) {
|
|
|
|
|
if (! preg_match( "/^(\d{4})-(\d{2})-(\d{2})$/", $dueDate, $arrayMatch )) {
|
|
|
|
|
$result = new wsResponse( - 1, G::LoadTranslation( "ID_INVALID_DATA" ) . " $dueDate" );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-11 12:52:43 -04:00
|
|
|
return $result;
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$mktimeDueDate = mktime( 0, 0, 0, intval( $arrayMatch[2] ), intval( $arrayMatch[3] ), intval( $arrayMatch[1] ) );
|
2012-07-11 12:52:43 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $status )) {
|
2012-07-11 12:52:43 -04:00
|
|
|
if ($status != "ACTIVE" && $status != "INACTIVE" && $status != "VACATION") {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( - 1, G::LoadTranslation( "ID_INVALID_DATA" ) . " $status" );
|
2012-07-11 12:52:43 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2012-07-25 18:27:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$strRole = null;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $role )) {
|
|
|
|
|
$arrayRole = $RBAC->loadById( $role );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $arrayRole )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$strRole = $arrayRole["ROL_CODE"];
|
|
|
|
|
} else {
|
|
|
|
|
$strRole = $role;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($RBAC->verifyByCode( $role ) == 0) {
|
|
|
|
|
$data = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
$data["ROLE"] = $role;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 6, G::LoadTranslation( "ID_INVALID_ROLE", SYS_LANG, $data ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $password ) && strlen( $password ) > 20) {
|
|
|
|
|
$result = new wsResponse( - 1, G::LoadTranslation( "ID_PASSWORD_SURPRASES" ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$criteria = new Criteria();
|
2012-10-09 13:29:25 -04:00
|
|
|
$criteria->addSelectColumn( UsersPeer::USR_UID );
|
|
|
|
|
$criteria->add( UsersPeer::USR_USERNAME, $userName );
|
|
|
|
|
$criteria->add( UsersPeer::USR_UID, $userUid, Criteria::NOT_EQUAL );
|
|
|
|
|
$rs = UsersPeer::doSelectRS( $criteria );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
if ($rs->next()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$data = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
$data["USER_ID"] = $userName;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 7, G::LoadTranslation( "ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Set fields
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData = array ();
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_UID"] = $userUid;
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_USERNAME"] = $userName;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $firstName )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_FIRSTNAME"] = $firstName;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $lastName )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_LASTNAME"] = $lastName;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $email )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_EMAIL"] = $email;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($mktimeDueDate != 0) {
|
|
|
|
|
$arrayData["USR_DUE_DATE"] = $mktimeDueDate;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayData["USR_UPDATE_DATE"] = date( "Y-m-d H:i:s" );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $status )) {
|
2012-07-25 18:27:48 -04:00
|
|
|
$arrayData["USR_STATUS"] = $status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($strRole != null) {
|
|
|
|
|
$arrayData["USR_ROLE"] = $strRole;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $password )) {
|
|
|
|
|
$arrayData["USR_PASSWORD"] = md5( $password );
|
2012-07-25 18:27:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Update user
|
|
|
|
|
if ($strRole != null) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$RBAC->updateUser( $arrayData, $strRole );
|
2012-07-11 12:52:43 -04:00
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$RBAC->updateUser( $arrayData );
|
2012-07-11 12:52:43 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-25 18:27:48 -04:00
|
|
|
$user = new Users();
|
2012-10-09 13:29:25 -04:00
|
|
|
$user->update( $arrayData );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
|
|
|
|
//Response
|
|
|
|
|
//$res = new wsResponse(0, G::LoadTranslation("ID_OBJECT_UPDATE"));
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::LoadTranslation( "ID_UPDATED_SUCCESSFULLY" ) );
|
2012-07-25 18:27:48 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
|
2012-07-09 16:26:17 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-11-15 12:56:33 -04:00
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Information User
|
|
|
|
|
* @param string userUid : The user UID.
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
|
|
|
|
public function informationUser($userUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if (empty($userUid)) {
|
|
|
|
|
$result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$user = new Users();
|
|
|
|
|
$userInfo = $user->getAllInformation($userUid);
|
|
|
|
|
|
|
|
|
|
//Response
|
|
|
|
|
$res = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
|
|
|
|
|
|
|
|
|
|
$result = new stdClass();
|
|
|
|
|
$result->status_code = $res->status_code;
|
|
|
|
|
$result->message = $res->message;
|
|
|
|
|
$result->timestamp = $res->timestamp;
|
|
|
|
|
$result->info = $userInfo;
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
2011-11-11 17:28:22 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* create Group
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $groupName
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function createGroup ($groupName)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
2011-11-11 17:28:22 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (trim( $groupName ) == '') {
|
|
|
|
|
$result = new wsCreateGroupResponse( 25, G::loadTranslation( 'ID_GROUP_NAME_REQUIRED' ), '' );
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
2011-11-11 17:28:22 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$group = new Groupwf();
|
|
|
|
|
$grpRow['GRP_TITLE'] = $groupName;
|
2012-10-09 13:29:25 -04:00
|
|
|
$groupId = $group->create( $grpRow );
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['GROUP_NAME'] = $groupName;
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsCreateGroupResponse( 0, G::loadTranslation( 'ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $groupId );
|
2012-07-09 13:21:20 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = wsCreateGroupResponse( 100, $e->getMessage(), '' );
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
2011-11-08 17:37:47 -04:00
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create New Department link on the top section of the left pane allows you to create a root-level department.
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $departmentName
|
|
|
|
|
* @param string $parentUID
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function createDepartment ($departmentName, $parentUID)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (trim( $departmentName ) == '') {
|
|
|
|
|
$result = new wsCreateDepartmentResponse( 25, G::loadTranslation( 'ID_DEPARTMENT_NAME_REQUIRED' ), '' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$department = new Department();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (($parentUID != '') && ! ($department->existsDepartment( $parentUID ))) {
|
|
|
|
|
$result = new wsCreateDepartmentResponse( 26, G::loadTranslation( 'ID_PARENT_DEPARTMENT_NOT_EXIST' ), $parentUID );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($department->checkDepartmentName( $departmentName, $parentUID )) {
|
|
|
|
|
$result = new wsCreateDepartmentResponse( 27, G::loadTranslation( 'ID_DEPARTMENT_EXISTS' ), '' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$row['DEP_TITLE'] = $departmentName;
|
|
|
|
|
$row['DEP_PARENT'] = $parentUID;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$departmentId = $department->create( $row );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$data['DEPARTMENT_NAME'] = $departmentName;
|
2012-10-09 13:29:25 -04:00
|
|
|
$data['PARENT_UID'] = $parentUID;
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['DEPARTMENT_NAME'] = $departmentName;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsCreateDepartmentResponse( 0, G::loadTranslation( 'ID_DEPARTMENT_CREATED_SUCCESSFULLY', SYS_LANG, $data ), $departmentId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = wsCreateDepartmentResponse( 100, $e->getMessage(), '' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
BUG 9043 Variable for Case Notes content needed SOLVED
- Se crearon varias funciones para este caso.
- La funcion getCaseNotes en la class.case.php con los parametros applicationID, type que es la forma que quiere que se devuelvan los datos, puede ser array, objetc, string por defecto esta en array, y userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios.
- Se modifico la funcion getNotesList para poder traer las notas por un determinado usuario y por defecto recupera las notas de todos los usuarios.
- en class.pmFunctions.php se creo la funcion PMFGetCaseNotes con los parametros applicationID, type que es la forma que quiere que se devuelvan los datos, puede ser array, objetc, string por defecto esta en array, y userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios.
- En class.wsBase.php la funcion getCaseNotes con los parametros applicationID, userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios, esta funcion nos devuelve un array con los fieds en minuscula.
- En soap2.php getCaseNotes donde se tienen los siguiente parametros: sessionId, se necesita iniciar una session para poder utilizarlo, applicationID, userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios.
- Se adiciono la funcion para utilizarlo en SoapServer.
- En wsResponse se creo un nuevo template para la respuesta del webservice wsGetCaseNotesResponse con los campos status_code, message, notes, timestamp.
- En pmos2.wsdl se agregaron los datos necesarios para la salida correcta del webservice.
2012-05-02 09:56:30 -04:00
|
|
|
}
|
|
|
|
|
}
|
2011-02-02 21:29:47 +00:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
|
|
|
|
* remove user from group
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $appDocUid
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function removeUserFromGroup ($userId, $groupId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
G::LoadClass( 'groups' );
|
2012-07-09 16:26:17 -04:00
|
|
|
global $RBAC;
|
|
|
|
|
|
|
|
|
|
$RBAC->initRBAC();
|
2012-10-09 13:29:25 -04:00
|
|
|
$user = $RBAC->verifyUserId( $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($user == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$groups = new Groups();
|
|
|
|
|
$very_group = $groups->verifyGroup( $groupId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($very_group == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 9, G::loadTranslation( 'ID_GROUP_NOT_REGISTERED_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$very_user = $groups->verifyUsertoGroup( $groupId, $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($very_user == 1) {
|
|
|
|
|
$oGroup = new Groups();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oGroup->removeUserOfGroup( $groupId, $userId );
|
|
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//$oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 8, G::loadTranslation( 'ID_USER_NOT_REGISTERED_GROUP' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//G::LoadClass('groups');
|
|
|
|
|
//$oGroup = new Groups();
|
|
|
|
|
//$oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* assigns a user to a group
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $groupId
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function assignUserToGroup ($userId, $groupId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
global $RBAC;
|
|
|
|
|
$RBAC->initRBAC();
|
2012-10-09 13:29:25 -04:00
|
|
|
$user = $RBAC->verifyUserId( $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($user == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$groups = new Groups();
|
2012-10-09 13:29:25 -04:00
|
|
|
$very_group = $groups->verifyGroup( $groupId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($very_group == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 9, G::loadTranslation( 'ID_GROUP_NOT_REGISTERED_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$very_user = $groups->verifyUsertoGroup( $groupId, $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($very_user == 1) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 8, G::loadTranslation( 'ID_USER_ALREADY_EXISTS_GROUP' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$groups->addUserToGroup( $groupId, $userId );
|
|
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* assigns user to department
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $depId
|
|
|
|
|
* @param string $manager
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function assignUserToDepartment ($userId, $depId, $manager)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
global $RBAC;
|
|
|
|
|
$RBAC->initRBAC();
|
2012-10-09 13:29:25 -04:00
|
|
|
$user = $RBAC->verifyUserId( $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($user == 0) {
|
|
|
|
|
$result = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$deps = new Department();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $deps->existsDepartment( $depId )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['DEP_ID'] = $depId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, G::loadTranslation( 'ID_DEPARTMENT_NOT_REGISTERED_SYSTEM', SYS_LANG, $data ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $deps->existsUserInDepartment( $depId, $userId )) {
|
|
|
|
|
$deps->addUserToDepartment( $depId, $userId, $manager, true );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sends variables to a case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $variables
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function sendVariables ($caseId, $variables)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
//delegation where app uid (caseId) y usruid(session) ordenar delindes descendente y agaarr el primero
|
|
|
|
|
//delfinishdate != null error
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$cnt = 0;
|
|
|
|
|
|
|
|
|
|
while ($oDataset->next()) {
|
|
|
|
|
$aRow = $oDataset->getRow();
|
2012-10-09 13:29:25 -04:00
|
|
|
$cnt ++;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($cnt == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $variables )) {
|
|
|
|
|
$cant = count( $variables );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($cant > 0) {
|
|
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields = $oCase->loadCase( $caseId );
|
|
|
|
|
$oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $variables );
|
2012-07-09 16:26:17 -04:00
|
|
|
ob_start();
|
2012-10-09 13:29:25 -04:00
|
|
|
print_r( $variables );
|
2012-07-09 16:26:17 -04:00
|
|
|
$cdata = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
2012-10-09 13:29:25 -04:00
|
|
|
$up_case = $oCase->updateCase( $caseId, $oldFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, $cant . " " . G::loadTranslation( 'ID_VARIABLES_RECEIVED' ) . ": \n" . trim( str_replace( 'Array', '', $cdata ) ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 23, G::loadTranslation( 'ID_VARIABLES_PARAM_ZERO' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 24, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-09 13:29:25 -04:00
|
|
|
* get variables The variables can be system variables and/or case variables
|
|
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $variables
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function getVariables ($caseId, $variables)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $variables )) {
|
|
|
|
|
$cant = count( $variables );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($cant > 0) {
|
|
|
|
|
$oCase = new Cases();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$caseFields = $oCase->loadCase( $caseId );
|
|
|
|
|
$oldFields = $caseFields['APP_DATA'];
|
|
|
|
|
$resFields = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
foreach ($variables as $key => $val) {
|
|
|
|
|
$a .= $val->name . ', ';
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $oldFields[$val->name] )) {
|
|
|
|
|
if (! is_array( $oldFields[$val->name] )) {
|
|
|
|
|
$node = new stdClass();
|
|
|
|
|
$node->name = $val->name;
|
|
|
|
|
$node->value = $oldFields[$val->name];
|
2012-07-09 16:26:17 -04:00
|
|
|
$resFields[] = $node;
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($oldFields[$val->name] as $gridKey => $gridRow) {
|
|
|
|
|
//Special Variables like grids or checkgroups
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $gridRow )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
//Grids
|
|
|
|
|
foreach ($gridRow as $col => $colValue) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$node = new stdClass();
|
|
|
|
|
$node->name = $val->name . "][" . $gridKey . "][" . $col;
|
2012-07-09 16:26:17 -04:00
|
|
|
$node->value = $colValue;
|
|
|
|
|
$resFields[] = $node;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//Checkgroups, Radiogroups
|
2012-10-09 13:29:25 -04:00
|
|
|
$node = new stdClass();
|
|
|
|
|
$node->name = $key;
|
|
|
|
|
$node->value = implode( "|", $val );
|
2012-07-09 16:26:17 -04:00
|
|
|
$resFields[] = $node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 0, count( $resFields ) . G::loadTranslation( 'ID_VARIABLES_SENT' ), $resFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 23, G::loadTranslation( 'ID_VARIABLES_PARAM_ZERO' ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 24, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 100, $e->getMessage(), null );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-05 16:38:14 -04:00
|
|
|
/**
|
2012-10-09 13:29:25 -04:00
|
|
|
* get all variables the system and case selected
|
|
|
|
|
*
|
2012-10-05 16:38:14 -04:00
|
|
|
* @param string $caseId
|
|
|
|
|
*
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function getVariablesNames ($caseId)
|
2012-10-05 16:38:14 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
$oCase = new Cases();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$caseFields = $oCase->loadCase( $caseId );
|
2012-10-05 16:38:14 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields = $caseFields['APP_DATA'];
|
|
|
|
|
$resFields = array ();
|
2012-10-05 16:38:14 -04:00
|
|
|
|
|
|
|
|
foreach ($oldFields as $key => $val) {
|
|
|
|
|
$node = new stdClass();
|
2012-10-09 13:29:25 -04:00
|
|
|
$node->name = $key;
|
2012-10-05 16:38:14 -04:00
|
|
|
$resFields[] = $node;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 0, count( $resFields ) . G::loadTranslation( 'ID_VARIABLES_SENT' ), $resFields );
|
2012-10-05 16:38:14 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetVariableResponse( 100, $e->getMessage(), null );
|
2012-10-05 16:38:14 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
/**
|
2012-10-12 14:44:13 -04:00
|
|
|
* save the $_SESSION variables into $originalValues array, to unset them temporary.
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
*/
|
2012-10-12 14:44:13 -04:00
|
|
|
private function saveTemporarySessionVars()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
2012-10-12 14:44:13 -04:00
|
|
|
//Unset any variable, because we are starting a new case
|
|
|
|
|
if (isset( $_SESSION['APPLICATION'] )) {
|
|
|
|
|
$this->originalValues['APPLICATION'] = $_SESSION['APPLICATION'];
|
|
|
|
|
unset( $_SESSION['APPLICATION'] );
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['PROCESS'] )) {
|
|
|
|
|
$this->originalValues['PROCESS'] = $_SESSION['PROCESS'];
|
|
|
|
|
unset( $_SESSION['PROCESS'] );
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['TASK'] )) {
|
|
|
|
|
$this->originalValues['TASK'] = $_SESSION['TASK'];
|
|
|
|
|
unset( $_SESSION['TASK'] );
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['INDEX'] )) {
|
|
|
|
|
$this->originalValues['INDEX'] = $_SESSION['INDEX'];
|
|
|
|
|
unset( $_SESSION['INDEX'] );
|
|
|
|
|
}
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['USER_LOGGED'] )) {
|
|
|
|
|
$this->originalValues['USER_LOGGED'] = $_SESSION['USER_LOGGED'];
|
|
|
|
|
unset( $_SESSION['USER_LOGGED'] );
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['USR_USERNAME'] )) {
|
|
|
|
|
$this->originalValues['USR_USERNAME'] = $_SESSION['USR_USERNAME'];
|
|
|
|
|
unset( $_SESSION['USR_USERNAME'] );
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $_SESSION['STEP_POSITION'] )) {
|
|
|
|
|
$this->originalValues['STEP_POSITION'] = $_SESSION['STEP_POSITION'];
|
|
|
|
|
unset( $_SESSION['STEP_POSITION'] );
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
/**
|
|
|
|
|
* restore the Session variables with values of $originalValues array, if this is set.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
private function restoreSessionVars()
|
|
|
|
|
{
|
|
|
|
|
//Restore original values
|
|
|
|
|
if (isset( $this->originalValues['APPLICATION'] )) {
|
|
|
|
|
$_SESSION['APPLICATION'] = $this->originalValues['APPLICATION'];
|
|
|
|
|
unset( $this->originalValues['APPLICATION']);
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $this->originalValues['PROCESS'] )) {
|
|
|
|
|
$_SESSION['PROCESS'] = $this->originalValues['PROCESS'];
|
|
|
|
|
unset( $this->originalValues['PROCESS']);
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $this->originalValues['TASK'] )) {
|
|
|
|
|
$_SESSION['TASK'] = $this->originalValues['TASK'];
|
|
|
|
|
unset( $this->originalValues['TASK']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset( $this->originalValues['INDEX'] )) {
|
|
|
|
|
$_SESSION['INDEX'] = $this->originalValues['INDEX'];
|
|
|
|
|
unset( $this->originalValues['INDEX']);
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $this->originalValues['USR_USERNAME'] )) {
|
|
|
|
|
$_SESSION['USR_USERNAME'] = $this->originalValues['USR_USERNAME'];
|
|
|
|
|
unset( $this->originalValues['USR_USERNAME']);
|
|
|
|
|
}
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
if (isset( $this->originalValues['USER_LOGGED'] )) {
|
|
|
|
|
$_SESSION['USER_LOGGED'] = $this->originalValues['USER_LOGGED'];
|
|
|
|
|
unset( $this->originalValues['USER_LOGGED']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset( $this->originalValues['STEP_POSITION'] )) {
|
|
|
|
|
$_SESSION['STEP_POSITION'] = $this->originalValues['STEP_POSITION'];
|
|
|
|
|
unset( $this->originalValues['STEP_POSITION']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* new Case begins a new case under the name of the logged-in user.
|
|
|
|
|
*
|
|
|
|
|
* @param string $processId
|
|
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $taskId
|
|
|
|
|
* @param string $variables
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
|
|
|
|
public function newCase ($processId, $userId, $taskId, $variables)
|
|
|
|
|
{
|
|
|
|
|
try {
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->saveTemporarySessionVars();
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$Fields = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $variables ) && count( $variables ) > 0) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$Fields = $variables;
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oProcesses = new Processes();
|
2012-10-09 13:29:25 -04:00
|
|
|
$pro = $oProcesses->processExists( $processId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $pro) {
|
|
|
|
|
$result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId );
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->restoreSessionVars();
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oCase = new Cases();
|
|
|
|
|
$oTask = new Tasks();
|
2012-10-09 13:29:25 -04:00
|
|
|
$startingTasks = $oCase->getStartCases( $userId );
|
|
|
|
|
array_shift( $startingTasks ); //remove the first row, the header row
|
|
|
|
|
$founded = '';
|
2012-07-09 16:26:17 -04:00
|
|
|
$tasksInThisProcess = 0;
|
2012-10-09 13:29:25 -04:00
|
|
|
$validTaskId = $taskId;
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
foreach ($startingTasks as $key => $val) {
|
|
|
|
|
if ($val['pro_uid'] == $processId) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$tasksInThisProcess ++;
|
2012-07-09 16:26:17 -04:00
|
|
|
$validTaskId = $val['uid'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($val['uid'] == $taskId) {
|
|
|
|
|
$founded = $val['value'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($taskId == '') {
|
|
|
|
|
if ($tasksInThisProcess == 1) {
|
|
|
|
|
$founded = $validTaskId;
|
2012-10-09 13:29:25 -04:00
|
|
|
$taskId = $validTaskId;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($tasksInThisProcess > 1) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 13, G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) );
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->restoreSessionVars();
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($founded == '') {
|
|
|
|
|
$result = new wsResponse( 14, G::loadTranslation( 'ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK' ) );
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->restoreSessionVars();
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$case = $oCase->startCase( $taskId, $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$_SESSION['APPLICATION'] = $case['APPLICATION'];
|
|
|
|
|
$_SESSION['PROCESS'] = $case['PROCESS'];
|
|
|
|
|
$_SESSION['TASK'] = $taskId;
|
|
|
|
|
$_SESSION['INDEX'] = $case['INDEX'];
|
|
|
|
|
$_SESSION['USER_LOGGED'] = $userId;
|
|
|
|
|
$_SESSION['USR_USERNAME'] = $case['USR_USERNAME'];
|
2012-07-15 22:27:06 -04:00
|
|
|
$_SESSION['STEP_POSITION'] = 0;
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$caseId = $case['APPLICATION'];
|
|
|
|
|
$caseNr = $case['CASE_NUMBER'];
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields = $oCase->loadCase( $caseId );
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields );
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$up_case = $oCase->updateCase( $caseId, $oldFields );
|
2012-10-12 12:52:50 -04:00
|
|
|
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->restoreSessionVars();
|
2012-11-15 12:56:33 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_STARTED_SUCCESSFULLY' ) );
|
|
|
|
|
$result->caseId = $caseId;
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->caseNumber = $caseNr;
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-10-12 14:44:13 -04:00
|
|
|
$this->restoreSessionVars();
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* creates a new case impersonating a user who has the proper privileges to create new cases
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $processId
|
|
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $variables
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function newCaseImpersonate ($processId, $userId, $variables)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $variables )) {
|
|
|
|
|
if (count( $variables ) > 0) {
|
|
|
|
|
$c = count( $variables );
|
2012-07-09 16:26:17 -04:00
|
|
|
$Fields = $variables;
|
|
|
|
|
|
|
|
|
|
if ($c == 0) {
|
|
|
|
|
//Si no tenenmos ninguna variables en el array variables.
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 10, G::loadTranslation( 'ID_ARRAY_VARIABLES_EMPTY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 10, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-10 17:48:42 -04:00
|
|
|
$processes = new Processes();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $processes->processExists( $processId )) {
|
|
|
|
|
$result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId . "!!" );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-10 17:48:42 -04:00
|
|
|
$user = new Users();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $user->userExists( $userId )) {
|
|
|
|
|
$result = new wsResponse( 11, G::loadTranslation( 'ID_USER_NOT_REGISTERED' ) . " " . $userId . "!!" );
|
2012-07-10 17:48:42 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oCase = new Cases();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$arrayTask = $processes->getStartingTaskForUser( $processId, null );
|
|
|
|
|
$numTasks = count( $arrayTask );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($numTasks == 1) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$case = $oCase->startCase( $arrayTask[0]['TAS_UID'], $userId );
|
|
|
|
|
$caseId = $case['APPLICATION'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$caseNumber = $case['CASE_NUMBER'];
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields = $oCase->loadCase( $caseId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$up_case = $oCase->updateCase( $caseId, $oldFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->caseId = $caseId;
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->caseNumber = $caseNumber;
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
|
|
|
|
if ($numTasks == 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 12, G::loadTranslation( 'ID_NO_STARTING_TASK' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($numTasks > 1) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 13, G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* derivate Case moves the case to the next task in the process according to the routing rules
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $delIndex
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function derivateCase ($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$sStatus = 'TO_DO';
|
|
|
|
|
|
|
|
|
|
$varResponse = '';
|
|
|
|
|
$varTriggers = "\n";
|
|
|
|
|
|
|
|
|
|
if ($delIndex == '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (AppDelegationPeer::doCount( $oCriteria ) > 1) {
|
|
|
|
|
$result = new wsResponse( 20, G::loadTranslation( 'ID_SPECIFY_DELEGATION_INDEX' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
2012-10-09 13:29:25 -04:00
|
|
|
$aRow = $oDataset->getRow();
|
2012-07-09 16:26:17 -04:00
|
|
|
$delIndex = $aRow['DEL_INDEX'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oAppDel = new AppDelegation();
|
2012-10-09 13:29:25 -04:00
|
|
|
$appdel = $oAppDel->Load( $caseId, $delIndex );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
if ($userId != $appdel['USR_UID']) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 17, G::loadTranslation( 'ID_CASE_ASSIGNED_ANOTHER_USER' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($appdel['DEL_FINISH_DATE'] != null) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelayPeer::APP_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX );
|
|
|
|
|
$oCriteria->add( AppDelayPeer::APP_TYPE, '' );
|
|
|
|
|
$oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) );
|
|
|
|
|
$oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE );
|
|
|
|
|
$oDataset = AppDelayPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $aRow )) {
|
|
|
|
|
if (isset( $aRow['APP_DISABLE_ACTION_USER'] ) && $aRow['APP_DISABLE_ACTION_USER'] != 0 && isset( $aRow['APP_DISABLE_ACTION_DATE'] ) && $aRow['APP_DISABLE_ACTION_DATE'] != '') {
|
|
|
|
|
$result = new wsResponse( 19, G::loadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$aData['APP_UID'] = $caseId;
|
2012-07-09 16:26:17 -04:00
|
|
|
$aData['DEL_INDEX'] = $delIndex;
|
2012-10-09 13:29:25 -04:00
|
|
|
$aData['USER_UID'] = $userId;
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//Load data
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase = new Cases();
|
|
|
|
|
$appFields = $oCase->loadCase( $caseId, $delIndex );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_null( $appFields["DEL_INIT_DATE"] )) {
|
|
|
|
|
$oCase->setDelInitDate( $caseId, $delIndex );
|
|
|
|
|
$appFields = $oCase->loadCase( $caseId, $delIndex );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-07-19 15:09:40 -04:00
|
|
|
$appFields["APP_DATA"]["APPLICATION"] = $caseId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! isset( $_SESSION["PROCESS"] )) {
|
2012-07-19 15:32:19 -04:00
|
|
|
$_SESSION["PROCESS"] = $appFields["PRO_UID"];
|
2012-07-19 15:09:40 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($bExecuteTriggersBeforeAssignment) {
|
|
|
|
|
//Execute triggers before assignment
|
2012-10-09 13:29:25 -04:00
|
|
|
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 1, 'BEFORE' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (count( $aTriggers ) > 0) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript = new PMScript();
|
|
|
|
|
|
|
|
|
|
foreach ($aTriggers as $aTrigger) {
|
|
|
|
|
//$appFields = $oCase->loadCase( $caseId );
|
|
|
|
|
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
//Set variables
|
|
|
|
|
$params = new stdClass();
|
|
|
|
|
$params->appData = $appFields["APP_DATA"];
|
|
|
|
|
|
|
|
|
|
if ($this->stored_system_variables) {
|
|
|
|
|
$params->option = "STORED SESSION";
|
2012-10-09 13:29:25 -04:00
|
|
|
$params->SID = $this->wsSessionId;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );
|
2012-07-23 17:09:07 -04:00
|
|
|
|
|
|
|
|
//PMScript
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setFields( $appFields['APP_DATA'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$bExecute = true;
|
|
|
|
|
|
|
|
|
|
if ($aTrigger['ST_CONDITION'] !== '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['ST_CONDITION'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$bExecute = $oPMScript->evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($bExecute) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['TRI_WEBBOT'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript->execute();
|
2012-07-19 15:09:40 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$varTriggers .= "<br/><b>-= Before Assignment =-</b><br/>" . nl2br( htmlentities( $aTrigger['TRI_WEBBOT'], ENT_QUOTES ) ) . "<br/>";
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//$appFields = $oCase->loadCase( $caseId );
|
|
|
|
|
$appFields['APP_DATA'] = $oPMScript->aFields;
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase->updateCase( $caseId, $appFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Execute triggers before derivation
|
2012-10-09 13:29:25 -04:00
|
|
|
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (count( $aTriggers ) > 0) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$varTriggers .= "<b>-= Before Derivation =-</b><br/>";
|
|
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
$oPMScript = new PMScript();
|
|
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
foreach ($aTriggers as $aTrigger) {
|
|
|
|
|
//$appFields = $oCase->loadCase( $caseId );
|
|
|
|
|
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
//Set variables
|
|
|
|
|
$params = new stdClass();
|
|
|
|
|
$params->appData = $appFields["APP_DATA"];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
if ($this->stored_system_variables) {
|
|
|
|
|
$params->option = "STORED SESSION";
|
2012-10-09 13:29:25 -04:00
|
|
|
$params->SID = $this->wsSessionId;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );
|
2012-07-23 17:09:07 -04:00
|
|
|
|
|
|
|
|
//PMScript
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setFields( $appFields['APP_DATA'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$bExecute = true;
|
|
|
|
|
|
|
|
|
|
if ($aTrigger['ST_CONDITION'] !== '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['ST_CONDITION'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$bExecute = $oPMScript->evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($bExecute) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['TRI_WEBBOT'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript->execute();
|
2012-07-19 15:09:40 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] );
|
|
|
|
|
$varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>";
|
2012-07-09 16:26:17 -04:00
|
|
|
//$appFields = $oCase->loadCase( $caseId );
|
|
|
|
|
$appFields['APP_DATA'] = $oPMScript->aFields;
|
|
|
|
|
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase->updateCase( $caseId, $appFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oDerivation = new Derivation();
|
2012-10-09 13:29:25 -04:00
|
|
|
$derive = $oDerivation->prepareInformation( $aData );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $derive[1] )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
if ($derive[1]['ROU_TYPE'] == 'SELECT') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 21, G::loadTranslation( 'ID_CAN_NOT_ROUTE_CASE_USING_WEBSERVICES' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 22, G::loadTranslation( 'ID_TASK_DOES_NOT_HAVE_ROUTING_RULE' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($derive as $key => $val) {
|
|
|
|
|
if ($val['NEXT_TASK']['TAS_ASSIGN_TYPE'] == 'MANUAL') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 15, G::loadTranslation( 'ID_TASK_DEFINED_MANUAL_ASSIGNMENT' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Routed to the next task, if end process then not exist user
|
2012-10-09 13:29:25 -04:00
|
|
|
$nodeNext = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
$usrasgdUid = null;
|
|
|
|
|
$usrasgdUserName = null;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $val['NEXT_TASK']['USER_ASSIGNED'] )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$usrasgdUid = $val['NEXT_TASK']['USER_ASSIGNED']['USR_UID'];
|
|
|
|
|
$usrasgdUserName = '(' . $val['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME'] . ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$nodeNext['TAS_UID'] = $val['NEXT_TASK']['TAS_UID'];
|
|
|
|
|
$nodeNext['USR_UID'] = $usrasgdUid;
|
2012-10-09 13:29:25 -04:00
|
|
|
$nodeNext['TAS_ASSIGN_TYPE'] = $val['NEXT_TASK']['TAS_ASSIGN_TYPE'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE'];
|
|
|
|
|
$nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY'];
|
2012-10-09 13:29:25 -04:00
|
|
|
$nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT'];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$nextDelegations[] = $nodeNext;
|
2012-10-09 13:29:25 -04:00
|
|
|
$varResponse = $varResponse . (($varResponse != '') ? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$appFields['DEL_INDEX'] = $delIndex;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (isset( $derive['TAS_UID'] )) {
|
|
|
|
|
$appFields['TAS_UID'] = $derive['TAS_UID'];
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Save data - Start
|
|
|
|
|
//$appFields = $oCase->loadCase( $caseId );
|
|
|
|
|
//$oCase->updateCase ( $caseId, $appFields );
|
|
|
|
|
//Save data - End
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
|
|
|
|
$row = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
2012-07-09 16:26:17 -04:00
|
|
|
$del = DBAdapter::getStringDelimiter();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->addSelectColumn( RoutePeer::ROU_TYPE );
|
|
|
|
|
$oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK );
|
|
|
|
|
$oCriteria->add( RoutePeer::TAS_UID, $appdel['TAS_UID'] );
|
|
|
|
|
$oDataset = TaskPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$row[] = array ('ROU_TYPE' => $aRow['ROU_TYPE'],'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//derivate case
|
2012-10-09 13:29:25 -04:00
|
|
|
$aCurrentDerivation = array ('APP_UID' => $caseId,'DEL_INDEX' => $delIndex,'APP_STATUS' => $sStatus,'TAS_UID' => $appdel['TAS_UID'],'ROU_TYPE' => $row[0]['ROU_TYPE']
|
2012-07-09 16:26:17 -04:00
|
|
|
);
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oDerivation->derivate( $aCurrentDerivation, $nextDelegations );
|
|
|
|
|
$appFields = $oCase->loadCase( $caseId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
//Execute triggers after derivation
|
2012-10-09 13:29:25 -04:00
|
|
|
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'AFTER' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (count( $aTriggers ) > 0) {
|
2012-07-09 16:26:17 -04:00
|
|
|
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
//Set variables
|
|
|
|
|
$params = new stdClass();
|
|
|
|
|
$params->appData = $appFields["APP_DATA"];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-07-23 17:09:07 -04:00
|
|
|
if ($this->stored_system_variables) {
|
|
|
|
|
$params->option = "STORED SESSION";
|
2012-10-09 13:29:25 -04:00
|
|
|
$params->SID = $this->wsSessionId;
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );
|
2012-07-23 17:09:07 -04:00
|
|
|
|
|
|
|
|
//PMScript
|
|
|
|
|
$oPMScript = new PMScript();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setFields( $appFields['APP_DATA'] );
|
2012-07-23 17:09:07 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$varTriggers .= "<b>-= After Derivation =-</b><br/>";
|
|
|
|
|
|
|
|
|
|
foreach ($aTriggers as $aTrigger) {
|
|
|
|
|
$bExecute = true;
|
|
|
|
|
|
|
|
|
|
if ($aTrigger['ST_CONDITION'] !== '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['ST_CONDITION'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$bExecute = $oPMScript->evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($bExecute) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setScript( $aTrigger['TRI_WEBBOT'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript->execute();
|
2012-07-19 15:09:40 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] );
|
|
|
|
|
$varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>";
|
2012-07-09 16:26:17 -04:00
|
|
|
//$appFields = $oCase->loadCase($caseId);
|
|
|
|
|
$appFields['APP_DATA'] = $oPMScript->aFields;
|
|
|
|
|
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
|
|
|
|
//$appFields = $oCase->loadCase($caseId);
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase->updateCase( $caseId, $appFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oUser = new Users();
|
2012-10-09 13:29:25 -04:00
|
|
|
$aUser = $oUser->load( $userId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (trim( $aUser['USR_EMAIL'] ) == '') {
|
|
|
|
|
$aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST'];
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>';
|
|
|
|
|
$oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//Save data - Start
|
|
|
|
|
//$appFields = $oCase->loadCase($caseId);
|
|
|
|
|
//$oCase->updateCase($caseId, $appFields);
|
|
|
|
|
//Save data - End
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oProcess = new Process();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcessFieds = $oProcess->Load( $appFields['PRO_UID'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
//here dubug mode in web entry
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
|
|
|
|
if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) {
|
|
|
|
|
$result = new wsResponse( 0, $varResponse . "
|
2012-07-09 16:26:17 -04:00
|
|
|
<br><br><table width='100%' cellpadding='0' cellspacing='0'><tr><td class='FormTitle'>
|
2012-10-09 13:29:25 -04:00
|
|
|
" . G::LoadTranslation( 'ID_DEBUG_MESSAGE' ) . "</td></tr></table>" . $varTriggers );
|
2012-07-09 16:26:17 -04:00
|
|
|
} else {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, $varResponse . " --- " . $oProcessFieds['PRO_DEBUG'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$res = $result->getPayloadArray();
|
|
|
|
|
|
|
|
|
|
//now fill the array of AppDelegationPeer
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_PREVIOUS, $delIndex );
|
|
|
|
|
$oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
|
|
|
|
|
|
|
|
|
$aCurrentUsers = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
while ($oDataset->next()) {
|
|
|
|
|
$aAppDel = $oDataset->getRow();
|
|
|
|
|
|
|
|
|
|
$oUser = new Users();
|
|
|
|
|
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oUser->load( $aAppDel['USR_UID'] );
|
|
|
|
|
$uFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
|
2012-07-09 16:26:17 -04:00
|
|
|
$currentUserName = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$currentUserName = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oTask = new Task();
|
|
|
|
|
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$uFields = $oTask->load( $aAppDel['TAS_UID'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$taskName = $uFields['TAS_TITLE'];
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$taskName = '';
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-27 12:30:48 -04:00
|
|
|
// execute events
|
|
|
|
|
$eventPro = $_SESSION["PROCESS"];
|
|
|
|
|
$eventApp = $caseId;
|
|
|
|
|
$eventInd = $aAppDel['DEL_INDEX'];
|
|
|
|
|
$eventTas = $aAppDel['TAS_UID'];
|
|
|
|
|
|
|
|
|
|
$oEvent = new Event();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oEvent->createAppEvents( $eventPro, $eventApp, $eventInd, $eventTas );
|
2012-07-27 12:30:48 -04:00
|
|
|
// end events
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$currentUser = new stdClass();
|
2012-10-09 13:29:25 -04:00
|
|
|
$currentUser->userId = $aAppDel['USR_UID'];
|
|
|
|
|
$currentUser->userName = $currentUserName;
|
|
|
|
|
$currentUser->taskId = $aAppDel['TAS_UID'];
|
|
|
|
|
$currentUser->taskName = $taskName;
|
|
|
|
|
$currentUser->delIndex = $aAppDel['DEL_INDEX'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$currentUser->delThread = $aAppDel['DEL_THREAD'];
|
|
|
|
|
$currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];
|
|
|
|
|
$aCurrentUsers[] = $currentUser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$res['routing'] = $aCurrentUsers;
|
|
|
|
|
|
|
|
|
|
return $res;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-09 13:29:25 -04:00
|
|
|
* execute Trigger, executes a ProcessMaker trigger.
|
|
|
|
|
* Note that triggers which are tied to case derivation
|
2012-07-09 16:26:17 -04:00
|
|
|
* will executing automatically.
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string $userId
|
|
|
|
|
* @param string $caseId
|
|
|
|
|
* @param string $delIndex
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function executeTrigger ($userId, $caseId, $triggerIndex, $delIndex)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oAppDel = new AppDelegation();
|
2012-10-09 13:29:25 -04:00
|
|
|
$appdel = $oAppDel->Load( $caseId, $delIndex );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($userId != $appdel['USR_UID']) {
|
|
|
|
|
$result = new wsResponse( 17, G::loadTranslation( 'ID_CASE_ASSIGNED_ANOTHER_USER' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($appdel['DEL_FINISH_DATE'] != null) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelayPeer::APP_UID );
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX );
|
|
|
|
|
$oCriteria->add( AppDelayPeer::APP_TYPE, '' );
|
|
|
|
|
$oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) );
|
|
|
|
|
$oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE );
|
|
|
|
|
$oDataset = AppDelayPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $aRow )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
if ($aRow['APP_DISABLE_ACTION_USER'] != 0 && $aRow['APP_DISABLE_ACTION_DATE'] != '') {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 19, G::loadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-19 15:09:40 -04:00
|
|
|
//Load data
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase = new Cases();
|
|
|
|
|
$appFields = $oCase->loadCase( $caseId );
|
2012-07-19 15:09:40 -04:00
|
|
|
|
|
|
|
|
$appFields["APP_DATA"]["APPLICATION"] = $caseId;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! isset( $_SESSION["PROCESS"] )) {
|
2012-07-19 15:32:19 -04:00
|
|
|
$_SESSION["PROCESS"] = $appFields["PRO_UID"];
|
2012-07-19 15:09:40 -04:00
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//executeTrigger
|
2012-10-09 13:29:25 -04:00
|
|
|
$aTriggers = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
$c = new Criteria();
|
2012-10-09 13:29:25 -04:00
|
|
|
$c->add( TriggersPeer::TRI_UID, $triggerIndex );
|
|
|
|
|
$rs = TriggersPeer::doSelectRS( $c );
|
|
|
|
|
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$rs->next();
|
|
|
|
|
$row = $rs->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_array( $row ) && $row['TRI_TYPE'] == 'SCRIPT') {
|
2012-07-09 16:26:17 -04:00
|
|
|
$aTriggers[] = $row;
|
2012-07-19 15:09:40 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript = new PMScript();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oPMScript->setFields( $appFields['APP_DATA'] );
|
|
|
|
|
$oPMScript->setScript( $row['TRI_WEBBOT'] );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oPMScript->execute();
|
|
|
|
|
|
|
|
|
|
//Save data - Start
|
|
|
|
|
$appFields['APP_DATA'] = $oPMScript->aFields;
|
|
|
|
|
//$appFields = $oCase->loadCase($caseId);
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCase->updateCase( $caseId, $appFields );
|
2012-07-09 16:26:17 -04:00
|
|
|
//Save data - End
|
|
|
|
|
} else {
|
|
|
|
|
$data['TRIGGER_INDEX'] = $triggerIndex;
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, G::loadTranslation( 'ID_INVALID_TRIGGER', SYS_LANG, $data ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_EXECUTED' ) . ": " . trim( $row['TRI_WEBBOT'] ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
//$result = new wsResponse(0, 'executed: ' . print_r($oPMScript, 1));
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
2012-07-09 16:26:17 -04:00
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* task Case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string sessionId : The session ID which is obtained when logging in
|
|
|
|
|
* @param string caseId : The case ID. The caseList() function can be used to find the ID number for cases
|
2012-07-09 16:26:17 -04:00
|
|
|
* @return $result returns the current task for a given case. Note that the logged-in user must have privileges
|
|
|
|
|
* to access the task
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function taskCase ($caseId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ();
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$del = DBAdapter::getStringDelimiter();
|
|
|
|
|
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
|
|
|
|
|
|
|
|
|
$oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' );
|
|
|
|
|
$oCriteria->addAlias( "C1", 'CONTENT' );
|
|
|
|
|
$tasTitleConds = array ();
|
|
|
|
|
$tasTitleConds[] = array (AppDelegationPeer::TAS_UID,'C1.CON_ID'
|
|
|
|
|
);
|
|
|
|
|
$tasTitleConds[] = array ('C1.CON_CATEGORY',$del . 'TAS_TITLE' . $del
|
|
|
|
|
);
|
|
|
|
|
$tasTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
|
|
|
|
|
);
|
|
|
|
|
$oCriteria->addJoinMC( $tasTitleConds, Criteria::LEFT_JOIN );
|
|
|
|
|
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
|
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
|
|
|
|
|
while ($aRow = $oDataset->getRow()) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $aRow['DEL_INDEX'],'name' => $aRow['TAS_TITLE']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* process list verified
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string sessionId : The session ID which is obtained when logging in
|
|
|
|
|
* @param string userId :
|
|
|
|
|
* @return $result will return an object
|
2012-07-09 16:26:17 -04:00
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function processListVerified ($userId)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$rows = $oCase->getStartCases( $userId );
|
|
|
|
|
$result = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
foreach ($rows as $key => $val) {
|
|
|
|
|
if ($key != 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $val['pro_uid'],'name' => $val['value']
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* reassign Case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string sessionId : The session ID (which was obtained during login)
|
|
|
|
|
* @param string caseId : The case ID (which can be obtained with the caseList() function)
|
|
|
|
|
* @param string delIndex : The delegation index number of the case (which can be obtained with the caseList()
|
|
|
|
|
* function).
|
|
|
|
|
* @param string userIdSource : The user who is currently assigned the case.
|
|
|
|
|
* @param string userIdTarget : The target user who will be newly assigned to the case.
|
|
|
|
|
* @return $result will return an object
|
2012-07-09 16:26:17 -04:00
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function reassignCase ($sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget)
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if ($userIdTarget == $userIdSource) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 30, G::loadTranslation( 'ID_TARGET_ORIGIN_USER_SAME' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
|
|
|
|
* ****************( 1 )*****************
|
|
|
|
|
*/
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
|
|
|
|
$oCriteria->add( UsersPeer::USR_UID, $userIdSource );
|
|
|
|
|
$oDataset = UsersPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! is_array( $aRow )) {
|
|
|
|
|
$result = new wsResponse( 31, G::loadTranslation( 'ID_INVALID_ORIGIN_USER' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
|
|
|
|
* ****************( 2 )*****************
|
|
|
|
|
*/
|
2012-07-09 16:26:17 -04:00
|
|
|
$oCase = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$rows = $oCase->loadCase( $caseId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! is_array( $aRow )) {
|
|
|
|
|
$result = new wsResponse( 32, G::loadTranslation( 'ID_CASE_NOT_OPEN' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
|
|
|
|
* ****************( 3 )*****************
|
|
|
|
|
*/
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$aConditions = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
// $aConditions[] = array(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID);
|
|
|
|
|
// $aConditions[] = array(AppDelegationPeer::TAS_UID, TaskUserPeer::TAS_UID);
|
|
|
|
|
// $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
|
|
|
|
//$oCriteria->addJoin(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN);
|
2012-10-09 13:29:25 -04:00
|
|
|
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::USR_UID, $userIdSource );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $delIndex );
|
|
|
|
|
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
|
|
|
|
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! is_array( $aRow )) {
|
|
|
|
|
$result = new wsResponse( 33, G::loadTranslation( 'ID_INVALID_CASE_DELEGATION_INDEX' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tasUid = $aRow['TAS_UID'];
|
|
|
|
|
$derivation = new Derivation();
|
2012-10-09 13:29:25 -04:00
|
|
|
$userList = $derivation->getAllUsersFromAnyTask( $tasUid );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! in_array( $userIdTarget, $userList )) {
|
|
|
|
|
$result = new wsResponse( 34, G::loadTranslation( 'ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
|
|
|
|
* ****************( 4 )*****************
|
|
|
|
|
*/
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
|
|
|
|
$oCriteria->add( UsersPeer::USR_UID, $userIdTarget );
|
|
|
|
|
$oDataset = UsersPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
2012-07-09 16:26:17 -04:00
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! is_array( $aRow )) {
|
|
|
|
|
$result = new wsResponse( 35, G::loadTranslation( 'ID_TARGET_USER_DESTINATION_INVALID' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
/**
|
|
|
|
|
* ****************( 5 )*****************
|
|
|
|
|
*/
|
|
|
|
|
$var = $oCase->reassignCase( $caseId, $delIndex, $userIdSource, $userIdTarget );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $var) {
|
|
|
|
|
$result = new wsResponse( 36, G::loadTranslation( 'ID_CASE_COULD_NOT_REASSIGNED' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
|
|
|
|
|
);
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get system information
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string sessionId : The session ID (which was obtained at login)
|
2012-07-09 16:26:17 -04:00
|
|
|
* @return $eturns information about the WAMP/LAMP stack, the workspace database, the IP number and version
|
|
|
|
|
* of ProcessMaker, and the IP number and version of web browser of the user
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function systemInformation ()
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
define( 'SKIP_RENDER_SYSTEM_INFORMATION', true );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
require_once (PATH_METHODS . 'login' . PATH_SEP . 'dbInfo.php');
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->status_code = 0;
|
|
|
|
|
$result->message = G::loadTranslation( 'ID_SUCESSFUL' );
|
|
|
|
|
$result->timestamp = date( 'Y-m-d H:i:s' );
|
|
|
|
|
G::LoadClass( "system" );
|
|
|
|
|
$result->version = System::getVersion();
|
|
|
|
|
$result->operatingSystem = $redhat;
|
|
|
|
|
$result->webServer = getenv( 'SERVER_SOFTWARE' );
|
|
|
|
|
$result->serverName = getenv( 'SERVER_NAME' );
|
|
|
|
|
$result->serverIp = $Fields['IP']; //lookup ($ip);
|
|
|
|
|
$result->phpVersion = phpversion();
|
|
|
|
|
$result->databaseVersion = $Fields['DATABASE'];
|
|
|
|
|
$result->databaseServerIp = $Fields['DATABASE_SERVER'];
|
|
|
|
|
$result->databaseName = $Fields['DATABASE_NAME'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->availableDatabases = $Fields['AVAILABLE_DB'];
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->userBrowser = $Fields['HTTP_USER_AGENT'];
|
|
|
|
|
$result->userIp = $Fields['IP'];
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* import process fromLibrary: downloads and imports a process from the ProcessMaker library
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-07-09 16:26:17 -04:00
|
|
|
* @param string sessionId : The session ID (which was obtained at login).
|
|
|
|
|
* @param string processId :
|
|
|
|
|
* @param string version :
|
|
|
|
|
* @param string importOption :
|
|
|
|
|
* @param string usernameLibrary : The username to obtain access to the ProcessMaker library.
|
|
|
|
|
* @param string passwordLibrary : The password to obtain access to the ProcessMaker library.
|
2012-10-09 13:29:25 -04:00
|
|
|
* @return $eturns will return an object
|
2012-07-09 16:26:17 -04:00
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function importProcessFromLibrary ($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '')
|
|
|
|
|
{
|
2012-07-09 16:26:17 -04:00
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
G::LoadClass( 'processes' );
|
2012-07-09 16:26:17 -04:00
|
|
|
//$versionReq = $_GET['v'];
|
|
|
|
|
//. (isset($_GET['s']) ? '&s=' . $_GET['s'] : '')
|
2012-10-09 13:29:25 -04:00
|
|
|
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
2012-07-09 16:26:17 -04:00
|
|
|
$oProcesses = new Processes();
|
|
|
|
|
$oProcesses->ws_open_public();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess = $oProcesses->ws_processGetData( $processId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
if ($oProcess->status_code != 0) {
|
2012-10-09 13:29:25 -04:00
|
|
|
throw (new Exception( $oProcess->message ));
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$privacy = $oProcess->privacy;
|
|
|
|
|
|
|
|
|
|
$strSession = '';
|
|
|
|
|
|
|
|
|
|
if ($privacy != 'FREE') {
|
|
|
|
|
global $sessionId;
|
|
|
|
|
$antSession = $sessionId;
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcesses->ws_open( $usernameLibrary, $passwordLibrary );
|
2012-07-09 16:26:17 -04:00
|
|
|
$strSession = "&s=" . $sessionId;
|
|
|
|
|
$sessionId = $antSession;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//downloading the file
|
|
|
|
|
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
|
2012-10-09 13:29:25 -04:00
|
|
|
G::mk_dir( $localPath );
|
2012-07-09 16:26:17 -04:00
|
|
|
$newfilename = G::GenerateUniqueId() . '.pm';
|
|
|
|
|
|
|
|
|
|
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $processId . $strSession;
|
|
|
|
|
|
|
|
|
|
$oProcess = new Processes();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
//getting the ProUid from the file recently downloaded
|
2012-10-09 13:29:25 -04:00
|
|
|
$oData = $oProcess->getProcessData( $localPath . $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (is_null( $oData )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['DOWNLOAD_URL'] = $downloadUrl;
|
2012-10-09 13:29:25 -04:00
|
|
|
$data['LOCAL_PATH'] = $localPath;
|
2012-07-09 16:26:17 -04:00
|
|
|
$data['NEW_FILENAME'] = $newfilename;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
throw new Exception( G::loadTranslation( 'ID_ERROR_URL_PROCESS_INVALID', SYS_LANG, $data ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sProUid = $oData->process['PRO_UID'];
|
|
|
|
|
$oData->process['PRO_UID_OLD'] = $sProUid;
|
|
|
|
|
|
|
|
|
|
//if the process exists, we need to check the $importOption to and re-import if the user wants,
|
2012-10-09 13:29:25 -04:00
|
|
|
if ($oProcess->processExists( $sProUid )) {
|
2012-07-09 16:26:17 -04:00
|
|
|
//Update the current Process, overwriting all tasks and steps
|
|
|
|
|
if ($importOption == 1) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->updateProcessFromData( $oData, $localPath . $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
//delete the xmlform cache
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
|
|
|
|
|
if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) {
|
|
|
|
|
$oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
while ($sObjectName = $oDirectory->read()) {
|
|
|
|
|
if (($sObjectName != '.') && ($sObjectName != '..')) {
|
|
|
|
|
$strAux = PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP;
|
|
|
|
|
$strAux = $strAux . $sProUid . PATH_SEP . $sObjectName;
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
unlink( $strAux );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oDirectory->close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sNewProUid = $sProUid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Disable current Process and create a new version of the Process
|
|
|
|
|
if ($importOption == 2) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->disablePreviousProcesses( $sProUid );
|
2012-07-09 16:26:17 -04:00
|
|
|
$sNewProUid = $oProcess->getUnusedProcessGUID();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->setProcessGuid( $oData, $sNewProUid );
|
|
|
|
|
$oProcess->setProcessParent( $oData, $sProUid );
|
|
|
|
|
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
|
|
|
|
|
$oProcess->renewAll( $oData );
|
|
|
|
|
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Create a completely new Process without change the current Process
|
|
|
|
|
if ($importOption == 3) {
|
|
|
|
|
//krumo ($oData); die;
|
|
|
|
|
$sNewProUid = $oProcess->getUnusedProcessGUID();
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->setProcessGuid( $oData, $sNewProUid );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$strAux = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
$oData->process['PRO_TITLE'] = $strAux;
|
2012-10-09 13:29:25 -04:00
|
|
|
$oProcess->renewAll( $oData );
|
|
|
|
|
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($importOption != 1 && $importOption != 2 && $importOption != 3) {
|
2012-10-09 13:29:25 -04:00
|
|
|
throw new Exception( G::loadTranslation( 'ID_PROCESS_ALREADY_IN_SYSTEM' ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//finally, creating the process if the process doesn't exist
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! $oProcess->processExists( $processId )) {
|
|
|
|
|
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the info after the imported process
|
|
|
|
|
$oProcess = new Processes();
|
|
|
|
|
$oProcess->ws_open_public();
|
2012-10-09 13:29:25 -04:00
|
|
|
$processData = $oProcess->ws_processGetData( $processId );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->status_code = 0;
|
|
|
|
|
$result->message = G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' );
|
|
|
|
|
$result->timestamp = date( 'Y-m-d H:i:s' );
|
|
|
|
|
$result->processId = $processId;
|
2012-07-09 16:26:17 -04:00
|
|
|
$result->processTitle = $processData->title;
|
2012-10-09 13:29:25 -04:00
|
|
|
$result->category = (isset( $processData->category ) ? $processData->category : '');
|
|
|
|
|
$result->version = $processData->version;
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
public function getCaseNotes ($applicationID, $userUid = '')
|
2012-07-09 16:26:17 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
G::LoadClass( 'case' );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsGetCaseNotesResponse( 0, G::loadTranslation( 'ID_SUCCESS' ), Cases::getCaseNotes( $applicationID, 'array', $userUid ) );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$var = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
foreach ($result->notes as $key => $value) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$var2 = array ();
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
foreach ($value as $keys => $values) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$field = strtolower( $keys );
|
2012-07-09 16:26:17 -04:00
|
|
|
$var2[$field] = $values;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$var[] = $var2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result->notes = $var;
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = new wsResponse( 100, $e->getMessage() );
|
2012-07-09 16:26:17 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
2012-09-11 16:41:05 -04:00
|
|
|
* @param string caseUid : ID of the case.
|
|
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function deleteCase ($caseUid)
|
2012-09-11 16:41:05 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $caseUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$case = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$case->removeCase( $caseUid );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
//Response
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" ) );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
|
2012-09-11 16:41:05 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-11-15 12:56:33 -04:00
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Cancel case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string caseUid : ID of the case.
|
|
|
|
|
* @param int delIndex : Delegation index of the case.
|
|
|
|
|
* @param string userUid : The unique ID of the user who will cancel the case.
|
2012-09-11 16:41:05 -04:00
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function cancelCase ($caseUid, $delIndex, $userUid)
|
2012-09-11 16:41:05 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $caseUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $delIndex )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$case = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$case->cancelCase( $caseUid, $delIndex, $userUid );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
//Response
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" ) );
|
2012-09-11 16:41:05 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
|
2012-09-11 16:41:05 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-11-15 12:56:33 -04:00
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
2012-09-11 16:41:05 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pause case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string caseUid : ID of the case.
|
|
|
|
|
* @param int delIndex : Delegation index of the case.
|
|
|
|
|
* @param string userUid : The unique ID of the user who will pause the case.
|
2012-09-12 14:46:26 -04:00
|
|
|
* @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause
|
2012-10-09 13:29:25 -04:00
|
|
|
* the case.
|
2012-09-12 14:46:26 -04:00
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function pauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null)
|
2012-09-12 14:46:26 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $caseUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $delIndex )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (! empty( $unpauseDate )) {
|
|
|
|
|
if (! preg_match( "/^\d{4}-\d{2}-\d{2}$/", $unpauseDate )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_INVALID_DATA" ) . " $unpauseDate" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$case = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$case->pauseCase( $caseUid, $delIndex, $userUid, $unpauseDate );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
//Response
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" ) );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
|
2012-09-12 14:46:26 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-11-15 12:56:33 -04:00
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unpause case
|
2012-10-09 13:29:25 -04:00
|
|
|
*
|
|
|
|
|
* @param string caseUid : ID of the case.
|
|
|
|
|
* @param int delIndex : Delegation index of the case.
|
|
|
|
|
* @param string userUid : The unique ID of the user who will unpause the case.
|
2012-09-12 14:46:26 -04:00
|
|
|
* @return $result will return an object
|
|
|
|
|
*/
|
2012-10-09 13:29:25 -04:00
|
|
|
public function unpauseCase ($caseUid, $delIndex, $userUid)
|
2012-09-12 14:46:26 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $caseUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $delIndex )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
if (empty( $userUid )) {
|
|
|
|
|
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$case = new Cases();
|
2012-10-09 13:29:25 -04:00
|
|
|
$case->unpauseCase( $caseUid, $delIndex, $userUid );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
//Response
|
2012-10-09 13:29:25 -04:00
|
|
|
$res = new wsResponse( 0, G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" ) );
|
2012-09-12 14:46:26 -04:00
|
|
|
|
2012-10-09 13:29:25 -04:00
|
|
|
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
|
2012-09-12 14:46:26 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-11-15 12:56:33 -04:00
|
|
|
$result = new wsResponse(100, $e->getMessage());
|
2012-09-12 14:46:26 -04:00
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-09 16:26:17 -04:00
|
|
|
}
|
2012-07-11 15:24:11 -04:00
|
|
|
|