BUG 7835 "Error con los reportables" Solved!
This commit is contained in:
@@ -347,3 +347,8 @@ String.prototype.trim = function() {
|
|||||||
return this.replace(/^\s+|\s+get/g,"");
|
return this.replace(/^\s+|\s+get/g,"");
|
||||||
//return Ext.util.Format.trim(this);
|
//return Ext.util.Format.trim(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.nl2br = function () {
|
||||||
|
return this.replace(/\n/g,'<br />');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class PmTable
|
|||||||
$this->prepare($loadSchema);
|
$this->prepare($loadSchema);
|
||||||
$this->phingbuildModel();
|
$this->phingbuildModel();
|
||||||
$this->phingbuildSql();
|
$this->phingbuildSql();
|
||||||
$this->upgradeDatabaseFor($this->dataSource, $tablesList);
|
//$this->upgradeDatabaseFor($this->dataSource, $tablesList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,8 +349,13 @@ class PmTable
|
|||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
|
|
||||||
if (is_object($con)) {
|
if (is_object($con)) {
|
||||||
|
try {
|
||||||
$stmt->executeQuery("DROP TABLE {$tableName}");
|
$stmt->executeQuery("DROP TABLE {$tableName}");
|
||||||
}
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
throw new Exception("Phisical table '$tableName' does not exist!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -467,12 +472,13 @@ class PmTable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeDatabaseFor($dataSource, $tablesList)
|
public function upgradeDatabaseFor($dataSource, $tablesList = array())
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection($dataSource);
|
$con = Propel::getConnection($dataSource);
|
||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
$lines = file($this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql');
|
$lines = file($this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql');
|
||||||
$previous = NULL;
|
$previous = NULL;
|
||||||
|
$errors = '';
|
||||||
|
|
||||||
foreach ($lines as $j => $line) {
|
foreach ($lines as $j => $line) {
|
||||||
$line = trim($line); // Remove comments from the script
|
$line = trim($line); // Remove comments from the script
|
||||||
@@ -509,17 +515,27 @@ class PmTable
|
|||||||
$line = substr($line, 0, strrpos($line, ";"));
|
$line = substr($line, 0, strrpos($line, ";"));
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
if (stripos($line, 'CREATE TABLE') !== false || stripos($line, 'DROP TABLE') !== false) {
|
$isCreate = stripos($line, 'CREATE TABLE') !== false;
|
||||||
|
$isDrop = stripos($line, 'DROP TABLE') !== false;
|
||||||
|
|
||||||
|
if ($isCreate || $isDrop) {
|
||||||
if (preg_match('/TABLE\s[\'\"\`]+(\w+)[\'\"\`]+/i', $line, $match)) {
|
if (preg_match('/TABLE\s[\'\"\`]+(\w+)[\'\"\`]+/i', $line, $match)) {
|
||||||
if (in_array($match[1], $tablesList)) {
|
if (in_array($match[1], $tablesList)) {
|
||||||
//error_log($line);
|
//error_log($line);
|
||||||
|
try {
|
||||||
$stmt->executeQuery($line);
|
$stmt->executeQuery($line);
|
||||||
}
|
}
|
||||||
}
|
catch(Exception $e) {
|
||||||
|
$errors .= $e->getMessage() . "\n";
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2273,6 +2273,7 @@ class processMap {
|
|||||||
$oCriteria->addSelectColumn(ReportTablePeer::PRO_UID);
|
$oCriteria->addSelectColumn(ReportTablePeer::PRO_UID);
|
||||||
$oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_NAME);
|
$oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_NAME);
|
||||||
$oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_TYPE);
|
$oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_TYPE);
|
||||||
|
$oCriteria->addSelectColumn(ReportTablePeer::REP_TAB_CONNECTION);
|
||||||
// $oCriteria->addAsColumn ( 'REP_TAB_TITLE', 'C.CON_VALUE' );
|
// $oCriteria->addAsColumn ( 'REP_TAB_TITLE', 'C.CON_VALUE' );
|
||||||
$oCriteria->addAsColumn('REP_TAB_TITLE', "CASE WHEN C.CON_VALUE IS NULL THEN (SELECT DISTINCT MAX(A.CON_VALUE) FROM CONTENT A WHERE A.CON_ID = REPORT_TABLE.REP_TAB_UID ) ELSE C.CON_VALUE END ");
|
$oCriteria->addAsColumn('REP_TAB_TITLE', "CASE WHEN C.CON_VALUE IS NULL THEN (SELECT DISTINCT MAX(A.CON_VALUE) FROM CONTENT A WHERE A.CON_ID = REPORT_TABLE.REP_TAB_UID ) ELSE C.CON_VALUE END ");
|
||||||
$oCriteria->addAlias('C', 'CONTENT');
|
$oCriteria->addAlias('C', 'CONTENT');
|
||||||
|
|||||||
@@ -27,10 +27,14 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
* Function load
|
* Function load
|
||||||
* access public
|
* access public
|
||||||
*/
|
*/
|
||||||
public function load($sUID, $bFields = false) {
|
public function load($sUID, $bFields = false)
|
||||||
try {
|
{
|
||||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
||||||
if (!is_null($oAdditionalTables)) {
|
|
||||||
|
if (is_null($oAdditionalTables)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
@@ -40,14 +44,6 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
|
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
|
||||||
throw($oError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
@@ -709,6 +705,7 @@ class AdditionalTables extends BaseAdditionalTables {
|
|||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||||
|
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||||
|
|
||||||
if (isset($process)) {
|
if (isset($process)) {
|
||||||
foreach ($process as $key => $pro_uid) {
|
foreach ($process as $key => $pro_uid) {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$addTables['rows'][] = array(
|
$addTables['rows'][] = array(
|
||||||
'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],
|
'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],
|
||||||
'PRO_UID' => $oldRepTab['PRO_UID'],
|
'PRO_UID' => $oldRepTab['PRO_UID'],
|
||||||
|
'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION']=='wf'? 'workflow' : 'rp'),
|
||||||
'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],
|
'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],
|
||||||
'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],
|
'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],
|
||||||
'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],
|
'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],
|
||||||
@@ -65,6 +66,19 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$addTables = AdditionalTables::getAll($start, $limit, $filter);
|
$addTables = AdditionalTables::getAll($start, $limit, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($addTables['rows'] as $i => $table) {
|
||||||
|
$con = Propel::getConnection($table['DBS_UID']);
|
||||||
|
$stmt = $con->createStatement();
|
||||||
|
$rs = $stmt->executeQuery('SELECT COUNT(*) AS NUM_ROWS from ' . $table['ADD_TAB_NAME']);
|
||||||
|
if ($rs->next()) {
|
||||||
|
$r = $rs->getRow();
|
||||||
|
$addTables['rows'][$i]['NUM_ROWS'] = $r['NUM_ROWS'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$addTables['rows'][$i]['NUM_ROWS'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $addTables;
|
return $addTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +237,13 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
case 'INT': $columns[$i]->field_type = 'INTEGER'; break;
|
case 'INT': $columns[$i]->field_type = 'INTEGER'; break;
|
||||||
case 'TEXT': $columns[$i]->field_type = 'LONGVARCHAR'; break;
|
case 'TEXT': $columns[$i]->field_type = 'LONGVARCHAR'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VALIDATIONS
|
||||||
|
if ($columns[$i]->field_autoincrement) {
|
||||||
|
if ($columns[$i]->field_type !== 'INTEGER') {
|
||||||
|
$columns[$i]->field_autoincrement = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
G::loadClass('pmTable');
|
G::loadClass('pmTable');
|
||||||
@@ -291,7 +312,8 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->message = $result->msg = $buildResult;
|
$result->message = $result->msg = $buildResult;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
$buildResult = ob_get_contents();
|
$buildResult = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$result->success = false;
|
$result->success = false;
|
||||||
@@ -319,23 +341,45 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
public function delete($httpData)
|
public function delete($httpData)
|
||||||
{
|
{
|
||||||
$rows = G::json_decode(stripslashes($httpData->rows));
|
$rows = G::json_decode(stripslashes($httpData->rows));
|
||||||
|
$errors = '';
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
try {
|
|
||||||
foreach ($rows as $row ) {
|
foreach ($rows as $row ) {
|
||||||
|
try {
|
||||||
|
$at = new AdditionalTables();
|
||||||
|
$table = $at->load($row->id);
|
||||||
|
|
||||||
|
if (!isset($table)) {
|
||||||
|
throw new Exception("Table does not exist... skipped!\n");
|
||||||
|
}
|
||||||
|
|
||||||
if($row->type == 'CLASSIC') {
|
if($row->type == 'CLASSIC') {
|
||||||
G::LoadClass('reportTables');
|
G::LoadClass('reportTables');
|
||||||
$rp = new reportTables();
|
$rp = new reportTables();
|
||||||
$rp->deleteReportTable($row->id);
|
$rp->deleteReportTable($row->id);
|
||||||
} else {
|
$count++;
|
||||||
$at = new AdditionalTables();
|
}
|
||||||
|
else {
|
||||||
$at->deleteAll($row->id);
|
$at->deleteAll($row->id);
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$result->success = true;
|
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$result->success = true; // if the table does not exist just skip it and don't show messages for it
|
$tableName = isset($table['ADD_TAB_NAME']) ? $table['ADD_TAB_NAME'] : $row->id;
|
||||||
$result->msg = $e->getMessage();
|
$errors .= $e->getMessage() . "\n";
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($errors == '') {
|
||||||
|
$result->success = true;
|
||||||
|
$result->message = "$count tables removed Successfully.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result->success = false;
|
||||||
|
$result->message = "$count tables removed but with errors.\n$errors" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->errors = $errors;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -655,7 +699,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
require_once 'classes/model/AdditionalTables.php';
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
try {
|
try {
|
||||||
$errors = '';
|
$errors = '';
|
||||||
ob_start();
|
|
||||||
$overWrite = isset($_POST['form']['OVERWRITE'])? true: false;
|
$overWrite = isset($_POST['form']['OVERWRITE'])? true: false;
|
||||||
|
|
||||||
//save the file
|
//save the file
|
||||||
@@ -681,8 +725,9 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
||||||
$fsData = intval(fread($fp, 9)); //reading the metadata
|
$fsData = intval(fread($fp, 9)); //reading the metadata
|
||||||
$sType = fread($fp, $fsData); //reading string $oData
|
$sType = fread($fp, $fsData);
|
||||||
|
|
||||||
|
// first create the tables structures
|
||||||
while (!feof($fp)) {
|
while (!feof($fp)) {
|
||||||
switch($sType) {
|
switch($sType) {
|
||||||
case '@META':
|
case '@META':
|
||||||
@@ -696,13 +741,12 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$fsData = intval(fread($fp, 9));
|
$fsData = intval(fread($fp, 9));
|
||||||
$schema = fread($fp, $fsData);
|
$schema = fread($fp, $fsData);
|
||||||
$contentSchema = unserialize($schema);
|
$contentSchema = unserialize($schema);
|
||||||
|
|
||||||
$additionalTable = new additionalTables();
|
$additionalTable = new additionalTables();
|
||||||
$tableExists = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
$tableExists = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
||||||
$tableNameMap[$contentSchema['ADD_TAB_NAME']] = $contentSchema['ADD_TAB_NAME'];
|
$tableNameMap[$contentSchema['ADD_TAB_NAME']] = $contentSchema['ADD_TAB_NAME'];
|
||||||
|
|
||||||
if ($overWrite) {
|
if ($overWrite) {
|
||||||
if($tableExists !== false) {
|
if ($tableExists !== false) {
|
||||||
$additionalTable->deleteAll($tableExists['ADD_TAB_UID']);
|
$additionalTable->deleteAll($tableExists['ADD_TAB_UID']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,19 +798,67 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
//save the table
|
//save the table
|
||||||
$alterTable = false;
|
$alterTable = false;
|
||||||
if (!isset($processQueue[$contentSchema['DBS_UID']])) {
|
|
||||||
$processQueue[$contentSchema['DBS_UID']] = array();
|
|
||||||
}
|
|
||||||
$processQueueTables[] = $contentSchema['ADD_TAB_NAME'];
|
|
||||||
|
|
||||||
$result = $this->save($tableData, $alterTable);
|
$result = $this->save($tableData, $alterTable);
|
||||||
|
|
||||||
if (!$result->success) {
|
if ($result->success) {
|
||||||
$errors .= $result->message . "\n\n";
|
$processQueueTables[$contentSchema['DBS_UID']][] = $contentSchema['ADD_TAB_NAME'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$errors .= 'Error creating table: '.$tableData->REP_TAB_NAME.'-> '.$result->message . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '@DATA':
|
||||||
|
$fstName = intval(fread($fp, 9));
|
||||||
|
$tableName = fread($fp, $fstName);
|
||||||
|
$fsData = intval(fread($fp, 9));
|
||||||
|
if ($fsData > 0) $data = fread($fp, $fsData);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fsData = intval(fread($fp, 9)); //reading the metadata
|
||||||
|
if($fsData > 0){ // reading next block type
|
||||||
|
$sType = fread($fp, $fsData);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
G::loadClass('pmTable');
|
||||||
|
|
||||||
|
foreach ($processQueueTables as $dbsUid => $tables) {
|
||||||
|
$pmTable = new pmTable();
|
||||||
|
ob_start();
|
||||||
|
$pmTable->buildModelFor($dbsUid, $tables);
|
||||||
|
$buildResult = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
$errors .= $pmTable->upgradeDatabaseFor($pmTable->getDataSource(), $tables);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
||||||
|
$fsData = intval(fread($fp, 9));
|
||||||
|
$sType = fread($fp, $fsData);
|
||||||
|
// data processing
|
||||||
|
|
||||||
|
while (!feof($fp)) {
|
||||||
|
|
||||||
|
switch($sType) {
|
||||||
|
case '@META':
|
||||||
|
$fsData = intval(fread($fp, 9));
|
||||||
|
$METADATA = fread($fp, $fsData);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '@SCHEMA':
|
||||||
|
$fsUid = intval(fread($fp, 9));
|
||||||
|
$uid = fread($fp, $fsUid);
|
||||||
|
$fsData = intval(fread($fp, 9));
|
||||||
|
$schema = fread($fp, $fsData);
|
||||||
|
break;
|
||||||
|
|
||||||
case '@DATA':
|
case '@DATA':
|
||||||
$fstName = intval(fread($fp, 9));
|
$fstName = intval(fread($fp, 9));
|
||||||
$tableName = fread($fp, $fstName);
|
$tableName = fread($fp, $fstName);
|
||||||
@@ -779,9 +871,24 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
$oAdditionalTables = new AdditionalTables();
|
$oAdditionalTables = new AdditionalTables();
|
||||||
$table = $oAdditionalTables->loadByName($tableName);
|
$table = $oAdditionalTables->loadByName($tableName);
|
||||||
|
$isReport = $table['PRO_UID'] !== '' ? true : false;
|
||||||
|
|
||||||
if ($table !== false) {
|
if ($table !== false) {
|
||||||
$processQueue[$contentSchema['DBS_UID']][] = array('id'=>$table[0]['ADD_TAB_UID'], 'records'=>$contentData);
|
if (!$isReport) {
|
||||||
|
//////////data
|
||||||
|
if (count($contentData) > 0) {
|
||||||
|
foreach ($contentData as $row) {
|
||||||
|
$data = new StdClass();
|
||||||
|
$data->id = $table['ADD_TAB_UID'];
|
||||||
|
$data->rows = base64_encode(serialize($row));
|
||||||
|
$res = $this->dataCreate($data , 'base64');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////////////
|
||||||
|
}
|
||||||
|
else { // is a report table
|
||||||
|
$oAdditionalTables->populateReportTable($tablename, $table['DBS_UID'], $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -797,37 +904,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
G::loadClass('pmTable');
|
|
||||||
|
|
||||||
foreach ($processQueue as $dbsUid => $tableData) {
|
|
||||||
|
|
||||||
$pmTable = new pmTable();
|
|
||||||
$pmTable->buildModelFor($dbsUid, $processQueueTables);
|
|
||||||
$buildResult = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
if (count($tableData) > 0) {
|
|
||||||
foreach ($tableData as $rows) {
|
|
||||||
foreach ($rows['records'] as $row) {
|
|
||||||
$data = new StdClass();
|
|
||||||
$data->id = $rows['id'];
|
|
||||||
$data->rows = base64_encode(serialize($row));
|
|
||||||
$this->dataCreate($data , 'base64');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$additionalTable = new AdditionalTables();
|
|
||||||
|
|
||||||
foreach ($processQueueTables as $tablename) {
|
|
||||||
$table = $additionalTable->loadByName($tablename);
|
|
||||||
$isReport = $table['PRO_UID'] !== '' ? true : false;
|
|
||||||
|
|
||||||
if ($table && $isReport) {
|
|
||||||
$oAdditionalTables->populateReportTable($tablename, $table['DBS_UID'], $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($errors == '') {
|
if ($errors == '') {
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ Ext.onReady(function(){
|
|||||||
header : tableDef.FIELDS[i].FLD_DESCRIPTION,
|
header : tableDef.FIELDS[i].FLD_DESCRIPTION,
|
||||||
dataIndex : tableDef.FIELDS[i].FLD_NAME,
|
dataIndex : tableDef.FIELDS[i].FLD_NAME,
|
||||||
width : 40,
|
width : 40,
|
||||||
align : columnAlign,
|
align : 'right',
|
||||||
renderer : columnRenderer
|
renderer : columnRenderer
|
||||||
};
|
};
|
||||||
if (tableDef.FIELDS[i].FLD_AUTO_INCREMENT != 1) {
|
if (tableDef.FIELDS[i].FLD_AUTO_INCREMENT != 1) {
|
||||||
@@ -282,7 +282,7 @@ Ext.onReady(function(){
|
|||||||
id: 'infoGrid',
|
id: 'infoGrid',
|
||||||
height:1000,
|
height:1000,
|
||||||
autoWidth : true,
|
autoWidth : true,
|
||||||
title : _('ID_PM_TABLE') + " : " + tableDef.ADD_TAB_NAME,
|
//title : _('ID_PM_TABLE') + " : " + tableDef.ADD_TAB_NAME,
|
||||||
stateful : true,
|
stateful : true,
|
||||||
stateId : 'grid',
|
stateId : 'grid',
|
||||||
enableColumnResize: true,
|
enableColumnResize: true,
|
||||||
@@ -296,15 +296,15 @@ Ext.onReady(function(){
|
|||||||
loadMask: true,
|
loadMask: true,
|
||||||
cm: cmodel,
|
cm: cmodel,
|
||||||
sm: smodel,
|
sm: smodel,
|
||||||
tbar:[ newButton,
|
tbar:[
|
||||||
|
newButton,
|
||||||
'-',
|
'-',
|
||||||
editButton,
|
editButton,
|
||||||
deleteButton,
|
deleteButton,
|
||||||
'-',
|
'-',
|
||||||
importButton,
|
importButton,
|
||||||
exportButton,
|
exportButton
|
||||||
{xtype: 'tbfill'},
|
],
|
||||||
backButton ],
|
|
||||||
bbar: bbarpaging
|
bbar: bbarpaging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ Ext.onReady(function(){
|
|||||||
{name : 'ADD_TAB_TYPE'},
|
{name : 'ADD_TAB_TYPE'},
|
||||||
{name : 'ADD_TAB_TAG'},
|
{name : 'ADD_TAB_TAG'},
|
||||||
{name : 'PRO_UID'},
|
{name : 'PRO_UID'},
|
||||||
|
{name : 'NUM_ROWS'}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -216,7 +217,10 @@ Ext.onReady(function(){
|
|||||||
editButton.enable();
|
editButton.enable();
|
||||||
deleteButton.enable();
|
deleteButton.enable();
|
||||||
exportButton.enable();
|
exportButton.enable();
|
||||||
|
row = sm.getSelected();
|
||||||
|
if (row.data.NUM_ROWS > 0) {
|
||||||
dataButton.enable();
|
dataButton.enable();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
editButton.disable();
|
editButton.disable();
|
||||||
@@ -253,6 +257,8 @@ Ext.onReady(function(){
|
|||||||
return '<span style="color:'+color+'">'+value+'</span> ';
|
return '<span style="color:'+color+'">'+value+'</span> ';
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
cmodelColumns.push({header: 'Records', dataIndex: 'NUM_ROWS', width: 90, align:'left'});
|
||||||
|
|
||||||
if (PRO_UID === false) {
|
if (PRO_UID === false) {
|
||||||
cmodelColumns.push({header: _('ID_PROCESS'), dataIndex: 'PRO_TITLE', width: 180, align:'left'});
|
cmodelColumns.push({header: _('ID_PROCESS'), dataIndex: 'PRO_TITLE', width: 180, align:'left'});
|
||||||
}
|
}
|
||||||
@@ -421,15 +427,16 @@ DeletePMTable = function() {
|
|||||||
},
|
},
|
||||||
success: function(resp){
|
success: function(resp){
|
||||||
result = Ext.util.JSON.decode(resp.responseText);
|
result = Ext.util.JSON.decode(resp.responseText);
|
||||||
if (result.success) {
|
|
||||||
Ext.getCmp('infoGrid').getStore().reload();
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
if (result.success) {
|
||||||
PMExt.notify(_("ID_DELETION_SUCCESSFULLY"), _("ID_ALL_RECORDS_DELETED_SUCESSFULLY"));
|
PMExt.notify(_("ID_DELETION_SUCCESSFULLY"), _("ID_ALL_RECORDS_DELETED_SUCESSFULLY"));
|
||||||
} else {
|
} else {
|
||||||
Ext.Msg.alert( _('ID_ERROR'), result.msg);
|
PMExt.error( _('ID_ERROR'), result.message.nl2br());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
failure: function(obj, resp){
|
failure: function(obj, resp){
|
||||||
Ext.Msg.alert( _('ID_ERROR'), resp.result.msg);
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
Ext.Msg.alert( _('ID_ERROR'), resp.result.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -573,9 +580,32 @@ ExportPMTable = function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Load PM TAble Data
|
//Load PM TAble Data
|
||||||
PMTableData = function(){
|
PMTableData = function()
|
||||||
|
{
|
||||||
var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected();
|
var row = Ext.getCmp('infoGrid').getSelectionModel().getSelected();
|
||||||
location.href = 'pmTables/data?id='+row.get('ADD_TAB_UID');
|
//location.href = 'pmTables/data?id='+row.get('ADD_TAB_UID');
|
||||||
|
if (row.get('TYPE') != '') {
|
||||||
|
PMExt.info(_('ID_INFO'), _('ID_DATA_LIST_NOT_AVAILABLE_FOR_OLDVER'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
win = new Ext.Window({
|
||||||
|
layout:'fit',
|
||||||
|
width:700,
|
||||||
|
title: _('ID_PM_TABLE') +': '+ row.get('ADD_TAB_NAME'),
|
||||||
|
height:500,
|
||||||
|
modal: true,
|
||||||
|
maximizable: true,
|
||||||
|
constrain: true,
|
||||||
|
//closeAction:'hide',
|
||||||
|
plain: true,
|
||||||
|
items: [{
|
||||||
|
xtype:"iframepanel",
|
||||||
|
defaultSrc : 'pmTables/data?id='+row.get('ADD_TAB_UID')+'&type='+row.get('TYPE'),
|
||||||
|
loadMask:{msg: _('ID_LOADING')}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Gets UIDs from a array of rows
|
//Gets UIDs from a array of rows
|
||||||
|
|||||||
Reference in New Issue
Block a user