Merge remote branch 'upstream/master'

This commit is contained in:
jennylee
2012-10-18 11:35:54 -04:00
21 changed files with 3410 additions and 3331 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* upgrade.php
*
@@ -12,15 +13,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.
*
*/
/*
global $RBAC;
@@ -44,34 +44,35 @@ $G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DB_CONNECTIONS';
*/
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
G::LoadClass('processMap');
G::LoadClass( 'processMap' );
$oProcess = new processMap();
$oCriteria = $oProcess->getConditionProcessList();
if (ProcessPeer::doCount($oCriteria) > 0) {
$aProcesses = array();
$aProcesses[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
$oDataset = StepPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if (ProcessPeer::doCount( $oCriteria ) > 0) {
$aProcesses = array ();
$aProcesses[] = array ('PRO_UID' => 'char','PRO_TITLE' => 'char' );
$oDataset = StepPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$sProcessUID = '';
while ($aRow = $oDataset->getRow()) {
if ($sProcessUID == '') {
$sProcessUID = $aRow['PRO_UID'];
}
$aProcesses[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE']);
$aProcesses[] = array ('PRO_UID' => $aRow['PRO_UID'],'PRO_TITLE' => $aRow['PRO_TITLE'] );
$oDataset->next();
}
global $_DBArray;
$_DBArray['PROCESSES'] = $aProcesses;
$_SESSION['_DBArray'] = $_DBArray;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dbConnections/dbConnections_Events');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dbConnections/dbConnections_Events' );
require_once 'classes/model/DbSource.php';
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList($sProcessUID);
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria);
$oCriteria = $oDBSource->getCriteriaDBSList( $sProcessUID );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria );
} else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/noProcesses');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/noProcesses' );
}
G::RenderPage('publish');
G::RenderPage( 'publish' );

View File

@@ -1,4 +1,5 @@
<?php
/**
* upgrade.php
*
@@ -12,15 +13,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.
*
*/
/*
@@ -30,285 +30,260 @@
* @Param var action from POST request
*/
if( isset($_POST['action']) || isset($_POST['function']) ){
$action = (isset($_POST['action']))?$_POST['action']:$_POST['function'];
if (isset( $_POST['action'] ) || isset( $_POST['function'] )) {
$action = (isset( $_POST['action'] )) ? $_POST['action'] : $_POST['function'];
} else {
throw new Exception('dbconnections Fatal error, No action defined!...');
throw new Exception( 'dbconnections Fatal error, No action defined!...' );
}
if(isset($_POST['PROCESS']))
if (isset( $_POST['PROCESS'] )) {
$_SESSION['PROCESS'] = $_POST['PROCESS'];
}
#Global Definitions
#Global Definitions
require_once 'classes/model/DbSource.php';
require_once 'classes/model/Content.php';
$G_PUBLISH = new Publisher;
G::LoadClass('processMap');
G::LoadClass('ArrayPeer');
G::LoadClass ('dbConnections');
$G_PUBLISH = new Publisher();
G::LoadClass( 'processMap' );
G::LoadClass( 'ArrayPeer' );
G::LoadClass( 'dbConnections' );
global $_DBArray;
switch ( $action ){
case 'loadInfoAssigConnecctionDB':
$oStep = new Step();
return print ($oStep->loadInfoAssigConnecctionDB($_POST['PRO_UID'],$_POST['DBS_UID']));
break;
case 'showDbConnectionsList':
switch ($action) {
case 'loadInfoAssigConnecctionDB':
$oStep = new Step();
return print ($oStep->loadInfoAssigConnecctionDB( $_POST['PRO_UID'], $_POST['DBS_UID'] )) ;
break;
case 'showDbConnectionsList':
$oProcess = new processMap();
$oCriteria = $oProcess->getConditionProcessList();
if (ProcessPeer::doCount( $oCriteria ) > 0) {
$aProcesses = array ();
$aProcesses[] = array ('PRO_UID' => 'char','PRO_TITLE' => 'char'
);
$oDataset = ArrayBasePeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$sProcessUID = '';
while ($aRow = $oDataset->getRow()) {
if ($sProcessUID == '') {
$sProcessUID = $aRow['PRO_UID'];
}
$aProcesses[] = array ('PRO_UID' => (isset( $aRow['PRO_UID'] ) ? $aRow['PRO_UID'] : ''),'PRO_TITLE' => (isset( $aRow['PRO_TITLE'] ) ? $aRow['PRO_TITLE'] : '')
);
$oDataset->next();
}
$oProcess = new processMap();
$oCriteria = $oProcess->getConditionProcessList();
if( ProcessPeer::doCount($oCriteria) > 0 ){
$aProcesses = array();
$aProcesses[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
$oDataset = ArrayBasePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$sProcessUID = '';
while( $aRow = $oDataset->getRow() ){
if( $sProcessUID == '' ){
$sProcessUID = $aRow['PRO_UID'];
}
$aProcesses[] = array('PRO_UID' => (isset($aRow['PRO_UID']) ? $aRow['PRO_UID'] : ''), 'PRO_TITLE' => (isset($aRow['PRO_TITLE']) ? $aRow['PRO_TITLE'] : ''));
$oDataset->next();
}
$_DBArray['PROCESSES'] = $aProcesses;
$_SESSION['_DBArray'] = $_DBArray;
$_SESSION['PROCESS'] = (isset($_POST['PRO_UID']) ? $_POST['PRO_UID'] : '');
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList($_SESSION['PROCESS']);
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria);
}
G::RenderPage('publish', 'raw');
break;
$_DBArray['PROCESSES'] = $aProcesses;
$_SESSION['_DBArray'] = $_DBArray;
$_SESSION['PROCESS'] = (isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : '');
case 'showConnections':
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList($_SESSION['PROCESS']);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria);
G::RenderPage('publish', 'raw');
break;
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList( $_SESSION['PROCESS'] );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria );
}
G::RenderPage( 'publish', 'raw' );
break;
case 'showConnections':
$oDBSource = new DbSource();
$oCriteria = $oDBSource->getCriteriaDBSList( $_SESSION['PROCESS'] );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dbConnections/dbConnections', $oCriteria );
G::RenderPage( 'publish', 'raw' );
break;
case 'newDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables();
$dbService = $dbs->getEncondeList();
case 'newDdConnection':
//we are updating the passwords with encrupt info
$dbs->encryptThepassw( $_SESSION['PROCESS'] );
//end updating
$dbs = new dbConnections($_SESSION['PROCESS']);
$dbServices = $dbs->getDbServicesAvailables();
$dbService = $dbs->getEncondeList();
//we are updating the passwords with encrupt info
$dbs->encryptThepassw($_SESSION['PROCESS']);
//end updating
$rows[] = array('uid' => 'char', 'name' => 'char');
$rows[] = array ('uid' => 'char','name' => 'char'
);
foreach($dbServices as $srv) {
$rows[] = array('uid' => $srv['id'], 'name' => $srv['name']);
}
foreach ($dbServices as $srv) {
$rows[] = array ('uid' => $srv['id'],'name' => $srv['name']
);
}
$_DBArray['BDCONNECTIONS'] = $rows;
$_DBArray['BDCONNECTIONS'] = $rows;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dbConnections/dbConnections_New', '', '');
G::RenderPage('publish', 'raw');
break;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dbConnections/dbConnections_New', '', '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'editDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables();
case 'editDdConnection':
$dbs = new dbConnections($_SESSION['PROCESS']);
$dbServices = $dbs->getDbServicesAvailables();
$rows[] = array ('uid' => 'char','name' => 'char'
);
foreach ($dbServices as $srv) {
$rows[] = array ('uid' => $srv['id'],'name' => $srv['name']
);
}
$rows[] = array('uid' => 'char', 'name' => 'char');
foreach($dbServices as $srv) {
$rows[] = array('uid' => $srv['id'], 'name' => $srv['name']);
}
$_DBArray['BDCONNECTIONS'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
$_DBArray['BDCONNECTIONS'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
$o = new DbSource();
$aFields = $o->load( $_POST['DBS_UID'], $_SESSION['PROCESS'] );
if ($aFields['DBS_PORT'] == '0') {
$aFields['DBS_PORT'] = '';
}
$aFields['DBS_PASSWORD'] = $dbs->getPassWithoutEncrypt( $aFields );
$aFields['DBS_PASSWORD'] = ($aFields['DBS_PASSWORD'] == 'none') ? "" : $aFields['DBS_PASSWORD'];
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dbConnections/dbConnections_Edit', '', $aFields );
G::RenderPage( 'publish', 'raw' );
break;
case 'saveEditConnection':
$oDBSource = new DbSource();
$oContent = new Content();
if (strpos( $_POST['server'], "\\" )) {
$_POST['port'] = 'none';
}
$aData = Array ('DBS_UID' => $_POST['dbs_uid'],'PRO_UID' => $_SESSION['PROCESS'],'DBS_TYPE' => $_POST['type'],'DBS_SERVER' => $_POST['server'],'DBS_DATABASE_NAME' => $_POST['db_name'],'DBS_USERNAME' => $_POST['user'],'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "" : G::encrypt( $_POST['passwd'], $_POST['db_name'] )) . "_2NnV3ujj3w",'DBS_PORT' => (($_POST['port'] == 'none') ? "" : $_POST['port']),'DBS_ENCODE' => $_POST['enc']
);
$o = new DbSource();
$aFields = $o->load($_POST['DBS_UID'], $_SESSION['PROCESS']);
if ($aFields['DBS_PORT'] == '0') {
$aFields['DBS_PORT'] = '';
}
$aFields['DBS_PASSWORD']=$dbs->getPassWithoutEncrypt($aFields);
$aFields['DBS_PASSWORD']=($aFields['DBS_PASSWORD'] == 'none') ? "": $aFields['DBS_PASSWORD'];
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dbConnections/dbConnections_Edit', '', $aFields);
G::RenderPage('publish', 'raw');
break;
$oDBSource->update( $aData );
$oContent->addContent( 'DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc'] );
break;
case 'saveConnection':
$oDBSource = new DbSource();
$oContent = new Content();
if (strpos( $_POST['server'], "\\" )) {
$_POST['port'] = 'none';
}
$aData = Array ('PRO_UID' => $_SESSION['PROCESS'],'DBS_TYPE' => $_POST['type'],'DBS_SERVER' => $_POST['server'],'DBS_DATABASE_NAME' => $_POST['db_name'],'DBS_USERNAME' => $_POST['user'],'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "" : G::encrypt( $_POST['passwd'], $_POST['db_name'] )) . "_2NnV3ujj3w",'DBS_PORT' => (($_POST['port'] == 'none') ? "" : $_POST['port']),'DBS_ENCODE' => $_POST['enc']
);
$newid = $oDBSource->create( $aData );
$sDelimiter = DBAdapter::getStringDelimiter();
$oContent->addContent( 'DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc'] );
break;
case 'deleteDbConnection':
try {
$oDBSource = new DbSource();
$oContent = new Content();
case 'saveEditConnection':
$DBS_UID = $_POST['dbs_uid'];
$PRO_UID = $_SESSION['PROCESS'];
$oDBSource->remove( $DBS_UID, $PRO_UID );
$oContent->removeContent( 'DBS_DESCRIPTION', "", $DBS_UID );
$result->success = true;
$result->msg = G::LoadTranslation( 'ID_DBCONNECTION_REMOVED' );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
break;
case 'showTestConnection':
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'dbConnections/dbConnections' );
G::RenderPage( 'publish', 'raw' );
break;
case 'testConnection':
sleep( 0 );
$step = $_POST['step'];
$type = $_POST['type'];
$server = $_POST['server'];
$db_name = $_POST['db_name'];
$user = $_POST['user'];
$passwd = ($_POST['passwd'] == 'none') ? "" : $_POST['passwd'];
$port = $_POST['port'];
$oDBSource = new DbSource();
$oContent = new Content();
if(strpos($_POST['server'], "\\"))
$_POST['port'] = 'none';
$aData = Array(
'DBS_UID' => $_POST['dbs_uid'],
'PRO_UID' => $_SESSION['PROCESS'],
'DBS_TYPE' => $_POST['type'],
'DBS_SERVER' => $_POST['server'],
'DBS_DATABASE_NAME' => $_POST['db_name'],
'DBS_USERNAME' => $_POST['user'],
'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "": G::encrypt($_POST['passwd'], $_POST['db_name']))."_2NnV3ujj3w",
'DBS_PORT' => (($_POST['port'] == 'none') ? "": $_POST['port']),
'DBS_ENCODE' => $_POST['enc']
);
if (($port == 'none') || ($port == 0)) {
//setting defaults ports
switch ($type) {
case 'mysql':
$port = 3306;
break;
case 'pgsql':
$port = 5432;
break;
case 'mssql':
$port = 1433;
break;
case 'oracle':
$port = 1521;
break;
}
}
$oDBSource->update($aData);
$oContent->addContent('DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc']);
G::LoadClass( 'net' );
$Server = new NET( $server );
break;
define( "SUCCESSFULL", 'SUCCESSFULL' );
define( "FAILED", 'FAILED' );
case 'saveConnection':
switch ($step) {
case 1:
if ($Server->getErrno() == 0) {
print (SUCCESSFULL . ',') ;
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
case 2:
$Server->scannPort( $port );
if ($Server->getErrno() == 0) {
print (SUCCESSFULL . ',') ;
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
case 3:
$Server->loginDbServer( $user, $passwd );
$Server->setDataBase( $db_name, $port );
$oDBSource = new DbSource();
$oContent = new Content();
if(strpos($_POST['server'], "\\"))
$_POST['port'] = 'none';
$aData = Array(
'PRO_UID' => $_SESSION['PROCESS'],
'DBS_TYPE' => $_POST['type'],
'DBS_SERVER' => $_POST['server'],
'DBS_DATABASE_NAME' => $_POST['db_name'],
'DBS_USERNAME' => $_POST['user'],
'DBS_PASSWORD' => (($_POST['passwd'] == 'none') ? "": G::encrypt($_POST['passwd'], $_POST['db_name']))."_2NnV3ujj3w",
'DBS_PORT' => (($_POST['port'] == 'none') ? "": $_POST['port']),
'DBS_ENCODE' => $_POST['enc']
);
$newid = $oDBSource->create($aData);
$sDelimiter = DBAdapter::getStringDelimiter();
$oContent->addContent('DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc']);
if ($Server->errno == 0) {
$response = $Server->tryConnectServer( $type );
if ($response->status == 'SUCCESS') {
print (SUCCESSFULL . ',') ;
} else {
print (FAILED . ',' . $Server->error) ;
}
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
case 4:
$Server->loginDbServer( $user, $passwd );
$Server->setDataBase( $db_name, $port );
if ($Server->errno == 0) {
$response = $Server->tryConnectServer( $type );
if ($response->status == 'SUCCESS') {
$response = $Server->tryOpenDataBase( $type );
if ($response->status == 'SUCCESS') {
print (SUCCESSFULL . ',' . $Server->error) ;
} else {
print (FAILED . ',' . $Server->error) ;
}
} else {
print (FAILED . ',' . $Server->error) ;
}
} else {
print (FAILED . ',' . $Server->error) ;
}
break;
default:
print ('finished') ;
}
break;
case 'showEncodes':
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
$engine = $_POST['engine'];
break;
if ($engine != "0") {
$dbs = new dbConnections();
echo $oJSON->encode( $dbs->getEncondeList( $engine ) );
case 'deleteDbConnection':
try{
$oDBSource = new DbSource();
$oContent = new Content();
$DBS_UID = $_POST['dbs_uid'];
$PRO_UID = $_SESSION['PROCESS'];
$oDBSource->remove($DBS_UID, $PRO_UID);
$oContent->removeContent('DBS_DESCRIPTION', "", $DBS_UID);
$result->success = true;
$result->msg = G::LoadTranslation('ID_DBCONNECTION_REMOVED');
}catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
break;
case 'showTestConnection':
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'dbConnections/dbConnections');
G::RenderPage('publish', 'raw');
break;
case 'testConnection':
sleep(0);
$step = $_POST['step'];
$type = $_POST['type'];
$server = $_POST['server'];
$db_name = $_POST['db_name'];
$user = $_POST['user'];
$passwd = ($_POST['passwd'] == 'none') ? "": $_POST['passwd'];
$port = $_POST['port'];
if( ($port == 'none') || ($port == 0) ){
//setting defaults ports
switch ($type){
case 'mysql': $port = 3306; break;
case 'pgsql': $port = 5432; break;
case 'mssql': $port = 1433; break;
case 'oracle': $port = 1521; break;
}
}
G::LoadClass('net');
$Server = new NET($server);
define("SUCCESSFULL", 'SUCCESSFULL');
define("FAILED", 'FAILED');
switch ($step) {
case 1:
if ($Server->getErrno() == 0) {
print (SUCCESSFULL.',');
} else {
print (FAILED.','.$Server->error);
}
break;
case 2:
$Server->scannPort($port);
if ($Server->getErrno() == 0) {
print (SUCCESSFULL.',');
} else {
print (FAILED.','.$Server->error);
}
break;
case 3:
$Server->loginDbServer($user, $passwd);
$Server->setDataBase($db_name, $port);
if($Server->errno == 0){
$response = $Server->tryConnectServer($type);
if($response->status == 'SUCCESS') {
print (SUCCESSFULL.',');
} else {
print (FAILED.','.$Server->error);
}
} else {
print (FAILED.','.$Server->error);
}
break;
case 4:
$Server->loginDbServer($user, $passwd);
$Server->setDataBase($db_name, $port);
if($Server->errno == 0){
$response = $Server->tryConnectServer($type);
if($response->status == 'SUCCESS') {
$response = $Server->tryOpenDataBase($type);
if($response->status == 'SUCCESS') {
print (SUCCESSFULL.','.$Server->error);
} else {
print (FAILED.','.$Server->error);
}
} else {
print (FAILED.','.$Server->error);
}
} else {
print (FAILED.','.$Server->error);
}
break;
default:
print('finished');
}
break;
case 'showEncodes':
G::LoadThirdParty('pear/json','class.json');
$oJSON = new Services_JSON();
$engine = $_POST['engine'];
if($engine != "0"){
$dbs = new dbConnections();
echo $oJSON->encode($dbs->getEncondeList($engine));
} else {
echo '[["0","..."]]';
}
break;
} else {
echo '[["0","..."]]';
}
break;
}

View File

@@ -1,26 +1,27 @@
<?php
/**
* @Author: Erik Amaru Ortiz <erik@colosa.com>
* @Description:This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
*/
if( isset($_SESSION['PROCESS']) ){
$pro = include (PATH_CORE . "config/databases.php");
G::LoadClass('dbConnections');
$oDbConnections = new dbConnections($_SESSION['PROCESS']);
foreach( $oDbConnections->connections as $db ) {
$db['DBS_PASSWORD'] = $oDbConnections->getPassWithoutEncrypt($db);
$dbsPort = ($db['DBS_PORT'] == '') ? ('') : (':'.$db['DBS_PORT']);
$ENCODE = (trim($db['DBS_ENCODE']) == '')? '': '?encoding=' . $db['DBS_ENCODE'];
if(strpos($db['DBS_SERVER'], "\\") && $db['DBS_TYPE'] == 'mssql'){
$pro['datasources'][$db['DBS_UID']]['connection'] = $db['DBS_TYPE'] . '://' . $db['DBS_USERNAME'] . ':' . $db['DBS_PASSWORD'] . '@' . $db['DBS_SERVER'] . '/' . $db['DBS_DATABASE_NAME'] . $ENCODE;
/**
* Description: This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
*
* @author : Erik Amaru Ortiz <erik@colosa.com>
*/
if (isset( $_SESSION['PROCESS'] )) {
$pro = include (PATH_CORE . "config/databases.php");
G::LoadClass( 'dbConnections' );
$oDbConnections = new dbConnections( $_SESSION['PROCESS'] );
foreach ($oDbConnections->connections as $db) {
$db['DBS_PASSWORD'] = $oDbConnections->getPassWithoutEncrypt( $db );
$dbsPort = ($db['DBS_PORT'] == '') ? ('') : (':' . $db['DBS_PORT']);
$ENCODE = (trim( $db['DBS_ENCODE'] ) == '') ? '' : '?encoding=' . $db['DBS_ENCODE'];
if (strpos( $db['DBS_SERVER'], "\\" ) && $db['DBS_TYPE'] == 'mssql') {
$pro['datasources'][$db['DBS_UID']]['connection'] = $db['DBS_TYPE'] . '://' . $db['DBS_USERNAME'] . ':' . $db['DBS_PASSWORD'] . '@' . $db['DBS_SERVER'] . '/' . $db['DBS_DATABASE_NAME'] . $ENCODE;
} else {
$pro['datasources'][$db['DBS_UID']]['connection'] = $db['DBS_TYPE'] . '://' . $db['DBS_USERNAME'] . ':' . $db['DBS_PASSWORD'] . '@' . $db['DBS_SERVER'] .$dbsPort. '/' . $db['DBS_DATABASE_NAME'] . $ENCODE;
$pro['datasources'][$db['DBS_UID']]['connection'] = $db['DBS_TYPE'] . '://' . $db['DBS_USERNAME'] . ':' . $db['DBS_PASSWORD'] . '@' . $db['DBS_SERVER'] . $dbsPort . '/' . $db['DBS_DATABASE_NAME'] . $ENCODE;
}
$pro['datasources'][$db['DBS_UID']]['adapter'] = $db['DBS_TYPE'];
}
return $pro;
}
?>

View File

@@ -1,21 +1,23 @@
<?php
/**
* @Author: Erik Amaru Ortiz <erik@colosa.com>
* @Description:This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
* ription:This is a additional configuration for load all connections; if exist in a particular proccess
* @Date: 15-05-2008
*
* @author : Erik Amaru Ortiz <erik@colosa.com>
*/
$dbHash = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
$host = $dbHash[0];
$user = $dbHash[1];
$pass = $dbHash[2];
$dbName = DB_NAME;
$pro = include (PATH_CORE . "config/databases.php");
$pro['datasources']['root'] = Array ();
$pro['datasources']['root']['connection'] = "mysql://$user:$pass@$host/$dbName?encoding=utf8";
$pro['datasources']['root']['adapter'] = "mysql";
return $pro;
$dbHash = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
$host = $dbHash[0];
$user = $dbHash[1];
$pass = $dbHash[2];
$dbName = DB_NAME;
$pro = include (PATH_CORE . "config/databases.php");
$pro['datasources']['root'] = Array ();
$pro['datasources']['root']['connection'] = "mysql://$user:$pass@$host/$dbName?encoding=utf8";
$pro['datasources']['root']['adapter'] = "mysql";
return $pro;

View File

@@ -1,77 +1,78 @@
<?php
/**
* departments.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
* 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.
*
*/
require_once 'classes/model/Department.php';
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'DEPARTMENTS';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('departments/departmentUsers', false); //adding a javascript file .js
$oHeadPublisher->addContent('departments/departmentUsers'); //adding a html file .html.
G::LoadClass('configuration');
$c = new Configurations();
$dep = new Department();
$dep->Load($_GET['dUID']);
$depart = Array();
$depart['DEP_UID'] = $dep->getDepUid();
$depart['DEP_TITLE'] = $dep->getDepTitle();
$depart['DEP_MANAGER'] = $dep->getDepManager();
$oHeadPublisher->assign('DEPARTMENT', $depart);
$oHeadPublisher->assign('FORMATS',$c->getFormats());
G::RenderPage('publish', 'extJs');
?>
<?php
/**
* departments.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
* 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.
*/
require_once 'classes/model/Department.php';
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'DEPARTMENTS';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'departments/departmentUsers', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'departments/departmentUsers' ); //adding a html file .html.
G::LoadClass( 'configuration' );
$c = new Configurations();
$dep = new Department();
$dep->Load( $_GET['dUID'] );
$depart = Array ();
$depart['DEP_UID'] = $dep->getDepUid();
$depart['DEP_TITLE'] = $dep->getDepTitle();
$depart['DEP_MANAGER'] = $dep->getDepManager();
$oHeadPublisher->assign( 'DEPARTMENT', $depart );
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,69 +1,71 @@
<?php
/**
* departments.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
* 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.
*
*/
G::LoadClass('configuration');
$c = new Configurations();
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'DEPARTMENTS';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('departments/departmentList', false); //adding a javascript file .js
$oHeadPublisher->addContent('departments/departmentList'); //adding a html file .html.
//$labels = G::getTranslations(Array('ID_DEPARTMENTS','ID_DELETE','ID_EDIT','ID_USERS','ID_ACTIVE','ID_INACTIVE','ID_SELECT_STATUS',
// 'ID_CLOSE','ID_SAVE','ID_DEPARTMENT_NAME','ID_STATUS'));
//
//$oHeadPublisher->assign('TRANSLATIONS', $labels);
$oHeadPublisher->assign('FORMATS',$c->getFormats());
G::RenderPage('publish', 'extJs');
?>
<?php
/**
* departments.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
* 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.
*/
G::LoadClass( 'configuration' );
$c = new Configurations();
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'DEPARTMENTS';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'departments/departmentList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'departments/departmentList' ); //adding a html file .html.
//$labels = G::getTranslations(Array('ID_DEPARTMENTS','ID_DELETE','ID_EDIT','ID_USERS','ID_ACTIVE','ID_INACTIVE','ID_SELECT_STATUS',
// 'ID_CLOSE','ID_SAVE','ID_DEPARTMENT_NAME','ID_STATUS'));
//
//$oHeadPublisher->assign('TRANSLATIONS', $labels);
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,10 +1,11 @@
<?php
/**
* departments_AddManager.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,50 +13,47 @@
*
* 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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadClass('departos');
G::LoadClass( 'departos' );
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
//print_r($_GET);
$oDpto = new Departos();
//$DptoUid = (isset($_GET['UID'])) ? urldecode($_GET['UID']):'';
$aUser=Array();
$aUser[]= Array ('USR_UID'=>'char', 'USR_FIRSTNAME'=>'char', 'USR_LASTNAME'=>'char');
$aUserManagers=$oDpto->getUsersManagers();
$aUser_Manager= array_merge($aUser,$aUserManagers);
//print_r($aUser_Manager);
/*
//print_r($_GET);
$oDpto = new Departos();
//$DptoUid = (isset($_GET['UID'])) ? urldecode($_GET['UID']):'';
$aUser = Array ();
$aUser[] = Array ('USR_UID' => 'char','USR_FIRSTNAME' => 'char','USR_LASTNAME' => 'char' );
$aUserManagers = $oDpto->getUsersManagers();
$aUser_Manager = array_merge( $aUser, $aUserManagers );
//print_r($aUser_Manager);
/*
global $_DBArray;
$_DBArray['aManager'] = $aUser_Manager;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('aManager');
*/
$aFields=array();
$aFields['DEP_UID']= $_GET['SUID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_AddManager', '', $aFields , 'departments_SaveManager');
$aFields = array ();
$aFields['DEP_UID'] = $_GET['SUID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/departments_AddManager', '', $aFields, 'departments_SaveManager' );
G::RenderPage( "publish" , "raw" );
G::RenderPage( "publish", "raw" );
?>

View File

@@ -1,56 +1,58 @@
<?php
/**
* groups_AddUser.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
* 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.
*
*/
require_once ( 'classes/class.xmlfield_InputPM.php' );
require_once ( 'classes/model/Department.php' );
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
$oDept = new Department();
$aFields = $oDept->load($_GET['UID']);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'departments/paged-table', 'departments/departments_AvailableUsers', $oDept->getAvailableUsersCriteria($_GET['UID']));
G::RenderPage('publish', 'raw');
<?php
/**
* groups_AddUser.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
* 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.
*/
require_once ('classes/class.xmlfield_InputPM.php');
require_once ('classes/model/Department.php');
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
$oDept = new Department();
$aFields = $oDept->load( $_GET['UID'] );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'departments/paged-table', 'departments/departments_AvailableUsers', $oDept->getAvailableUsersCriteria( $_GET['UID'] ) );
G::RenderPage( 'publish', 'raw' );

View File

@@ -1,4 +1,5 @@
<?php
/**
* departments_Ajax.php
*
@@ -12,356 +13,335 @@
*
* 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.
*
*/
function LookForChildren($parent, $level,$aDepUsers){
G::LoadClass('configuration');
$conf = new Configurations();
$oDept = new Department();
$allDepartments = $oDept->getDepartments ( $parent );
$level++;
$rows = Array();
foreach($allDepartments as $department){
unset($depto);
$depto['DEP_TITLE'] = str_replace(array("<", ">"), array("&lt;", "&gt;"), $department['DEP_TITLE']);
$depto['DEP_STATUS'] = $department['DEP_STATUS'];
if ($department['DEP_MANAGER_USERNAME']!=''){
$depto['DEP_MANAGER_NAME'] = $conf->usersNameFormat($department['DEP_MANAGER_USERNAME'], $department['DEP_MANAGER_FIRSTNAME'], $department['DEP_MANAGER_LASTNAME']);
}else{
$depto['DEP_MANAGER_NAME'] = '';
}
$depto['DEP_TOTAL_USERS'] = isset($aDepUsers[$department['DEP_UID']])? $aDepUsers[$department['DEP_UID']] : 0;
$depto['DEP_UID'] = $department['DEP_UID'];
$depto['DEP_MANAGER'] = $department['DEP_MANAGER'];
$depto['DEP_PARENT'] = $department['DEP_PARENT'];
if ($department['HAS_CHILDREN'] > 0){
$depto['children'] = LookForChildren($department['DEP_UID'], $level, $aDepUsers);
$depto['iconCls'] = 'ss_sprite ss_chart_organisation';
$depto['expanded'] = true;
}else{
$depto['leaf'] = true;
if ($level==1){
$depto['iconCls'] = 'ss_sprite ss_chart_organisation';
}else{
$depto['iconCls'] = 'ss_sprite ss_plugin';
}
}
$rows[] = $depto;
}
return $rows;
function LookForChildren ($parent, $level, $aDepUsers)
{
G::LoadClass( 'configuration' );
$conf = new Configurations();
$oDept = new Department();
$allDepartments = $oDept->getDepartments( $parent );
$level ++;
$rows = Array ();
foreach ($allDepartments as $department) {
unset( $depto );
$depto['DEP_TITLE'] = str_replace( array ("<",">" ), array ("&lt;","&gt;" ), $department['DEP_TITLE'] );
$depto['DEP_STATUS'] = $department['DEP_STATUS'];
if ($department['DEP_MANAGER_USERNAME'] != '') {
$depto['DEP_MANAGER_NAME'] = $conf->usersNameFormat( $department['DEP_MANAGER_USERNAME'], $department['DEP_MANAGER_FIRSTNAME'], $department['DEP_MANAGER_LASTNAME'] );
} else {
$depto['DEP_MANAGER_NAME'] = '';
}
$depto['DEP_TOTAL_USERS'] = isset( $aDepUsers[$department['DEP_UID']] ) ? $aDepUsers[$department['DEP_UID']] : 0;
$depto['DEP_UID'] = $department['DEP_UID'];
$depto['DEP_MANAGER'] = $department['DEP_MANAGER'];
$depto['DEP_PARENT'] = $department['DEP_PARENT'];
if ($department['HAS_CHILDREN'] > 0) {
$depto['children'] = LookForChildren( $department['DEP_UID'], $level, $aDepUsers );
$depto['iconCls'] = 'ss_sprite ss_chart_organisation';
$depto['expanded'] = true;
} else {
$depto['leaf'] = true;
if ($level == 1) {
$depto['iconCls'] = 'ss_sprite ss_chart_organisation';
} else {
$depto['iconCls'] = 'ss_sprite ss_plugin';
}
}
$rows[] = $depto;
}
return $rows;
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
G::LoadInclude('ajax');
$_POST['action'] = get_ajax_value('action');
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadInclude( 'ajax' );
$_POST['action'] = get_ajax_value( 'action' );
require_once 'classes/model/Department.php';
switch ($_POST['action'])
{
case 'showUsers':
global $G_PUBLISH;
$oDept = new Department();
$aFields = $oDept->load($_POST['sDptoUID']);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_Edit', '', $aFields , '');
switch ($_POST['action']) {
case 'showUsers':
global $G_PUBLISH;
$oDept = new Department();
$aFields = $oDept->load( $_POST['sDptoUID'] );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/departments_Edit', '', $aFields, '' );
$criteria = $oDept->getUsersFromDepartment( $_POST['sDptoUID'], $aFields ['DEP_MANAGER'] );
$criteria = $oDept->getUsersFromDepartment( $_POST['sDptoUID'], $aFields['DEP_MANAGER'] );
$G_PUBLISH->AddContent('propeltable', 'departments/paged-table2', 'departments/departments_UsersList', $criteria, $aFields );
//$G_PUBLISH->AddContent('propeltable', 'paged-table', 'departments/departments_UsersList', $criteria, $aFields);
$G_PUBLISH->AddContent( 'propeltable', 'departments/paged-table2', 'departments/departments_UsersList', $criteria, $aFields );
//$G_PUBLISH->AddContent('propeltable', 'paged-table', 'departments/departments_UsersList', $criteria, $aFields);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("groupname='{$aFields["DEPO_TITLE"]}';");
$oHeadPublisher->addScriptCode("depUid='{$aFields["DEP_UID"]}';");
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptCode( "groupname='{$aFields["DEPO_TITLE"]}';" );
$oHeadPublisher->addScriptCode( "depUid='{$aFields["DEP_UID"]}';" );
G::RenderPage('publish', 'raw');
break;
G::RenderPage( 'publish', 'raw' );
break;
case 'assignAllUsers':
$aUsers = explode( ',', $_POST['aUsers'] );
$oDept = new Department();
$depUid = $_POST['DEP_UID'];
$cant = $oDept->cantUsersInDepartment( $depUid );
case 'assignAllUsers':
$aUsers = explode(',', $_POST['aUsers']);
$oDept = new Department();
$depUid = $_POST['DEP_UID'];
$cant = $oDept->cantUsersInDepartment( $depUid);
if ($cant == 0) {
$manager = true;
}
if ( $cant == 0 ) $manager = true;
for ($i = 0; $i < count( $aUsers ); $i ++) {
$oDept->addUserToDepartment( $depUid, $aUsers[$i], $manager, false );
$manager = false;
}
$oDept->updateDepartmentManager( $depUid );
break;
case 'removeUserFromDepartment':
$oDept = new Department();
$oDept->removeUserFromDepartment( $_POST['DEP_UID'], $_POST['USR_UID'] );
break;
case 'verifyDptoname':
$_POST['sOriginalGroupname'] = get_ajax_value( 'sOriginalGroupname' );
$_POST['sGroupname'] = get_ajax_value( 'sGroupname' );
if ($_POST['sOriginalGroupname'] == $_POST['sGroupname']) {
echo '0';
} else {
$oDpto = new Department();
$oCriteria = $oDpto->loadByGroupname( $_POST['sGroupname'] );
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
if (! $aRow) {
echo '0';
} else {
echo '1';
}
}
break;
case 'showUnAssignedUsers':
$_POST['UID'] = get_ajax_value( 'UID' );
require_once ('classes/class.xmlfield_InputPM.php');
for( $i=0; $i<count($aUsers); $i++) {
$oDept->addUserToDepartment( $depUid, $aUsers[$i], $manager, false );
$manager = false;
}
$oDept->updateDepartmentManager( $depUid );
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadClass( 'departments' );
$oDept = new Department();
break;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'propeltable', 'departments/paged-table3', 'departments/departments_AddUnAssignedUsers', $oDept->getAvailableUsersCriteria( '' ) );
G::RenderPage( 'publish', 'raw' );
break;
case 'departmentList':
global $RBAC;
$aDEPTS = $RBAC->getAllUsersByDepartment();
$tree_depart = LookForChildren( '', 0, $aDEPTS );
echo G::json_encode( $tree_depart );
break;
case 'checkDepartmentName':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
case 'removeUserFromDepartment':
$oDept = new Department();
$oDept->removeUserFromDepartment($_POST['DEP_UID'], $_POST['USR_UID']);
break;
$oCriteria = new Criteria( 'workflow' );
case 'verifyDptoname':
$_POST['sOriginalGroupname'] = get_ajax_value('sOriginalGroupname');
$_POST['sGroupname'] = get_ajax_value('sGroupname');
if ($_POST['sOriginalGroupname'] == $_POST['sGroupname'])
{
echo '0';
}
else
{
$oDpto = new Department();
$oCriteria=$oDpto->loadByGroupname($_POST['sGroupname']);
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn( ContentPeer::CON_CATEGORY );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addSelectColumn( DepartmentPeer::DEP_PARENT );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'DEPO_TITLE' );
$oCriteria->addJoin( ContentPeer::CON_ID, DepartmentPeer::DEP_UID, Criteria::LEFT_JOIN );
$oCriteria->add( ContentPeer::CON_VALUE, $dep_name );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add( DepartmentPeer::DEP_PARENT, $parent );
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
if (!$aRow)
{
echo '0';
}
else
{
echo '1';
}
}
break;
echo (! $aRow) ? 'true' : 'false';
break;
case 'checkEditDepartmentName':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$dep_uid = $_REQUEST['uid'];
$oDepartment = new Department();
$checkVal = $oDepartment->checkDepartmentName( $dep_name, $parent, $dep_uid );
echo (! $checkVal) ? 'true' : 'false';
break;
case 'saveDepartment':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$newDepartment['DEP_PARENT'] = $parent;
$newDepartment['DEP_TITLE'] = $dep_name;
$oDept = new Department();
$oDept->create( $newDepartment );
echo '{success: true}';
break;
case 'usersByDepartment':
G::LoadClass( 'configuration' );
$sDepUid = $_REQUEST['DEP_UID'];
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_REPORTS_TO );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
$oCriteria->add( UsersPeer::DEP_UID, $sDepUid );
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
case 'showUnAssignedUsers':
$_POST['UID'] = get_ajax_value('UID');
require_once ( 'classes/class.xmlfield_InputPM.php' );
$rows = Array ();
unset( $first );
$first['USR_UID'] = '';
$first['USR_VALUE'] = G::LoadTranslation( 'ID_NO_MANAGER_SELECTED' );
$rows[] = $first;
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
G::LoadClass ( 'departments');
$oDept = new Department();
$conf = new Configurations();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'departments/paged-table3', 'departments/departments_AddUnAssignedUsers', $oDept->getAvailableUsersCriteria(''));
G::RenderPage('publish', 'raw');
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
$user['USR_UID'] = $aRow['USR_UID'];
$user['USR_VALUE'] = $conf->usersNameFormat( $aRow['USR_USERNAME'], $aRow['USR_FIRSTNAME'], $aRow['USR_LASTNAME'] );
$rows[] = $user;
}
break;
case 'departmentList':
global $RBAC;
$aDEPTS = $RBAC->getAllUsersByDepartment();
$tree_depart = LookForChildren('', 0,$aDEPTS);
echo G::json_encode($tree_depart);
break;
case 'checkDepartmentName':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
echo '{users: ' . G::json_encode( $rows ) . '}';
break;
case 'updateDepartment':
try {
$dep_name = $_REQUEST['name'];
$dep_uid = $_REQUEST['uid'];
$dep_manager = $_REQUEST['manager'];
$dep_status = $_REQUEST['status'];
$editDepartment['DEP_UID'] = $dep_uid;
$editDepartment['DEPO_TITLE'] = $dep_name;
$editDepartment['DEP_STATUS'] = $dep_status;
$editDepartment['DEP_MANAGER'] = $dep_manager;
$oDept = new Department();
$oDept->update( $editDepartment );
$oDept->updateDepartmentManager( $dep_uid );
echo '{success: true}';
} catch (exception $e) {
echo '{success: false}';
}
break;
case 'canDeleteDepartment':
global $RBAC;
$aDEPTS = $RBAC->getAllUsersByDepartment();
if (isset( $aDEPTS[$_POST['dep_uid']] )) {
echo '{success: false, users: ' . $aDEPTS[$_POST['dep_uid']] . '}';
} else {
echo '{success: true}';
}
break;
case 'deleteDepartment':
$DEP_UID = $_POST['DEP_UID'];
$oDept = new Department();
$oDept->remove( $DEP_UID );
echo '{success: true}';
break;
case 'assignedUsers':
$filter = isset( $_POST['textFilter'] ) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oDept = new Department();
$oDept->Load( $dep_uid );
$manager = $oDept->getDepManager();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
if ($filter != '') {
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE ) ) ) );
}
$oCriteria->add( UsersPeer::DEP_UID, $dep_uid );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$aUsers[] = $oDataset->getRow();
$index = sizeof( $aUsers ) - 1;
$aUsers[$index]['USR_SUPERVISOR'] = ($manager == $aUsers[$index]['USR_UID']) ? true : false;
}
echo '{users:' . G::json_encode( $aUsers ) . '}';
break;
case 'availableUsers':
$filter = isset( $_POST['textFilter'] ) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
$oCriteria = new Criteria('workflow');
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn( ContentPeer::CON_CATEGORY );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addSelectColumn(DepartmentPeer::DEP_PARENT);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'DEPO_TITLE');
$oCriteria->addJoin(ContentPeer::CON_ID, DepartmentPeer::DEP_UID, Criteria::LEFT_JOIN);
$oCriteria->add(ContentPeer::CON_VALUE, $dep_name);
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add(DepartmentPeer::DEP_PARENT,$parent);
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
echo (!$aRow) ? 'true' : 'false';
break;
case 'checkEditDepartmentName':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$dep_uid = $_REQUEST['uid'];
$oDepartment = new Department();
$checkVal = $oDepartment->checkDepartmentName($dep_name, $parent, $dep_uid );
echo ( !$checkVal ) ? 'true' : 'false';
break;
case 'saveDepartment':
$parent = $_REQUEST['parent'];
$dep_name = $_REQUEST['name'];
$newDepartment['DEP_PARENT'] = $parent;
$newDepartment['DEP_TITLE'] = $dep_name;
$oDept = new Department();
$oDept->create($newDepartment);
echo '{success: true}';
break;
case 'usersByDepartment':
G::LoadClass ( 'configuration' );
$sDepUid = $_REQUEST['DEP_UID'];
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_REPORTS_TO);
$oCriteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
$oCriteria->add(UsersPeer::DEP_UID, $sDepUid);
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rows = Array();
unset($first);
$first['USR_UID'] = '';
$first['USR_VALUE'] = G::LoadTranslation('ID_NO_MANAGER_SELECTED');
$rows[] = $first;
$conf = new Configurations();
while ($oDataset->next()){
$aRow = $oDataset->getRow();
$user['USR_UID'] = $aRow['USR_UID'];
$user['USR_VALUE'] = $conf->usersNameFormat($aRow['USR_USERNAME'], $aRow['USR_FIRSTNAME'], $aRow['USR_LASTNAME']);
$rows[] = $user;
}
echo '{users: '.G::json_encode($rows).'}';
break;
case 'updateDepartment':
try{
$dep_name = $_REQUEST['name'];
$dep_uid = $_REQUEST['uid'];
$dep_manager = $_REQUEST['manager'];
$dep_status = $_REQUEST['status'];
$editDepartment['DEP_UID'] = $dep_uid;
$editDepartment['DEPO_TITLE'] = $dep_name;
$editDepartment['DEP_STATUS'] = $dep_status;
$editDepartment['DEP_MANAGER'] = $dep_manager;
$oDept = new Department();
$oDept->update($editDepartment);
$oDept->updateDepartmentManager($dep_uid);
echo '{success: true}';
}catch(exception $e){
echo '{success: false}';
}
break;
case 'canDeleteDepartment':
global $RBAC;
$aDEPTS = $RBAC->getAllUsersByDepartment();
if (isset($aDEPTS[$_POST['dep_uid']])){
echo '{success: false, users: '.$aDEPTS[$_POST['dep_uid']].'}';
}else{
echo '{success: true}';
}
break;
case 'deleteDepartment':
$DEP_UID = $_POST['DEP_UID'];
$oDept = new Department();
$oDept->remove($DEP_UID);
echo '{success: true}';
break;
case 'assignedUsers':
$filter = isset($_POST['textFilter']) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oDept = new Department();
$oDept->Load($dep_uid);
$manager = $oDept->getDepManager();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_STATUS);
$oCriteria->add(UsersPeer::DEP_UID,'');
$oCriteria->add(UsersPeer::USR_STATUS,'CLOSED',Criteria::NOT_EQUAL);
if ($filter!=''){
$oCriteria->add(
$oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%'.$filter.'%',Criteria::LIKE)))
);
}
$oCriteria->add(UsersPeer::DEP_UID,$dep_uid);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aUsers = array();
while ($oDataset->next()){
$aUsers[] = $oDataset->getRow();
$index = sizeof($aUsers)-1;
$aUsers[$index]['USR_SUPERVISOR'] = ($manager == $aUsers[$index]['USR_UID'])? true : false;
}
echo '{users:'.G::json_encode($aUsers).'}';
break;
case 'availableUsers':
$filter = isset($_POST['textFilter']) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_STATUS);
$oCriteria->add(UsersPeer::DEP_UID,'');
$oCriteria->add(UsersPeer::USR_STATUS,'CLOSED',Criteria::NOT_EQUAL);
if ($filter!=''){
$oCriteria->add(
$oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%'.$filter.'%',Criteria::LIKE)->addOr(
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%'.$filter.'%',Criteria::LIKE)))
);
}
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aUsers = array();
while ($oDataset->next()){
$aUsers[] = $oDataset->getRow();
}
echo '{users:'.G::json_encode($aUsers).'}';
break;
case 'assignDepartmentToUserMultiple':
$DEP_UID = $_REQUEST['DEP_UID'];
$uSERS = $_REQUEST['USR_UID'];
$aUsers = explode(',',$uSERS);
$dep = new Department();
$dep->Load($DEP_UID);
$dep_manager = $dep->getDepManager();
$manager = ($dep_manager=='')? true : false;
foreach ($aUsers as $USR_UID){
$dep->addUserToDepartment($DEP_UID, $USR_UID, $manager, false);
$manager = false;
}
$dep->updateDepartmentManager($DEP_UID);
break;
case 'deleteDepartmentToUserMultiple':
$DEP_UID = $_REQUEST['DEP_UID'];
$uSERS = $_REQUEST['USR_UID'];
$aUsers = explode(',',$uSERS);
$dep = new Department();
$dep->Load($DEP_UID);
$manager = $dep->getDepManager();
foreach ($aUsers as $USR_UID){
$dep->removeUserFromDepartment($DEP_UID, $USR_UID);
if ($USR_UID==$manager){
$editDepto['DEP_UID'] = $DEP_UID;
$editDepto['DEP_MANAGER'] = '';
$dep->update($editDepto);
$dep->updateDepartmentManager($DEP_UID);
}
}
break;
case 'updateSupervisor':
$dep_manager = $_POST['USR_UID'];
$dep_uid = $_POST['DEP_UID'];
$editDepartment['DEP_UID'] = $dep_uid;
$editDepartment['DEP_MANAGER'] = $dep_manager;
$oDept = new Department();
$oDept->update($editDepartment);
$oDept->updateDepartmentManager($dep_uid);
echo '{success: true}';
break;
if ($filter != '') {
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE ) ) ) );
}
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$aUsers[] = $oDataset->getRow();
}
echo '{users:' . G::json_encode( $aUsers ) . '}';
break;
case 'assignDepartmentToUserMultiple':
$DEP_UID = $_REQUEST['DEP_UID'];
$uSERS = $_REQUEST['USR_UID'];
$aUsers = explode( ',', $uSERS );
$dep = new Department();
$dep->Load( $DEP_UID );
$dep_manager = $dep->getDepManager();
$manager = ($dep_manager == '') ? true : false;
foreach ($aUsers as $USR_UID) {
$dep->addUserToDepartment( $DEP_UID, $USR_UID, $manager, false );
$manager = false;
}
$dep->updateDepartmentManager( $DEP_UID );
break;
case 'deleteDepartmentToUserMultiple':
$DEP_UID = $_REQUEST['DEP_UID'];
$uSERS = $_REQUEST['USR_UID'];
$aUsers = explode( ',', $uSERS );
$dep = new Department();
$dep->Load( $DEP_UID );
$manager = $dep->getDepManager();
foreach ($aUsers as $USR_UID) {
$dep->removeUserFromDepartment( $DEP_UID, $USR_UID );
if ($USR_UID == $manager) {
$editDepto['DEP_UID'] = $DEP_UID;
$editDepto['DEP_MANAGER'] = '';
$dep->update( $editDepto );
$dep->updateDepartmentManager( $DEP_UID );
}
}
break;
case 'updateSupervisor':
$dep_manager = $_POST['USR_UID'];
$dep_uid = $_POST['DEP_UID'];
$editDepartment['DEP_UID'] = $dep_uid;
$editDepartment['DEP_MANAGER'] = $dep_manager;
$oDept = new Department();
$oDept->update( $editDepartment );
$oDept->updateDepartmentManager( $dep_uid );
echo '{success: true}';
break;
}

View File

@@ -1,10 +1,11 @@
<?php
/**
* departments_Delete.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,47 +13,47 @@
*
* 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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
require_once 'classes/model/Department.php';
require_once 'classes/model/Users.php';
$oDpto = new Department();
require_once 'classes/model/Department.php';
require_once 'classes/model/Users.php';
$oDpto = new Department();
if (! isset( $_POST['DEP_UID'] )) {
return;
}
$ocriteria = new Criteria( 'workflow' );
$ocriteria->addSelectColumn( DepartmentPeer::DEP_MANAGER );
$ocriteria->add( DepartmentPeer::DEP_UID, $_POST['DEP_UID'] );
$oDataset = DepartmentPeer::doSelectRS( $ocriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->add( UsersPeer::USR_REPORTS_TO, $aRow['DEP_MANAGER'], Criteria::EQUAL );
$oCriteria2 = new Criteria( 'workflow' );
$oCriteria2->add( UsersPeer::USR_REPORTS_TO, '' );
BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
$oCriteriaA = new Criteria( 'workflow' );
$oCriteriaA->add( UsersPeer::DEP_UID, $_POST['DEP_UID'], Criteria::EQUAL );
$oCriteriaB = new Criteria( 'workflow' );
$oCriteriaB->add( UsersPeer::DEP_UID, '' );
BasePeer::doUpdate( $oCriteriaA, $oCriteriaB, Propel::getConnection( 'workflow' ) );
$oDpto->remove( urldecode( $_POST['DEP_UID'] ) );
if (!isset($_POST['DEP_UID'])) return;
$ocriteria = new Criteria('workflow');
$ocriteria->addSelectColumn(DepartmentPeer::DEP_MANAGER);
$ocriteria->add(DepartmentPeer::DEP_UID,$_POST['DEP_UID']);
$oDataset = DepartmentPeer::doSelectRS($ocriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->add(UsersPeer::USR_REPORTS_TO, $aRow['DEP_MANAGER'], Criteria::EQUAL);
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(UsersPeer::USR_REPORTS_TO, '');
BasePeer::doUpdate($oCriteria1, $oCriteria2, Propel::getConnection('workflow'));
$oCriteriaA = new Criteria('workflow');
$oCriteriaA->add(UsersPeer::DEP_UID, $_POST['DEP_UID'], Criteria::EQUAL);
$oCriteriaB = new Criteria('workflow');
$oCriteriaB->add(UsersPeer::DEP_UID, '');
BasePeer::doUpdate($oCriteriaA, $oCriteriaB, Propel::getConnection('workflow'));
$oDpto->remove(urldecode($_POST['DEP_UID']));
?>

View File

@@ -1,64 +1,63 @@
<?php
/**
* departments_Edit.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
* 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.
*
*/
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
$dept = new Department();
$DptoUid = (isset($_GET['UID'])) ? urldecode($_GET['UID']):'';
if ($DptoUid) {
$aFields = $dept->Load( $DptoUid );
}
else {
$aFields=array();
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_Edit', '', $aFields , 'departments_Save');
G::RenderPage( "publish" , "raw" );
?>
<?php
/**
* departments_Edit.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
* 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.
*/
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
$dept = new Department();
$DptoUid = (isset( $_GET['UID'] )) ? urldecode( $_GET['UID'] ) : '';
if ($DptoUid) {
$aFields = $dept->Load( $DptoUid );
} else {
$aFields = array ();
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/departments_Edit', '', $aFields, 'departments_Save' );
G::RenderPage( "publish", "raw" );

View File

@@ -1,53 +1,55 @@
<?php
/**
* groups_List.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
* 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.
*
*/
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'view', 'departments/departments_Tree' );
G::RenderPage( "publish-raw" , "raw" );
?>
<?php
/**
* groups_List.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
* 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.
*/
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'departments/departments_Tree' );
G::RenderPage( "publish-raw", "raw" );

View File

@@ -1,65 +1,65 @@
<?php
/**
* departments_Edit.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
* 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.
*
*/
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
require_once 'classes/model/Department.php';
$oDept = new Department();
$parentUid = (isset($_GET['DEP_UID'])) ? urldecode($_GET['DEP_UID']) : '' ;
$Fields['DEP_STATUS'] = 'ACTIVE';
$G_PUBLISH = new Publisher();
if ( strlen( $parentUid) > 0 ) {
$Fields['DEP_PARENT'] = $parentUid;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_SubNew', '', $Fields , 'departments_Save');
}
else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/departments_New', '', null, '');
}
G::RenderPage( "publish" , "raw" );
<?php
/**
* departments_Edit.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
* 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.
*/
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
require_once 'classes/model/Department.php';
$oDept = new Department();
$parentUid = (isset( $_GET['DEP_UID'] )) ? urldecode( $_GET['DEP_UID'] ) : '';
$Fields['DEP_STATUS'] = 'ACTIVE';
$G_PUBLISH = new Publisher();
if (strlen( $parentUid ) > 0) {
$Fields['DEP_PARENT'] = $parentUid;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/departments_SubNew', '', $Fields, 'departments_Save' );
} else {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/departments_New', '', null, '' );
}
G::RenderPage( "publish", "raw" );

View File

@@ -1,10 +1,10 @@
<?php
/**
* departments_Delete.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,33 +12,35 @@
*
* 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.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
//G::LoadClass('groups');
G::LoadClass('departos');
//$group = new Groupwf();
$oDpto = new Department();
//G::LoadClass('groups');
G::LoadClass( 'departos' );
if (!isset($_POST['DEP_UID'])) return;
$oDpto->remove(urldecode($_POST['DEP_UID']));
require_once 'classes/model/TaskUser.php';
$oProcess = new TaskUser();
//$group = new Groupwf();
$oDpto = new Department();
if (! isset( $_POST['DEP_UID'] )) {
return;
}
$oDpto->remove( urldecode( $_POST['DEP_UID'] ) );
require_once 'classes/model/TaskUser.php';
$oProcess = new TaskUser();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( TaskUserPeer::USR_UID, $_POST['DEP_UID'] );
TaskUserPeer::doDelete( $oCriteria );
$oCriteria = new Criteria('workflow');
$oCriteria->add(TaskUserPeer::USR_UID, $_POST['DEP_UID']);
TaskUserPeer::doDelete($oCriteria);
?>

View File

@@ -1,71 +1,68 @@
<?php
/**
* departments_Edit.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
* 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.
*
*/
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
G::LoadClass('departments');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$Dpto = new Department();
$DptoUid = (isset($_GET['SUID'])) ? urldecode($_GET['SUID']):'';
$DepParent = (isset($_GET['SDEPPARENT'])) ? urldecode($_GET['SDEPPARENT']):'';
if (strlen($DptoUid) > 1 && strlen($DepParent)>1)
{
$aFields=$Dpto->Load( $DptoUid );
}
else
{$infosubDto = $Dpto->Load( $DptoUid );//print_r($infosubDto);
$aFields=array('SUID'=>$DptoUid,'SDEPPARENT'=>$DepParent);//print_r($aFields);print"<hr>";
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'departments/subdep_Edit', '', $aFields , 'subdep_Save');
G::RenderPage( "publish" , "raw" );
?>
<?php
/**
* departments_Edit.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
* 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.
*/
$access = $RBAC->userCanAccess( 'PM_USERS' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadClass( 'departments' );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$Dpto = new Department();
$DptoUid = (isset( $_GET['SUID'] )) ? urldecode( $_GET['SUID'] ) : '';
$DepParent = (isset( $_GET['SDEPPARENT'] )) ? urldecode( $_GET['SDEPPARENT'] ) : '';
if (strlen( $DptoUid ) > 1 && strlen( $DepParent ) > 1) {
$aFields = $Dpto->Load( $DptoUid );
} else {
$infosubDto = $Dpto->Load( $DptoUid ); //print_r($infosubDto);
$aFields = array ('SUID' => $DptoUid,'SDEPPARENT' => $DepParent ); //print_r($aFields);print"<hr>";
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'departments/subdep_Edit', '', $aFields, 'subdep_Save' );
G::RenderPage( "publish", "raw" );

View File

@@ -1,10 +1,10 @@
<?php
/**
* groups_Save.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,57 +12,53 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <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.
*
*/
//print_r($_POST);die;
if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
//G::LoadClass('groups');
G::LoadClass('departments');
$G_MAIN_MENU = 'wf.login';
$G_MENU_SELECTED = '';
//print_r($_POST);die;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
//G::LoadClass('groups');
G::LoadClass( 'departments' );
$G_MAIN_MENU = 'wf.login';
$G_MENU_SELECTED = '';
//$oDepto = new Departos();
//$oDepto->saveNewDepto($_POST['form']);
//print_r($_GET);
$oDepto = new Department();
$depRow = $_POST['form'];
$DptoUid = (isset($_POST ['form']['SUID'])) ? urldecode($_POST['form']['SUID']):'';
$DepParent = (isset($_POST['form']['SDEPPARENT'])) ? urldecode($_POST['form']['SDEPPARENT']):'';
//if($_POST['form']['SDEP_UID']==='' && $_POST['form']['SDEP_UID'] ==='')
//if($_POST['form']['SUID']!=='' && $_POST['form']['SDEPPARENT'] ==='')
if (strlen($DptoUid) > 1 && strlen($DepParent)==1)
{
$oDepto->subcreate( $depRow );
//unset ( $depRow['DEP_UID'] );
$oDepto = new Department();
$depRow = $_POST['form'];
$DptoUid = (isset( $_POST['form']['SUID'] )) ? urldecode( $_POST['form']['SUID'] ) : '';
$DepParent = (isset( $_POST['form']['SDEPPARENT'] )) ? urldecode( $_POST['form']['SDEPPARENT'] ) : '';
//if($_POST['form']['SDEP_UID']==='' && $_POST['form']['SDEP_UID'] ==='')
//if($_POST['form']['SUID']!=='' && $_POST['form']['SDEPPARENT'] ==='')
if (strlen( $DptoUid ) > 1 && strlen( $DepParent ) == 1) {
$oDepto->subcreate( $depRow );
//unset ( $depRow['DEP_UID'] );
//$oDepto->subcreate( $depRow );
//$_POST['form']['GRP_UID']=$group->getGrpUid();
//$group->update($_POST['form']);
}
else
{// 1ro
////////$oDepto->subcreate( $depRow );
$oDepto->subupdate($depRow);
}
?>
} else {
// 1ro
////////$oDepto->subcreate( $depRow );
$oDepto->subupdate( $depRow );
}