BUG 7835 "Error con los reportables" Solved!
This commit is contained in:
@@ -180,7 +180,7 @@ class PmTable
|
||||
$this->prepare($loadSchema);
|
||||
$this->phingbuildModel();
|
||||
$this->phingbuildSql();
|
||||
$this->upgradeDatabaseFor($this->dataSource, $tablesList);
|
||||
//$this->upgradeDatabaseFor($this->dataSource, $tablesList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,7 +349,12 @@ class PmTable
|
||||
$stmt = $con->createStatement();
|
||||
|
||||
if (is_object($con)) {
|
||||
$stmt->executeQuery("DROP TABLE {$tableName}");
|
||||
try {
|
||||
$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);
|
||||
$stmt = $con->createStatement();
|
||||
$lines = file($this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql');
|
||||
$previous = NULL;
|
||||
$errors = '';
|
||||
|
||||
foreach ($lines as $j => $line) {
|
||||
$line = trim($line); // Remove comments from the script
|
||||
@@ -509,17 +515,27 @@ class PmTable
|
||||
$line = substr($line, 0, strrpos($line, ";"));
|
||||
|
||||
// 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 (in_array($match[1], $tablesList)) {
|
||||
//error_log($line);
|
||||
$stmt->executeQuery($line);
|
||||
try {
|
||||
$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::REP_TAB_NAME);
|
||||
$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', "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');
|
||||
|
||||
@@ -27,26 +27,22 @@ class AdditionalTables extends BaseAdditionalTables {
|
||||
* Function load
|
||||
* access public
|
||||
*/
|
||||
public function load($sUID, $bFields = false) {
|
||||
try {
|
||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
||||
if (!is_null($oAdditionalTables)) {
|
||||
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
public function load($sUID, $bFields = false)
|
||||
{
|
||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
|
||||
|
||||
if (is_null($oAdditionalTables)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($bFields) {
|
||||
$aFields['FIELDS'] = $this->getFields();
|
||||
}
|
||||
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
throw(new Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
$aFields = $oAdditionalTables->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($bFields) {
|
||||
$aFields['FIELDS'] = $this->getFields();
|
||||
}
|
||||
|
||||
return $aFields;
|
||||
}
|
||||
|
||||
public function getFields()
|
||||
@@ -709,6 +705,7 @@ class AdditionalTables extends BaseAdditionalTables {
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||
|
||||
if (isset($process)) {
|
||||
foreach ($process as $key => $pro_uid) {
|
||||
|
||||
Reference in New Issue
Block a user