Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Victor Saisa Lopez
2014-06-27 09:14:33 -04:00
28 changed files with 219 additions and 87 deletions

View File

@@ -326,9 +326,7 @@ Bootstrap::registerClass('UsersPeer', PATH_HOME . "engine/classes/mode
Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . "class.xmlDocument.php");
G::LoadClass("case");
G::LoadClass("dates");
G::LoadClass("pmScript");
if (!defined('SYS_SYS')) {
$sObject = $argv[1];
@@ -451,6 +449,13 @@ if (!defined('SYS_SYS')) {
function processWorkspace()
{
try {
Bootstrap::LoadClass("plugin");
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
$oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
}
Bootstrap::LoadClass("case");
global $sObject;
global $sLastExecution;
@@ -578,11 +583,7 @@ function executePlugins()
// Executing registered cron files
// -> Get registered cron files
Bootstrap::LoadClass( 'plugin' );
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
$oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
}
$cronFiles = $oPluginRegistry->getCronFiles();
// -> Execute functions

View File

@@ -512,16 +512,11 @@ class Cases
try {
$oApp = new Application;
$aFields = $oApp->Load($sAppUid);
//$aFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME);
$appData = @unserialize($aFields['APP_DATA']);
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
if ($appData === false) {
$appData = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $aFields['APP_DATA']);
$appData = @unserialize($appData);
}
$appData = self::unserializeData($aFields['APP_DATA']);
$aFields['APP_DATA'] = G::array_merges(G::getSystemConstants(), $appData);
switch ($oApp->getAppStatus()) {
case 'COMPLETED':
$aFields['STATUS'] = G::LoadTranslation('ID_COMPLETED');
@@ -6456,13 +6451,13 @@ class Cases
$row[] = $aUser['USR_UID'];
}
}
global $RBAC;
//Adding the actual user if this has the PM_REASSIGNCASE permission assigned.
global $RBAC;
//Adding the actual user if this has the PM_REASSIGNCASE permission assigned.
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1){
if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)){
$row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
}
}
}
require_once 'classes/model/Users.php';
@@ -6728,4 +6723,16 @@ class Cases
}
}
}
public function unserializeData($data) {
$unserializedData = @unserialize($data);
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
if ($unserializedData === false) {
$unserializedData = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data);
$unserializedData = @unserialize($unserializedData);
}
return $unserializedData;
}
}

View File

@@ -3339,6 +3339,7 @@ class processMap
$oCriteria->addJoin(ProcessUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
$oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
$oCriteria->add(UsersPeer::USR_STATUS, "CLOSED", Criteria::NOT_EQUAL);
$oCriteria->addAscendingOrderByColumn(UsersPeer::USR_FIRSTNAME);
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

View File

@@ -361,6 +361,8 @@ class AppCacheView extends BaseAppCacheView
$c2 = new Criteria();
$c2->clearSelectColumns();
$c2->addSelectColumn(AppDelegationPeer::APP_UID);
$c2->addSelectColumn(ApplicationPeer::APP_DATA);
$c2->addJoin(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
$c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']);
$c2->add(AppDelegationPeer::USR_UID, '');
$c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
@@ -368,10 +370,11 @@ class AppCacheView extends BaseAppCacheView
$rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs2->next();
while ($row2 = $rs2->getRow()) {
$caseData = $caseInstance->LoadCase($row2['APP_UID']);
if (isset($caseData['APP_DATA'][$tasGroupVariable])) {
if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') {
if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) {
$caseData = $caseInstance->unserializeData($row2['APP_DATA']);
if (isset($caseData[$tasGroupVariable])) {
if (trim($caseData[$tasGroupVariable]) != '') {
if (in_array(trim($caseData[$tasGroupVariable]), $aGroups)) {
$cases[] = $row2['APP_UID'];
}
}

View File

@@ -15,6 +15,8 @@ class Admin extends Controller
public function system ()
{
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
require_once PATH_CONTROLLERS . 'main.php';
G::loadClass( 'system' );
$skinsList = System::getSkingList();
@@ -60,6 +62,8 @@ class Admin extends Controller
public function uxList ()
{
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
require_once PATH_CONTROLLERS . 'adminProxy.php';
$this->includeExtJS( 'admin/uxUsersList' );
G::LoadClass( 'configuration' );

View File

@@ -16,6 +16,12 @@ class Dashboard extends Controller
// Class constructor
public function __construct ()
{
global $RBAC;
if ($RBAC->userCanAccess('PM_DASHBOARD') != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header( 'location: login/login' );
exit(0);
}
G::LoadClass( 'pmDashlet' );
$this->pmDashlet = new PMDashlet();
}

View File

@@ -12,7 +12,7 @@ var stagesmap=function(){
render:{
base:function(xml) {
this.panels.editor.loader.hide();
this.data.db=xml.xmlhttp.responseText.parseJSON().concat({});
this.data.db=xml.xmlhttp.responseText.parseJSON().concatMaborak({});
if (this.options.rw===true) {
this.menu = new this.parent.module.app.menuRight();
this.menu.make({
@@ -433,7 +433,7 @@ stagesmap.prototype={
rw :true,
mi :true,
hideMenu:true
}.concat(this.options || {});
}.concatMaborak(this.options || {});
this.options.target = this.parent.dom.element(this.options.target);
if(!this.validate()){return false;}
this.observers = {

View File

@@ -73,6 +73,13 @@ try {
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers;
$oProcess = new Process();
$oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] );
//trigger debug routines...
if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) {
$trigger_debug_session = true;
}
}
if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {

View File

@@ -22,9 +22,11 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1) {
return $RBAC_Response;
}
$RBAC->requirePermissions( 'PM_SETUP' );
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' );

View File

@@ -354,7 +354,7 @@ switch ($_POST['action']) {
$rsCriteria = TaskUserPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if($rsCriteria->next() != 0) {
if ($rsCriteria->next()) {
$message = "ERROR";
}

View File

@@ -142,15 +142,31 @@ $_SESSION ['_DBArray'] = $_DBArray;
$aField ['LOGIN_VERIFY_MSG'] = G::loadTranslation ('LOGIN_VERIFY_MSG');
$aField['USER_LANG'] = SYS_LANG;
//Get Server Configuration
//G::LoadClass ('serverConfiguration'); //already called
$oServerConf = & serverConf::getSingleton ();
$G_PUBLISH = new Publisher ();
if ($oServerConf->getProperty ('LOGIN_NO_WS')) {
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'login/sysLoginNoWS', '', $aField, 'sysLogin');
} else {
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'login/sysLogin', '', $aField, 'sysLogin');
if (!defined('WS_IN_LOGIN')) {
define('WS_IN_LOGIN', 'serverconf');
}
$fileLogin = 'login/sysLogin';
switch (WS_IN_LOGIN) {
case 'serverconf':
//Get Server Configuration
$oServerConf = & serverConf::getSingleton ();
if ($oServerConf->getProperty ('LOGIN_NO_WS')) {
$fileLogin = 'login/sysLoginNoWS';
} else {
$fileLogin = 'login/sysLogin';
}
break;
case 'no':
$fileLogin = 'login/sysLoginNoWS';
break;
case 'yes':
$fileLogin = 'login/sysLogin';
break;
default:
$fileLogin = 'login/sysLogin';
break;
}
$G_PUBLISH->AddContent ('xmlform', 'xmlform', $fileLogin, '', $aField, 'sysLogin');
G::RenderPage ("publish");

View File

@@ -23,6 +23,8 @@
*/
//$oHeadPublisher = & headPublisher::getSingleton();
global $RBAC;
$RBAC->requirePermissions( 'PM_FACTORY' );
G::loadClass( 'configuration' );
$conf = new Configurations();

View File

@@ -1,4 +1,6 @@
<?php
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
// header('Pragma: no-cache');
// header('Cache-Control: no-store, no-cache, must-revalidate');

View File

@@ -21,6 +21,8 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/clearCompiled', true ); //adding a javascript file .js

View File

@@ -1,4 +1,7 @@
<?php
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
G::loadClass( 'configuration' );
$c = new Configurations();
$oHeadPublisher = & headPublisher::getSingleton();

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
G::loadClass( 'configuration' );
$oConf = new Configurations();

View File

@@ -21,6 +21,8 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
$headPublisher = & headPublisher::getSingleton();
$headPublisher->addExtJsScript( 'setup/pluginsMain', false );

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
$oHeadPublisher = & headPublisher::getSingleton();
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();

View File

@@ -1,4 +1,7 @@
<?php
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
$option = (isset($_GET["option"]))? $_GET["option"] : null;
switch ($option) {

View File

@@ -210,6 +210,14 @@ try {
$criteria->add( DashletInstancePeer::DAS_INS_OWNER_UID, $UID );
$criteria->add( DashletInstancePeer::DAS_INS_OWNER_TYPE , 'USER');
DashletInstancePeer::doDelete( $criteria );
//Delete users as supervisor
$criteria = new Criteria("workflow");
$criteria->add(ProcessUserPeer::USR_UID, $UID, Criteria::EQUAL);
$criteria->add(ProcessUserPeer::PU_TYPE, "SUPERVISOR", Criteria::EQUAL);
ProcessUserPeer::doDelete($criteria);
break;
case 'changeUserStatus':
$response = new stdclass();
@@ -390,9 +398,9 @@ try {
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);
$oCriteria->addSelectColumn(UsersPeer::USR_ROLE);
$oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE);
$oCriteria->addSelectColumn(UsersPeer::USR_STATUS);
$oCriteria->addSelectColumn(UsersPeer::USR_UX);
@@ -440,7 +448,7 @@ try {
$uRole = Array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
try {
$uRole = $oRoles->loadByCode($row['USR_ROLE']);
} catch (exception $oError) {
@@ -456,7 +464,7 @@ try {
$row['DEP_TITLE'] = isset($aDepart[$row['USR_UID']]) ? $aDepart[$row['USR_UID']] : '';
$row['USR_UX'] = isset($uxList[$row['USR_UX']]) ? $uxList[$row['USR_UX']] : $uxList['NORMAL'];
$row['USR_AUTH_SOURCE'] = isset($aAuthSources[$row['USR_UID']]) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)';
$rows[] = $row;
}
@@ -511,6 +519,29 @@ try {
$misc['REPLACED_NAME'] = $replaced_by;
echo '{success: true, userdata: ' . G::json_encode($data) . ', cases: ' . G::json_encode($aCount) . ', misc: ' . G::json_encode($misc) . '}';
break;
case "verifyIfUserAssignedAsSupervisor":
$supervisorUserUid = $_POST["supervisorUserUid"];
$message = "OK";
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ProcessUserPeer::PU_UID);
$criteria->add(ProcessUserPeer::USR_UID, $supervisorUserUid, Criteria::EQUAL);
$criteria->add(ProcessUserPeer::PU_TYPE, "SUPERVISOR", Criteria::EQUAL);
$rsCriteria = ProcessUserPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$message = "ERROR";
}
$response = array();
$response["result"] = $message;
echo G::json_encode($response);
break;
}
} catch (Exception $oException) {
die($oException->getMessage());

View File

@@ -293,7 +293,7 @@ Ext.onReady(function(){
}
});
} else {
loadMaskStep.show();
loadMaskStep.show();
document.getElementById("openCaseFrame").src = node.attributes.url;
}
} else {
@@ -462,12 +462,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -500,12 +500,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -577,12 +577,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -656,12 +656,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -694,12 +694,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -732,12 +732,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -770,12 +770,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -808,12 +808,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -954,7 +954,7 @@ Ext.onReady(function(){
{header: _('ID_LASTNAME'), dataIndex: 'USR_LASTNAME', width: 300}
]
}),
sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
store: store,
tbar:[
@@ -997,12 +997,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -1153,12 +1153,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -1191,12 +1191,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -1300,12 +1300,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
@@ -1386,12 +1386,12 @@ Ext.onReady(function(){
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn : function(btn) {
try
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
catch (err)
{
parent.location = parent.location;
}

View File

@@ -494,6 +494,28 @@ DeleteUserAction = function(){
if (uid.data.USR_UID==user_admin){
Ext.Msg.alert(_('ID_USERS'), _('ID_CANNOT_DELETE_ADMIN_USER'));
}else{
var flagVerifyUserAssigSupervisor = 1;
Ext.Ajax.request({
url: "users_Ajax",
method: "POST",
params: {
"function": "verifyIfUserAssignedAsSupervisor",
supervisorUserUid: uid.data.USR_UID
},
success: function (response, opts) {
var dataRespuesta = Ext.util.JSON.decode(response.responseText);
if (dataRespuesta.result == "OK") {
flagVerifyUserAssigSupervisor = 0;
}
},
failure: function (response, opts){
//
}
});
viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({
url: 'users_Ajax',
@@ -509,7 +531,9 @@ DeleteUserAction = function(){
}
);
}else{
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_MSG_CONFIRM_DELETE_USER'),
var msgConfirm = (flagVerifyUserAssigSupervisor == 1)? _("ID_MSG_CONFIRM_DELETE_USER_ASSINGED_SUPERVISOR") : _("ID_MSG_CONFIRM_DELETE_USER");
Ext.Msg.confirm(_('ID_CONFIRM'), msgConfirm,
function(btn){
if (btn=='yes') DeleteUser(uid.data.USR_UID);
}

View File

@@ -15,9 +15,13 @@
</SAVE>
<JS type="javascript" replacetags="1"><![CDATA[
var updateStage = function(oForm) {
ajax_post(oForm.action, oForm, 'POST');
Sm.data.db.stages[getField('THEINDEX').value].label = Sm.data.db.stages[getField('THEINDEX').value].object.elements.label.innerHTML = getField('STG_TITLE').value;
Sm.tmp.stagePanel.remove();
if (document.getElementById("form[STG_TITLE]").value.trim() != "") {
ajax_post(oForm.action, oForm, 'POST');
Sm.data.db.stages[getField('THEINDEX').value].label = Sm.data.db.stages[getField('THEINDEX').value].object.elements.label.innerHTML = getField('STG_TITLE').value;
Sm.tmp.stagePanel.remove();
} else {
msgBox("@G::LoadTranslation(ID_NAME_STG_TITLE_REQUIRE)", "alert");
}
};
]]></JS>
</dynaForm>

View File

@@ -320,6 +320,8 @@ define( 'MEMCACHED_ENABLED', $config['memcached'] );
define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define( 'TIME_ZONE', $config['time_zone'] );
define ('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf');
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];