BUG 6588 Problems importing a process that has Report Tables
Fixed an issue whe a process is imported with Report Tables when there are duplicate fields
This commit is contained in:
@@ -968,7 +968,7 @@ class Processes {
|
|||||||
$aEvent[] = $oEvent->load($aRow['EVN_UID']);
|
$aEvent[] = $oEvent->load($aRow['EVN_UID']);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
return $aEvent;
|
return $aEvent;
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
catch (Exception $oError) {
|
||||||
throw($oError);
|
throw($oError);
|
||||||
@@ -994,7 +994,7 @@ class Processes {
|
|||||||
$aCaseScheduler[] = $oCaseScheduler->load($aRow['SCH_UID']);
|
$aCaseScheduler[] = $oCaseScheduler->load($aRow['SCH_UID']);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
return $aCaseScheduler;
|
return $aCaseScheduler;
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
catch (Exception $oError) {
|
||||||
throw($oError);
|
throw($oError);
|
||||||
@@ -1215,7 +1215,7 @@ class Processes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Field Conditions from an array of Field Conditions and Dynaforms,
|
* Create Field Conditions from an array of Field Conditions and Dynaforms,
|
||||||
* removing those Objects with the same UID, and recreaiting the records
|
* removing those Objects with the same UID, and recreaiting the records
|
||||||
* from the arrays data.
|
* from the arrays data.
|
||||||
* @param $aFieldCondition array.
|
* @param $aFieldCondition array.
|
||||||
@@ -1259,7 +1259,7 @@ class Processes {
|
|||||||
function createCaseSchedulerRows ($CaseScheduler ) {
|
function createCaseSchedulerRows ($CaseScheduler ) {
|
||||||
foreach ( $CaseScheduler as $key => $row ) {
|
foreach ( $CaseScheduler as $key => $row ) {
|
||||||
$oCaseScheduler = new CaseScheduler();
|
$oCaseScheduler = new CaseScheduler();
|
||||||
if($oCaseScheduler->Exists($row['SCH_UID']))
|
if($oCaseScheduler->Exists($row['SCH_UID']))
|
||||||
$oCaseScheduler->remove($row['SCH_UID']);
|
$oCaseScheduler->remove($row['SCH_UID']);
|
||||||
|
|
||||||
$res = $oCaseScheduler->create($row);
|
$res = $oCaseScheduler->create($row);
|
||||||
@@ -1491,7 +1491,7 @@ class Processes {
|
|||||||
*/
|
*/
|
||||||
function renewAllDBSourceGuid ( &$oData ) {
|
function renewAllDBSourceGuid ( &$oData ) {
|
||||||
$map = array ();
|
$map = array ();
|
||||||
$aSqlConnections = array();
|
$aSqlConnections = array();
|
||||||
foreach ( $oData->dbconnections as $key => $val ) {
|
foreach ( $oData->dbconnections as $key => $val ) {
|
||||||
$newGuid = $val['DBS_UID']; ///-- $this->getUnusedDBSourceGUID();
|
$newGuid = $val['DBS_UID']; ///-- $this->getUnusedDBSourceGUID();
|
||||||
$map[ $val['DBS_UID'] ] = $newGuid;
|
$map[ $val['DBS_UID'] ] = $newGuid;
|
||||||
@@ -1577,8 +1577,13 @@ class Processes {
|
|||||||
$oData->reportTables[$key]['REP_TAB_UID'] = $newGuid;
|
$oData->reportTables[$key]['REP_TAB_UID'] = $newGuid;
|
||||||
}
|
}
|
||||||
foreach ( $oData->reportTablesVars as $key => $val ) {
|
foreach ( $oData->reportTablesVars as $key => $val ) {
|
||||||
$newGuid = $map[ $val['REP_TAB_UID'] ];
|
if(isset($map[ $val['REP_TAB_UID'] ])){
|
||||||
$oData->reportTablesVars[$key]['REP_TAB_UID'] = $newGuid;
|
/*TODO: Why this can be not defined?? The scenario was when
|
||||||
|
* imported an existing process but as a new one
|
||||||
|
*/
|
||||||
|
$newGuid = $map[ $val['REP_TAB_UID'] ];
|
||||||
|
$oData->reportTablesVars[$key]['REP_TAB_UID'] = $newGuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1608,7 +1613,7 @@ class Processes {
|
|||||||
$map[ $val['FCD_UID'] ] = $newGuid;
|
$map[ $val['FCD_UID'] ] = $newGuid;
|
||||||
$oData->fieldCondition[$key]['FCD_UID'] = $newGuid;
|
$oData->fieldCondition[$key]['FCD_UID'] = $newGuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renew the GUID's for all the Events Objects
|
* Renew the GUID's for all the Events Objects
|
||||||
@@ -2146,7 +2151,7 @@ class Processes {
|
|||||||
if( $oContent->Exists($ConCategory, $ConParent, $ConId, $ConLang) ) {
|
if( $oContent->Exists($ConCategory, $ConParent, $ConId, $ConLang) ) {
|
||||||
$oContent->removeContent($ConCategory, $ConParent, $ConId);
|
$oContent->removeContent($ConCategory, $ConParent, $ConId);
|
||||||
}
|
}
|
||||||
$oContent->addContent($ConCategory, $ConParent, $ConId, $ConLang);
|
$oContent->addContent($ConCategory, $ConParent, $ConId, $ConLang,"");
|
||||||
}
|
}
|
||||||
} #@!neyek
|
} #@!neyek
|
||||||
|
|
||||||
@@ -2268,7 +2273,7 @@ class Processes {
|
|||||||
//krumo ($oData);die;
|
//krumo ($oData);die;
|
||||||
//$oJSON = new Services_JSON();
|
//$oJSON = new Services_JSON();
|
||||||
//krumo ( $oJSON->encode($oData) );
|
//krumo ( $oJSON->encode($oData) );
|
||||||
//return $oJSON->encode($oData);
|
//return $oJSON->encode($oData);
|
||||||
return serialize($oData);
|
return serialize($oData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3415,7 +3420,7 @@ class ObjectCellection{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the collection of ObjectDocument
|
* get the collection of ObjectDocument
|
||||||
* @param $name name object document
|
* @param $name name object document
|
||||||
* @param $type type object document
|
* @param $type type object document
|
||||||
* @param $data data object document
|
* @param $data data object document
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ G::LoadClass('case');
|
|||||||
* @copyright 2007 COLOSA
|
* @copyright 2007 COLOSA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ReportTables
|
class ReportTables
|
||||||
{
|
{
|
||||||
private $aDef = array('mysql' => array('number' => 'DOUBLE',
|
private $aDef = array('mysql' => array('number' => 'DOUBLE',
|
||||||
'char' => 'VARCHAR(255)',
|
'char' => 'VARCHAR(255)',
|
||||||
@@ -53,12 +53,12 @@ class ReportTables
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function deleteAllReportVars
|
* Function deleteAllReportVars
|
||||||
* This function delete all reports
|
* This function delete all reports
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $$sRepTabUid
|
* @param string $$sRepTabUid
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function deleteAllReportVars($sRepTabUid = '')
|
public function deleteAllReportVars($sRepTabUid = '')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
@@ -78,7 +78,7 @@ class ReportTables
|
|||||||
* @param string $sConnection Conexion
|
* @param string $sConnection Conexion
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dropTable($sTableName, $sConnection = 'report')
|
public function dropTable($sTableName, $sConnection = 'report')
|
||||||
{
|
{
|
||||||
$sTableName = $this->sPrefix . $sTableName;
|
$sTableName = $this->sPrefix . $sTableName;
|
||||||
//we have to do the propel connection
|
//we have to do the propel connection
|
||||||
@@ -107,12 +107,12 @@ class ReportTables
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sTableName Table name
|
* @param string $sTableName Table name
|
||||||
* @param string $sConnection Connection name
|
* @param string $sConnection Connection name
|
||||||
* @param string $sType
|
* @param string $sType
|
||||||
* @param array $aFields
|
* @param array $aFields
|
||||||
* @param string $bDefaultFields
|
* @param string $bDefaultFields
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $bDefaultFields = true)
|
public function createTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $bDefaultFields = true)
|
||||||
{
|
{
|
||||||
$sTableName = $this->sPrefix . $sTableName;
|
$sTableName = $this->sPrefix . $sTableName;
|
||||||
//we have to do the propel connection
|
//we have to do the propel connection
|
||||||
@@ -199,13 +199,13 @@ class ReportTables
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sTableName Table name
|
* @param string $sTableName Table name
|
||||||
* @param string $sConnection Connection name
|
* @param string $sConnection Connection name
|
||||||
* @param string $sType
|
* @param string $sType
|
||||||
* @param array $aFields
|
* @param array $aFields
|
||||||
* @param string $sProcessUid
|
* @param string $sProcessUid
|
||||||
* @param string $sGrid
|
* @param string $sGrid
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function populateTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
|
public function populateTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
|
||||||
{
|
{
|
||||||
$sTableName = $this->sPrefix . $sTableName;
|
$sTableName = $this->sPrefix . $sTableName;
|
||||||
//we have to do the propel connection
|
//we have to do the propel connection
|
||||||
@@ -391,13 +391,16 @@ class ReportTables
|
|||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aVars = array();
|
$aVars = array();
|
||||||
|
$aImportedVars = array();//This array will help to control if the variable already exist
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
if ($bWhitType) {
|
if ($bWhitType) {
|
||||||
$aVars[] = array('sFieldName' => $aRow['REP_VAR_NAME'], 'sType' => $aRow['REP_VAR_TYPE']);
|
if(in_array($aRow['REP_VAR_NAME'],$aImportedVars)){
|
||||||
}
|
$aImportedVars[]=$aRow['REP_VAR_NAME'];
|
||||||
else {
|
$aVars[] = array('sFieldName' => $aRow['REP_VAR_NAME'], 'sType' => $aRow['REP_VAR_TYPE']);
|
||||||
$aVars[] = $aRow['REP_VAR_NAME'];
|
}
|
||||||
}
|
}else {
|
||||||
|
$aVars[] = $aRow['REP_VAR_NAME'];
|
||||||
|
}
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
return $aVars;
|
return $aVars;
|
||||||
@@ -432,7 +435,7 @@ class ReportTables
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function getSplitDate
|
* Function getSplitDate
|
||||||
* This function gets the split date
|
* This function gets the split date
|
||||||
* @access public
|
* @access public
|
||||||
* @param date $date
|
* @param date $date
|
||||||
* @param string $mask
|
* @param string $mask
|
||||||
@@ -446,13 +449,13 @@ class ReportTables
|
|||||||
switch($item){
|
switch($item){
|
||||||
case 'Y':
|
case 'Y':
|
||||||
switch($i){
|
switch($i){
|
||||||
case 0:
|
case 0:
|
||||||
$d1 = substr($date, 0, 4);
|
$d1 = substr($date, 0, 4);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$d1 = substr($date, 3, 4);
|
$d1 = substr($date, 3, 4);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$d1 = substr($date, 6, 4);
|
$d1 = substr($date, 6, 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -460,40 +463,40 @@ class ReportTables
|
|||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
switch($i){
|
switch($i){
|
||||||
case 0:
|
case 0:
|
||||||
$d1 = substr($date, 0, 2);
|
$d1 = substr($date, 0, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$d1 = substr($date, 3, 2);
|
$d1 = substr($date, 3, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$d1 = substr($date, 6, 2);
|
$d1 = substr($date, 6, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
switch($i){
|
switch($i){
|
||||||
case 0:
|
case 0:
|
||||||
$d2 = substr($date, 0, 2);
|
$d2 = substr($date, 0, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$d2 = ($sw1)? substr($date, 5, 2): substr($date, 3, 2);
|
$d2 = ($sw1)? substr($date, 5, 2): substr($date, 3, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$d2 = ($sw1)? substr($date, 8, 2): substr($date, 5, 2);
|
$d2 = ($sw1)? substr($date, 8, 2): substr($date, 5, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
switch($i){
|
switch($i){
|
||||||
case 0:
|
case 0:
|
||||||
$d3 = substr($date, 0, 2);
|
$d3 = substr($date, 0, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$d3 = ($sw1)? substr($date, 5, 2): substr($date, 3, 2);
|
$d3 = ($sw1)? substr($date, 5, 2): substr($date, 3, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$d3 = ($sw1)? substr($date, 8, 2): substr($date, 5, 2);
|
$d3 = ($sw1)? substr($date, 8, 2): substr($date, 5, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -513,7 +516,7 @@ class ReportTables
|
|||||||
function getFormatDate($sDate, $sMask)
|
function getFormatDate($sDate, $sMask)
|
||||||
{
|
{
|
||||||
//print $sDate." *** ". $sMask."<BR>";
|
//print $sDate." *** ". $sMask."<BR>";
|
||||||
$dateTime = explode(" ",$sDate); //To accept the Hour part
|
$dateTime = explode(" ",$sDate); //To accept the Hour part
|
||||||
$aDate = explode ( '-', str_replace("/", "-", $dateTime[0]) );
|
$aDate = explode ( '-', str_replace("/", "-", $dateTime[0]) );
|
||||||
$bResult = true;
|
$bResult = true;
|
||||||
foreach($aDate as $sDate){
|
foreach($aDate as $sDate){
|
||||||
@@ -549,9 +552,9 @@ class ReportTables
|
|||||||
* @param string $aFields
|
* @param string $aFields
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updateTables($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
|
public function updateTables($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//get all Active Report Tables
|
//get all Active Report Tables
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUid);
|
$oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUid);
|
||||||
@@ -638,7 +641,7 @@ class ReportTables
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//remove old rows from database
|
//remove old rows from database
|
||||||
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||||
$rsDelete = $stmt->executeQuery( $sqlDelete );
|
$rsDelete = $stmt->executeQuery( $sqlDelete );
|
||||||
|
|
||||||
$aAux = explode('-', $aRow['REP_TAB_GRID']);
|
$aAux = explode('-', $aRow['REP_TAB_GRID']);
|
||||||
@@ -668,7 +671,7 @@ class ReportTables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sQuery .= ')';
|
$sQuery .= ')';
|
||||||
$rs =$stmt->executeQuery( $sQuery );
|
$rs =$stmt->executeQuery( $sQuery );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -812,7 +815,7 @@ class ReportTables
|
|||||||
{
|
{
|
||||||
$repTabConnection = trim( strtoupper( $TabConnectionk ) );
|
$repTabConnection = trim( strtoupper( $TabConnectionk ) );
|
||||||
$PropelDatabase = 'rp';
|
$PropelDatabase = 'rp';
|
||||||
if ( $repTabConnection == '' || $repTabConnection == 'REPORT' )
|
if ( $repTabConnection == '' || $repTabConnection == 'REPORT' )
|
||||||
$PropelDatabase = 'rp';
|
$PropelDatabase = 'rp';
|
||||||
if ( $repTabConnection == 'RBAC' )
|
if ( $repTabConnection == 'RBAC' )
|
||||||
$PropelDatabase = 'rbac';
|
$PropelDatabase = 'rbac';
|
||||||
|
|||||||
Reference in New Issue
Block a user