Merged in luisfernandosl/processmaker/HOR-264-B-31 (pull request #4493)
HOR-264-B
This commit is contained in:
@@ -101,6 +101,10 @@ class pmTables extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/^PMT_(.*)$/", $table['ADD_TAB_NAME'], $match)) {
|
||||
$table['ADD_TAB_NAME'] = $match[1];
|
||||
}
|
||||
|
||||
$this->includeExtJS( 'pmTables/' . $jsFile );
|
||||
|
||||
$this->setJSVar( 'flagProcessmap', (isset($_REQUEST['flagProcessmap'])) ? $_REQUEST['flagProcessmap'] : 0);
|
||||
|
||||
@@ -348,11 +348,45 @@ class ReportTable
|
||||
$result = new \stdClass();
|
||||
|
||||
try {
|
||||
$additionalTableUid = $arrayData['REP_TAB_UID'];
|
||||
$flagNew = 0;
|
||||
|
||||
$additionalTables = \AdditionalTablesPeer::retrieveByPK($arrayData['REP_TAB_UID']);
|
||||
|
||||
if (!is_null($additionalTables)){
|
||||
$arrayData['REP_TAB_NAME'] = 'PMT_' . trim($arrayData['REP_TAB_NAME']);
|
||||
|
||||
if ($additionalTables->getAddTabName() != $arrayData['REP_TAB_NAME']) {
|
||||
$arrayData['REP_TAB_UID'] = '';
|
||||
$flagNew = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
$arrayData['PRO_UID'] = trim($arrayData['PRO_UID']);
|
||||
$arrayData['columns'] = \G::json_decode(stripslashes($arrayData['columns'])); //Decofing data columns
|
||||
|
||||
if ($flagNew == 1) {
|
||||
$arrayNewColumn = [];
|
||||
$counter = 0;
|
||||
|
||||
foreach ($arrayData['columns'] as $value) {
|
||||
$column = $value;
|
||||
|
||||
if (!preg_match('/^(?:APP_UID|APP_NUMBER|APP_STATUS|ROW)$/', $column->field_name)) {
|
||||
$column->uid = '';
|
||||
$column->_index = $counter;
|
||||
|
||||
$arrayNewColumn[] = $column;
|
||||
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayData['columns'] = $arrayNewColumn;
|
||||
}
|
||||
|
||||
$additionalTable = new \AdditionalTables();
|
||||
|
||||
$repTabClassName = $additionalTable->getPHPName($arrayData['REP_TAB_NAME']);
|
||||
@@ -531,6 +565,18 @@ class ReportTable
|
||||
|
||||
$result->success = true;
|
||||
$result->message = $result->msg = $buildResult;
|
||||
|
||||
require_once(PATH_CORE . 'controllers/pmTablesProxy.php');
|
||||
|
||||
if ($flagNew == 1) {
|
||||
$pmTablesProxy = new \pmTablesProxy();
|
||||
|
||||
$obj = new \stdClass();
|
||||
$obj->rows = \G::json_encode([['id' => $additionalTableUid, 'type' => '']]);
|
||||
|
||||
//Delete Report Table
|
||||
$resultDeleteReportTable = $pmTablesProxy->delete($obj);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$buildResult = ob_get_contents();
|
||||
|
||||
|
||||
@@ -923,7 +923,7 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
}
|
||||
// setting table attributes for current editing process
|
||||
Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME);
|
||||
Ext.getCmp('REP_TAB_NAME').setDisabled(true);
|
||||
Ext.getCmp('REP_TAB_NAME').setDisabled(false);
|
||||
Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION);
|
||||
|
||||
// grid
|
||||
@@ -1052,7 +1052,46 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) {
|
||||
buttons:[ {
|
||||
id: 'southPanelCreateUpdate',
|
||||
text: TABLE === false ? _("ID_CREATE") : _("ID_UPDATE"),
|
||||
handler: createReportTable
|
||||
handler: function()
|
||||
{
|
||||
if (TABLE === false) {
|
||||
createReportTable();
|
||||
} else {
|
||||
var oldRepTabName = TABLE.ADD_TAB_NAME;
|
||||
var newRepTabName = Ext.getCmp("REP_TAB_NAME").getValue().trim();
|
||||
|
||||
if (newRepTabName != "") {
|
||||
if (oldRepTabName != newRepTabName) {
|
||||
Ext.MessageBox.show({
|
||||
title: _("ID_CONFIRM"),
|
||||
msg: _("ID_RT_RENAME_NAME_TABLE"),
|
||||
icon: Ext.MessageBox.QUESTION,
|
||||
buttons: {
|
||||
yes: _("ID_RT_CONTINUE_TABLE_RENAME"),
|
||||
no: _("ID_RT_NOT_CHANGE_NAME")
|
||||
},
|
||||
fn: function (buttonId, text, opt)
|
||||
{
|
||||
if (buttonId == "yes") {
|
||||
createReportTable();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createReportTable();
|
||||
}
|
||||
} else {
|
||||
PMExt.error(
|
||||
_("ID_ERROR"),
|
||||
_("ID_TABLE_NAME_IS_REQUIRED"),
|
||||
function()
|
||||
{
|
||||
Ext.getCmp("REP_TAB_NAME").focus();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
id: 'southPanelCancel',
|
||||
text:_("ID_CANCEL"),
|
||||
|
||||
Reference in New Issue
Block a user