Merge branch 'master' of git://github.com/colosa/processmaker into BUG-11603
This commit is contained in:
@@ -1170,5 +1170,44 @@ class RBAC
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* this function permissions
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function verifyPermissions ()
|
||||
{
|
||||
$message = array();
|
||||
$listPermissions = $this->loadPermissionAdmin();
|
||||
$criteria = new Criteria( 'rbac' );
|
||||
$dataset = PermissionsPeer::doSelectRS( $criteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
while (is_array( $aRow )) {
|
||||
foreach($listPermissions as $key => $item) {
|
||||
if ($aRow['PER_UID'] == $item['PER_UID'] ) {
|
||||
unset($listPermissions[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
}
|
||||
foreach($listPermissions as $key => $item) {
|
||||
$data['PER_UID'] = $item['PER_UID'];
|
||||
$data['PER_CODE'] = $item['PER_CODE'];
|
||||
$data['PER_CREATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$data['PER_UPDATE_DATE'] = $data['PER_CREATE_DATE'];
|
||||
$data['PER_STATUS'] = 1;
|
||||
$permission = new Permissions();
|
||||
$permission->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$permission->save();
|
||||
$message[] = 'Add permission missing ' . $item['PER_CODE'];
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,27 +413,7 @@ class Applications
|
||||
if (($action == "sent" || $action == "search" || $action == "simple_search" || $action == "to_revise" || $action == "to_reassign") && ($status != "TO_DO")) {
|
||||
switch ($sort) {
|
||||
case "APP_CACHE_VIEW.APP_CURRENT_USER":
|
||||
$sort = "USRCR_USR_LASTNAME";
|
||||
|
||||
$confEnvSetting = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "");
|
||||
|
||||
if (is_array($confEnvSetting)) {
|
||||
$arrayAux = explode(" ", str_replace(array("(", ")", ","), array(null, null, null), $confEnvSetting["format"]));
|
||||
|
||||
if (isset($arrayAux[0])) {
|
||||
switch (trim($arrayAux[0])) {
|
||||
case "@userName":
|
||||
$sort = "USRCR_USR_USERNAME";
|
||||
break;
|
||||
case "@firstName":
|
||||
$sort = "USRCR_USR_FIRSTNAME";
|
||||
break;
|
||||
case "@lastName":
|
||||
$sort = "USRCR_USR_LASTNAME";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sort = "USRCR_" . $conf->userNameFormatGetFirstFieldByUsersTable();
|
||||
break;
|
||||
case "APP_CACHE_VIEW.APP_TAS_TITLE":
|
||||
$sort = "APPCVCR_APP_TAS_TITLE";
|
||||
|
||||
@@ -315,7 +315,6 @@ class Configurations // extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function userNameFormat($username, $fullname)
|
||||
{
|
||||
|
||||
@@ -338,6 +337,48 @@ class Configurations // extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
public function usersNameFormatBySetParameters($formatUserName, $userName, $firstName, $lastName)
|
||||
{
|
||||
$usersNameFormat = (!empty($formatUserName))? str_replace(array("@userName", "@firstName", "@lastName"), array($userName, $firstName, $lastName), $formatUserName) : null;
|
||||
$usersNameFormat = trim($usersNameFormat);
|
||||
|
||||
return $usersNameFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first field of the UserName format
|
||||
*
|
||||
* Returns the field, based on the field name in the USERS table
|
||||
*
|
||||
* @return string Return the field
|
||||
*/
|
||||
public function userNameFormatGetFirstFieldByUsersTable()
|
||||
{
|
||||
$field = "USR_LASTNAME";
|
||||
|
||||
$confEnvSetting = $this->getConfiguration("ENVIRONMENT_SETTINGS", "");
|
||||
|
||||
if (is_array($confEnvSetting) && isset($confEnvSetting["format"])) {
|
||||
$arrayAux = explode(" ", str_replace(array("(", ")", ","), array(null, null, null), $confEnvSetting["format"]));
|
||||
|
||||
if (isset($arrayAux[0])) {
|
||||
switch (trim($arrayAux[0])) {
|
||||
case "@userName":
|
||||
$field = "USR_USERNAME";
|
||||
break;
|
||||
case "@firstName":
|
||||
$field = "USR_FIRSTNAME";
|
||||
break;
|
||||
case "@lastName":
|
||||
$field = "USR_LASTNAME";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFormats
|
||||
*
|
||||
@@ -524,9 +565,9 @@ class Configurations // extends Configuration
|
||||
$newCreation = '';
|
||||
$maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%e', 'l' => '%A', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%P', 'A' => '%p', 'g' => '%l', 'G' => '%k', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S');
|
||||
$creationDateMask = trim($creationDateMask);
|
||||
|
||||
|
||||
if (strpos($creationDateMask, ' \\d\\e ') !== false) {
|
||||
$creationDateMask = str_replace(' \\d\\e ', ' [xx] ', $creationDateMask);
|
||||
$creationDateMask = str_replace(' \\d\\e ', ' [xx] ', $creationDateMask);
|
||||
}
|
||||
|
||||
|
||||
@@ -569,15 +610,15 @@ class Configurations // extends Configuration
|
||||
$dateTime = utf8_encode(strftime($newCreation, mktime(0, 0, 0, $m, $d, $y)));
|
||||
|
||||
if (strpos($dateTime, ' ') !== false) {
|
||||
$dateTime = ucwords($dateTime);
|
||||
$dateTime = ucwords($dateTime);
|
||||
}
|
||||
|
||||
|
||||
if (strpos($dateTime, ' [xx] ') !== false) {
|
||||
$dateTime = str_replace('[xx]', ' de ', $dateTime);
|
||||
$dateTime = str_replace('[xx]', ' de ', $dateTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $dateTime;
|
||||
|
||||
@@ -248,8 +248,11 @@ class processMap
|
||||
$oTask->color = "#939598"; //Gray
|
||||
}
|
||||
} else {
|
||||
//$oTask->color = "#FF9900"; //Yellow
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
if ($aRow3) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
} else {
|
||||
$oTask->color = "#939598"; //Gray
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class workspaceTools
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Updating cache view Process took $final seconds.\n");
|
||||
|
||||
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Updating cases directories structure...\n");
|
||||
$this->upgradeCasesDirectoryStructure($workSpace);
|
||||
@@ -460,6 +460,20 @@ class workspaceTools
|
||||
//Update APP_DELEGATION.DEL_LAST_INDEX data
|
||||
$res = $appCache->updateAppDelegationDelLastIndex($lang, $checkOnly);
|
||||
|
||||
CLI::logging("-> Verifying roles permissions in RBAC \n");
|
||||
//Update table RBAC permissions
|
||||
Bootstrap::LoadSystem( 'rbac' );
|
||||
$RBAC = & RBAC::getSingleton();
|
||||
$RBAC->initRBAC();
|
||||
$result = $RBAC->verifyPermissions();
|
||||
if (count($result) > 1) {
|
||||
foreach($result as $item) {
|
||||
CLI::logging(" $item... \n");
|
||||
}
|
||||
} else {
|
||||
CLI::logging(" All roles permissions already updated \n");
|
||||
}
|
||||
|
||||
CLI::logging("-> Creating triggers\n");
|
||||
//now check if we have the triggers installed
|
||||
$triggers = array();
|
||||
|
||||
@@ -105,8 +105,8 @@ class AppNotes extends BaseAppNotes
|
||||
$response['success'] = G::LoadTranslation("ID_FAILURE");
|
||||
$response['message'] = $msg;
|
||||
} else {
|
||||
$response['success'] = "success";
|
||||
$response['message'] = G::LoadTranslation("ID_SAVED");
|
||||
$response['success'] = 'success';
|
||||
$response['message'] = '';
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
|
||||
@@ -124,7 +124,16 @@ class AppProxy extends HttpProxyController
|
||||
|
||||
//Add note case
|
||||
$appNote = new AppNotes();
|
||||
$response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail));
|
||||
try {
|
||||
$response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail));
|
||||
} catch (Exception $error) {
|
||||
$response = new stdclass();
|
||||
$response->success = 'success';
|
||||
$response->message = G::LoadTranslation('ID_ERROR_SEND_NOTIFICATIONS');
|
||||
$response->message .= '<br /><br />' . $error->getMessage() . '<br /><br />';
|
||||
$response->message .= G::LoadTranslation('ID_CONTACT_ADMIN');
|
||||
die(G::json_encode($response));
|
||||
}
|
||||
|
||||
//Send the response to client
|
||||
@ini_set("implicit_flush", 1);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$response = new stdclass();
|
||||
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
$response->lostSession = true;
|
||||
print G::json_encode( $response );
|
||||
die();
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$response = new stdclass();
|
||||
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
$response->lostSession = true;
|
||||
print G::json_encode( $response );
|
||||
die();
|
||||
}
|
||||
/**
|
||||
* casesList_Ajax.php
|
||||
@@ -54,19 +54,35 @@ if ($actionAjax == "userValues") {
|
||||
switch ($action) {
|
||||
case 'search_simple':
|
||||
case 'search':
|
||||
G::LoadClass("configuration");
|
||||
|
||||
$conf = new Configurations();
|
||||
|
||||
$confEnvSetting = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "");
|
||||
$formatUserName = null;
|
||||
|
||||
if (is_array($confEnvSetting) && isset($confEnvSetting["format"])) {
|
||||
$formatUserName = $confEnvSetting["format"];
|
||||
}
|
||||
|
||||
$cUsers = new Criteria( 'workflow' );
|
||||
$cUsers->clearSelectColumns();
|
||||
$cUsers->addSelectColumn( UsersPeer::USR_UID );
|
||||
$cUsers->addSelectColumn( UsersPeer::USR_FIRSTNAME );
|
||||
$cUsers->addSelectColumn( UsersPeer::USR_LASTNAME );
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_UID);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$cUsers->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
|
||||
$cUsers->addAscendingOrderByColumn( UsersPeer::USR_LASTNAME );
|
||||
$cUsers->addAscendingOrderByColumn(UsersPeer::TABLE_NAME . "." . $conf->userNameFormatGetFirstFieldByUsersTable());
|
||||
$oDataset = UsersPeer::doSelectRS( $cUsers );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$users[] = array ("USR_UID" => $aRow['USR_UID'],"USR_FULLNAME" => $aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME']);
|
||||
$oDataset->next();
|
||||
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
|
||||
$usrFullName = $conf->usersNameFormatBySetParameters($formatUserName, $row["USR_USERNAME"], $row["USR_FIRSTNAME"], $row["USR_LASTNAME"]);
|
||||
$usrFullName = (!empty($usrFullName))? $usrFullName : $row["USR_LASTNAME"] . " " . $row["USR_FIRSTNAME"];
|
||||
|
||||
$users[] = array("USR_UID" => $row["USR_UID"], "USR_FULLNAME" => $usrFullName);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -363,8 +363,21 @@ function sendNote()
|
||||
Ext.getCmp('caseNoteText').setDisabled(false);
|
||||
Ext.getCmp('sendBtn').setDisabled(false);
|
||||
Ext.getCmp('addCancelBtn').setDisabled(false);
|
||||
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true);
|
||||
storeNotes.load();
|
||||
if (data.message != '') {
|
||||
Ext.Msg.show({
|
||||
title : _('ID_CASES_NOTE_POST_ERROR'),
|
||||
msg : data.message,
|
||||
icon : Ext.MessageBox.WARNING,
|
||||
buttons : Ext.Msg.OK,
|
||||
fn : function(btn) {
|
||||
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true);
|
||||
storeNotes.load();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true);
|
||||
storeNotes.load();
|
||||
}
|
||||
} else if (data.lostSession) {
|
||||
Ext.Msg.show({
|
||||
title : _('ID_CASES_NOTE_POST_ERROR'),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user