HOR-264-B-31 "Request an option to rename..." SOLVED

This commit is contained in:
Luis Fernando Saisa Lopez
2016-06-30 11:44:24 -04:00
parent 9e95b10463
commit bb9b85bf6a
3 changed files with 91 additions and 2 deletions

View File

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