Merged colosa/processmaker into master

This commit is contained in:
william barra
2015-03-05 13:29:14 -04:00
16 changed files with 201 additions and 78 deletions

View File

@@ -297,7 +297,9 @@ class WebApplication
$port = empty($port) ? '' : ";port=$port";
Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
if (DB_NAME != DB_RBAC_NAME) { //it's PM < 3
Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=".DB_RBAC_HOST.";dbname=".DB_RBAC_NAME.$port);
list($host, $port) = strpos(DB_RBAC_HOST, ':') !== false ? explode(':', DB_RBAC_HOST) : array(DB_RBAC_HOST, '');
$port = empty($port) ? '' : ";port=$port";
Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=$host;dbname=".DB_RBAC_NAME.$port);
}
// Setting default OAuth Client id, for local PM Web Designer

View File

@@ -414,7 +414,7 @@ class calendar extends CalendarDefinition
$hoursDuration -= (float)($secondRes/3600);
//$dataLog[] = (float)($secondRes/3600);
} else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate)));
$newDate = date("Y-m-d H:i:s", strtotime("+" . round(((float)($hoursDuration)) * 3600) . " seconds", strtotime($newDate)));
//$dataLog[] = (float)($hoursDuration);
$hoursDuration = 0;
}
@@ -797,4 +797,4 @@ class calendar extends CalendarDefinition
}
}
?>
?>

View File

@@ -87,21 +87,8 @@ class pmDynaform
$json->$key = $this->app_data[$triggerValue];
}
}
//data
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown")) {
$json->data = array(
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "",
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : ""
);
}
if ($key === "type" && ($value === "suggets")) {
$json->data = array(
"value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "",
"label" => isset($this->data[$json->name]) ? $this->data[$json->name] : ""
);
}
//query & options
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggets")) {
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest" || $value === "checkbox" || $value === "radio")) {
if (!isset($json->dbConnection))
$json->dbConnection = "none";
if (!isset($json->sql))
@@ -120,9 +107,24 @@ class pmDynaform
);
array_push($json->options, $option);
}
$json->data = isset($json->options[0]) ? $json->options[0] : $json->data;
if (isset($json->options[0])) {
$json->data = $json->options[0];
}
}
}
//data
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "checkbox" || $value === "radio")) {
$json->data = array(
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "",
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : ""
);
}
if ($key === "type" && ($value === "suggest")) {
$json->data = array(
"value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "",
"label" => isset($this->data[$json->name]) ? $this->data[$json->name] : ""
);
}
//grid
if ($key === "type" && ($value === "grid")) {
if (isset($this->data[$json->name])) {
@@ -135,14 +137,14 @@ class pmDynaform
//data
if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown") {
array_push($cells, array(
"value" => $row[$column->name],
"label" => $row[$column->name . "_label"]
"value" => isset($row[$column->name]) ? $row[$column->name] : "",
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : ""
));
}
if ($column->type === "suggest") {
array_push($cells, array(
"value" => $row[$column->name . "_label"],
"label" => $row[$column->name]
"value" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : "",
"label" => isset($row[$column->name]) ? $row[$column->name] : ""
));
}
}
@@ -191,6 +193,7 @@ class pmDynaform
"var credentials = " . G::json_encode($clientToken) . ";\n" .
"var filePost = null;\n" .
"var fieldsRequired = null;\n" .
"var triggerDebug = null;\n" .
"$(window).load(function () {\n" .
" var data = jsondata;\n" .
" data.items[0].mode = 'view';\n" .
@@ -221,6 +224,7 @@ class pmDynaform
public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT')
{
error_log(print_r($this->app_data, true));
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json);
@@ -242,6 +246,7 @@ class pmDynaform
"var credentials = " . G::json_encode($this->credentials) . ";\n" .
"var filePost = null;\n" .
"var fieldsRequired = null;\n" .
"var triggerDebug = " . ($this->app_data["TRIGGER_DEBUG"] === 1 ? "true" : "false") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
@@ -282,6 +287,7 @@ class pmDynaform
"var credentials = " . G::json_encode($this->credentials) . ";\n" .
"var filePost = '" . $filename . "';\n" .
"var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" .
"var triggerDebug = null;\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
@@ -387,7 +393,7 @@ class pmDynaform
{
if ($this->debugMode) {
echo "<pre>";
echo G::json_encode($json);
echo G::json_encode(array($this->app_data, $this->data));
echo "</pre>";
}
}

View File

@@ -1516,9 +1516,20 @@ class Processes
{
foreach ($SubProcess as $key => $row) {
$oSubProcess = new SubProcess();
if ($oSubProcess->subProcessExists( $row['SP_UID'] )) {
$oSubProcess->remove( $row['SP_UID'] );
}
//if ($oSubProcess->subProcessExists( $row['SP_UID'] )) {
// $oSubProcess->remove( $row['SP_UID'] );
//}
//Delete
$criteria = new Criteria("workflow");
$criteria->add(SubProcessPeer::PRO_PARENT, $row["PRO_PARENT"], Criteria::EQUAL);
$criteria->add(SubProcessPeer::TAS_PARENT, $row["TAS_PARENT"], Criteria::EQUAL);
$result = SubProcessPeer::doDelete($criteria);
//Create
$res = $oSubProcess->create( $row );
}
return;

View File

@@ -201,7 +201,7 @@ class OutputDocument extends BaseOutputDocument
}
$description .= ", By clicking on the generated file link: ".$genLink;
G::auditLog("CreateOutputDocument", $description);
return $aData['OUT_DOC_UID'];
} else {
$sMessage = '';
@@ -329,9 +329,11 @@ class OutputDocument extends BaseOutputDocument
Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid());
$iResult = $oOutputDocument->delete();
$oConnection->commit();
//Add Audit Log
G::auditLog("DeleteOutputDocument", "Output Document Name: ".$outputName.", Output Document Uid: ".$sOutDocUid.", Description: ".$outputDesc.", Filename generated: ".$outputFile);
//Add Audit Log
G::auditLog("DeleteOutputDocument", "Output Document Name: " . $oOutputDocument->getOutDocTitle() . ", Output Document Uid: " . $sOutDocUid . ", Description: " . $oOutputDocument->getOutDocDescription() . ", Filename generated: " . $oOutputDocument->getOutDocFilename());
//Return
return $iResult;
} else {
throw (new Exception('This row doesn\'t exist!'));
@@ -845,7 +847,7 @@ class OutputDocument extends BaseOutputDocument
$sContent = str_ireplace("</font>", "</span>", $sContent);
$sContent = str_replace($nrthtml, $nrt, $sContent);
$sContent = str_replace("margin-left", "text-indent", $sContent);
// define Save file

View File

@@ -189,7 +189,7 @@ class Triggers extends BaseTriggers
$description .= ", Description: ".$aData['TRI_DESCRIPTION'];
}
G::auditLog("CreateTrigger", $description);
return $result;
} else {
$con->rollback();
@@ -240,18 +240,14 @@ class Triggers extends BaseTriggers
$con->begin();
$oTri = TriggersPeer::retrieveByPK( $TriUid );
if (!is_null($oTri)) {
$triggerName = $this->getTriTitle();
$triggerDesc = $this->getTriDescription();
Content::removeContent( 'TRI_TITLE', '', $this->getTriUid());
Content::removeContent( 'TRI_DESCRIPTION', '', $this->getTriUid());
Content::removeContent("TRI_TITLE", "", $TriUid);
Content::removeContent("TRI_DESCRIPTION", "", $TriUid);
$result = $oTri->delete();
$con->commit();
//Add Audit Log
$description = "Trigger Name: ".$triggerName.", Trigger Uid: ".$TriUid;
if (isset ( $triggerDesc )) {
$description .= ", Description: ".$triggerDesc;
}
G::auditLog("DeleteTrigger", $description);
G::auditLog("DeleteTrigger", "Trigger Name: " . $oTri->getTriTitle() . ", Trigger Uid: " . $TriUid . ", Description: " . $oTri->getTriDescription());
}
return $result;
} catch (Exception $e) {

View File

@@ -1,25 +1,11 @@
function ajax_post(action, form, method, callback, asynchronous) {
document.getElementById("dyn_forward").onclick();
window.onload = function () {
method();
};
}
function dynaFormChanged(frm) {
for (var i1 = 0; i1 <= frm.elements.length - 1; i1++) {
if ((frm.elements[i1].type === "radio" || frm.elements[i1].type === "checkbox") && (frm.elements[i1].checked !== frm.elements[i1].defaultChecked)) {
return true;
}
if ((frm.elements[i1].type === "textarea" || frm.elements[i1].type === "text" || frm.elements[i1].type === "file") && (frm.elements[i1].value !== frm.elements[i1].defaultValue)) {
return true;
}
if (frm.elements[i1].tagName.toLowerCase() === "select") {
var selectDefaultValue = frm.elements[i1].value;
for (var i2 = 0; i2 <= frm.elements[i1].options.length - 1; i2++) {
if (frm.elements[i1].options[i2].defaultSelected) {
selectDefaultValue = frm.elements[i1].options[i2].value;
break;
}
}
if (frm.elements[i1].value !== selectDefaultValue) {
return true;
}
}
}
return false;
return true;
}
$(window).load(function () {
if (pm_run_outside_main_app === 'true') {
@@ -28,6 +14,7 @@ $(window).load(function () {
}
if (parent.setCurrent) {
parent.setCurrent(dyn_uid);
}
}
var data = jsondata;
@@ -88,4 +75,7 @@ $(window).load(function () {
form.submit();
return false;
};
if (triggerDebug === true) {
showdebug();
}
});

View File

@@ -272,6 +272,7 @@ try {
$a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']);
if ($a->isResponsive()) {
$a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle;
$a->app_data["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET'];
$a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode());
} else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));

View File

@@ -55,6 +55,7 @@ class Light
$task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
$response = array();
foreach ($processList as $key => $processInfo) {
$tempTreeChildren = array ();
foreach ($processList[$key] as $keyChild => $processInfoChild) {
@@ -78,7 +79,7 @@ class Light
$tempTreeChildren[] = $tempTreeChild;
}
}
$response = $tempTreeChildren;
$response = array_merge($response, $tempTreeChildren);
}
} catch (\Exception $e) {
throw $e;
@@ -592,4 +593,78 @@ class Light
return $response;
}
/**
* Get information for status paused and participated or other status
*
* @param $userUid
* @param $type
* @param $app_uid
* @throws \Exception
*/
public function getInformation($userUid, $type, $app_uid)
{
switch ($type) {
case 'paused':
case 'participated':
$oCase = new \Cases();
$iDelIndex = $oCase->getCurrentDelegationCase( $app_uid );
$aFields = $oCase->loadCase( $app_uid, $iDelIndex );
$this->getInfoResume($userUid, $aFields, $type);
break;
}
}
/**
* view in html response for status
*
* @param $userUid
* @param $Fields
* @param $type
* @throws \Exception
*/
public function getInfoResume($userUid, $Fields, $type)
{
//print_r($Fields);die;
/* Includes */
G::LoadClass( 'case' );
/* Prepare page before to show */
//$oCase = new \Cases();
// $participated = $oCase->userParticipatedInCase( $Fields['APP_UID'], $userUid );
// if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) {
// /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
// $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
// }*/
// $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' );
// $G_PUBLISH = new Publisher();
// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
// G::RenderPage( 'publishBlank', 'blank' );
// die();
// }
$objProc = new \Process();
$aProc = $objProc->load( $Fields['PRO_UID'] );
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
$objTask = new \Task();
if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) {
$task = explode('-', $Fields['TAS_UID']);
$Fields['TAS_TITLE'] = '';
for( $i = 0; $i < sizeof($task)-1; $i ++ ) {
$aTask = $objTask->load( $task[$i] );
$Fields['TAS_TITLE'][] = $aTask['TAS_TITLE'];
}
$Fields['TAS_TITLE'] = implode(" - ", array_values($Fields['TAS_TITLE']));
} else {
$aTask = $objTask->load( $Fields['TAS_UID'] );
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
}
require_once(PATH_GULLIVER .'../thirdparty/smarty/libs/Smarty.class.php');
$G_PUBLISH = new \Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' );
$G_PUBLISH->RenderContent();
}
}

View File

@@ -764,6 +764,13 @@ class Workflow extends Handler
$oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
\ProcessUserPeer::doDelete($oCriteria);
//Delete SubProcess
$criteria = new \Criteria("workflow");
$criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL);
$result = \SubProcessPeer::doDelete($criteria);
//Delete WebEntries
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();

View File

@@ -713,4 +713,22 @@ class Light extends Api
}
return $files;
}
/**
* @url GET /:type/case/:app_uid
*
* @param $access
* @param $refresh
* @return mixed
*/
public function getInformation($type, $app_uid)
{
try {
$userUid = $this->getUserId();
$oMobile = new \ProcessMaker\BusinessModel\Light();
$oMobile->getInformation($userUid, $type, $app_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -49,7 +49,7 @@ class Server implements iAuthenticate
$cnn = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword);
if (self::$isRBAC) {
$config = array('user_table' => 'USERS');
$config = array();
$cnnrbac = array('dsn' => self::$dsnRBAC, 'username' => self::$dbUserRBAC, 'password' => self::$dbPasswordRBAC);
$this->storage = new PmPdo($cnn, $config, $cnnrbac);
} else {

View File

@@ -30,7 +30,15 @@ function formatAMPM(date, initVal) {
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
return strTime;
}
};
function isBrowserIE(){
if ( (navigator.userAgent.indexOf("MSIE")!=-1) || (navigator.userAgent.indexOf("Trident")!=-1) ){
return true;
} else {
return false;
}
};
Ext.onReady(function(){
openToRevisePanel = function() {
@@ -249,7 +257,7 @@ Ext.onReady(function(){
if (iframeDynaForm.getElementsByTagName("form")) {
dynaformChange = iframeDynaForm.getElementsByTagName("form").item(0);
if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function") {
if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function" && dynaformChange) {
swDynaformChange = (window.frames["openCaseFrame"].dynaFormChanged(dynaformChange))? 1 : 0;
}
}
@@ -1531,20 +1539,24 @@ Ext.onReady(function(){
TabPanel.setActiveTab(tabId);
}
else {
TabPanel.add({
id: tabId,
title: menuSelectedTitle[name],
frameConfig: {name: name + 'Frame', id: name + 'Frame'},
defaultSrc: uri,
loadMask: {msg: _('ID_LOADING_GRID') + '...'},
autoWidth: true,
closable: true,
autoScroll: true,
bodyStyle: {height: (PMExt.getBrowser().screen.height - 60) + 'px', overflow: 'auto'}
}).show();
if(!isBrowserIE()){
TabPanel.add({
id: tabId,
title: menuSelectedTitle[name],
frameConfig: {name: name + 'Frame', id: name + 'Frame'},
defaultSrc: uri,
loadMask: {msg: _('ID_LOADING_GRID') + '...'},
autoWidth: true,
closable: true,
autoScroll: true,
bodyStyle: {height: (PMExt.getBrowser().screen.height - 60) + 'px', overflow: 'auto'}
}).show();
TabPanel.doLayout();
}
TabPanel.doLayout();
}else{
var windContainer = window.open(uri,"winContainer");
}
}
}
},
failure: function ( result, request) {

View File

@@ -7,9 +7,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/lib/pmdynaform/libs/datepicker/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery-1.11.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/datepicker/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/restclient/restclient.js"></script>
@@ -19,6 +21,7 @@
<body>
<div id="container"></div>
###TEMPLATES###
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
{javascript}
</body>