diff --git a/gulliver/js/ext/pmos-common.js b/gulliver/js/ext/pmos-common.js
index e9999ced1..bd38119ec 100755
--- a/gulliver/js/ext/pmos-common.js
+++ b/gulliver/js/ext/pmos-common.js
@@ -1,6 +1,6 @@
PMExtJSCommon = function() {
this.version = '1.8';
-
+
this.notify_time_out = 3;
this.confirm = function(title, msg, fnYes, fnNo)
@@ -16,9 +16,9 @@ PMExtJSCommon = function() {
setTimeout(fnYes, 0)
else if( fnNo != undefined )
setTimeout(fnNo, 0)
- });
+ });
}
-
+
this.info = function(title, msg, fn) {
Ext.MessageBox.show({
title: title,
@@ -65,12 +65,12 @@ PMExtJSCommon = function() {
icon: Ext.MessageBox.ERROR
});
}
-
+
this.notify = function(title, msg, type, time)
{
Ext.msgBoxSlider.msg(title, msg, type, time);
}
-
+
this.getBrowser = function()
{
var browsersList = new Array("opera", "msie", "firefox", "chrome", "safari");
@@ -78,12 +78,12 @@ PMExtJSCommon = function() {
var name = 'Unknown';
var version = '';
var screen = {
- width : Ext.getBody().getViewSize().width,
+ width : Ext.getBody().getViewSize().width,
height : Ext.getBody().getViewSize().height
};
-
+
var so = Ext.isLinux ? 'Linux' : ( Ext.isWindows ? 'Windows' : (Ext.isMac ? 'Mac OS' : 'Unknown') );
-
+
for (var i = 0; i < browsersList.length; i++){
if ((name == "") && (browserMeta.indexOf(browsersList[i]) != -1)){
name = browsersList[i];
@@ -91,7 +91,7 @@ PMExtJSCommon = function() {
break;
}
}
-
+
return {name:name, version:version, screen: screen}
}
@@ -100,7 +100,7 @@ PMExtJSCommon = function() {
var labelColumnWidth = 170;
var valueColumnWidth = 350;
params = params || {};
-
+
if(typeof columnsSize != 'undefined') {
labelColumnWidth = columnsSize[0] || labelColumnWidth;
valueColumnWidth = columnsSize[1] || valueColumnWidth;
@@ -124,7 +124,7 @@ PMExtJSCommon = function() {
dataIndex : 'label',
renderer: function(v){return ''+v+''},
align: 'right'
- },
+ },
{
width : valueColumnWidth,
dataIndex : 'value'
@@ -133,7 +133,7 @@ PMExtJSCommon = function() {
dataIndex : 'section'
}],
autoHeight : true,
- columnLines: true,
+ columnLines: true,
trackMouseOver:false,
disableSelection:true,
view: new Ext.grid.GroupingView({
@@ -171,7 +171,7 @@ PMExtJSCommon = function() {
}
}
-}
+}
var PMExt = new PMExtJSCommon();
@@ -198,7 +198,7 @@ Ext.msgBoxSlider = function(){
}
//msgCt.alignTo(document, 'br-br');
//msgCt.alignTo(document, "br-br", [-20, -20]);
-
+
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
m.setWidth(400 );
@@ -207,7 +207,7 @@ Ext.msgBoxSlider = function(){
type = typeof type != 'undefined' ? type : '';
time = typeof time != 'undefined' ? time : PMExt.notify_time_out;
-
+
switch(type) {
case 'alert':
case 'warning':
@@ -222,7 +222,7 @@ Ext.msgBoxSlider = function(){
case 'info':
image = '/images/info.png';
break;
- case 'success':
+ case 'success':
case 'ok':
image = '/images/select-icon.png';
break;
@@ -244,7 +244,7 @@ Ext.msgBoxSlider = function(){
},
msgTopCenter : function(type, title, format, time) {
- if (typeof remove == 'undefined')
+ if (typeof remove == 'undefined')
remove : true;
time = typeof time != 'undefined' ? time : PMExt.notify_time_out;
@@ -252,7 +252,7 @@ Ext.msgBoxSlider = function(){
if( ! msgCt ) {
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div', style:'position:absolute'}, true);
}
-
+
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 2));
var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
m.setWidth(400 );
@@ -273,7 +273,7 @@ Ext.msgBoxSlider = function(){
case 'info':
image = '/images/info.png';
break;
- case 'success':
+ case 'success':
case 'ok':
image = '/images/select-icon.png';
break;
@@ -318,7 +318,7 @@ Ext.msgBoxSlider = function(){
};
}();*/
-/**
+/**
* Translator function for internationalization
*/
function _()
@@ -328,20 +328,20 @@ function _()
if( typeof TRANSLATIONS != 'undefined' && TRANSLATIONS) {
if( typeof TRANSLATIONS[argv[0]] != 'undefined' ) {
- if (argc > 1) {
+ if (argc > 1) {
trn = TRANSLATIONS[argv[0]];
for (i = 1; i < argv.length; i++) {
trn = trn.replace('{'+(i-1)+'}', argv[i]);
}
}
else {
- trn = TRANSLATIONS[argv[0]];
+ trn = TRANSLATIONS[argv[0]];
}
- }
+ }
else {
trn = '**' + argv[0] + '**';
}
- }
+ }
else {
PMExt.error('Processmaker JS Core Error', 'The TRANSLATIONS global object is not loaded!');
trn = '';
@@ -349,18 +349,18 @@ function _()
return trn;
}
-/**
+/**
* Environment Formats function for full name
*/
function _FNF(USER_NAME, FIRST_NAME, LAST_NAME, FN_FORMAT)
-{
+{
if (typeof FORMATS != 'undefined') {
FN_FORMAT = FORMATS.format;
}
else {
FN_FORMAT = '(@lastName, @firstName) @userName';
}
-
+
var aux = FN_FORMAT;
aux = aux.replace('@userName',USER_NAME);
aux = aux.replace('@firstName',FIRST_NAME);
@@ -368,13 +368,13 @@ function _FNF(USER_NAME, FIRST_NAME, LAST_NAME, FN_FORMAT)
return aux;
}
-/**
+/**
* Environment Formats function for date
*/
function _DF(DATE_TIME, D_FORMAT)
{
function LZ(x){return(x<0||x>9?"":"0")+x;}
-
+
if(typeof D_FORMAT == 'undefined'){
if (typeof FORMATS != 'undefined') {
D_FORMAT = FORMATS.dateFormat;
@@ -388,7 +388,7 @@ function _DF(DATE_TIME, D_FORMAT)
if (DATE_TIME == '')
return '';
else
- return '**' + DATE_TIME + '**';
+ return '**' + DATE_TIME + '**';
}
var arrD = DATE_TIME.split(' ');
@@ -400,8 +400,8 @@ function _DF(DATE_TIME, D_FORMAT)
else {
var arrH = new Array(0,0,0);
}
-
-
+
+
var MONTH_NAMES=new Array(_('ID_MONTH_1'),_('ID_MONTH_2'),_('ID_MONTH_3'),_('ID_MONTH_4'),_('ID_MONTH_5'),_('ID_MONTH_6'),_('ID_MONTH_7'),
_('ID_MONTH_8'),_('ID_MONTH_9'),_('ID_MONTH_10'),_('ID_MONTH_11'),_('ID_MONTH_12'),_('ID_MONTH_ABB_1'),_('ID_MONTH_ABB_2'),
_('ID_MONTH_ABB_3'),_('ID_MONTH_ABB_4'),_('ID_MONTH_ABB_5'),_('ID_MONTH_ABB_6'),_('ID_MONTH_ABB_7'),_('ID_MONTH_ABB_8'),
@@ -410,7 +410,7 @@ function _DF(DATE_TIME, D_FORMAT)
_('ID_WEEKDAY_6'),_('ID_WEEKDAY_ABB_0'),_('ID_WEEKDAY_ABB_1'),_('ID_WEEKDAY_ABB_2'),_('ID_WEEKDAY_ABB_3'),_('ID_WEEKDAY_ABB_4'),
_('ID_WEEKDAY_ABB_5'),_('ID_WEEKDAY_ABB_6'));
- var date = new Date(arrF[0],parseInt(arrF[1])-1,arrF[2],arrH[0],arrH[1],arrH[2],0);
+ var date = new Date(arrF[0],parseFloat(arrF[1])-1,arrF[2],arrH[0],arrH[1],arrH[2],0);
var y=date.getFullYear()+'';
var M=date.getMonth()+1;
var d=date.getDate();
@@ -418,7 +418,7 @@ function _DF(DATE_TIME, D_FORMAT)
var H=date.getHours();
var m=date.getMinutes();
var s=date.getSeconds();
-
+
var values = new Object();
values['Y'] = y;
values['y'] = y.substring(2, 4);
@@ -442,14 +442,14 @@ function _DF(DATE_TIME, D_FORMAT)
if (H>11) values['A'] = 'PM'; else values['A'] = 'AM';
if (typeof FORMATS == 'undefined') values['T'] = '**';
else values['T'] = FORMATS.TimeZone;
-
+
var aDate = D_FORMAT.split('');
var aux = '';
-
+
var xParts = new Array('Y','y','F','M','m','n','d','j','D','l','G','H','g','h','i','s','a','A','T');
for (var i=0; i < aDate.length; i++){
if (xParts.indexOf(aDate[i])==-1){
- aux = aux + aDate[i];
+ aux = aux + aDate[i];
}
else{
aux = aux + values[aDate[i]];
@@ -482,3 +482,13 @@ String.prototype.nl2br = function () {
return this.replace(/\n/g,'
');
}
+/**
+ * String Replace function, if StrSearch has special characters "(", "[", must be escape "\\(", "\\[".
+ */
+function stringReplace(strSearch, stringReplace, str)
+{
+ var expression = eval("/" + strSearch + "/g");
+
+ return str.replace(expression, stringReplace);
+}
+
diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php
index 7588f7198..adce69861 100755
--- a/gulliver/system/class.g.php
+++ b/gulliver/system/class.g.php
@@ -563,14 +563,21 @@ class G
}
if (is_dir($dirName)) {
- foreach(glob($dirName . '/*') as $file) {
+ foreach(glob($dirName . '/{,.}*', GLOB_BRACE) as $file) {
+ if ( $file == $dirName . '/.' || $file == $dirName . '/..') {
+ continue;
+ }
if(is_dir($file)) {
G::rm_dir($file);
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
- exec('DEL /F /S /Q %' . $dirName . '%', $res);
- else
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ $dirNameWin = str_replace('/','\\' ,$dirName);
+ exec('DEL /F /S /Q ' . $dirNameWin . '', $res);
+ exec('RD /S /Q ' . $dirNameWin . '', $res);
+ } else {
@rmdir($file);
+ }
+
}
else {
@unlink($file);
diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php
index ae33bb2fb..d714065cb 100755
--- a/gulliver/system/class.xmlform.php
+++ b/gulliver/system/class.xmlform.php
@@ -1242,6 +1242,17 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$depValues = '+';
}
+ $aDepFields = array();
+ $count = 0;
+ if ($this->dependentFields !== '') {
+ $sqlDepField = $owner->fields[$this->dependentFields]->sql;
+ $count = preg_match_all('/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/',
+ $sqlDepField, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
+ for ($cnt = 0; $cnt < $count; $cnt++) {
+ $aDepFields[$cnt] = $match[2][$cnt][0];
+ }
+ }
+
$sOptions = 'script: function (input) { ';
$sOptions .= ' var inputValue = base64_encode(getField(\''. $this->name .'_label\').value); ';
@@ -1251,7 +1262,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= '},';
$sOptions .= 'json: true,';
$sOptions .= 'limit: '.$this->maxresults.',';
- // $sOptions .= 'varname: "input",';
+
$sOptions .= 'shownoresults: ' . ($this->shownoresults ? 'true' : 'false') . ',';
$sOptions .= 'maxresults: '.$this->maxresults.',';
$sOptions .= 'chache: true,';
@@ -1260,8 +1271,20 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= 'callback: function(obj){';
- $sOptions .= ' var jField = { ' . $this->name . ' : obj.id };';
+ $sOptions .= ' var jField = { };';
+ $sOptions .= ' var sField = "[]"; ';
+ if ($count > 0) {
+ for ($cnt = 0; $cnt < $count; $cnt++ ) {
+ $sOptions .= 'if ( "' . $this->name . '" == "' . $aDepFields[$cnt] . '" ) {';
+ $sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = obj.id;';
+ $sOptions .= '} else { ';
+ $sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = getField(\'' . $aDepFields[$cnt] . '\').value; ';
+ $sOptions .= '}';
+ }
+ }
+
$sOptions .= ' var sField = "["+ encodeURIComponent(jField.toJSONString()) + "]"; ';
+
$sOptions .= $sCallBack . '; getField("' . $this->name . '").value = obj.id;';
$sOptions .= 'var response = ajax_function("../gulliver/defaultAjaxDynaform", "reloadField", ';
@@ -1279,6 +1302,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= ' for (ni = 0; ni < fieldLength; ni++ ){ ';
$sOptions .= ' getField(newcont[i].name).options.remove(ni); ';
$sOptions .= ' } ';
+ $sOptions .= ' getField(newcont[i].name).length = 0; ';
$sOptions .= ' for (ni = 0; ni < newcont[i].content.options.length; ni++ ){ ';
$sOptions .= ' var opt = document.createElement("OPTION"); ';
diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php
index 7eb39bce4..33d0fde56 100644
--- a/workflow/engine/bin/reindex_solr.php
+++ b/workflow/engine/bin/reindex_solr.php
@@ -23,14 +23,51 @@
*/
// check script parameters
-// php reindex_solr.php workspacename [reindexall|reindexmissing]
+// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
// var_dump($argv);
-if (count ($argv) != 3) {
- print "Invalid command line arguments: \n syntax: php reindex_solr.php [workspace_name] [reindexall|reindexmissing] \n" . " Where reindexall : reindex all the database \n" . " reindexmissing: reindex only the missing records stored in database.\n";
+//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
+$commandLineSyntaxMsg = "Invalid command line arguments: \n " .
+ "syntax: ".
+ "php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex] [-skip {record_number}] [-reindextrunksize {trunk_size}]\n" .
+ " Where \n".
+ " reindexall : reindex all the database. \n" .
+ " reindexmissing: reindex only the missing records stored in database. \n".
+ " (records defined in APP_SOLR_QUEUE table are required)\n" .
+ " optimizeindex: optimize the changes in the search index. (used to get faster results) \n" .
+ " Optional Options: \n" .
+ " -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" .
+ " -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
+
+if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
+ ($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex')) {
+ print $commandLineSyntaxMsg;
die ();
}
$workspaceName = $argv [1];
$ScriptAction = $argv [2];
+$SkipRecords = 0;
+$TrunkSize = 1000;
+//3 5 7
+if(count ($argv) > 3) {
+ for($argNumber = 3 ; $argNumber < count ($argv) ; $argNumber += 2) {
+ if(($argv [$argNumber] == '-skip' || $argv [$argNumber] == '-reindextrunksize')) {
+ //get options
+ if($argv [$argNumber] == '-skip') {
+ //use skip option
+ $SkipRecords = intval($argv [$argNumber + 1]);
+ }
+ if($argv [$argNumber] == '-reindextrunksize') {
+ //use skip option
+ $TrunkSize = intval($argv [$argNumber + 1]);
+ }
+ }
+ else {
+ print $commandLineSyntaxMsg;
+ die ();
+ }
+ }
+}
+
ini_set ('display_errors', 1);
error_reporting (E_ALL);
@@ -237,6 +274,8 @@ function processWorkspace()
{
global $sLastExecution;
global $ScriptAction;
+ global $SkipRecords;
+ global $TrunkSize;
try {
@@ -249,11 +288,14 @@ function processWorkspace()
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") {
- $oAppSolr->reindexAllApplications ();
+ $oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
}
if ($ScriptAction == "reindexmissing") {
$oAppSolr->synchronizePendingApplications ();
}
+ if ($ScriptAction == "optimizeindex") {
+ $oAppSolr->optimizeSearchIndex ();
+ }
}
else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
diff --git a/workflow/engine/classes/class.AppSolr.php b/workflow/engine/classes/class.AppSolr.php
index f414680e5..2d55083bd 100644
--- a/workflow/engine/classes/class.AppSolr.php
+++ b/workflow/engine/classes/class.AppSolr.php
@@ -85,6 +85,31 @@ class ApplicationWithoutDelegationRecordsException extends Exception
}
}
+/**
+ * Dynaform file corrupt
+ *
+ * @author Herbert Saal Gutierrez
+ *
+ * @category Colosa
+ * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com)
+ */
+class ApplicationWithCorruptDynaformException extends Exception
+{
+ // Redefine the exception so message isn't optional
+ public function __construct($message, $code = 0)
+ {
+ // some code
+ // make sure everything is assigned properly
+ parent::__construct ($message, $code);
+ }
+
+ // custom string representation of object
+ public function __toString()
+ {
+ return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
+ }
+}
+
/**
* Application APP_DATA could not be unserialized exception
*
@@ -219,6 +244,7 @@ class AppSolr
$swErrorInSearchText = false;
$solrQueryResult = null;
$aPriorities = array('1'=>'VL', '2'=>'L', '3'=>'N', '4'=>'H', '5'=>'VH');
+ $delegationIndexes = array();
$result = array ();
$result ['totalCount'] = 0;
@@ -321,30 +347,30 @@ class AppSolr
if ($userUid != null && $action == 'todo') {
if ($filter == 'read') {
$solrSearchText .= "APP_ASSIGNED_USERS_READ:" . $userUid . " AND ";
- $delIndexDynaField = "APP_ASSIGNED_USER_READ_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_ASSIGNED_USER_READ_DEL_INDEX_" . trim ($userUid) . '_txt';
}
elseif ($filter == 'unread') {
$solrSearchText .= "APP_ASSIGNED_USERS_UNREAD:" . $userUid . " AND ";
- $delIndexDynaField = "APP_ASSIGNED_USER_UNREAD_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_ASSIGNED_USER_UNREAD_DEL_INDEX_" . trim ($userUid) . '_txt';
}
else {
$solrSearchText .= "APP_ASSIGNED_USERS:" . $userUid . " AND ";
- $delIndexDynaField = "APP_ASSIGNED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
}
}
// participated, add condition
if ($userUid != null && $action == 'sent') {
if ($filter == 'started') {
$solrSearchText .= "APP_PARTICIPATED_USERS_STARTED:" . $userUid . " AND ";
- $delIndexDynaField = "APP_PARTICIPATED_USER_STARTED_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_PARTICIPATED_USER_STARTED_DEL_INDEX_" . trim ($userUid) . '_txt';
}
elseif ($filter == 'completed') {
$solrSearchText .= "APP_PARTICIPATED_USERS_COMPLETED:" . $userUid . " AND ";
- $delIndexDynaField = "APP_PARTICIPATED_USER_COMPLETED_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_PARTICIPATED_USER_COMPLETED_DEL_INDEX_" . trim ($userUid) . '_txt';
}
else {
$solrSearchText .= "APP_PARTICIPATED_USERS:" . $userUid . " AND ";
- $delIndexDynaField = "APP_PARTICIPATED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_PARTICIPATED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
}
}
// draft, add condition
@@ -356,6 +382,7 @@ class AppSolr
if ($userUid != null && $action == 'unassigned') {
// get the list of groups to which belongs the user.
$userGroups = $this->getUserGroups ($userUid);
+
$solrSearchText .= "(APP_UNASSIGNED_USERS:" . $userUid;
if (count ($userGroups) > 0) {
$solrSearchText .= " OR ";
@@ -370,7 +397,10 @@ class AppSolr
}
$solrSearchText .= ") AND ";
- $delIndexDynaField = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($userUid) . '_txt';
+ $delegationIndexes[] = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($userUid) . '_txt';
+ foreach ($userGroups as $group) {
+ $delegationIndexes[] = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($group ['GRP_UID']) . '_txt';
+ }
}
// remove last AND in condition
@@ -392,10 +422,9 @@ class AppSolr
if ($search != "")
$solrSearchText .= "(" . $search . ")";
}
- // add del_index dynamic field to list of resulting columns
- $columsToInclude = array_merge ($columsToInclude, array (
- $delIndexDynaField
- ));
+ // add del_index dynamic fields to list of resulting columns
+ // the fields begin in the 30th column and more
+ $columsToInclude = array_merge ($columsToInclude, $delegationIndexes);
// if is a counter no records are returned
if ($doCount) {
@@ -420,6 +449,7 @@ class AppSolr
'resultFormat' => 'json'
);
+
$solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data);
// use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
@@ -465,13 +495,24 @@ class AppSolr
$result ['totalCount'] = $solrQueryResult->iTotalDisplayRecords;
// complete the missing data to display it in the grid.
+ $delIndexes = array(); //store all the delegation indexes
foreach ($solrQueryResult->aaData as $i => $data) {
+ //initialize array
+ $delIndexes = array();
// complete empty values
$appUID = $data [11];
- $delIndexes = $data [30];
+ //get all the delindexes
+ for($i = 30 ; $i < count($data) ; $i++) {
+ if (is_array ($data [$i])) {
+ foreach($data [$i] as $delIndex){
+ $delIndexes[] = $delIndex;
+ }
+ }
+ }
// verify if the delindex is an array
- // if is not an array all the indexed must be returned
- if (! is_array ($delIndexes)) {
+ // if is not check different types of repositories
+ // the delegation index must always be defined.
+ if (count($delIndexes) == 0) {
// if is draft
if ($action == 'draft') {
$delIndexes [] = 1; // the first default index
@@ -480,9 +521,14 @@ class AppSolr
// get all the indexes
$delIndexes = $this->getApplicationDelegationsIndex ($appUID);
}
- else {
- $delIndexes = array();
+ else {
+ //error an index must always be defined
+ print "Delegation not defined\n";
}
+ /*
+ elseif ($action == 'unassigned'){
+ $delIndexes = $this->getApplicationDelegationsIndex ($appUID);
+ }*/
}
foreach ($delIndexes as $delIndex) {
$aRow = array ();
@@ -535,14 +581,14 @@ class AppSolr
return $result;
} // end try
- catch ( InvalidIndexSearchTextException $e ) {
+ catch ( InvalidIndexSearchTextException $ex ) {
// return empty result with description of error
$result = array ();
$result ['totalCount'] = 0;
$result ['data'] = array ();
$result ['success'] = true;
$result ['result'] = false;
- $result ['message'] = $e->getMessage ();
+ $result ['message'] = $ex->getMessage ();
return $result;
}
}
@@ -928,6 +974,7 @@ class AppSolr
}
+
/**
* Update the information of the specified applications in Solr
*
@@ -954,6 +1001,7 @@ class AppSolr
foreach ($aaAPPUIDs as $aAPPUID) {
$this->applicationChangedUpdateSolrQueue ($aAPPUID ['APP_UID'], true);
}
+ return;
}
// create XML document
$xmlDoc = $this->createSolrXMLDocument ($aaAPPUIDs);
@@ -974,8 +1022,8 @@ class AppSolr
$oSearchIndex->updateIndexDocument ($oSolrUpdateDocument);
// commit changes
$oSearchIndex->commitIndexChanges ($this->_solrInstance);
- } catch(Exception $ex)
- {
+ }
+ catch(Exception $ex) {
//print "Excepcion indexing data: " . $ex->getMessage() . "\n"; die;
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, $ex->getMessage());
@@ -1032,11 +1080,27 @@ class AppSolr
try {
$result = $this->getApplicationIndexData ($aAPPUID ['APP_UID']);
}
- catch ( ApplicationWithoutDelegationRecordsException $e ) {
+ catch ( ApplicationWithoutDelegationRecordsException $ex ) {
// exception trying to get application information
// skip and continue with the next application
+ $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
+ fwrite($fh, $ex->getMessage());
+ fclose($fh);
continue;
}
+ catch( ApplicationWithCorruptDynaformException $ex) {
+ $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
+ fwrite($fh, $ex->getMessage());
+ fclose($fh);
+ continue;
+ }
+ catch (Exception $ex) {
+ $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
+ fwrite($fh, "getApplicationIndexData " . $aAPPUID . ":" . $ex->getMessage() . "\n");
+ fclose($fh);
+ continue;
+ }
+
$documentInformation = $result [0];
$dynaformFieldTypes = $result [1];
$lastUpdateDate = $result [2];
@@ -1058,14 +1122,20 @@ class AppSolr
$draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser,
$unassignedUsers, $unassignedGroups);
}
- catch ( ApplicationAPP_DATAUnserializeException $e ) {
+ catch ( ApplicationAPP_DATAUnserializeException $ex ) {
// exception trying to get application information
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
- fwrite($fh, $e->getMessage());
+ fwrite($fh, $ex->getMessage());
fclose($fh);
// skip and continue with the next application
continue;
}
+ catch (Exception $ex) {
+ $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
+ fwrite($fh, "buildSearchIndexDocumentPMOS2 " . $aAPPUID . ":" . $ex->getMessage() . "\n");
+ fclose($fh);
+ continue;
+ }
}
@@ -1315,8 +1385,8 @@ class AppSolr
// add dynamic field for del_index information
$writer->startElement ("field");
- $writer->writeAttribute ('name', 'APP_UNASSIGNED_USER_GROUP_DEL_INDEX_' . trim ($userUID ['USR_UID']) . '_txt');
- $writer->text ($userUID ['DEL_INDEX']);
+ $writer->writeAttribute ('name', 'APP_UNASSIGNED_USER_GROUP_DEL_INDEX_' . trim ($groupUID ['USR_UID']) . '_txt');
+ $writer->text ($groupUID ['DEL_INDEX']);
$writer->endElement ();
}
}
@@ -1333,7 +1403,7 @@ class AppSolr
if (! $UnSerializedCaseData) {
// error unserializing
- throw new ApplicationAPP_DATAUnserializeException ("Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID']);
+ throw new ApplicationAPP_DATAUnserializeException ("Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID'] . "\n");
}
else {
foreach ($UnSerializedCaseData as $k => $value) {
@@ -1347,14 +1417,14 @@ class AppSolr
$typeSufix = '_t';
break;
case 'Int' :
- if(intval ($value) > 2147483647) {
+ if(intval ($value) > 2147483647) {
$typeSufix = '_tl'; //for long values
$value = intval ($value);
- }
- else {
- $typeSufix = '_ti';
+ }
+ else {
+ $typeSufix = '_ti';
$value = intval ($value);
- }
+ }
break;
case 'Real' :
$typeSufix = '_td';
@@ -1397,7 +1467,7 @@ class AppSolr
break;
case 'currency' :
$typeSufix = '_td';
- $value = floatval ($value);
+ $value = floatval ($value);
break;
case 'percentage' :
$typeSufix = '_t';
@@ -1481,7 +1551,7 @@ class AppSolr
// this case occurs when the application doesn't have related delegation
// records.
if (empty ($allAppDbData) || ! isset ($allAppDbData [0])) {
- throw new ApplicationWithoutDelegationRecordsException ("Application without delegation records. APP_UID: " . $AppUID);
+ throw new ApplicationWithoutDelegationRecordsException ("Application without delegation records. APP_UID: " . $AppUID . "\n");
}
// copy the application information
@@ -1593,33 +1663,42 @@ class AppSolr
// search information of unassigned users
// the unassigned users are the self service users and groups.
// the self service users are defined in the TASKs of the PROCESS.
- foreach ($allAppDbData as $row) {
+ $unassignedUsers = array ();
+ $unassignedGroups = array ();
+ //filter only the delegations that are in selfservice status
+ // `USR_UID` = '' AND `DEL_FINISH_DATE` IS NULL
+ $indexes = $this->aaSearchRecords ($allAppDbData, array (
+ 'USR_UID' => 'NULL',
+ 'DEL_FINISH_DATE' => 'NULL',
+ 'APP_THREAD_STATUS' => 'OPEN'
+ ));
+ foreach ($indexes as $index) {
$unassignedUsersGroups = array ();
// use cache
$oMemcache = PMmemcached::getSingleton ($this->_solrInstance);
- $unassignedUsersGroups = $oMemcache->get ($row ['PRO_UID'] . "_" . $row ['TAS_UID']);
+ $unassignedUsersGroups = $oMemcache->get ($allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID']);
if (! $unassignedUsersGroups) {
- $unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData ($row ['PRO_UID'], $row ['TAS_UID']);
+ $unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData ($allAppDbData [$index] ['PRO_UID'], $allAppDbData [$index] ['TAS_UID']);
- // add del_index
+ // if the task has unassigned users or groups add del_index of delegation
foreach ($unassignedUsersGroups as $i => $newRow) {
- $unassignedUsersGroups [$i] ['DEL_INDEX'] = $row ['DEL_INDEX'];
+ $unassignedUsersGroups [$i] ['DEL_INDEX'] = $allAppDbData [$index] ['DEL_INDEX'];
}
// store in cache
- $oMemcache->set ($row ['PRO_UID'] . "_" . $row ['TAS_UID'], $unassignedUsersGroups);
+ $oMemcache->set ($allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID'], $unassignedUsersGroups);
}
// copy list of unassigned users and groups
- $unassignedUsers = array ();
- $unassignedGroups = array ();
foreach ($unassignedUsersGroups as $unassignedUserGroup) {
+ //unassigned users
if ($unassignedUserGroup ['TU_RELATION'] == 1) {
$unassignedUsers [] = array (
'USR_UID' => $unassignedUserGroup ['USR_UID'],
'DEL_INDEX' => $unassignedUserGroup ['DEL_INDEX']
);
}
+ //unassigned groups
elseif ($unassignedUserGroup ['TU_RELATION'] == 2) {
$unassignedGroups [] = array (
'USR_UID' => $unassignedUserGroup ['USR_UID'],
@@ -1644,12 +1723,17 @@ class AppSolr
G::LoadClass ('dynaformhandler');
$dynaformFileNames = $this->getProcessDynaformFileNames ($documentInformation ['PRO_UID']);
$dynaformFields = array ();
- foreach ($dynaformFileNames as $dynaformFileName) {
+ foreach ($dynaformFileNames as $dynaformFileName) {
if (file_exists (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') &&
filesize(PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') >0 ) {
$dyn = new dynaFormHandler (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml');
$dynaformFields [] = $dyn->getFields ();
}
+ if (file_exists (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') &&
+ filesize(PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') == 0 ) {
+
+ throw new ApplicationWithCorruptDynaformException("Application with corrupt dynaform. APP_UID: " . $AppUID . "\n");
+ }
}
foreach ($dynaformFields as $aDynFormFields) {
@@ -1787,10 +1871,10 @@ class AppSolr
* Search array of indexes that fullfill the conditions
*
* @param
- * array o arrays $arr contains the arrays that are searched
+ * array of arrays $arr contains the arrays that are searched
* @param array $andColumnsConditions
* contain the conditions that must fullfill 'Column'=>'Condition'
- * @return array array of indexes with the found records
+ * @return array of indexes with the found records
*/
public function aaSearchRecords($arr, $andColumnsConditions)
{
@@ -2092,11 +2176,28 @@ class AppSolr
*/
public function getCountApplicationsSearchIndex()
{
+ G::LoadClass ('searchIndex');
+
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query
$count = $searchIndex->getNumberDocuments ($this->_solrInstance);
return $count;
+ }
+
+ /**
+ * Optimize the records in search index
+ *
+ * @return
+ */
+ public function optimizeSearchIndex()
+ {
+ G::LoadClass ('searchIndex');
+
+ $searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
+ // execute query
+ $searchIndex->optimizeIndexChanges ($this->_solrInstance);
+
}
/**
@@ -2135,9 +2236,9 @@ class AppSolr
* Reindex all the application records in Solr server
* update applications in groups of 1000
*/
- public function reindexAllApplications()
+ public function reindexAllApplications($SkipRecords = 0, $indexTrunkSize = 1000)
{
- $trunk = 1000;
+ $trunk = $indexTrunkSize;
// delete all documents to begin reindex
// deleteAllDocuments();
// commitChanges();
@@ -2147,8 +2248,8 @@ class AppSolr
print "Total number of records: " . $numRows . "\n";
//
$initTimeAll = microtime (true);
- // $numRows = 15;
- for ($skip = 0; $skip <= $numRows;) {
+
+ for ($skip = $SkipRecords; $skip <= $numRows;) {
$aaAPPUIds = $this->getPagedApplicationUids ($skip, $trunk);
printf ("Indexing %d to %d \n", $skip, $skip + $trunk);
@@ -2162,6 +2263,7 @@ class AppSolr
$curTimeDoc = gmdate ('H:i:s', (microtime (true) - $initTimeAll));
printf ("Total reindex time: %s \n", $curTimeDoc);
+ printf ("Reindex completed successfully!!.\n");
}
}
diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php
index 5c144b8c3..e1d79ae46 100755
--- a/workflow/engine/classes/class.processMap.php
+++ b/workflow/engine/classes/class.processMap.php
@@ -445,6 +445,7 @@ class processMap {
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
$aFields['PRO_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo ['CALENDAR_UID'] : "";
+ $aFields['SYS_LANG'] = SYS_LANG;
global $G_PUBLISH;
$G_PUBLISH = new Publisher ( );
diff --git a/workflow/engine/classes/class.searchIndex.php b/workflow/engine/classes/class.searchIndex.php
index 29751d995..26888f28c 100644
--- a/workflow/engine/classes/class.searchIndex.php
+++ b/workflow/engine/classes/class.searchIndex.php
@@ -331,6 +331,20 @@ class BpmnEngine_Services_SearchIndex
$solr->commitChanges ($workspace);
}
+ /**
+ * Optimize index changes
+ * @param string $workspace
+ */
+ public function optimizeIndexChanges($workspace)
+ {
+ G::LoadClass ('solr');
+
+ $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
+
+ // commit
+ $solr->optimizeChanges ($workspace);
+ }
+
/**
* Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData
diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php
index 20b214e84..1c89da681 100755
--- a/workflow/engine/classes/class.wsTools.php
+++ b/workflow/engine/classes/class.wsTools.php
@@ -968,10 +968,16 @@ class workspaceTools {
$backup = new Archive_Tar($filename);
//Get a temporary directory in the upgrade directory
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
- mkdir($tempDirectory);
+ $parentDirectory = PATH_DATA . "upgrade";
+ if (is_writable($parentDirectory)) {
+ mkdir($tempDirectory);
+ } else {
+ throw new Exception("Could not create directory:" . $parentDirectory);
+ }
//Extract all backup files, including database scripts and workspace files
- if (!$backup->extract($tempDirectory))
- throw new Exception("Could not extract backup");
+ if (!$backup->extract($tempDirectory)) {
+ throw new Exception("Could not extract backup");
+ }
//Search for metafiles in the new standard (the old standard would contain
//txt files).
$metaFiles = glob($tempDirectory . "/*.meta");
@@ -1015,9 +1021,9 @@ class workspaceTools {
else
throw new Exception("Destination workspace already exist (use -o to overwrite)");
- if (file_exists($workspace->path))
+ if (file_exists($workspace->path)) {
G::rm_dir($workspace->path);
-
+ }
foreach ($metadata->directories as $dir) {
CLI::logging("+> Restoring directory '$dir'\n");
diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php
index b2f676548..4c9a6c0e8 100755
--- a/workflow/engine/classes/model/OutputDocument.php
+++ b/workflow/engine/classes/model/OutputDocument.php
@@ -509,8 +509,12 @@ class OutputDocument extends BaseOutputDocument
$aProperties=array()
) {
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
- $sContent = G::unhtmlentities($sContent);
- $strContentAux = str_replace(array("\n", "\r", "\t"), array(null, null, null), $sContent);
+ $nrt = array("\n", "\r", "\t");
+ $nrthtml = array("(n /)", "(r /)", "(t /)");
+
+ $sContent = G::unhtmlentities($sContent);
+
+ $strContentAux = str_replace($nrt, $nrthtml, $sContent);
$iOcurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
@@ -554,6 +558,8 @@ class OutputDocument extends BaseOutputDocument
}
}
+ $strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
+
$sContent = $strContentAux;
foreach ($aFields as $sKey => $vValue) {
diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php
index 00ccec8c4..c5e2d7c02 100755
--- a/workflow/engine/classes/model/Process.php
+++ b/workflow/engine/classes/model/Process.php
@@ -81,7 +81,7 @@ class Process extends BaseProcess {
if ($this->pro_title !== $v || $v === '') {
$this->pro_title = $v;
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
-
+
$res = Content::addContent( 'PRO_TITLE', '', $this->getProUid(), $lang, $this->pro_title );
}
@@ -191,6 +191,9 @@ class Process extends BaseProcess {
$this->setProDescription ( 'Default Process Description' );
$con->commit();
+
+ $this->memcachedDelete();
+
return $this->getProUid();
}
else {
@@ -393,7 +396,7 @@ class Process extends BaseProcess {
if (isset($aData['PRO_DYNAFORMS']) && is_array($aData['PRO_DYNAFORMS'])) {
$aData['PRO_DYNAFORMS'] = @serialize($aData['PRO_DYNAFORMS']);
}
-
+
$con = Propel::getConnection( ProcessPeer::DATABASE_NAME );
try {
$con->begin();
@@ -513,8 +516,11 @@ class Process extends BaseProcess {
$oPro = ProcessPeer::retrieveByPK( $ProUid );
if (!is_null($oPro))
{
- Content::removeContent('PRO_TITLE', '', $oPro->getProUid());
+ Content::removeContent('PRO_TITLE', '', $oPro->getProUid());
Content::removeContent('PRO_DESCRIPTION', '', $oPro->getProUid());
+
+ $this->memcachedDelete();
+
return $oPro->delete();
}
else {
@@ -715,7 +721,7 @@ class Process extends BaseProcess {
$memcache = & PMmemcached::getSingleton(SYS_SYS);
$memkey = 'getCasesCountInAllProcesses';
- if ( ($aProcesses = $memcache->get( $memkey )) === false ) {
+ if ( ($aProcesses = $memcache->get( $memkey )) === false ) {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria->addSelectColumn(ApplicationPeer::APP_STATUS);
@@ -732,7 +738,7 @@ class Process extends BaseProcess {
$aProcesses[$row['PRO_UID']][$row['APP_STATUS']] = $row['CNT'];
}
$memcache->set( $memkey , $aProcesses, PMmemcached::ONE_HOUR );
- }
+ }
return $aProcesses;
}
@@ -751,7 +757,23 @@ class Process extends BaseProcess {
return $aProc;
}
-} // Process
+ public function memcachedDelete()
+ {
+ //Limit defined in processmaker/workflow/engine/templates/processes/main.js
+ $limit = 25;
+ $start = 0;
+
+ $memcache = &PMmemcached::getSingleton(SYS_SYS);
+
+ for ($start = 0; $start <= 50 - 1; $start++) {
+ $memkey = "processList-allProcesses-" . ($start * $limit) . "-" . $limit;
+ $memkeyTotal = $memkey . "-total";
+
+ $r = $memcache->delete($memkey);
+ $r = $memcache->delete($memkeyTotal);
+ }
+ }
+} //Process
function ordProcessByProTitle($a, $b){
diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php
index a866f1bd6..e4bed9372 100644
--- a/workflow/engine/controllers/main.php
+++ b/workflow/engine/controllers/main.php
@@ -192,42 +192,41 @@ class Main extends Controller
$availableLangArray = $this->getLanguagesList();
- //$G_PUBLISH = new Publisher ();
- //$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'login/login', '', $aFields, SYS_URI .
- //'login/authentication.php');
-
G::LoadClass ('serverConfiguration');
- if (($nextBeatDate = $this->memcache->get('nextBeatDate')) === false) {
- //get the serverconf singleton, and check if we can send the heartbeat
- $oServerConf = & serverConf::getSingleton ();
+ $oServerConf = & serverConf::getSingleton ();
+ $flagHeartBeat = '';
+ $sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF');
+ $sflag = (trim($sflag) != '') ? $sflag : '1';
- $sflag = $oServerConf->getHeartbeatProperty('HB_OPTION','HEART_BEAT_CONF');
- $sflag = (trim($sflag)!='')?$sflag:'1';
+ //get date of next beat
+ $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
- //get date of next beat
- $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
- $this->memcache->set('nextBeatDate', $nextBeatDate, 1*3600);
+ //if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat.
+ if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) {
+ //To do: we need to change to ExtJs
+ $this->setJSVar('flagHeartBeat', ($flagHeartBeat == 1));
+ } else {
+ $this->setJSVar('flagHeartBeat', ($flagHeartBeat == 0));
}
- $sflag = 1;
//check if we show the panel with the getting started info
- if (($flagGettingStarted = $this->memcache->get('flagGettingStarted')) === false) {
- require_once 'classes/model/Configuration.php';
- $oConfiguration = new Configuration ();
- $oCriteria = new Criteria ('workflow');
- $oCriteria->add (ConfigurationPeer::CFG_UID, 'getStarted');
- $oCriteria->add (ConfigurationPeer::OBJ_UID, '');
- $oCriteria->add (ConfigurationPeer::CFG_VALUE, '1');
- $oCriteria->add (ConfigurationPeer::PRO_UID, '');
- $oCriteria->add (ConfigurationPeer::USR_UID, '');
- $oCriteria->add (ConfigurationPeer::APP_UID, '');
- $flagGettingStarted = ConfigurationPeer::doCount ($oCriteria);
- $this->memcache->set('flagGettingStarted', $flagGettingStarted, 8*3600) ;
+ require_once 'classes/model/Configuration.php';
+ $oConfiguration = new Configuration ();
+ $oCriteria = new Criteria ('workflow');
+ $oCriteria->add (ConfigurationPeer::CFG_UID, 'getStarted');
+ $oCriteria->add (ConfigurationPeer::OBJ_UID, '');
+ $oCriteria->add (ConfigurationPeer::CFG_VALUE, '1');
+ $oCriteria->add (ConfigurationPeer::PRO_UID, '');
+ $oCriteria->add (ConfigurationPeer::USR_UID, '');
+ $oCriteria->add (ConfigurationPeer::APP_UID, '');
+ $flagGettingStarted = ConfigurationPeer::doCount ($oCriteria);
+ if ($flagGettingStarted == 0) {
+ $this->setJSVar('flagGettingStarted', ($flagGettingStarted == 1));
+ } else {
+ $this->setJSVar('flagGettingStarted', ($flagGettingStarted == 0));
}
- $this->setJSVar('flagGettingStarted', ($flagGettingStarted == 0));
-
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
diff --git a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php
index 07573e6ce..3342848a5 100644
--- a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php
+++ b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php
@@ -318,6 +318,8 @@
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;';
+ $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_POST['DYN_UID'];
+
$_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID'];
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view');
diff --git a/workflow/engine/methods/cases/cases_PrintView.php b/workflow/engine/methods/cases/cases_PrintView.php
index 7191a16ca..42fc53372 100755
--- a/workflow/engine/methods/cases/cases_PrintView.php
+++ b/workflow/engine/methods/cases/cases_PrintView.php
@@ -27,10 +27,18 @@ try {
require_once 'classes/model/Dynaform.php';
require_once 'classes/model/Process.php';
-
+ $currentDynUid = '';
+ if (isset($_GET['DYNUIDPRINT']) && $_GET['DYNUIDPRINT'] != '') {
+ $currentDynUid = $_GET['DYNUIDPRINT'];
+ } elseif (isset($_SESSION['DYN_UID_PRINT'])) {
+ $currentDynUid = $_SESSION['DYN_UID_PRINT'];
+ } elseif (isset($_SESSION['CURRENT_DYN_UID'])) {
+ $currentDynUid = $_SESSION['CURRENT_DYN_UID'];
+ }
$oDynaform = new Dynaform();
- $aDyn = $oDynaform->load($_SESSION['CURRENT_DYN_UID']);
+ $aDyn = $oDynaform->load($currentDynUid);
+
G::LoadClass('case');
$oCase = new Cases();
@@ -75,9 +83,7 @@ try {
$array['PROCESS'] = G::LoadTranslation('ID_PROCESS');
$array['DATELABEL'] = G::LoadTranslation('DATE_LABEL');
- $aDyn['DYN_UID'] = (isset($_SESSION['DYN_UID_PRINT']) && $_SESSION['DYN_UID_PRINT'] != '')
- ? $_SESSION['DYN_UID_PRINT']
- : $aDyn['DYN_UID'];
+ $aDyn['DYN_UID'] = $currentDynUid;
if ($noShowTitle == 0) {
$G_PUBLISH->AddContent('smarty', 'cases/cases_PrintViewTitle', '', '', $array);
}
diff --git a/workflow/engine/methods/cases/cases_Resume.php b/workflow/engine/methods/cases/cases_Resume.php
index 68ec9d97a..b075450ee 100755
--- a/workflow/engine/methods/cases/cases_Resume.php
+++ b/workflow/engine/methods/cases/cases_Resume.php
@@ -58,7 +58,7 @@
/*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 ');
+ $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');
diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php
index 9f2a2711e..0f3131263 100755
--- a/workflow/engine/methods/cases/cases_Step.php
+++ b/workflow/engine/methods/cases/cases_Step.php
@@ -207,6 +207,7 @@
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE'];
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation('ID_NEXT_STEP');
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PHPSESSID'] = @session_id();
+ $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_GET['UID'];
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("
diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php
index 7bdd57d2a..f3e76dc88 100755
--- a/workflow/engine/methods/login/login.php
+++ b/workflow/engine/methods/login/login.php
@@ -160,7 +160,6 @@ $sflag = (trim($sflag) != '') ? $sflag : '1';
//get date of next beat
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
-$sflag = 1;
//if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat.
if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) {
diff --git a/workflow/engine/methods/processes/processes_Save.php b/workflow/engine/methods/processes/processes_Save.php
index 1fcfc51b1..61b52eb62 100755
--- a/workflow/engine/methods/processes/processes_Save.php
+++ b/workflow/engine/methods/processes/processes_Save.php
@@ -53,6 +53,8 @@ switch($function){
$_POST['form']['PRO_UID'] = $_GET['PRO_UID'];
}
+ $_POST['form']['PRO_TITLE'] = trim($_POST['form']['PRO_TITLE']);
+
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
if (!isset($_POST['form']['PRO_UID'])) {
diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js
index 288b35378..cdf13cb3a 100644
--- a/workflow/engine/templates/cases/casesList.js
+++ b/workflow/engine/templates/cases/casesList.js
@@ -16,6 +16,7 @@ new Ext.KeyMap(document, {
}
});
+
/*** global variables **/
var storeCases;
var storeReassignCases;
@@ -210,7 +211,7 @@ function pauseCase(date){
xtype:'checkbox',
name: 'notifyReason',
hideLabel: true,
- boxLabel: _('ID_NOTIFY_USERS_CASE'),
+ boxLabel: _('ID_NOTIFY_USERS_CASE')
}
],
diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js
index c186359b4..aac5f69fc 100755
--- a/workflow/engine/templates/cases/open.js
+++ b/workflow/engine/templates/cases/open.js
@@ -493,7 +493,7 @@ Ext.onReady(function(){
xtype:'checkbox',
name: 'notifyReason',
hideLabel: true,
- boxLabel: _('ID_NOTIFY_USERS_CASE'),
+ boxLabel: _('ID_NOTIFY_USERS_CASE')
}
],
@@ -688,7 +688,7 @@ Ext.onReady(function(){
id: 'notifyReason',
xtype:'checkbox',
name: 'notifyReason',
- fieldLabel: _('ID_NOTIFY_USERS_CASE'),
+ fieldLabel: _('ID_NOTIFY_USERS_CASE')
}
],
buttons : [
diff --git a/workflow/engine/templates/main/login.js b/workflow/engine/templates/main/login.js
index f5c9d377e..e007b6d3f 100644
--- a/workflow/engine/templates/main/login.js
+++ b/workflow/engine/templates/main/login.js
@@ -72,6 +72,9 @@ var Login = function() {
if (flagGettingStarted) {
this.gettingStartedWindow.show();
}
+ if (flagHeartBeat) {
+ processHbInfo();
+ }
}
}
}();
@@ -374,6 +377,19 @@ Login.initComponents = function()
//Ext.getCmp('login-form').hide();
}
+processHbInfo = function() {
+ Ext.Ajax.request({
+ url : '../services/processHeartBeat_Ajax' ,
+ params : {action:'processInformation'},
+ success: function ( result, request ) {
+ //console.info("");
+ },
+ failure: function ( result, request) {
+ //Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
+ }
+ });
+}
+
Login.forgotPassword = function()
{
this.window.hide();
diff --git a/workflow/engine/templates/outputdocs/htmlEditor.js b/workflow/engine/templates/outputdocs/htmlEditor.js
index d0d052eaa..32b123825 100755
--- a/workflow/engine/templates/outputdocs/htmlEditor.js
+++ b/workflow/engine/templates/outputdocs/htmlEditor.js
@@ -1,14 +1,97 @@
+function setGridHtml(outdocHtml, swEdit)
+{
+ var outdocHtmlAux = outdocHtml;
+
+ outdocHtmlAux = stringReplace("\\x0A", "(n /)", outdocHtmlAux); //\n 10
+ outdocHtmlAux = stringReplace("\\x0D", "(r /)", outdocHtmlAux); //\r 13
+ outdocHtmlAux = stringReplace("\\x09", "(t /)", outdocHtmlAux); //\t 9
+
+ var arrayMatch1 = [];
+ var outdocHtmlAux1 = "";
+ var strHtml = "";
+
+ ///////
+ outdocHtmlAux1 = outdocHtmlAux;
+ strHtml = "";
+
+ //@>
+ if (swEdit == 1) {
+ while ((arrayMatch1 = /^(.*)