this bug 5882 was solved, we added a way to validate it
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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(){
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
<en>Edit</en>
|
||||
</DBS_EDIT>
|
||||
|
||||
<DBS_DELETE type="link" colWidth="50" link="javascript:deleteDbConnection('@#DBS_UID')">
|
||||
<DBS_DELETE type="link" colWidth="50" link="javascript:deleteDbConnection('@#DBS_UID','@#PRO_UID')">
|
||||
<en>Delete</en>
|
||||
</DBS_DELETE>
|
||||
|
||||
<GET_UID type="link" colWidth="40" value="UID" link="#" onclick="msgBox('UID: '+@QDBS_UID, 'info');return false;"/>
|
||||
|
||||
</dynaForm>
|
||||
</dynaForm>
|
||||
|
||||
Reference in New Issue
Block a user