HOR-264-B-31 "Request an option to rename..." SOLVED
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user