mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
#1151 Error (with no explanation) when deleting some 1-N links
SVN:trunk[3773]
This commit is contained in:
@@ -101,6 +101,7 @@ class DeletionPlan
|
||||
}
|
||||
if ($aData['mode'] == DEL_MANUAL)
|
||||
{
|
||||
$this->m_aToDelete[$sClass][$iId]['issue'] = $sClass.'::'.$iId.' '.Dict::S('UI:Delete:MustBeDeletedManually');
|
||||
$this->m_bFoundStopper = true;
|
||||
$this->m_bFoundManualDelete = true;
|
||||
}
|
||||
|
||||
25
pages/UI.php
25
pages/UI.php
@@ -778,18 +778,35 @@ EOF
|
||||
list($bRes, $aIssues) = $oObj->CheckToWrite();
|
||||
if ($bRes)
|
||||
{
|
||||
$oObj->DBUpdate();
|
||||
try
|
||||
{
|
||||
CMDBSource::Query('START TRANSACTION');
|
||||
$oObj->DBUpdate();
|
||||
CMDBSource::Query('COMMIT');
|
||||
$sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName());
|
||||
$sSeverity = 'ok';
|
||||
}
|
||||
catch(DeleteException $e)
|
||||
{
|
||||
CMDBSource::Query('ROLLBACK');
|
||||
// Say two things: 1) Don't be afraid nothing was modified
|
||||
$sMessage = Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName());
|
||||
$sSeverity = 'info';
|
||||
cmdbAbstractObject::SetSessionMessage(get_class($oObj), $oObj->GetKey(), 'UI:Class_Object_NotUpdated', $sMessage, $sSeverity, 0, true /* must not exist */);
|
||||
// 2) Ok, there was some trouble indeed
|
||||
$sMessage = $e->getMessage();
|
||||
$sSeverity = 'error';
|
||||
$bDisplayDetails = true;
|
||||
}
|
||||
utils::RemoveTransaction($sTransactionId);
|
||||
|
||||
$sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName());
|
||||
$sSeverity = 'ok';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bDisplayDetails = false;
|
||||
// Found issues, explain and give the user a second chance
|
||||
//
|
||||
$oObj->DisplayModifyForm($oP, array('wizard_container' => true), $sToken); // wizard_container: display the wizard border and the title
|
||||
$oObj->DisplayModifyForm($oP, array('wizard_container' => true)); // wizard_container: display the wizard border and the title
|
||||
$sIssueDesc = Dict::Format('UI:ObjectCouldNotBeWritten', implode(', ', $aIssues));
|
||||
$oP->add_ready_script("alert('".addslashes($sIssueDesc)."');");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user