diff --git a/workflow/engine/classes/class.consolidatedCases.php b/workflow/engine/classes/class.consolidatedCases.php
index b298e1e34..85776f9ca 100644
--- a/workflow/engine/classes/class.consolidatedCases.php
+++ b/workflow/engine/classes/class.consolidatedCases.php
@@ -2,286 +2,173 @@
G::LoadClass("pmFunctions");
G::LoadClass("reportTables");
-
class ConsolidatedCases
{
- function cochalo ($data)
+ function saveConsolidated ($data)
{
$sTasUid = $data['tas_uid'];
$sDynUid = $data['dyn_uid'];
- $sStatus = $data['status'];
$sProUid = $data['pro_uid'];
$sRepTabUid = $data['rep_uid'];
$tableName = $data['table_name'];
$title = $data['title'];
- $swOverwrite = $data['overwrite'];
- $isBPMN = $data['isBPMN'];
-
- if ($sStatus == "1" && $sDynUid != "") {
- switch ($swOverwrite) {
- case 1:
- //Delete report table
- $criteria = new Criteria();
-
- $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
- $criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);
-
- $rsCriteria = ReportTablePeer::doSelectRS($criteria);
-
- $rptUid = null;
-
- if ($rsCriteria->next()) {
- $row = $rsCriteria->getRow();
-
- $rptUid = $row[0];
- }
-
- $rpts = new ReportTables();
-
- if ($rptUid != null) {
- $rpts->deleteReportTable($rptUid);
- }
-
- $sRepTabUid = "";
- break;
- case 2:
- //Delete table
- $rpts = new ReportTables();
- $rpts->dropTable($tableName, "wf");
-
- $sRepTabUid = "";
- break;
- }
+ if ($sRepTabUid != '') {
+ $rptUid = null;
$criteria = new Criteria();
+
$criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
- //$criteria->add(ReportTablePeer::PRO_UID, $sProUid);
$criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);
-
- $result = ReportTablePeer::doSelectRS($criteria);
- $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
- if ($result->next()) {
- $dataRes = $result->getRow();
-
- if ($dataRes["REP_TAB_UID"] != $sRepTabUid) {
- return 1;
- }
- } else {
- //check if table $tableName exists
- $con = Propel::getConnection("workflow");
- $stmt = $con->createStatement();
-
- $sql="SHOW TABLES";
- $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
- $rs1->next();
- while ( is_array($row = $rs1->getRow() )) {
- if ( $row[0] == $tableName ) {
- return 2;
- }
- $rs1->next();
- }
+ $rsCriteria = ReportTablePeer::doSelectRS($criteria);
+
+ if ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+ $rptUid = $row[0];
}
- if ($isBPMN) {
- $_POST['form']['PRO_UID'] = $sProUid;
- $_POST['form']['REP_TAB_UID'] = $sRepTabUid;
- $_POST['form']['REP_TAB_NAME'] = $tableName;
- $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
- $_POST['form']['REP_TAB_GRID'] = '';
- $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
- $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
- $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
- $_POST['form']['REP_TAB_TITLE'] = $title;
- } else {
- $_POST['form']['PRO_UID'] = $sProUid;
- $_POST['form']['REP_TAB_UID'] = $sRepTabUid;
- $_POST['form']['REP_TAB_NAME'] = $tableName;
- $_POST['form']['REP_TAB_TYPE'] = "GRID";
- $_POST['form']['REP_TAB_GRID'] = $sProUid . "-" . $sDynUid;
- $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
- $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
- $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
- $_POST['form']['REP_TAB_TITLE'] = $title;
+ $rpts = new ReportTables();
+ if ($rptUid != null) {
+ $rpts->deleteReportTable($rptUid);
}
- $_POST['form']['FIELDS'] = array();
-
- G::LoadClass("reportTables");
-
- $oReportTable = new ReportTable();
- //if (!isset($_POST['form']['REP_TAB_CONNECTION'])) {
- // $_POST['form']['REP_TAB_CONNECTION'] = 'report';
- //}
- if ($_POST['form']['REP_TAB_UID'] != "") {
- $aReportTable = $oReportTable->load($_POST['form']['REP_TAB_UID']);
- $sOldTableName = $aReportTable['REP_TAB_NAME'];
- $sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
- } else {
-
- $sOldTableName = $_POST['form']['REP_TAB_NAME'];
- $sOldConnection = $_POST['form']['REP_TAB_CONNECTION'];
- $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
- $oReportTable->create($_POST['form']);
- $_POST['form']['REP_TAB_UID'] = $oReportTable->getRepTabUid();
- }
-
- $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
- $oReportTable->update($_POST['form']);
-
- $oReportVar = new ReportVar();
- $oReportTables = new ReportTables();
- $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
-
- $aFields = array();
-
- if ($isBPMN) {
- G::LoadClass("pmDynaform");
- $pmDyna = new pmDynaform(array());
- $pmDyna->fields["CURRENT_DYNAFORM"] = $sDynUid;
- $dataDyna = $pmDyna->getDynaform();
- $json = G::json_decode($dataDyna["DYN_CONTENT"]);
- $fieldsDyna = $json->items[0]->items;
- foreach ($fieldsDyna as $value) {
- $_POST['form']['FIELDS'][] = $value[0]->name . '-' . $value[0]->type;
- }
- } else {
- $aAux = explode('-', $_POST['form']['REP_TAB_GRID']);
- global $G_FORM;
-
- require_once "classes/class.formBatchRouting.php";
-
- $G_FORM = new FormBatchRouting($_POST["form"]["PRO_UID"] . PATH_SEP . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
- $aAux = $G_FORM->getVars(false);
-
- foreach ($aAux as $aField) {
- $_POST['form']['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
- }
- }
-
- $aFieldsClases = array();
- $i = 1;
- $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
- $aFieldsClases[$i]['FLD_NULL'] = 'off';
- $aFieldsClases[$i]['FLD_KEY'] = 'on';
- $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
- $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
- $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
- $aFieldsClases[$i]['FLD_SIZE'] = 32;
- $i++;
- $aFieldsClases[$i]['FLD_NAME'] = 'APP_NUMBER';
- $aFieldsClases[$i]['FLD_NULL'] = 'off';
- $aFieldsClases[$i]['FLD_KEY'] = 'on';
- $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
- $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
- $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
- $aFieldsClases[$i]['FLD_SIZE'] = 255;
-
- foreach ($_POST['form']['FIELDS'] as $sField) {
- $aField = explode('-', $sField);
- $i++;
- $aFieldsClases[$i]['FLD_NAME'] = $aField[0];
- $aFieldsClases[$i]['FLD_NULL'] = 'off';
- $aFieldsClases[$i]['FLD_KEY'] = 'off';
- $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
- $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
-
- switch ($aField[1]) {
- case 'currency':
- case 'percentage':
- $sType = 'number';
- $aFieldsClases[$i]['FLD_TYPE'] = 'FLOAT' ;
- $aFieldsClases[$i]['FLD_SIZE'] = 255;
- break;
- case 'text':
- case 'password':
- case 'dropdown':
- case 'yesno':
- case 'checkbox':
- case 'radiogroup':
- case 'hidden':
- case "link":
- $sType = 'char';
- $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
- $aFieldsClases[$i]['FLD_SIZE'] = 255;
- break;
- case 'textarea':
- $sType = 'text';
- $aFieldsClases[$i]['FLD_TYPE'] = 'TEXT' ;
- $aFieldsClases[$i]['FLD_SIZE'] = '';
- break;
- case 'date':
- $sType = 'date';
- $aFieldsClases[$i]['FLD_TYPE'] = 'DATE' ;
- $aFieldsClases[$i]['FLD_SIZE'] = '';
- break;
- default:
- $sType = 'char';
- $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
- $aFieldsClases[$i]['FLD_SIZE'] = 255;
- break;
- }
-
- $oReportVar->create(array('REP_TAB_UID' => $_POST['form']['REP_TAB_UID'],
- 'PRO_UID' => $_POST['form']['PRO_UID'],
- 'REP_VAR_NAME' => $aField[0],
- 'REP_VAR_TYPE' => $sType));
- $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
- }
-
- $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
- $oReportTables->dropTable($sOldTableName, $sOldConnection);
- $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
- $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');
-
- $sRepTabUid = $_POST['form']['REP_TAB_UID'];
-
- //clases
- } else {
- $oReportTables = new ReportTables();
- if ($sRepTabUid != "") {
- $oReportTables->deleteReportTable($sRepTabUid);
- }
- $sRepTabUid = "";
- }
-
- require_once ("classes/model/CaseConsolidatedPeer.php");
- require_once ("classes/model/CaseConsolidated.php");
-
- $oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);
-
- if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
- $oCaseConsolidated = new CaseConsolidated();
- $oCaseConsolidated->setTasUid($sTasUid);
- }
-
- if ($sStatus == '1') {
- $oCaseConsolidated->setConStatus('ACTIVE');
- } else {
- $oCaseConsolidated->setConStatus('INACTIVE');
- }
-
- $oCaseConsolidated->setDynUid($sDynUid);
- $oCaseConsolidated->setRepTabUid($sRepTabUid);
- $oCaseConsolidated->save();
-
- $sClassName = $tableName;//'__' . $sTasUid;
-
- if ($sStatus == '1') {
- //$oAdditionalTables->createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid)
- //require_once 'classes/model/AdditionalTables.php';
- //$oAdditionalTables = new AdditionalTables();
- $oAdditionalTables = new AdditionalTables();//AdditionalTablesConsolidated
-
- $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid);
- } else {
+ $sClassName = $tableName;
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
+
@unlink($sPath . $sClassName . '.php');
@unlink($sPath . $sClassName . 'Peer.php');
@unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
+ $sRepTabUid = '';
}
+ $_POST['form']['PRO_UID'] = $sProUid;
+ $_POST['form']['REP_TAB_UID'] = $sRepTabUid;
+ $_POST['form']['REP_TAB_NAME'] = $tableName;
+ $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
+ $_POST['form']['REP_TAB_GRID'] = '';
+ $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
+ $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
+ $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
+ $_POST['form']['REP_TAB_TITLE'] = $title;
+ $_POST['form']['FIELDS'] = array();
+ G::LoadClass("reportTables");
+ $oReportTable = new ReportTable();
+
+ $sOldTableName = $_POST['form']['REP_TAB_NAME'];
+ $sOldConnection = $_POST['form']['REP_TAB_CONNECTION'];
+ $oReportTable->create($_POST['form']);
+
+ $_POST['form']['REP_TAB_UID'] = $oReportTable->getRepTabUid();
+
+ $oReportVar = new ReportVar();
+ $oReportTables = new ReportTables();
+ $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
+
+ $aFields = array();
+ G::LoadClass("pmDynaform");
+ $pmDyna = new pmDynaform(array());
+ $pmDyna->fields["CURRENT_DYNAFORM"] = $sDynUid;
+ $dataDyna = $pmDyna->getDynaform();
+ $json = G::json_decode($dataDyna["DYN_CONTENT"]);
+ $fieldsDyna = $json->items[0]->items;
+ foreach ($fieldsDyna as $value) {
+ $_POST['form']['FIELDS'][] = $value[0]->name . '-' . $value[0]->type;
+ }
+
+ $aFieldsClases = array();
+ $i = 1;
+ $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'on';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 32;
+ $i++;
+ $aFieldsClases[$i]['FLD_NAME'] = 'APP_NUMBER';
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'on';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+
+ foreach ($_POST['form']['FIELDS'] as $sField) {
+ $aField = explode('-', $sField);
+ if ($aField[1] == 'title' || $aField[1] == 'submit') {
+ continue;
+ }
+ $i++;
+ $aFieldsClases[$i]['FLD_NAME'] = $aField[0];
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'off';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+
+ switch ($aField[1]) {
+ case 'currency':
+ case 'percentage':
+ $sType = 'number';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'FLOAT' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ case 'text':
+ case 'password':
+ case 'dropdown':
+ case 'yesno':
+ case 'checkbox':
+ case 'radiogroup':
+ case 'hidden':
+ case "link":
+ $sType = 'char';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ case 'textarea':
+ $sType = 'text';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'TEXT' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = '';
+ break;
+ case 'date':
+ $sType = 'date';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'DATE' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = '';
+ break;
+ default:
+ $sType = 'char';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ }
+
+ $oReportVar->create(array('REP_TAB_UID' => $_POST['form']['REP_TAB_UID'],
+ 'PRO_UID' => $_POST['form']['PRO_UID'],
+ 'REP_VAR_NAME' => $aField[0],
+ 'REP_VAR_TYPE' => $sType));
+ $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
+ }
+
+ $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
+ $oReportTables->dropTable($sOldTableName, $sOldConnection);
+ $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
+ $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');
+ $sRepTabUid = $_POST['form']['REP_TAB_UID'];
+
+ $oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);
+ if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
+ $oCaseConsolidated = new CaseConsolidated();
+ $oCaseConsolidated->setTasUid($sTasUid);
+ }
+
+ $oCaseConsolidated->setConStatus('ACTIVE');
+ $oCaseConsolidated->setDynUid($sDynUid);
+ $oCaseConsolidated->setRepTabUid($sRepTabUid);
+ $oCaseConsolidated->save();
+
+ $sClassName = $tableName;
+ $oAdditionalTables = new AdditionalTables();
+ $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid);
}
}
diff --git a/workflow/engine/classes/class.licensedFeatures.php b/workflow/engine/classes/class.licensedFeatures.php
index 2136ec33c..8affa55bf 100644
--- a/workflow/engine/classes/class.licensedFeatures.php
+++ b/workflow/engine/classes/class.licensedFeatures.php
@@ -75,7 +75,11 @@ class PMLicensedFeatures
$padl = new padl();
$value = $padl->_decrypt($featureName);
- $enable = in_array($value[0], $licenseManager->licensedfeatures);
+ if (is_array($value)) {
+ $trueValue = $value[0];
+ }
+ $trueValue = $value;
+ $enable = in_array($trueValue, $licenseManager->licensedfeatures);
if (!isset($this->featuresDetails[$value[0]]) || !is_object($this->featuresDetails[$value[0]])) {
$this->featuresDetails[$value[0]] = new stdclass();
diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php
index 20a83527e..6befabc56 100755
--- a/workflow/engine/classes/class.processMap.php
+++ b/workflow/engine/classes/class.processMap.php
@@ -1464,6 +1464,9 @@ class processMap
case 7:
$sFilename = 'tasks/tasks_Notifications.xml';
break;
+ case 8:
+ $sFilename = 'tasks/tasks_Consolidated.xml';
+ break;
default:
//if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
$oPluginRegistry = & PMPluginRegistry::getSingleton();
@@ -1541,6 +1544,55 @@ class processMap
}
}
+ if ($iForm == 8) {
+ $oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"]);
+ if ((is_object($oCaseConsolidated)) && get_class($oCaseConsolidated) == "CaseConsolidated") {
+ require_once ("classes/model/ReportTable.php");
+
+ $aFields["CON_STATUS"] = $oCaseConsolidated->getConStatus();
+ $aFields["DYN_UID"] = $oCaseConsolidated->getDynUid();
+ $aFields["REP_TAB_UID"] = $oCaseConsolidated->getRepTabUid();
+
+ $oReportTables = new ReportTable();
+ $oReportTables = $oReportTables->load($aFields["REP_TAB_UID"]);
+ if (count($oReportTables)>0) {
+ if ($oReportTables['REP_TAB_STATUS'] == 'ACTIVE') {
+ $aFields["TABLE_NAME"] = $oReportTables['REP_TAB_NAME'];
+ $aFields["TITLE"] = $oReportTables['REP_TAB_TITLE'];
+ }
+ }
+ }
+ $aFields["PRO_UID"] = $_SESSION["PROCESS"];
+ $aFields["TAS_UID"] = $_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"];
+ $aFields["SYS_LANG"] = SYS_LANG;
+ $aFields['INDEX'] = 0;
+ $aFields["TABLE_NAME_DEFAULT"] = "__" . $aFields["TAS_UID"];
+
+ $oCriteria = new Criteria("workflow");
+ $del = DBAdapter::getStringDelimiter();
+
+ $oCriteria->setDistinct();
+ $oCriteria->addSelectColumn(DynaformPeer::DYN_UID);
+ $oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
+
+ $aConditions = array();
+ $aConditions[] = array(DynaformPeer::DYN_UID, ContentPeer::CON_ID);
+ $aConditions[] = array(ContentPeer::CON_CATEGORY, $del . "DYN_TITLE" . $del);
+ $aConditions[] = array(ContentPeer::CON_LANG, $del . "en" . $del);
+ $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
+
+ $oCriteria->add(DynaformPeer::PRO_UID, $_SESSION["PROCESS"]);
+ $oCriteria->add(DynaformPeer::DYN_TYPE, "grid");
+
+ $oCriteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
+
+ $numRows = DynaformPeer::doCount($oCriteria);
+ if ($numRows == 0) {
+ echo "
".G::LoadTranslation('ID_ALERT')."
".G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED')."
";
+ die;
+ }
+ }
+
global $G_PUBLISH;
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php
index f76fbb5e2..7d6079d8d 100644
--- a/workflow/engine/controllers/designer.php
+++ b/workflow/engine/controllers/designer.php
@@ -54,8 +54,15 @@ class Designer extends Controller
$clientToken["client_id"] = $client['CLIENT_ID'];
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
+ $consolidated = 0;
+ $licensedFeatures = & PMLicensedFeatures::getSingleton();
+ if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
+ $consolidated = 1;
+ }
+
$this->setVar('prj_uid', $proUid);
$this->setVar('app_uid', $appUid);
+ $this->setVar('consolidated', $consolidated);
$this->setVar('prj_readonly', $proReadOnly);
$this->setVar('credentials', base64_encode(json_encode($clientToken)));
$this->setVar('isDebugMode', $debug);
diff --git a/workflow/engine/js/processmap/core/processmap.js b/workflow/engine/js/processmap/core/processmap.js
index bb7cc2d9e..a31cc2f84 100755
--- a/workflow/engine/js/processmap/core/processmap.js
+++ b/workflow/engine/js/processmap/core/processmap.js
@@ -1698,6 +1698,13 @@ var processmap=function(){
noClear : true
}]
};
+ if (this.options.consolidated == '1') {
+ panel.tab.options.push({
+ title : _('ID_CONSOLIDATED_CASE_LIST'),
+ content : this.parent.closure({instance:this,method:iForm,args:[panel,index,8]}),
+ noClear : true
+ });
+ }
var taskOptions = this.data.db.taskOptions;
this.loadExtendedProperties = function(){
for(i=0;i 'string',
+ 'TEXT' => 'string',
+ 'DATE' => 'int',
+ 'INT' => 'int',
+ 'FLOAT' => 'double');
+ $aCreoleTypes = array('VARCHAR' => 'VARCHAR',
+ 'TEXT' => 'LONGVARCHAR',
+ 'DATE' => 'TIMESTAMP',
+ 'INT' => 'INTEGER',
+ 'FLOAT' => 'DOUBLE');
+ if ($sClassName == '') {
+ $sClassName = $this->getPHPName($sTableName);
+ }
+
+ $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
+ if (!file_exists($sPath)) {
+ G::mk_dir($sPath);
+ G::mk_dir($sPath . 'map');
+ G::mk_dir($sPath . 'om');
+ }
+ $aData = array();
+ $aData['pathClasses'] = substr(PATH_DB, 0, -1);
+ $aData['tableName'] = $sTableName;
+ $aData['className'] = $sClassName;
+ $aData['GUID'] = $sAddTabUid;
+ $aData['firstColumn'] = $aFields[1]['FLD_NAME'];
+ $aData['totalColumns'] = count($aFields);
+ $aData['useIdGenerator'] = 'false';
+ $oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl');
+ $oTP1->prepare();
+ $oTP1->assignGlobal($aData);
+ file_put_contents($sPath . $sClassName . '.php', $oTP1->getOutputContent());
+ $oTP2 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'TablePeer.tpl');
+ $oTP2->prepare();
+ $oTP2->assignGlobal($aData);
+ file_put_contents($sPath . $sClassName . 'Peer.php', $oTP2->getOutputContent());
+ $aColumns = array();
+ $aPKs = array();
+ $aNotPKs = array();
+ $i = 0;
+ foreach ($aFields as $iKey => $aField) {
+ $aColumn = array('name' => $aField['FLD_NAME'],
+ 'phpName' => $this->getPHPName($aField['FLD_NAME']),
+ 'type' => $aTypes[$aField['FLD_TYPE']],
+ 'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']],
+ 'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'),
+ 'size' => (($aField['FLD_TYPE'] == 'VARCHAR') || ($aField['FLD_TYPE'] == 'INT') || ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
+ 'var' => strtolower($aField['FLD_NAME']),
+ 'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR') || ($aField['FLD_TYPE'] == 'TEXT') || ($aField['FLD_TYPE'] == 'DATE') ? '$' . strtolower($aField['FLD_NAME']) . " = ''" : '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
+ 'index' => $i,
+ );
+ if ($aField['FLD_TYPE'] == 'DATE') {
+ $aColumn['getFunction'] = '
+ /**
+ * Get the [optionally formatted] [' . $aColumn['var'] . '] column value.
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the integer unix timestamp will be returned.
+ * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
+ * @throws PropelException - if unable to convert the date/time to timestamp.
+ */
+ public function get' . $aColumn['phpName'] . '($format = "Y-m-d")
+ {
+
+ if ($this->' . $aColumn['var'] . ' === null || $this->' . $aColumn['var'] . ' === "") {
+ return null;
+ } elseif (!is_int($this->' . $aColumn['var'] . ')) {
+ // a non-timestamp value was set externally, so we convert it
+ if (($this->' . $aColumn['var'] . ' == "0000-00-00 00:00:00") || ($this->' . $aColumn['var'] . ' == "0000-00-00") || !$this->' . $aColumn['var'] . ') {
+ $ts = "0";
+ }
+ else {
+ $ts = strtotime($this->' . $aColumn['var'] . ');
+ }
+ if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
+ throw new PropelException("Unable to parse value of [' . $aColumn['var'] . '] as date/time value: " . var_export($this->' . $aColumn['var'] . ', true));
+ }
+ } else {
+ $ts = $this->' . $aColumn['var'] . ';
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, "%") !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }';
+ } else {
+ $aColumn['getFunction'] = '
+ /**
+ * Get the [' . $aColumn['var'] . '] column value.
+ *
+ * @return string
+ */
+ public function get' . $aColumn['phpName'] . '()
+ {
+
+ return $this->' . $aColumn['var'] . ';
+ }';
+ }
+
+ switch ($aField['FLD_TYPE']) {
+ case 'VARCHAR':
+ case 'TEXT':
+ $aColumn['setFunction'] = '
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->' . $aColumn['var'] . ' !== $v) {
+ $this->' . $aColumn['var'] . ' = $v;
+ $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
+ }';
+ break;
+ case 'DATE':
+ $aColumn['setFunction'] = '
+ if ($v !== null && !is_int($v)) {
+ // if($v == \'\')
+ // $ts = null;
+ // else
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
+ //throw new PropelException("Unable to parse date/time value for [' . $aColumn['var'] . '] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->' . $aColumn['var'] . ' !== $ts) {
+ $this->' . $aColumn['var'] . ' = $ts;
+ $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
+ }';
+ break;
+ case 'INT':
+ $aColumn['setFunction'] = '
+ // Since the native PHP type for this column is integer,
+ // we will cast the input value to an int (if it is not).
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->' . $aColumn['var'] . ' !== $v || $v === 1) {
+ $this->' . $aColumn['var'] . ' = $v;
+ $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
+ }';
+ break;
+ case 'FLOAT':
+ $aColumn['setFunction'] = '
+ if ($this->' . $aColumn['var'] . ' !== $v || $v === 0) {
+ $this->' . $aColumn['var'] . ' = $v;
+ $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
+ }';
+ break;
+ }
+ $aColumns[] = $aColumn;
+ if ($aField['FLD_KEY'] == 'on') {
+ $aPKs[] = $aColumn;
+ } else {
+ $aNotPKs[] = $aColumn;
+ }
+ if ($aField['FLD_AUTO_INCREMENT'] == 'on') {
+ $aData['useIdGenerator'] = 'true';
+ }
+ $i++;
+ }
+
+ $oTP3 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'map' . PATH_SEP . 'TableMapBuilder.tpl');
+ $oTP3->prepare();
+ $oTP3->assignGlobal($aData);
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $oTP3->newBlock('primaryKeys');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP3->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ $oTP3->gotoBlock('_ROOT');
+ foreach ($aNotPKs as $iIndex => $aColumn) {
+ $oTP3->newBlock('columnsWhitoutKeys');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP3->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ file_put_contents($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php', $oTP3->getOutputContent());
+ $oTP4 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTable.tpl');
+ $oTP4->prepare();
+ switch (count($aPKs)) {
+ case 0:
+ $aData['getPrimaryKeyFunction'] = 'return null;';
+ $aData['setPrimaryKeyFunction'] = '';
+ break;
+ case 1:
+ $aData['getPrimaryKeyFunction'] = 'return $this->get' . $aPKs[0]['phpName'] . '();';
+ $aData['setPrimaryKeyFunction'] = '$this->set' . $aPKs[0]['phpName'] . '($key);';
+ break;
+ default:
+ $aData['getPrimaryKeyFunction'] = '$pks = array();' . "\n";
+ $aData['setPrimaryKeyFunction'] = '';
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $aData['getPrimaryKeyFunction'] .= '$pks[' . $iIndex . '] = $this->get' . $aColumn['phpName'] . '();' . "\n";
+ $aData['setPrimaryKeyFunction'] .= '$this->set' . $aColumn['phpName'] . '($keys[' . $iIndex . ']);' . "\n";
+ }
+ $aData['getPrimaryKeyFunction'] .= 'return $pks;' . "\n";
+ break;
+ }
+ $oTP4->assignGlobal($aData);
+ foreach ($aColumns as $iIndex => $aColumn) {
+ $oTP4->newBlock('allColumns1');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns2');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns3');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns4');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns5');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns6');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns7');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns8');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP4->newBlock('allColumns9');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ $oTP4->gotoBlock('_ROOT');
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $oTP4->newBlock('primaryKeys1');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ $oTP4->gotoBlock('_ROOT');
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $oTP4->newBlock('primaryKeys2');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ $oTP4->gotoBlock('_ROOT');
+ foreach ($aNotPKs as $iIndex => $aColumn) {
+ $oTP4->newBlock('columnsWhitoutKeys');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP4->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php', $oTP4->getOutputContent());
+ $oTP5 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTablePeer.tpl');
+ $oTP5->prepare();
+ $sKeys = '';
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $sKeys .= '$' . $aColumn['var'] . ', ';
+ }
+ $sKeys = substr($sKeys, 0, -2);
+ //$sKeys = '$pm_unique_id';
+ if ($sKeys != '') {
+ $aData['sKeys'] = $sKeys;
+ } else {
+ $aData['sKeys'] = '$DUMMY';
+ }
+ $oTP5->assignGlobal($aData);
+ foreach ($aColumns as $iIndex => $aColumn) {
+ $oTP5->newBlock('allColumns1');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns2');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns3');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns4');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns5');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns6');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns7');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns8');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns9');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ $oTP5->newBlock('allColumns10');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ $oTP5->gotoBlock('_ROOT');
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $oTP5->newBlock('primaryKeys1');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ foreach ($aPKs as $iIndex => $aColumn) {
+ $oTP5->newBlock('primaryKeys2');
+ $aKeys = array_keys($aColumn);
+ foreach ($aKeys as $sKey) {
+ $oTP5->assign($sKey, $aColumn[$sKey]);
+ }
+ }
+ file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php', $oTP5->getOutputContent());
+ } catch (Exception $oError) {
+ throw($oError);
+ }
+ }
+}
+
+class ajax_con extends WebResource
+{
+ public function con_save_properties($sTasUid, $sDynUid, $sStatus, $sProUid, $sRepTabUid, $tableName, $title, $swOverwrite)
+ {
+ G::LoadClass("reportTables");
+
+ if ($sStatus == "1" && $sDynUid != "") {
+ //Verified as not to duplicate the name of the table
+
+ switch ($swOverwrite) {
+ case 1:
+ //Delete report table
+ $criteria = new Criteria();
+
+ $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
+ $criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);
+
+ $rsCriteria = ReportTablePeer::doSelectRS($criteria);
+
+ $rptUid = null;
+
+ if ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $rptUid = $row[0];
+ }
+
+ $rpts = new ReportTables();
+
+ if ($rptUid != null) {
+ $rpts->deleteReportTable($rptUid);
+ }
+
+ $sRepTabUid = "";
+ break;
+ case 2:
+ //Delete table
+ $rpts = new ReportTables();
+ $rpts->dropTable($tableName, "wf");
+
+ $sRepTabUid = "";
+ break;
+ }
+
+ $criteria = new Criteria();
+ $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
+ //$criteria->add(ReportTablePeer::PRO_UID, $sProUid);
+ $criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);
+
+ $result = ReportTablePeer::doSelectRS($criteria);
+ $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+
+ if ($result->next()) {
+ $dataRes = $result->getRow();
+
+ if ($dataRes["REP_TAB_UID"] != $sRepTabUid) {
+ return 1;
+ }
+ } else {
+ //check if table $tableName exists
+ $con = Propel::getConnection("workflow");
+ $stmt = $con->createStatement();
+
+ $sql="SHOW TABLES";
+ $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
+ $rs1->next();
+ while ( is_array($row = $rs1->getRow() )) {
+ if ( $row[0] == $tableName ) {
+ return 2;
+ }
+ $rs1->next();
+ }
+ }
+
+ $_POST['form']['PRO_UID'] = $sProUid;
+ $_POST['form']['REP_TAB_UID'] = $sRepTabUid;
+ $_POST['form']['REP_TAB_NAME'] = $tableName;
+ $_POST['form']['REP_TAB_TYPE'] = "GRID";
+ $_POST['form']['REP_TAB_GRID'] = $sProUid . "-" . $sDynUid;
+ $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
+ $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
+ $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
+ $_POST['form']['REP_TAB_TITLE'] = $title;
+
+ $_POST['form']['FIELDS'] = array();
+
+ G::LoadClass("reportTables");
+
+ $oReportTable = new ReportTable();
+ //if (!isset($_POST['form']['REP_TAB_CONNECTION'])) {
+ // $_POST['form']['REP_TAB_CONNECTION'] = 'report';
+ //}
+ if ($_POST['form']['REP_TAB_UID'] != "") {
+ $aReportTable = $oReportTable->load($_POST['form']['REP_TAB_UID']);
+ $sOldTableName = $aReportTable['REP_TAB_NAME'];
+ $sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
+ } else {
+ $sOldTableName = $_POST['form']['REP_TAB_NAME'];
+ $sOldConnection = $_POST['form']['REP_TAB_CONNECTION'];
+ $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
+ $oReportTable->create($_POST['form']);
+ $_POST['form']['REP_TAB_UID'] = $oReportTable->getRepTabUid();
+ }
+
+ $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
+ $oReportTable->update($_POST['form']);
+
+ $_POST['form']['REP_TAB_TYPE'] = 'GRID';
+
+ $oReportVar = new ReportVar();
+ $oReportTables = new ReportTables();
+ $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
+
+ $aFields = array();
+
+ if ($_POST['form']['REP_TAB_TYPE'] == 'GRID') {
+ $aAux = explode('-', $_POST['form']['REP_TAB_GRID']);
+ global $G_FORM;
+
+ G::LoadClass("formBatchRouting");
+ $G_FORM = new FormBatchRouting($_POST["form"]["PRO_UID"] . PATH_SEP . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
+ $aAux = $G_FORM->getVars(false);
+
+ foreach ($aAux as $aField) {
+ $_POST['form']['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
+ }
+ }
+
+ $aFieldsClases = array();
+ $i = 1;
+ $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'on';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 32;
+ $i++;
+ $aFieldsClases[$i]['FLD_NAME'] = 'APP_NUMBER';
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'on';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+
+ foreach ($_POST['form']['FIELDS'] as $sField) {
+ $aField = explode('-', $sField);
+ $i++;
+ $aFieldsClases[$i]['FLD_NAME'] = $aField[0];
+ $aFieldsClases[$i]['FLD_NULL'] = 'off';
+ $aFieldsClases[$i]['FLD_KEY'] = 'off';
+ $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
+ $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
+
+ switch ($aField[1]) {
+ case 'currency':
+ case 'percentage':
+ $sType = 'number';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'FLOAT' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ case 'text':
+ case 'password':
+ case 'dropdown':
+ case 'yesno':
+ case 'checkbox':
+ case 'radiogroup':
+ case 'hidden':
+ case "link":
+ $sType = 'char';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ case 'textarea':
+ $sType = 'text';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'TEXT' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = '';
+ break;
+ case 'date':
+ $sType = 'date';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'DATE' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = '';
+ break;
+ default:
+ $sType = 'char';
+ $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
+ $aFieldsClases[$i]['FLD_SIZE'] = 255;
+ break;
+ }
+
+ $oReportVar->create(array('REP_TAB_UID' => $_POST['form']['REP_TAB_UID'],
+ 'PRO_UID' => $_POST['form']['PRO_UID'],
+ 'REP_VAR_NAME' => $aField[0],
+ 'REP_VAR_TYPE' => $sType));
+ $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
+ }
+
+ $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
+ $oReportTables->dropTable($sOldTableName, $sOldConnection);
+ $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
+ $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');
+
+ $sRepTabUid = $_POST['form']['REP_TAB_UID'];
+
+ //clases
+ } else {
+ $oReportTables = new ReportTables();
+ if ($sRepTabUid != "") {
+ $oReportTables->deleteReportTable($sRepTabUid);
+ }
+ $sRepTabUid = "";
+ }
+
+ $oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);
+
+ if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
+ $oCaseConsolidated = new CaseConsolidated();
+ $oCaseConsolidated->setTasUid($sTasUid);
+ }
+
+ if ($sStatus == '1') {
+ $oCaseConsolidated->setConStatus('ACTIVE');
+ } else {
+ $oCaseConsolidated->setConStatus('INACTIVE');
+ }
+
+ $oCaseConsolidated->setDynUid($sDynUid);
+ $oCaseConsolidated->setRepTabUid($sRepTabUid);
+ $oCaseConsolidated->save();
+
+ $sClassName = $tableName;//'__' . $sTasUid;
+
+ if ($sStatus == '1') {
+ //$oAdditionalTables->createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid)
+ //require_once 'classes/model/AdditionalTables.php';
+ //$oAdditionalTables = new AdditionalTables();
+ $oAdditionalTables = new AdditionalTables();//AdditionalTablesConsolidated
+
+ $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid);
+ } else {
+ $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
+ @unlink($sPath . $sClassName . '.php');
+ @unlink($sPath . $sClassName . 'Peer.php');
+ @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
+ @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
+ @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
+ }
+
+ return ($sRepTabUid);
+ }
+}
+
+$o = new ajax_con($_SERVER["REQUEST_URI"], $_POST);
+
diff --git a/workflow/engine/methods/processes/processes_Map.php b/workflow/engine/methods/processes/processes_Map.php
index 130292073..33a508243 100755
--- a/workflow/engine/methods/processes/processes_Map.php
+++ b/workflow/engine/methods/processes/processes_Map.php
@@ -79,6 +79,14 @@ $G_ID_SUB_MENU_SELECTED = '_';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
+$consolidated = 0;
+/*----------------------------------********---------------------------------*/
+$licensedFeatures = & PMLicensedFeatures::getSingleton();
+if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
+ $consolidated = 1;
+}
+/*----------------------------------********---------------------------------*/
+
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/dbConnections/main.js' );
$oHeadPublisher->addScriptCode( '
@@ -99,6 +107,7 @@ $oHeadPublisher->addScriptCode( '
dataServer :"processes_Ajax.php",
uid :"' . $processUID . '",
lang :"' . SYS_LANG . '",
+ consolidated :"' . $consolidated . '",
theme :"processmaker",
size :{w:pb.offsetWidth-10,h:pb.offsetHeight},
images_dir :"/jscore/processmap/core/images/"
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php
index 7a1a90bdb..981562d4e 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php
@@ -31,6 +31,7 @@ class Consolidated
$criteria = new Criteria();
$criteria->addSelectColumn(CaseConsolidatedPeer::DYN_UID);
$criteria->addSelectColumn(\ReportTablePeer::REP_TAB_NAME);
+ $criteria->addSelectColumn(\ReportTablePeer::REP_TAB_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
@@ -48,8 +49,9 @@ class Consolidated
$response = $dataset->getRow();
} else {
$response = array(
- 'REP_TAB_NAME' => '__' . $tas_uid,
- 'CON_VALUE' => '__' . $tas_uid,
+ 'REP_TAB_UID' => '',
+ 'REP_TAB_NAME' => '__' . $tas_uid,
+ 'CON_VALUE' => '__' . $tas_uid,
);
}
return array_change_key_case($response, CASE_LOWER);;
@@ -441,26 +443,30 @@ class Consolidated
$json = G::json_decode($dataTask["DYN_CONTENT"]);
$pmDyna->jsonr($json);
$fieldsDyna = $json->items[0]->items;
-
+
$xmlfrm = new \stdclass();
$xmlfrm->fields = array();
foreach ($fieldsDyna as $key => $value) {
- //$temp = $value[0];
+ if ($value[0]->type == 'title' || $value[0]->type == 'submit') {
+ continue;
+ }
$temp = new \stdclass();
$temp->type = $value[0]->type;
$temp->label = $value[0]->label;
$temp->name = $value[0]->name;
- $temp->required = $value[0]->required;
- $temp->mode = $value[0]->mode;
+ $temp->required = (isset($value[0]->required)) ? $value[0]->required : 0;
+ $temp->mode = (isset($value[0]->mode)) ? $value[0]->mode : 'edit';
- $temp->storeData = '[';
- foreach ($value[0]->options as $valueOption) {
- $temp->storeData .= '{"value":"' . $valueOption['value'] . '", "text":"' . $valueOption['value'] . '"},';
+ if (!empty($value[0]->options)) {
+ $temp->storeData = '[';
+ foreach ($value[0]->options as $valueOption) {
+ $temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
+ }
+ $temp->storeData = substr($temp->storeData,0,-1);
+ $temp->storeData .= ']';
}
- $temp->storeData = substr($temp->storeData,0,-1);
- $temp->storeData .= ']';
- $temp->readOnly = ($value[0]->mode == 'view') ? "0" : "1";
+ $temp->readOnly = ($temp->mode == 'view') ? "1" : "0";
$temp->colWidth = 200;
$xmlfrm->fields[] = $temp;
}
@@ -515,31 +521,66 @@ class Consolidated
case "dropdown":
$dropList[] = $field->name;
$align = "left";
- $editor = "* new Ext.form.ComboBox({
+
+ if (empty($field->storeData)) {
+ $editor = "* new Ext.form.ComboBox({
+ id: \"cbo" . $field->name . "_" . $pro_uid . "\",
+
+ valueField: 'value',
+ displayField: 'text',
+
+ /*store: comboStore,*/
+ store: new Ext.data.JsonStore({
+ storeId: \"store" . $field->name . "_" . $pro_uid . "\",
+ proxy: new Ext.data.HttpProxy({
+ url: 'proxyDataCombobox'
+ }),
+ root: 'records',
+ fields: [{name: 'value'},
+ {name: 'text'}
+ ]
+ }),
+
+ triggerAction: 'all',
+ mode: 'local',
+ editable: false,
+ disabled: $fieldDisabled,
+ lazyRender: false,
+
+ $fieldReadOnly
+ $fieldRequired
+ $fieldValidate
+ cls: \"\"
+ }) *";
+ } else {
+ $editor = "* new Ext.form.ComboBox({
id: \"cbo" . $field->name . "_" . $pro_uid . "\",
+ typeAhead: true,
+ autocomplete:true,
+ editable:false,
+ lazyRender:true,
+ mode:'local',
+ triggerAction:'all',
+ forceSelection:true,
+
valueField: 'value',
displayField: 'text',
-
- /*store: comboStore,*/
- store: new Ext.data.JsonStore({
- data: " . htmlspecialchars_decode($field->storeData) . ",
- fields: [{name: 'value'},
- {name: 'text'}
- ]
- }),
-
-
- queryMode: 'local',
- editable: false,
- disabled: $fieldDisabled,
- lazyRender: false,
+ store:new Ext.data.SimpleStore({
+ fields: [{name: 'value'},
+ {name: 'text'}],
+ data: " . htmlspecialchars_decode($field->storeData) . ",
+ sortInfo:{field:'text',direction:'ASC'}
+ }),
$fieldReadOnly
$fieldRequired
$fieldValidate
cls: \"\"
- }) *";
+ }) *";
+ }
+
+
$editor = eregi_replace("[\n|\r|\n\r]", ' ', $editor);
$width = $field->colWidth;
@@ -789,7 +830,7 @@ class Consolidated
$width = $size;
$editor = "* new Ext.form.TextField({ $fieldReadOnly $fieldRequired $fieldValidate cls: \"\"}) *";
- if ($field->mode != "edit") {
+ if ($field->mode != "edit" && $field->mode != "parent") {
$editor = null;
}
@@ -930,11 +971,9 @@ class Consolidated
$array = array();
$array["form"] = $dataUpdate;
-
$appUid = $array["form"]["APP_UID"];
$fields = $oCase->loadCase($appUid);
-
if (!isset($fields["DEL_INIT_DATE"])) {
$oCase->setDelInitDate($appUid, $delIndex);
//$aFields = $oCase->loadCase($appUid, $delIndex);
@@ -948,7 +987,8 @@ class Consolidated
foreach ($array["form"] as $key => $value) {
$array["form"][$key] = (string)$array["form"][$key];
- }
+ }
+ /*
$_POST['form'] = $array["form"];
if (!class_exists('Smarty')) {
require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');
@@ -956,6 +996,7 @@ class Consolidated
$oForm = new \Form( $auxAppDataProcess . "/" . $dynaformUid , PATH_DYNAFORM );
$oForm->validatePost();
$array["form"] = $_POST['form'];
+ */
$fields["APP_DATA"] = array_merge($fields["APP_DATA"], G::getSystemConstants());
$fields["APP_DATA"] = array_merge($fields["APP_DATA"], $array["form"]);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
index 917995d6c..404e63f68 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
@@ -389,15 +389,12 @@ class Task
$dataConso = array(
'tas_uid' => $arrayProperty['TAS_UID'],
'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'],
- 'status' => true,
'pro_uid' => $arrayProperty['PRO_UID'],
- 'rep_uid' => '',
+ 'rep_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_report_table'],
'table_name' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_table'],
- 'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title'],
- 'overwrite' => true,
- 'isBPMN' => true
+ 'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title']
);
- $consolidated->cochalo($dataConso);
+ $consolidated->saveConsolidated($dataConso);
}
$arrayResult["status"] = "OK";
diff --git a/workflow/engine/templates/designer/index.html b/workflow/engine/templates/designer/index.html
index 864036d8a..c5e4e3634 100644
--- a/workflow/engine/templates/designer/index.html
+++ b/workflow/engine/templates/designer/index.html
@@ -20,6 +20,7 @@
@@ -66,6 +67,7 @@
diff --git a/workflow/engine/xmlform/tasks/tasks_Consolidated.xml b/workflow/engine/xmlform/tasks/tasks_Consolidated.xml
new file mode 100644
index 000000000..a86daff32
--- /dev/null
+++ b/workflow/engine/xmlform/tasks/tasks_Consolidated.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file