this bug 5882 was solved, we added a way to validate it

This commit is contained in:
Carlos Pacha
2011-02-04 16:32:13 +00:00
parent 79042a4877
commit d25ef3b1c3
4 changed files with 77 additions and 6 deletions

View File

@@ -454,6 +454,65 @@ class Step extends BaseStep {
}
}
/**
* verify if a dbconnection is assigned in some dynaforms or triggers
*
* @param string $sproUid the uid of the process
* @param string $sdbsUid the uid of the db connection
*/
function loadInfoAssigConnecctionDB($sproUid,$sdbsUid){
require_once ( "classes/model/DynaformPeer.php" );
G::LoadSystem('dynaformhandler');
$swDynaform = true;
$swTriggers = true;
//we are looking for triggers if there is at least one db connection
$oC = new Criteria('workflow');
$oC->add(TriggersPeer::PRO_UID, $sproUid);
$oDataset = TriggersPeer::doSelectRS($oC);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
//print $sproUid;
while($aRowT = $oDataset->getRow()){
$uidConnection =preg_quote($sdbsUid) ;
if( strrpos($uidConnection,$aRowT['TRI_WEBBOT']) ) {
$swTriggers = false;
}
$oDataset->next();
}
//we are looking for dynaforms if there is at least one db connection
$oC = new Criteria('workflow');
$oC->add(DynaformPeer::PRO_UID, $sproUid);
$oDataset = DynaformPeer::doSelectRS($oC);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while($aRow = $oDataset->getRow()){
if($aRow['DYN_TYPE']=='xmlform') {
$dynHandler = new dynaFormHandler(PATH_DYNAFORM.$aRow['DYN_FILENAME'].".xml");
$dynFields = $dynHandler->getFields();
$sxmlgrid = '';
$sType = '';
$check=0;
foreach($dynFields as $field){
$ssqlConnection = $this->getAttribute($field, 'sqlconnection');
if($ssqlConnection==$sdbsUid)
$swDynaform=false;
}//end foreach
}//end if
$oDataset->next();
}//end while
//is there a connecction?
if ($swDynaform && $swTriggers){
//there is no db connection, you can delete this connection
return true;
} else {
//there is a db connection, you can not delete this connection
return false;
}
die;
}
/**
* Get related steps for a determinated case
*

View File

@@ -157,8 +157,15 @@ function editDbConnection(DBS_UID)
oRPC.make();
}
function deleteDbConnection(DBS_UID)
function deleteDbConnection(DBS_UID,PRO_UID)
{
isokDependent = ajax_function(PROCESS_REQUEST_FILE,'loadInfoAssigConnecctionDB','DBS_UID='+DBS_UID+'&PRO_UID='+PRO_UID,'POST');
if(!isokDependent){
msgBox(G_STRINGS.ID_DB_CONNECTION_ASSIGN,"alert");
return;
}
new leimnud.module.app.confirm().make({
label:G_STRINGS.ID_MSG_CONFIRM_REMOVE_DBS,
action:function(){

View File

@@ -30,8 +30,8 @@
* @Param var action from POST request
*/
if( isset($_POST['action']) ){
$action = $_POST['action'];
if( isset($_POST['action']) || isset($_POST['function']) ){
$action = (isset($_POST['action']))?$_POST['action']:$_POST['function'];
} else {
throw new Exception('dbconnections Fatal error, No action defined!...');
}
@@ -50,7 +50,12 @@ G::LoadClass ('dbConnections');
global $_DBArray;
switch ( $action ){
case 'loadInfoAssigConnecctionDB':
$oStep = new Step();
return print ($oStep->loadInfoAssigConnecctionDB($_POST['PRO_UID'],$_POST['DBS_UID']));
break;
case 'showDbConnectionsList':
$oProcess = new processMap();

View File

@@ -25,10 +25,10 @@
<en>Edit</en>
</DBS_EDIT>
<DBS_DELETE type="link" colWidth="50" link="javascript:deleteDbConnection(&#039;@#DBS_UID&#039;)">
<DBS_DELETE type="link" colWidth="50" link="javascript:deleteDbConnection(&#039;@#DBS_UID&#039;,&#039;@#PRO_UID&#039;)">
<en>Delete</en>
</DBS_DELETE>
<GET_UID type="link" colWidth="40" value="UID" link="#" onclick="msgBox(&#039;UID: &#039;+@QDBS_UID, &#039;info&#039;);return false;"/>
</dynaForm>
</dynaForm>