BUG 000 Fixes for Report PMTables type updating data when running case

- fixes for report pmtables to edit grid report structure
- fixes to insert or update the data when case is running
This commit is contained in:
Erik Amaru Ortiz
2011-08-30 13:15:25 -04:00
parent 29d2ee80d1
commit 4cdf06dc19
3 changed files with 170 additions and 492 deletions

View File

@@ -76,11 +76,10 @@ class PmTable
*/
function setDataSource($dbsUid)
{
$this->dataSource = $dbsUid;
$this->dataSource = self::resolveDbSource($dbsUid);
switch ($dbsUid) {
case 'workflow': case 'wf': case '0': case '':
$this->dataSource = 'workflow';
case 'workflow':
$this->dbConfig->adapter= DB_ADAPTER;
$this->dbConfig->host = DB_HOST;
$this->dbConfig->name = DB_NAME;
@@ -89,8 +88,7 @@ class PmTable
$this->dbConfig->port = 3306; //FIXME update this when port for workflow dsn will be available
break;
case 'rp': case 'report':
$this->dataSource = 'rp';
case 'rp':
$this->dbConfig->adapter= DB_ADAPTER;
$this->dbConfig->host = DB_REPORT_HOST;
$this->dbConfig->name = DB_REPORT_NAME;
@@ -101,7 +99,7 @@ class PmTable
default:
require_once 'classes/model/DbSource.php';
$dbSource = DbSource::load($dbsUid);
$dbSource = DbSource::load($this->dataSource);
if (!is_object($dbSource)) {
throw new Exception("Db source with id $dbsUid does not exist!");
}
@@ -115,6 +113,26 @@ class PmTable
}
}
/**
* Backward compatibility function
* Resolve a propel data source
* @param string $dbsUid corresponding to DBS_UID key
* @return string contains resolved DBS_UID
*/
public function resolveDbSource($dbsUid)
{
switch ($dbsUid) {
case 'workflow': case 'wf': case '0': case '': case null:
$dbsUid = 'workflow';
break;
case 'rp': case 'report':
$dbsUid = 'rp';
break;
}
return $dbsUid;
}
public function getDataSource()
{
return $this->dataSource;
@@ -280,14 +298,14 @@ class PmTable
/**
* Drop the phisical table of target pmTable or any specified as parameter
*/
public function dropTable($table = null)
public function dropTable($tableName = null)
{
$table = isset($table) ? $table : $this->dataSource;
$con = Propel::getConnection();
$tableName = isset($tableName) ? $tableName : $this->tableName;
$con = Propel::getConnection($this->dataSource);
$stmt = $con->createStatement();
if (is_object($con)) {
$stmt->executeQuery("DROP TABLE {$this->tableName}");
$stmt->executeQuery("DROP TABLE {$tableName}");
}
}
@@ -506,6 +524,8 @@ class PmTable
*/
public static function callPhing($target, $buildFile = '', $options = array(), $verbose = true)
{
G::loadClass('pmPhing');
$args = array();
foreach ($options as $key => $value) {
$args[] = "-D$key=$value";
@@ -541,18 +561,3 @@ class PmTable
}
}
include_once 'phing/Phing.php';
set_include_path(PATH_THIRDPARTY . 'propel-generator/classes/' . PATH_SEPARATOR . get_include_path());
if (!class_exists('Phing')) {
throw new Exception('Fatal Error: Phing is not loaded!');
}
class pmPhing extends Phing
{
function getPhingVersion()
{
return 'pmPhing Ver 1.0';
}
}