@@ -12,446 +12,456 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @date Jan 10th, 2010
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @date Jan 10th, 2010
|
||||
*/
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
unset($_REQUEST['action']);
|
||||
unset( $_REQUEST['action'] );
|
||||
|
||||
$ajax = new Ajax();
|
||||
$ajax->$action($_REQUEST);
|
||||
$ajax->$action( $_REQUEST );
|
||||
|
||||
class Ajax
|
||||
{
|
||||
function categoriesList()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory;
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array('CATEGORY_UID'=>'<reset>', 'CATEGORY_NAME'=>G::LoadTranslation('ID_ALL'));
|
||||
$defaultOption[] = Array('CATEGORY_UID'=>'', 'CATEGORY_NAME'=>G::LoadTranslation('ID_PROCESS_NO_CATEGORY'));
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
}
|
||||
|
||||
function processCategories()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory;
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array('CATEGORY_UID'=>'', 'CATEGORY_NAME'=>G::LoadTranslation('ID_PROCESS_NO_CATEGORY'));
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
}
|
||||
|
||||
function saveProcess()
|
||||
{
|
||||
try{
|
||||
require_once 'classes/model/Task.php';
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new ProcessMap();
|
||||
|
||||
if( ! isset($_POST['PRO_UID']) ) {
|
||||
|
||||
if( Process::existsByProTitle($_POST['PRO_TITLE']) ) {
|
||||
$result = array(
|
||||
'success' => false,
|
||||
'msg' => 'Process Save Error',
|
||||
'errors' => array(
|
||||
'PRO_TITLE' => G::LoadTranslation('ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST)
|
||||
)
|
||||
);
|
||||
print G::json_encode($result);
|
||||
exit(0);
|
||||
|
||||
function categoriesList ()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array ();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '<reset>','CATEGORY_NAME' => G::LoadTranslation( 'ID_ALL' )
|
||||
);
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' )
|
||||
);
|
||||
|
||||
$response->rows = array_merge( $defaultOption, $processCategory->getAll( 'array' ) );
|
||||
|
||||
echo G::json_encode( $response );
|
||||
}
|
||||
|
||||
function processCategories ()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array ();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' )
|
||||
);
|
||||
|
||||
$response->rows = array_merge( $defaultOption, $processCategory->getAll( 'array' ) );
|
||||
|
||||
echo G::json_encode( $response );
|
||||
}
|
||||
|
||||
function saveProcess ()
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/Task.php';
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new ProcessMap();
|
||||
|
||||
if (! isset( $_POST['PRO_UID'] )) {
|
||||
|
||||
if (Process::existsByProTitle( $_POST['PRO_TITLE'] )) {
|
||||
$result = array ('success' => false,'msg' => 'Process Save Error','errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST )
|
||||
)
|
||||
);
|
||||
print G::json_encode( $result );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
$processData['PRO_TITLE'] = $_POST['PRO_TITLE'];
|
||||
$processData['PRO_DESCRIPTION'] = $_POST['PRO_DESCRIPTION'];
|
||||
$processData['PRO_CATEGORY'] = $_POST['PRO_CATEGORY'];
|
||||
|
||||
$sProUid = $oProcessMap->createProcess( $processData );
|
||||
|
||||
//call plugins
|
||||
$oData['PRO_UID'] = $sProUid;
|
||||
$oData['PRO_TEMPLATE'] = (isset( $_POST['PRO_TEMPLATE'] ) && $_POST['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : '';
|
||||
$oData['PROCESSMAP'] = $oProcessMap;
|
||||
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $_POST['PRO_UID'];
|
||||
}
|
||||
|
||||
//Save Calendar ID for this process
|
||||
if (isset( $_POST['PRO_CALENDAR'] )) {
|
||||
G::LoadClass( "calendar" );
|
||||
$calendarObj = new Calendar();
|
||||
$calendarObj->assignCalendarTo( $sProUid, $_POST['PRO_CALENDAR'], 'PROCESS' );
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->PRO_UID = $sProUid;
|
||||
$result->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
$processData['PRO_TITLE'] = $_POST['PRO_TITLE'];
|
||||
$processData['PRO_DESCRIPTION'] = $_POST['PRO_DESCRIPTION'];
|
||||
$processData['PRO_CATEGORY'] = $_POST['PRO_CATEGORY'];
|
||||
|
||||
$sProUid = $oProcessMap->createProcess($processData);
|
||||
|
||||
//call plugins
|
||||
$oData['PRO_UID'] = $sProUid;
|
||||
$oData['PRO_TEMPLATE'] = ( isset($_POST['PRO_TEMPLATE']) && $_POST['PRO_TEMPLATE'] != '' ) ? $_POST['form']['PRO_TEMPLATE'] : '';
|
||||
$oData['PROCESSMAP'] = $oProcessMap;
|
||||
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers ( PM_NEW_PROCESS_SAVE , $oData );
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $_POST['PRO_UID'];
|
||||
}
|
||||
|
||||
//Save Calendar ID for this process
|
||||
if( isset($_POST['PRO_CALENDAR']) ){
|
||||
G::LoadClass("calendar");
|
||||
$calendarObj=new Calendar();
|
||||
$calendarObj->assignCalendarTo($sProUid, $_POST['PRO_CALENDAR'], 'PROCESS');
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->PRO_UID = $sProUid;
|
||||
$result->msg = G::LoadTranslation('ID_CREATE_PROCESS_SUCCESS');
|
||||
} catch(Exception $e){
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function changeStatus()
|
||||
{
|
||||
$ids = explode(',', $_REQUEST['UIDS']);
|
||||
|
||||
G::LoadClass('processes');
|
||||
$oProcess = new Processes();
|
||||
if( count($ids) > 0 ){
|
||||
foreach($ids as $id)
|
||||
$oProcess->changeStatus($id);
|
||||
}
|
||||
}
|
||||
|
||||
function changeDebugMode()
|
||||
{
|
||||
$ids = explode(',', $_REQUEST['UIDS']);
|
||||
|
||||
G::LoadClass('processes');
|
||||
$oProcess = new Processes();
|
||||
if( count($ids) > 0 ){
|
||||
foreach($ids as $id)
|
||||
$oProcess->changeDebugMode($id);
|
||||
}
|
||||
}
|
||||
|
||||
function getUsers($params)
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
G::LoadClass('configuration');
|
||||
$conf = new Configurations;
|
||||
|
||||
$search = isset($params['search']) ? $params['search']: null;
|
||||
$users = Users::getAll($params['start'], $params['limit'], $search);
|
||||
|
||||
foreach($users->data as $i=>$user){
|
||||
$users->data[$i]['USER'] = $conf->getEnvSetting(
|
||||
'format',
|
||||
Array(
|
||||
'userName'=>$user['USR_USERNAME'],
|
||||
'firstName'=>$user['USR_FIRSTNAME'],
|
||||
'lastName'=>$user['USR_LASTNAME']
|
||||
)
|
||||
);
|
||||
}
|
||||
print G::json_encode($users);
|
||||
}
|
||||
|
||||
function getGroups($params)
|
||||
{
|
||||
require_once 'classes/model/Groupwf.php';
|
||||
$search = isset($params['search']) ? $params['search']: null;
|
||||
$groups = Groupwf::getAll($params['start'], $params['limit'], $search);
|
||||
|
||||
print G::json_encode($groups);
|
||||
}
|
||||
|
||||
function assignUsersTask($param)
|
||||
{
|
||||
try{
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTaskUser = new TaskUser();
|
||||
$UIDS = explode(',', $param['UIDS']);
|
||||
$TU_TYPE = 1;
|
||||
|
||||
foreach( $UIDS as $UID ) {
|
||||
if ($_POST['TU_RELATION'] == 1 )
|
||||
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1));
|
||||
else
|
||||
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2));
|
||||
}
|
||||
$task = TaskPeer::retrieveByPk($param['TAS_UID']);
|
||||
|
||||
$result->success = true;
|
||||
if( count($UIDS) > 1 )
|
||||
$result->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array(count($UIDS), $task->getTasTitle()));
|
||||
else
|
||||
$result->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array('tas_title'=>$task->getTasTitle()));
|
||||
} catch(Exception $e){
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
function changeStatus ()
|
||||
{
|
||||
$ids = explode( ',', $_REQUEST['UIDS'] );
|
||||
|
||||
function removeUsersTask($param)
|
||||
{
|
||||
try{
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
$oTaskUser = new TaskUser();
|
||||
$USR_UIDS = explode(',', $param['USR_UID']);
|
||||
$TU_RELATIONS = explode(',', $param['TU_RELATION']);
|
||||
$TU_TYPE = 1;
|
||||
|
||||
foreach($USR_UIDS as $i=>$USR_UID) {
|
||||
if ($TU_RELATIONS[$i] == 1 ){
|
||||
|
||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 1);
|
||||
|
||||
} else {
|
||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 2);
|
||||
G::LoadClass( 'processes' );
|
||||
$oProcess = new Processes();
|
||||
if (count( $ids ) > 0) {
|
||||
foreach ($ids as $id)
|
||||
$oProcess->changeStatus( $id );
|
||||
}
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = '';
|
||||
} catch(Exception $e){
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
function changeDebugMode ()
|
||||
{
|
||||
$ids = explode( ',', $_REQUEST['UIDS'] );
|
||||
|
||||
function getUsersTask($param)
|
||||
{
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
G::LoadClass('configuration');
|
||||
$usersTaskList = Array();
|
||||
$task = new TaskUser;
|
||||
$conf = new Configurations;
|
||||
$TU_TYPE = 1;
|
||||
|
||||
$usersTask = $task->getUsersTask($param['TAS_UID'], $TU_TYPE);
|
||||
|
||||
foreach($usersTask->data as $userTask) {
|
||||
$usersTaskListItem['TAS_UID'] = $userTask['TAS_UID'];
|
||||
if( $userTask['TU_RELATION'] == 1 ) {
|
||||
$usersTaskListItem['USR_USERNAME'] = $userTask['USR_USERNAME'];
|
||||
$usersTaskListItem['USR_FIRSTNAME'] = $userTask['USR_FIRSTNAME'];
|
||||
$usersTaskListItem['USR_LASTNAME'] = $userTask['USR_LASTNAME'];
|
||||
} else
|
||||
$usersTaskListItem['NAME'] = $userTask['GRP_TITLE'];
|
||||
|
||||
$usersTaskListItem['TU_RELATION'] = $userTask['TU_RELATION'];
|
||||
$usersTaskListItem['USR_UID'] = $userTask['USR_UID'];
|
||||
|
||||
$usersTaskList[] = $usersTaskListItem;
|
||||
}
|
||||
|
||||
$result->data = $usersTaskList;
|
||||
$result->totalCount = $usersTask->totalCount;
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function getProcessDetail($param){
|
||||
require_once 'classes/model/Process.php';
|
||||
|
||||
$PRO_UID = $param['PRO_UID'];
|
||||
|
||||
G::loadClass('tasks');
|
||||
$tasks = new Tasks();
|
||||
$process = ProcessPeer::retrieveByPk($PRO_UID);
|
||||
|
||||
$tasksList = $tasks->getAllTasks($PRO_UID);
|
||||
|
||||
|
||||
$rootNode->id = $process->getProUid();
|
||||
$rootNode->type = 'process';
|
||||
$rootNode->typeLabel = G::LoadTranslation('ID_PROCESS');
|
||||
$rootNode->text = $process->getProTitle();
|
||||
$rootNode->leaf = count($tasksList) > 0 ? false : true;
|
||||
$rootNode->iconCls = 'ss_sprite ss_application';
|
||||
$rootNode->expanded =true;
|
||||
foreach($tasksList as $task) {
|
||||
$node = new stdClass;
|
||||
$node->id = $task['TAS_UID'];
|
||||
$node->type = 'task';
|
||||
$node->typeLabel = G::LoadTranslation('ID_TASK');
|
||||
$node->text = $task['TAS_TITLE'];
|
||||
$node->iconCls = 'ss_sprite ss_layout';
|
||||
$node->leaf = true;
|
||||
$rootNode->children[] = $node;
|
||||
G::LoadClass( 'processes' );
|
||||
$oProcess = new Processes();
|
||||
if (count( $ids ) > 0) {
|
||||
foreach ($ids as $id)
|
||||
$oProcess->changeDebugMode( $id );
|
||||
}
|
||||
}
|
||||
|
||||
$treeDetail[] = $rootNode;
|
||||
print G::json_encode($treeDetail);
|
||||
}
|
||||
function getUsers ($params)
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
G::LoadClass( 'configuration' );
|
||||
$conf = new Configurations();
|
||||
|
||||
function getProperties($param)
|
||||
{
|
||||
switch ($param['type']) {
|
||||
case 'process':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
require_once 'classes/model/CalendarDefinition.php';
|
||||
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
$process = $oProcessMap->editProcessNew($param['UID']);
|
||||
$category = ProcessCategoryPeer::retrieveByPk($process['PRO_CATEGORY']);
|
||||
$categoryName = is_object($category) ? $category->getCategoryName(): '';
|
||||
$calendar = CalendarDefinitionPeer::retrieveByPk($process['PRO_CALENDAR']);
|
||||
$calendarName = is_object($calendar) ? $calendar->getCalendarName(): '';
|
||||
|
||||
$properties['Title'] = $process['PRO_TITLE'];
|
||||
$properties['Description'] = $process['PRO_DESCRIPTION'];
|
||||
$properties['Calendar'] = $calendarName;
|
||||
$properties['Category'] = $categoryName;
|
||||
$properties['Debug'] = $process['PRO_DEBUG'] == '1' ? true: false;
|
||||
|
||||
$result->sucess = true;
|
||||
$result->prop = $properties;
|
||||
break;
|
||||
$search = isset( $params['search'] ) ? $params['search'] : null;
|
||||
$users = Users::getAll( $params['start'], $params['limit'], $search );
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$task = new Task();
|
||||
$taskData = $task->load($param['UID']);
|
||||
|
||||
$properties['Title'] = $taskData['TAS_TITLE'];
|
||||
$properties['Description'] = $taskData['TAS_DESCRIPTION'];
|
||||
$properties['Variable for case priority'] = $taskData['TAS_PRIORITY_VARIABLE'];
|
||||
$properties['Starting Task'] = $taskData['TAS_START'] == 'TRUE' ? true: false;
|
||||
|
||||
$result->sucess = true;
|
||||
$result->prop = $properties;
|
||||
|
||||
break;
|
||||
foreach ($users->data as $i => $user) {
|
||||
$users->data[$i]['USER'] = $conf->getEnvSetting( 'format', Array ('userName' => $user['USR_USERNAME'],'firstName' => $user['USR_FIRSTNAME'],'lastName' => $user['USR_LASTNAME']
|
||||
) );
|
||||
}
|
||||
print G::json_encode( $users );
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
function getGroups ($params)
|
||||
{
|
||||
require_once 'classes/model/Groupwf.php';
|
||||
$search = isset( $params['search'] ) ? $params['search'] : null;
|
||||
$groups = Groupwf::getAll( $params['start'], $params['limit'], $search );
|
||||
|
||||
function saveProperties($param)
|
||||
{
|
||||
try{
|
||||
$result->sucess = true;
|
||||
$result->msg = '';
|
||||
|
||||
switch ($param['type']) {
|
||||
case 'process':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
require_once 'classes/model/CalendarDefinition.php';
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new ProcessMap();
|
||||
$process['PRO_UID'] = $param['UID'];
|
||||
|
||||
switch ($param['property']) {
|
||||
case 'Title': $fieldName = 'PRO_TITLE'; break;
|
||||
case 'Description': $fieldName = 'PRO_DESCRIPTION'; break;
|
||||
case 'Debug':
|
||||
$fieldName = 'PRO_DEBUG';
|
||||
$param['value'] = $param['value'] == 'true' ? '1' : '0';
|
||||
break;
|
||||
case 'Category':
|
||||
$fieldName = 'PRO_CATEGORY';
|
||||
$category = ProcessCategory::loadByCategoryName($param['value']);
|
||||
$param['value'] = $category[0]['CATEGORY_UID'];
|
||||
break;
|
||||
case 'Calendar':
|
||||
$fieldName = 'PRO_CALENDAR';
|
||||
$calendar = CalendarDefinition::loadByCalendarName($param['value']);
|
||||
|
||||
G::LoadClass("calendar");
|
||||
$calendarObj = new Calendar();
|
||||
$calendarObj->assignCalendarTo($process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS');
|
||||
break;
|
||||
}
|
||||
|
||||
if( $fieldName != 'PRO_CALENDAR' ) {
|
||||
$process[$fieldName] = $param['value'];
|
||||
$oProcessMap->updateProcess($process);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTask = new Task();
|
||||
$task['TAS_UID'] = $param['UID'];
|
||||
|
||||
switch ($param['property']) {
|
||||
case 'Title': $fieldName = 'TAS_TITLE'; break;
|
||||
case 'Description': $fieldName = 'TAS_DESCRIPTION'; break;
|
||||
case 'Variable for case priority': $fieldName = 'TAS_PRIORITY_VARIABLE'; break;
|
||||
case 'Starting Task':
|
||||
$fieldName = 'TAS_START';
|
||||
$param['value'] = strtoupper($param['value']);
|
||||
break;
|
||||
}
|
||||
$task[$fieldName] = $param['value'];
|
||||
print_r($task);
|
||||
$oTask->update($task);
|
||||
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result->sucess = false;
|
||||
$result->msg = $e->getMessage();
|
||||
print G::json_encode( $groups );
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
}
|
||||
function assignUsersTask ($param)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTaskUser = new TaskUser();
|
||||
$UIDS = explode( ',', $param['UIDS'] );
|
||||
$TU_TYPE = 1;
|
||||
|
||||
function getCategoriesList()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
foreach ($UIDS as $UID) {
|
||||
if ($_POST['TU_RELATION'] == 1)
|
||||
$oTaskUser->create( array ('TAS_UID' => $param['TAS_UID'],'USR_UID' => $UID,'TU_TYPE' => $TU_TYPE,'TU_RELATION' => 1
|
||||
) );
|
||||
else
|
||||
$oTaskUser->create( array ('TAS_UID' => $param['TAS_UID'],'USR_UID' => $UID,'TU_TYPE' => $TU_TYPE,'TU_RELATION' => 2
|
||||
) );
|
||||
}
|
||||
$task = TaskPeer::retrieveByPk( $param['TAS_UID'] );
|
||||
|
||||
$processCategory = new ProcessCategory;
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array('CATEGORY_UID'=>'', 'CATEGORY_NAME'=>'');
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
print G::json_encode($response);
|
||||
}
|
||||
$result->success = true;
|
||||
if (count( $UIDS ) > 1)
|
||||
$result->msg = __( 'ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array (count( $UIDS ),$task->getTasTitle()
|
||||
) );
|
||||
else
|
||||
$result->msg = __( 'ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array ('tas_title' => $task->getTasTitle()
|
||||
) );
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
function getCaledarList()
|
||||
{
|
||||
G::LoadClass('calendar');
|
||||
$calendar = new CalendarDefinition();
|
||||
$calendarObj = $calendar->getCalendarList(true, true);
|
||||
$calendarObj['array'][0] = Array('CALENDAR_UID'=>'', 'CALENDAR_NAME'=>'');
|
||||
|
||||
$response->rows = $calendarObj['array'];
|
||||
|
||||
print G::json_encode($response);
|
||||
}
|
||||
|
||||
function getPMVariables($param)
|
||||
{
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection);
|
||||
$response->rows = getDynaformsVars($param['PRO_UID']);
|
||||
foreach($response->rows as $i=>$var){
|
||||
$response->rows[$i]['sName'] = "@@{$var['sName']}";
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
print G::json_encode($response);
|
||||
}
|
||||
|
||||
|
||||
function removeUsersTask ($param)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
$oTaskUser = new TaskUser();
|
||||
$USR_UIDS = explode( ',', $param['USR_UID'] );
|
||||
$TU_RELATIONS = explode( ',', $param['TU_RELATION'] );
|
||||
$TU_TYPE = 1;
|
||||
|
||||
foreach ($USR_UIDS as $i => $USR_UID) {
|
||||
if ($TU_RELATIONS[$i] == 1) {
|
||||
|
||||
$oTaskUser->remove( $param['TAS_UID'], $USR_UID, $TU_TYPE, 1 );
|
||||
|
||||
} else {
|
||||
$oTaskUser->remove( $param['TAS_UID'], $USR_UID, $TU_TYPE, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = '';
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
|
||||
function getUsersTask ($param)
|
||||
{
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
G::LoadClass( 'configuration' );
|
||||
$usersTaskList = Array ();
|
||||
$task = new TaskUser();
|
||||
$conf = new Configurations();
|
||||
$TU_TYPE = 1;
|
||||
|
||||
$usersTask = $task->getUsersTask( $param['TAS_UID'], $TU_TYPE );
|
||||
|
||||
foreach ($usersTask->data as $userTask) {
|
||||
$usersTaskListItem['TAS_UID'] = $userTask['TAS_UID'];
|
||||
if ($userTask['TU_RELATION'] == 1) {
|
||||
$usersTaskListItem['USR_USERNAME'] = $userTask['USR_USERNAME'];
|
||||
$usersTaskListItem['USR_FIRSTNAME'] = $userTask['USR_FIRSTNAME'];
|
||||
$usersTaskListItem['USR_LASTNAME'] = $userTask['USR_LASTNAME'];
|
||||
} else
|
||||
$usersTaskListItem['NAME'] = $userTask['GRP_TITLE'];
|
||||
|
||||
$usersTaskListItem['TU_RELATION'] = $userTask['TU_RELATION'];
|
||||
$usersTaskListItem['USR_UID'] = $userTask['USR_UID'];
|
||||
|
||||
$usersTaskList[] = $usersTaskListItem;
|
||||
}
|
||||
|
||||
$result->data = $usersTaskList;
|
||||
$result->totalCount = $usersTask->totalCount;
|
||||
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
|
||||
function getProcessDetail ($param)
|
||||
{
|
||||
require_once 'classes/model/Process.php';
|
||||
|
||||
$PRO_UID = $param['PRO_UID'];
|
||||
|
||||
G::loadClass( 'tasks' );
|
||||
$tasks = new Tasks();
|
||||
$process = ProcessPeer::retrieveByPk( $PRO_UID );
|
||||
|
||||
$tasksList = $tasks->getAllTasks( $PRO_UID );
|
||||
|
||||
$rootNode->id = $process->getProUid();
|
||||
$rootNode->type = 'process';
|
||||
$rootNode->typeLabel = G::LoadTranslation( 'ID_PROCESS' );
|
||||
$rootNode->text = $process->getProTitle();
|
||||
$rootNode->leaf = count( $tasksList ) > 0 ? false : true;
|
||||
$rootNode->iconCls = 'ss_sprite ss_application';
|
||||
$rootNode->expanded = true;
|
||||
foreach ($tasksList as $task) {
|
||||
$node = new stdClass();
|
||||
$node->id = $task['TAS_UID'];
|
||||
$node->type = 'task';
|
||||
$node->typeLabel = G::LoadTranslation( 'ID_TASK' );
|
||||
$node->text = $task['TAS_TITLE'];
|
||||
$node->iconCls = 'ss_sprite ss_layout';
|
||||
$node->leaf = true;
|
||||
$rootNode->children[] = $node;
|
||||
}
|
||||
|
||||
$treeDetail[] = $rootNode;
|
||||
print G::json_encode( $treeDetail );
|
||||
}
|
||||
|
||||
function getProperties ($param)
|
||||
{
|
||||
switch ($param['type']) {
|
||||
case 'process':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
require_once 'classes/model/CalendarDefinition.php';
|
||||
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new processMap( new DBConnection() );
|
||||
$process = $oProcessMap->editProcessNew( $param['UID'] );
|
||||
$category = ProcessCategoryPeer::retrieveByPk( $process['PRO_CATEGORY'] );
|
||||
$categoryName = is_object( $category ) ? $category->getCategoryName() : '';
|
||||
$calendar = CalendarDefinitionPeer::retrieveByPk( $process['PRO_CALENDAR'] );
|
||||
$calendarName = is_object( $calendar ) ? $calendar->getCalendarName() : '';
|
||||
|
||||
$properties['Title'] = $process['PRO_TITLE'];
|
||||
$properties['Description'] = $process['PRO_DESCRIPTION'];
|
||||
$properties['Calendar'] = $calendarName;
|
||||
$properties['Category'] = $categoryName;
|
||||
$properties['Debug'] = $process['PRO_DEBUG'] == '1' ? true : false;
|
||||
|
||||
$result->sucess = true;
|
||||
$result->prop = $properties;
|
||||
break;
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$task = new Task();
|
||||
$taskData = $task->load( $param['UID'] );
|
||||
|
||||
$properties['Title'] = $taskData['TAS_TITLE'];
|
||||
$properties['Description'] = $taskData['TAS_DESCRIPTION'];
|
||||
$properties['Variable for case priority'] = $taskData['TAS_PRIORITY_VARIABLE'];
|
||||
$properties['Starting Task'] = $taskData['TAS_START'] == 'TRUE' ? true : false;
|
||||
|
||||
$result->sucess = true;
|
||||
$result->prop = $properties;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
|
||||
function saveProperties ($param)
|
||||
{
|
||||
try {
|
||||
$result->sucess = true;
|
||||
$result->msg = '';
|
||||
|
||||
switch ($param['type']) {
|
||||
case 'process':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
require_once 'classes/model/CalendarDefinition.php';
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new ProcessMap();
|
||||
$process['PRO_UID'] = $param['UID'];
|
||||
|
||||
switch ($param['property']) {
|
||||
case 'Title':
|
||||
$fieldName = 'PRO_TITLE';
|
||||
break;
|
||||
case 'Description':
|
||||
$fieldName = 'PRO_DESCRIPTION';
|
||||
break;
|
||||
case 'Debug':
|
||||
$fieldName = 'PRO_DEBUG';
|
||||
$param['value'] = $param['value'] == 'true' ? '1' : '0';
|
||||
break;
|
||||
case 'Category':
|
||||
$fieldName = 'PRO_CATEGORY';
|
||||
$category = ProcessCategory::loadByCategoryName( $param['value'] );
|
||||
$param['value'] = $category[0]['CATEGORY_UID'];
|
||||
break;
|
||||
case 'Calendar':
|
||||
$fieldName = 'PRO_CALENDAR';
|
||||
$calendar = CalendarDefinition::loadByCalendarName( $param['value'] );
|
||||
|
||||
G::LoadClass( "calendar" );
|
||||
$calendarObj = new Calendar();
|
||||
$calendarObj->assignCalendarTo( $process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS' );
|
||||
break;
|
||||
}
|
||||
|
||||
if ($fieldName != 'PRO_CALENDAR') {
|
||||
$process[$fieldName] = $param['value'];
|
||||
$oProcessMap->updateProcess( $process );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTask = new Task();
|
||||
$task['TAS_UID'] = $param['UID'];
|
||||
|
||||
switch ($param['property']) {
|
||||
case 'Title':
|
||||
$fieldName = 'TAS_TITLE';
|
||||
break;
|
||||
case 'Description':
|
||||
$fieldName = 'TAS_DESCRIPTION';
|
||||
break;
|
||||
case 'Variable for case priority':
|
||||
$fieldName = 'TAS_PRIORITY_VARIABLE';
|
||||
break;
|
||||
case 'Starting Task':
|
||||
$fieldName = 'TAS_START';
|
||||
$param['value'] = strtoupper( $param['value'] );
|
||||
break;
|
||||
}
|
||||
$task[$fieldName] = $param['value'];
|
||||
print_r( $task );
|
||||
$oTask->update( $task );
|
||||
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result->sucess = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
print G::json_encode( $result );
|
||||
}
|
||||
|
||||
function getCategoriesList ()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array ();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => ''
|
||||
);
|
||||
|
||||
$response->rows = array_merge( $defaultOption, $processCategory->getAll( 'array' ) );
|
||||
|
||||
print G::json_encode( $response );
|
||||
}
|
||||
|
||||
function getCaledarList ()
|
||||
{
|
||||
G::LoadClass( 'calendar' );
|
||||
$calendar = new CalendarDefinition();
|
||||
$calendarObj = $calendar->getCalendarList( true, true );
|
||||
$calendarObj['array'][0] = Array ('CALENDAR_UID' => '','CALENDAR_NAME' => ''
|
||||
);
|
||||
|
||||
$response->rows = $calendarObj['array'];
|
||||
|
||||
print G::json_encode( $response );
|
||||
}
|
||||
|
||||
function getPMVariables ($param)
|
||||
{
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new processMap( new DBConnection() );
|
||||
$response->rows = getDynaformsVars( $param['PRO_UID'] );
|
||||
foreach ($response->rows as $i => $var) {
|
||||
$response->rows[$i]['sName'] = "@@{$var['sName']}";
|
||||
}
|
||||
print G::json_encode( $response );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
<?php
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
try {
|
||||
$aux = explode ( '|', $_GET['id'] );
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
try {
|
||||
$aux = explode( '|', $_GET['id'] );
|
||||
|
||||
$index=0;
|
||||
$ObjUid = str_replace ( '"', '', $aux[$index++] );
|
||||
if ( isset ($_GET['v'] ))
|
||||
$versionReq = $_GET['v'];
|
||||
$index = 0;
|
||||
$ObjUid = str_replace( '"', '', $aux[$index ++] );
|
||||
if (isset( $_GET['v'] ))
|
||||
$versionReq = $_GET['v'];
|
||||
|
||||
//downloading the file
|
||||
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP ;
|
||||
G::mk_dir($localPath);
|
||||
//downloading the file
|
||||
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
|
||||
G::mk_dir( $localPath );
|
||||
$newfilename = G::GenerateUniqueId() . '.pm';
|
||||
|
||||
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $ObjUid . (isset($_GET['s']) ? '&s=' . $_GET['s'] : '');
|
||||
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $ObjUid . (isset( $_GET['s'] ) ? '&s=' . $_GET['s'] : '');
|
||||
//print "<hr>$downloadUrl<hr>";die;
|
||||
|
||||
G::LoadClass('processes');
|
||||
|
||||
G::LoadClass( 'processes' );
|
||||
$oProcess = new Processes();
|
||||
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename);
|
||||
$oProcess->downloadFile( $downloadUrl, $localPath, $newfilename );
|
||||
|
||||
//getting the ProUid from the file recently downloaded
|
||||
$oData = $oProcess->getProcessData ( $localPath . $newfilename );
|
||||
if (is_null($oData)) {
|
||||
throw new Exception('Error');
|
||||
$oData = $oProcess->getProcessData( $localPath . $newfilename );
|
||||
if (is_null( $oData )) {
|
||||
throw new Exception( 'Error' );
|
||||
}
|
||||
$Fields['IMPORT_OPTION'] = 2;
|
||||
$Fields['PRO_FILENAME'] = $newfilename;
|
||||
$Fields['OBJ_UID'] = $ObjUid ;
|
||||
$Fields['PRO_FILENAME'] = $newfilename;
|
||||
$Fields['OBJ_UID'] = $ObjUid;
|
||||
$sProUid = $oData->process['PRO_UID'];
|
||||
$oData->process['PRO_UID_OLD']=$sProUid;
|
||||
//print $sProUid;die;
|
||||
$oData->process['PRO_UID_OLD'] = $sProUid;
|
||||
//print $sProUid;die;
|
||||
//if the process exists, we need to ask what kind of re-import the user wants,
|
||||
if ( $oProcess->processExists ( $sProUid ) ) {
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting' );
|
||||
G::RenderPage('publish', 'blank');
|
||||
die;
|
||||
if ($oProcess->processExists( $sProUid )) {
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting' );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
die();
|
||||
}
|
||||
|
||||
//creating the process
|
||||
$oProcess->createProcessFromData ($oData, $localPath . $newfilename );
|
||||
$oProcess->createProcessFromData( $oData, $localPath . $newfilename );
|
||||
|
||||
//show the info after the imported process
|
||||
G::LoadClass('processes');
|
||||
G::LoadClass( 'processes' );
|
||||
$oProcess = new Processes();
|
||||
$oProcess->ws_open_public ();
|
||||
$processData = $oProcess->ws_processGetData ( $ObjUid );
|
||||
|
||||
$Fields['pro_title'] = $processData->title;
|
||||
$Fields['installSteps'] = nl2br($processData->installSteps);
|
||||
$Fields['category'] = (isset($processData->category) ? $processData->category : '');
|
||||
$Fields['version'] = $processData->version;
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_PUBLISH = new Publisher;
|
||||
$Fields['PRO_UID'] = $sProUid;
|
||||
$processmapLink = "processes_Map?PRO_UID=$sProUid";
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink );
|
||||
G::RenderPage('publish', 'blank');
|
||||
die;
|
||||
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
$oProcess->ws_open_public();
|
||||
$processData = $oProcess->ws_processGetData( $ObjUid );
|
||||
|
||||
$Fields['pro_title'] = $processData->title;
|
||||
$Fields['installSteps'] = nl2br( $processData->installSteps );
|
||||
$Fields['category'] = (isset( $processData->category ) ? $processData->category : '');
|
||||
$Fields['version'] = $processData->version;
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_PUBLISH = new Publisher();
|
||||
$Fields['PRO_UID'] = $sProUid;
|
||||
$processmapLink = "processes_Map?PRO_UID=$sProUid";
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
}
|
||||
die();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$G_PUBLISH = new Publisher();
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
}
|
||||
|
||||
@@ -12,89 +12,87 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
try {
|
||||
//load the variables
|
||||
G::LoadClass('processes');
|
||||
$oProcess = new Processes();
|
||||
try {
|
||||
//load the variables
|
||||
G::LoadClass( 'processes' );
|
||||
$oProcess = new Processes();
|
||||
|
||||
if ( !isset ($_POST['form']['IMPORT_OPTION'] ) ) {
|
||||
throw ( new Exception ('Please select an option before to continue')) ;
|
||||
}
|
||||
|
||||
$option = $_POST['form']['IMPORT_OPTION'];
|
||||
$filename = $_POST['form']['PRO_FILENAME'];
|
||||
$ObjUid = $_POST['form']['OBJ_UID'];
|
||||
|
||||
$path = PATH_DOCUMENT . 'input' . PATH_SEP ;
|
||||
$oData = $oProcess->getProcessData ( $path . $filename );
|
||||
|
||||
$Fields['PRO_FILENAME'] = $filename;
|
||||
$sProUid = $oData->process['PRO_UID'];
|
||||
$oData->process['PRO_UID_OLD']=$sProUid;
|
||||
|
||||
//Update the current Process, overwriting all tasks and steps
|
||||
if ( $option == 1 ) {
|
||||
$oProcess->updateProcessFromData ($oData, $path . $filename );
|
||||
if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
|
||||
$oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid);
|
||||
while($sObjectName = $oDirectory->read()) {
|
||||
if (($sObjectName != '.') && ($sObjectName != '..')) {
|
||||
unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName);
|
||||
}
|
||||
}
|
||||
$oDirectory->close();
|
||||
if (! isset( $_POST['form']['IMPORT_OPTION'] )) {
|
||||
throw (new Exception( 'Please select an option before to continue' ));
|
||||
}
|
||||
$sNewProUid = $sProUid;
|
||||
}
|
||||
|
||||
//Disable current Process and create a new version of the Process
|
||||
if ( $option == 2 ) {
|
||||
$oProcess->disablePreviousProcesses( $sProUid );
|
||||
$sNewProUid = $oProcess->getUnusedProcessGUID() ;
|
||||
$oProcess->setProcessGuid ( $oData, $sNewProUid );
|
||||
$oProcess->setProcessParent( $oData, $sProUid );
|
||||
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' );
|
||||
$oProcess->renewAllTaskGuid ( $oData );
|
||||
$oProcess->renewAllDynaformGuid ( $oData );
|
||||
$oProcess->renewAllInputGuid ( $oData );
|
||||
$oProcess->renewAllOutputGuid ( $oData );
|
||||
$oProcess->renewAllStepGuid ( $oData );
|
||||
$oProcess->renewAllTriggerGuid ( $oData );
|
||||
$oProcess->renewAllSubProcessGuid ( $oData );
|
||||
$oProcess->createProcessFromData ($oData, $path . $filename );
|
||||
}
|
||||
$option = $_POST['form']['IMPORT_OPTION'];
|
||||
$filename = $_POST['form']['PRO_FILENAME'];
|
||||
$ObjUid = $_POST['form']['OBJ_UID'];
|
||||
|
||||
//Create a completely new Process without change the current Process
|
||||
if ( $option == 3 ) {
|
||||
//krumo ($oData);
|
||||
$sNewProUid = $oProcess->getUnusedProcessGUID() ;
|
||||
$oProcess->setProcessGuid ( $oData, $sNewProUid );
|
||||
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date ( 'M d, H:i' );
|
||||
$oProcess->renewAllTaskGuid ( $oData );
|
||||
$oProcess->renewAllDynaformGuid ( $oData );
|
||||
$oProcess->renewAllInputGuid ( $oData );
|
||||
$oProcess->renewAllOutputGuid ( $oData );
|
||||
$oProcess->renewAllStepGuid ( $oData );
|
||||
$oProcess->renewAllTriggerGuid ( $oData );
|
||||
$oProcess->renewAllSubProcessGuid ( $oData );
|
||||
$oProcess->createProcessFromData ($oData, $path . $filename );
|
||||
}
|
||||
G::header('Location: processes_Map?PRO_UID=' . $sNewProUid);
|
||||
}
|
||||
catch ( Exception $e ){
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage('publish', 'blank');
|
||||
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
|
||||
$oData = $oProcess->getProcessData( $path . $filename );
|
||||
|
||||
$Fields['PRO_FILENAME'] = $filename;
|
||||
$sProUid = $oData->process['PRO_UID'];
|
||||
$oData->process['PRO_UID_OLD'] = $sProUid;
|
||||
|
||||
//Update the current Process, overwriting all tasks and steps
|
||||
if ($option == 1) {
|
||||
$oProcess->updateProcessFromData( $oData, $path . $filename );
|
||||
if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) {
|
||||
$oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid );
|
||||
while ($sObjectName = $oDirectory->read()) {
|
||||
if (($sObjectName != '.') && ($sObjectName != '..')) {
|
||||
unlink( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName );
|
||||
}
|
||||
}
|
||||
$oDirectory->close();
|
||||
}
|
||||
$sNewProUid = $sProUid;
|
||||
}
|
||||
|
||||
//Disable current Process and create a new version of the Process
|
||||
if ($option == 2) {
|
||||
$oProcess->disablePreviousProcesses( $sProUid );
|
||||
$sNewProUid = $oProcess->getUnusedProcessGUID();
|
||||
$oProcess->setProcessGuid( $oData, $sNewProUid );
|
||||
$oProcess->setProcessParent( $oData, $sProUid );
|
||||
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
|
||||
$oProcess->renewAllTaskGuid( $oData );
|
||||
$oProcess->renewAllDynaformGuid( $oData );
|
||||
$oProcess->renewAllInputGuid( $oData );
|
||||
$oProcess->renewAllOutputGuid( $oData );
|
||||
$oProcess->renewAllStepGuid( $oData );
|
||||
$oProcess->renewAllTriggerGuid( $oData );
|
||||
$oProcess->renewAllSubProcessGuid( $oData );
|
||||
$oProcess->createProcessFromData( $oData, $path . $filename );
|
||||
}
|
||||
|
||||
//Create a completely new Process without change the current Process
|
||||
if ($option == 3) {
|
||||
//krumo ($oData);
|
||||
$sNewProUid = $oProcess->getUnusedProcessGUID();
|
||||
$oProcess->setProcessGuid( $oData, $sNewProUid );
|
||||
$oData->process['PRO_TITLE'] = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' );
|
||||
$oProcess->renewAllTaskGuid( $oData );
|
||||
$oProcess->renewAllDynaformGuid( $oData );
|
||||
$oProcess->renewAllInputGuid( $oData );
|
||||
$oProcess->renewAllOutputGuid( $oData );
|
||||
$oProcess->renewAllStepGuid( $oData );
|
||||
$oProcess->renewAllTriggerGuid( $oData );
|
||||
$oProcess->renewAllSubProcessGuid( $oData );
|
||||
$oProcess->createProcessFromData( $oData, $path . $filename );
|
||||
}
|
||||
G::header( 'Location: processes_Map?PRO_UID=' . $sNewProUid );
|
||||
} catch (Exception $e) {
|
||||
$G_PUBLISH = new Publisher();
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* index.php
|
||||
*
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -12,17 +12,15 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
$newFile = str_replace ( 'index.php', 'processes_List.php' , __FILE__ ) ;
|
||||
return $newFile;
|
||||
|
||||
|
||||
$newFile = str_replace( 'index.php', 'processes_List.php', __FILE__ );
|
||||
return $newFile;
|
||||
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/*$access = $RBAC->userCanAccess('PM_FACTORY');
|
||||
@@ -38,23 +37,23 @@ if( $access != 1 ) {
|
||||
}
|
||||
exit();
|
||||
}*/
|
||||
//next two variables store the current process uid and the last processmap used
|
||||
//next two variables store the current process uid and the last processmap used
|
||||
//print_r ($_SESSION['PROCESS'] );
|
||||
//print_r ($_SESSION['PROCESSMAP'] );
|
||||
$RBAC->requirePermissions('PM_FACTORY');
|
||||
$RBAC->requirePermissions( 'PM_FACTORY' );
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'process';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'process';
|
||||
$G_ID_MENU_SELECTED = 'PROCESSES';
|
||||
$G_ID_SUB_MENU_SELECTED = '-';
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$G_PUBLISH = new Publisher();
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
//$oHeadPublisher->addScriptFile('/jscore/processes/main.js');
|
||||
$G_PUBLISH->AddContent('view', 'processes/mainLoad');
|
||||
$G_PUBLISH->AddContent( 'view', 'processes/mainLoad' );
|
||||
|
||||
if (isset( $_GET['type'] ))
|
||||
G::RenderPage( "publishBlank", "blank" );
|
||||
else
|
||||
G::RenderPage( "publish" );
|
||||
|
||||
if( isset($_GET['type']) )
|
||||
G::RenderPage( "publishBlank", "blank");
|
||||
else
|
||||
G::RenderPage( "publish" );
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* main.php Cases List main processor
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* 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
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
G::loadClass('configuration');
|
||||
$conf = new Configurations;
|
||||
|
||||
$oHeadPublisher->addExtJsScript('processes/main', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('processes/main'); //adding a html file .html.
|
||||
|
||||
$oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber'));
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
|
||||
<?php
|
||||
/**
|
||||
* main.php Cases List main processor
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* 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
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
G::loadClass( 'configuration' );
|
||||
$conf = new Configurations();
|
||||
|
||||
$oHeadPublisher->addExtJsScript( 'processes/main', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent( 'processes/main' ); //adding a html file .html.
|
||||
|
||||
|
||||
$oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) );
|
||||
|
||||
G::RenderPage( 'publish', 'extJs' );
|
||||
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -39,30 +38,30 @@ switch ($RBAC->userCanAccess('PM_FACTORY'))
|
||||
break;
|
||||
}
|
||||
*/
|
||||
$PRO_UID = $_GET['PRO_UID'];
|
||||
require_once 'classes/model/Process.php';
|
||||
G::LoadClass('case');
|
||||
$oProcessMap = new Cases();
|
||||
|
||||
$process = new Process();
|
||||
$processData = $process->load($PRO_UID);
|
||||
|
||||
$c = $oProcessMap->getCriteriaProcessCases('TO_DO', $PRO_UID);
|
||||
$processData["TO_DO"] = ApplicationPeer::doCount($c);
|
||||
$PRO_UID = $_GET['PRO_UID'];
|
||||
require_once 'classes/model/Process.php';
|
||||
G::LoadClass( 'case' );
|
||||
$oProcessMap = new Cases();
|
||||
|
||||
$c = $oProcessMap->getCriteriaProcessCases('COMPLETED', $PRO_UID);
|
||||
$processData["COMPLETED"] = ApplicationPeer::doCount($c);
|
||||
$process = new Process();
|
||||
$processData = $process->load( $PRO_UID );
|
||||
|
||||
$c = $oProcessMap->getCriteriaProcessCases('DRAFT', $PRO_UID);
|
||||
$processData["DRAFT"] = ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaProcessCases( 'TO_DO', $PRO_UID );
|
||||
$processData["TO_DO"] = ApplicationPeer::doCount( $c );
|
||||
|
||||
$c = $oProcessMap->getCriteriaProcessCases('CANCELLED', $PRO_UID);
|
||||
$processData["CANCELLED"] = ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaProcessCases( 'COMPLETED', $PRO_UID );
|
||||
$processData["COMPLETED"] = ApplicationPeer::doCount( $c );
|
||||
|
||||
$processData["PRO_UID"] = $PRO_UID;
|
||||
$c = $oProcessMap->getCriteriaProcessCases( 'DRAFT', $PRO_UID );
|
||||
$processData["DRAFT"] = ApplicationPeer::doCount( $c );
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_DeleteCases', '', $processData, 'processes_Delete.php');
|
||||
G::RenderPage('publish', 'raw');
|
||||
$c = $oProcessMap->getCriteriaProcessCases( 'CANCELLED', $PRO_UID );
|
||||
$processData["CANCELLED"] = ApplicationPeer::doCount( $c );
|
||||
|
||||
$processData["PRO_UID"] = $PRO_UID;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_DeleteCases', '', $processData, 'processes_Delete.php' );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user