BUG 10953 Al crear un segundo Report Table los campos desde la BD se modifican SOLVED
- Al repoblar la tabla no se estaba considerando la validacion agregada cuando se actualiza el registro - Se agrego la validacion faltante al momento de popular toda la tabla
This commit is contained in:
@@ -591,7 +591,7 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
* @param string $sGrid
|
* @param string $sGrid
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '')
|
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '')
|
||||||
{
|
{
|
||||||
require_once "classes/model/Application.php";
|
require_once "classes/model/Application.php";
|
||||||
|
|
||||||
@@ -621,11 +621,41 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
$rs = $stmt->executeQuery($deleteSql);
|
$rs = $stmt->executeQuery($deleteSql);
|
||||||
// getting the case data
|
// getting the case data
|
||||||
$caseData = unserialize($row['APP_DATA']);
|
$caseData = unserialize($row['APP_DATA']);
|
||||||
|
|
||||||
|
$fieldTypes = array();
|
||||||
|
|
||||||
|
if ($addTabUid != '') {
|
||||||
|
require_once 'classes/model/Fields.php';
|
||||||
|
$criteriaField = new Criteria('workflow');
|
||||||
|
$criteriaField->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
||||||
|
$datasetField = FieldsPeer::doSelectRS($criteriaField);
|
||||||
|
$datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($datasetField->next()) {
|
||||||
|
$rowfield = $datasetField->getRow();
|
||||||
|
switch ($rowfield['FLD_TYPE']) {
|
||||||
|
case 'FLOAT':
|
||||||
|
case 'DOUBLE':
|
||||||
|
case 'INTEGER':
|
||||||
|
$fieldTypes[] = array($rowfield['FLD_NAME']=>$rowfield['FLD_TYPE']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// quick fix
|
// quick fix
|
||||||
// map all empty values as NULL for Database
|
// map all empty values as NULL for Database
|
||||||
foreach ($caseData as $dKey => $dValue) {
|
foreach ($caseData as $dKey => $dValue) {
|
||||||
if (!is_array($dValue)) {
|
if (!is_array($dValue)) {
|
||||||
|
foreach ($fieldTypes as $key => $fieldType) {
|
||||||
|
foreach ($fieldType as $name => $type) {
|
||||||
|
if (strtoupper($dKey) == $name) {
|
||||||
|
$caseData[$dKey] = validateType ($dValue, $type);
|
||||||
|
unset($name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// normal fields
|
// normal fields
|
||||||
if (trim($dValue) === '') {
|
if (trim($dValue) === '') {
|
||||||
$caseData[$dKey] = null;
|
$caseData[$dKey] = null;
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
if ($isReportTable && $alterTable) {
|
if ($isReportTable && $alterTable) {
|
||||||
// the table was create successfully but we're catching problems while populating table
|
// the table was create successfully but we're catching problems while populating table
|
||||||
try {
|
try {
|
||||||
$oAdditionalTables->populateReportTable( $data['REP_TAB_NAME'], $pmTable->getDataSource(), $data['REP_TAB_TYPE'], $data['PRO_UID'], $data['REP_TAB_GRID'] );
|
$oAdditionalTables->populateReportTable( $data['REP_TAB_NAME'], $pmTable->getDataSource(), $data['REP_TAB_TYPE'], $data['PRO_UID'], $data['REP_TAB_GRID'], $addTabData['ADD_TAB_UID'] );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result->message = $result->msg = $e->getMessage();
|
$result->message = $result->msg = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -883,7 +883,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$table = $additionalTable->loadByName( $tableNameMap[$contentSchema['ADD_TAB_NAME']] );
|
$table = $additionalTable->loadByName( $tableNameMap[$contentSchema['ADD_TAB_NAME']] );
|
||||||
if ($table['PRO_UID'] != '') {
|
if ($table['PRO_UID'] != '') {
|
||||||
// is a report table, try populate it
|
// is a report table, try populate it
|
||||||
$additionalTable->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'] );
|
$additionalTable->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '@DATA':
|
case '@DATA':
|
||||||
@@ -1214,7 +1214,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$additionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$table = $additionalTables->load( $httpData->id );
|
$table = $additionalTables->load( $httpData->id );
|
||||||
if ($table['PRO_UID'] != '') {
|
if ($table['PRO_UID'] != '') {
|
||||||
$additionalTables->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'] );
|
$additionalTables->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] );
|
||||||
$result->message = 'generated for table ' . $table['ADD_TAB_NAME'];
|
$result->message = 'generated for table ' . $table['ADD_TAB_NAME'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ switch ($action) {
|
|||||||
|
|
||||||
$oAdditionalTables->createPropelClasses( $data['REP_TAB_NAME'], $repTabClassName, $fieldsList, $addTabUid );
|
$oAdditionalTables->createPropelClasses( $data['REP_TAB_NAME'], $repTabClassName, $fieldsList, $addTabUid );
|
||||||
|
|
||||||
$oAdditionalTables->populateReportTable( $data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID'] );
|
$oAdditionalTables->populateReportTable( $data['REP_TAB_NAME'], $data['REP_TAB_CONNECTION'], $data['REP_TAB_TYPE'], $fieldsList, $data['PRO_UID'], $data['REP_TAB_GRID'], $repTabData['ADD_TAB_UID'] );
|
||||||
|
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user