Merged in cochalo/processmaker/CONSOLIDATED (pull request #1768)

Correccion de CONSOLIDATED
This commit is contained in:
Julio Cesar Laura Avendaño
2015-03-25 21:55:31 -04:00
11 changed files with 1052 additions and 294 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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();

View File

@@ -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 "<div style=\"margin:1em;\"><strong>".G::LoadTranslation('ID_ALERT')."</strong><br />".G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED')."</div>";
die;
}
}
global $G_PUBLISH;
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();

View File

@@ -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);

View File

@@ -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<taskOptions.length;i++){

File diff suppressed because it is too large Load Diff

View File

@@ -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/"

View File

@@ -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"]);

View File

@@ -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";

View File

@@ -20,6 +20,7 @@
<script type="text/javascript">
var prj_uid = "{$prj_uid}";
var app_uid = "{$app_uid}";
var consolidated = "{$consolidated}";
var prj_readonly = "{$prj_readonly}";
var credentials = "{$credentials}";
</script>
@@ -66,6 +67,7 @@
<script type="text/javascript">
var prj_uid = "{$prj_uid}";
var app_uid = "{$app_uid}";
var consolidated = "{$consolidated}";
var prj_readonly = "{$prj_readonly}";
var credentials = "{$credentials}";
</script>

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlform" name="" width="585" height="305" enabletemplate="0" mode="edit">
<PRO_UID type="hidden" />
<TAS_UID type="hidden" />
<SYS_LANG type="hidden" />
<REP_TAB_UID type="hidden" />
<INDEX type="hidden" />
<TABLE_NAME_DEFAULT type="hidden" />
<IFORM type="hidden" />
<CON_STATUS type="checkbox" value="ACTIVE" falsevalue="INACTIVE">
<en><![CDATA[Enable consolidate for this task.]]></en>
</CON_STATUS>
<DYN_UID type="dropdown">
<![CDATA[
SELECT
DISTINCT
D.DYN_UID,
C.CON_VALUE
FROM
DYNAFORM D
LEFT JOIN CONTENT C ON (D.DYN_UID = C.CON_ID AND C.CON_CATEGORY = 'DYN_TITLE' AND CON_LANG = 'en')
WHERE
D.PRO_UID = @@PRO_UID AND
D.DYN_TYPE = 'grid'
ORDER BY C.CON_VALUE
]]>
<en>
<![CDATA[Dynaform Template]]>
<option name="">- Select a DynaForm template -</option>
</en>
</DYN_UID>
<TABLE_NAME type="text" maxlength="60" validate="Login" size="40" mode="edit" required="1" mask="">
<en><![CDATA[Table Name]]></en>
</TABLE_NAME>
<TITLE type="text" maxlength="60" validate="Any" size="40" mode="edit">
<en><![CDATA[Title]]></en>
</TITLE>
<APPLY type="button" onClick="conSaveProperties(0)" >
<en><![CDATA[Apply]]></en>
</APPLY>
<JS type="javascript">
<![CDATA[
if(!getField('CON_STATUS').checked) {
hideRow('DYN_UID');
hideRow('TABLE_NAME');
hideRow('TITLE');
}
if (getField("TABLE_NAME").value == "") {
getField("TABLE_NAME").value = getField("TABLE_NAME_DEFAULT").value;
getField("TITLE").value = getField("TABLE_NAME_DEFAULT").value;
}
var ajax = WebResource("../processes/consolidated");
function conSaveProperties(swOverwrite) {
var tableName = new input(getField('TABLE_NAME'));
var dynUid = new input(getField('DYN_UID'));
if (!getField('CON_STATUS').checked || getField('DYN_UID').value != '') {
dynUid.passed();
if (getField('TABLE_NAME').value != '') {
var response = ajax.con_save_properties(getField('TAS_UID').value, getField('DYN_UID').value, getField('CON_STATUS').checked, getField('PRO_UID').value, getField('REP_TAB_UID').value, getField('TABLE_NAME').value, getField('TITLE').value, swOverwrite);
switch (response) {
case 1:
tableName.failed();
if(confirm("The table name already exists\n\nDo you want to overwrite the table?")) {
conSaveProperties(1);
}
break;
case 2:
tableName.failed();
if(confirm("It can't create the table because it already exists with the same name\n\nDo you want to overwrite the table?")) {
conSaveProperties(2);
}
break;
default:
tableName.passed();
getField('REP_TAB_UID').value = response
alert("Change was successfuly saved.");
break;
}
}
else {
tableName.failed();
alert('Please enter a Table Name');
}
}
else {
if (getField('TABLE_NAME').value == '') {
tableName.failed();
}
dynUid.failed();
alert('Please select a DynaForm Template');
}
}
getField('CON_STATUS').onclick = function() {
if(getField('CON_STATUS').checked) {
showRow('DYN_UID');
showRow('TABLE_NAME');
showRow('TITLE');
}
else {
hideRow('DYN_UID');
hideRow('TABLE_NAME');
hideRow('TITLE');
}
};
]]>
</JS>
</dynaForm>