Merge remote branch 'upstream/master' into BUG-10946

This commit is contained in:
Hector Cortez
2013-03-07 17:19:11 -04:00
4 changed files with 43 additions and 5 deletions

View File

@@ -2230,6 +2230,14 @@ function setCaseTrackerCode ($sApplicationUID, $sCode, $sPIN = '')
$aFields['APP_PIN'] = md5( $sPIN );
}
$oCase->updateCase( $sApplicationUID, $aFields );
if (isset($_SESSION['APPLICATION'])) {
if ($sApplicationUID == $_SESSION['APPLICATION']) {
global $oPMScript;
if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) {
$oPMScript->aFields['PIN'] = $aFields['APP_DATA']['PIN'];
}
}
}
return 1;
} else {
return 0;

View File

@@ -591,7 +591,7 @@ class AdditionalTables extends BaseAdditionalTables
* @param string $sGrid
* @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";
@@ -621,11 +621,41 @@ class AdditionalTables extends BaseAdditionalTables
$rs = $stmt->executeQuery($deleteSql);
// getting the case 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
// map all empty values as NULL for Database
foreach ($caseData as $dKey => $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
if (trim($dValue) === '') {
$caseData[$dKey] = null;

View File

@@ -317,7 +317,7 @@ class pmTablesProxy extends HttpProxyController
if ($isReportTable && $alterTable) {
// the table was create successfully but we're catching problems while populating table
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) {
$result->message = $result->msg = $e->getMessage();
}
@@ -883,7 +883,7 @@ class pmTablesProxy extends HttpProxyController
$table = $additionalTable->loadByName( $tableNameMap[$contentSchema['ADD_TAB_NAME']] );
if ($table['PRO_UID'] != '') {
// 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;
case '@DATA':
@@ -1214,7 +1214,7 @@ class pmTablesProxy extends HttpProxyController
$additionalTables = new AdditionalTables();
$table = $additionalTables->load( $httpData->id );
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'];
}

View File

@@ -260,7 +260,7 @@ switch ($action) {
$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;
} catch (Exception $e) {