mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-06 10:08:43 +02:00
Compare commits
1 Commits
develop
...
feature/88
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b80aa236f2 |
@@ -40,12 +40,16 @@ class CoreCannotSaveObjectException extends CoreException
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @since 3.2.3 add param $bWithHeader
|
||||||
*/
|
*/
|
||||||
public function getHtmlMessage()
|
public function getHtmlMessage($bWithHeader = false)
|
||||||
{
|
{
|
||||||
$sTitle = Dict::S('UI:Error:SaveFailed');
|
$sTitle = Dict::S('UI:Error:SaveFailed');
|
||||||
$sContent = "<span><strong>".utils::HtmlEntities($sTitle)."</strong></span>";
|
$sContent = "<span><strong>".utils::HtmlEntities($sTitle)."</strong></span>";
|
||||||
|
if ($bWithHeader) {
|
||||||
|
$oObject = MetaModel::GetObject($this->sObjectClass, $this->iObjectId, true, true);
|
||||||
|
$sContent .= " <span>".$oObject->Get('friendlyname')."</span>";
|
||||||
|
}
|
||||||
if (count($this->aIssues) == 1) {
|
if (count($this->aIssues) == 1) {
|
||||||
$sIssue = reset($this->aIssues);
|
$sIssue = reset($this->aIssues);
|
||||||
$sContent .= " <span>".utils::HtmlEntities($sIssue)."</span>";
|
$sContent .= " <span>".utils::HtmlEntities($sIssue)."</span>";
|
||||||
|
|||||||
@@ -859,6 +859,15 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
return $oLinkSet;
|
return $oLinkSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function RemoveRemoved()
|
||||||
|
{
|
||||||
|
$this->aRemoved = [];
|
||||||
|
}
|
||||||
|
public function GetRemoved()
|
||||||
|
{
|
||||||
|
return $this->aRemoved ;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetValues.
|
* GetValues.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -968,6 +968,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
|||||||
'UI:SystemIntrusion' => 'Access denied. You have requested an operation that is not allowed for you.',
|
'UI:SystemIntrusion' => 'Access denied. You have requested an operation that is not allowed for you.',
|
||||||
'UI:FatalErrorMessage' => 'Fatal error, '.ITOP_APPLICATION_SHORT.' cannot continue.',
|
'UI:FatalErrorMessage' => 'Fatal error, '.ITOP_APPLICATION_SHORT.' cannot continue.',
|
||||||
'UI:Error_Details' => 'Error: %1$s.',
|
'UI:Error_Details' => 'Error: %1$s.',
|
||||||
|
'UI:LinkedSet:RemovedObjectsDuringRefresh' => 'Warning: removed object(s) in <b>%1$s</b> are there again : <br>%2$s',
|
||||||
|
|
||||||
'UI:PageTitle:ProfileProjections' => ITOP_APPLICATION_SHORT.' user management - profile projections',
|
'UI:PageTitle:ProfileProjections' => ITOP_APPLICATION_SHORT.' user management - profile projections',
|
||||||
'UI:UserManagement:Class' => 'Class',
|
'UI:UserManagement:Class' => 'Class',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
namespace Combodo\iTop\Controller\Base\Layout;
|
namespace Combodo\iTop\Controller\Base\Layout;
|
||||||
|
|
||||||
|
use AttributeLinkedSet;
|
||||||
use Combodo\iTop\Application\WebPage\AjaxPage;
|
use Combodo\iTop\Application\WebPage\AjaxPage;
|
||||||
use ApplicationContext;
|
use ApplicationContext;
|
||||||
use ApplicationException;
|
use ApplicationException;
|
||||||
@@ -661,13 +662,35 @@ JS;
|
|||||||
// Found issues, explain and give the user a second chance
|
// Found issues, explain and give the user a second chance
|
||||||
//
|
//
|
||||||
$bDisplayDetails = false;
|
$bDisplayDetails = false;
|
||||||
$aIssues = $e->getIssues();
|
|
||||||
if ($this->IsHandlingXmlHttpRequest()) {
|
if ($this->IsHandlingXmlHttpRequest()) {
|
||||||
$aResult['data'] = ['error_message' => $e->getHtmlMessage()];
|
$aResult['data'] = ['error_message' => $e->getHtmlMessage()];
|
||||||
} else {
|
} else {
|
||||||
$oPage->AddHeaderMessage($e->getHtmlMessage(), 'message_error');
|
//8807 - displayModifyForm fail if a linkset is removed -> remove removed linkset and display a specific message
|
||||||
$oObj->DisplayModifyForm($oPage,
|
$bWithLinkedSetRemoved = false;
|
||||||
array('wizard_container' => true)); // wizard_container: display the wizard border and the title
|
foreach ($oObj->ListChanges() as $sAttCode => $aChange) {
|
||||||
|
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||||
|
if ($oAttDef instanceof AttributeLinkedSet) {
|
||||||
|
$aRemoved = $aChange->GetRemoved();
|
||||||
|
if (count($aRemoved) > 0) {
|
||||||
|
$bWithLinkedSetRemoved = true;
|
||||||
|
$sLinkedClass = $oAttDef->GetLinkedClass();
|
||||||
|
$aRemovedObjectFriendlyName = [];
|
||||||
|
foreach ($aRemoved as $key=>$value) {
|
||||||
|
$oLinkedObject = MetaModel::GetObject($sLinkedClass, $key, true, true);
|
||||||
|
$aRemovedObjectFriendlyName[] = $oLinkedObject->Get('friendlyname');
|
||||||
|
}
|
||||||
|
$aChange->RemoveRemoved();
|
||||||
|
$sRemovedMessage = Dict::Format('UI:LinkedSet:RemovedObjectsDuringRefresh', $oAttDef->GetLabel(), implode('<br> ', $aRemovedObjectFriendlyName));
|
||||||
|
$oPage->AddHeaderMessage($sRemovedMessage, 'message_info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($bWithLinkedSetRemoved) {
|
||||||
|
$oPage->AddHeaderMessage($e->getHtmlMessage(true), 'message_error');
|
||||||
|
} else {
|
||||||
|
$oPage->AddHeaderMessage($e->getHtmlMessage(), 'message_error');
|
||||||
|
}
|
||||||
|
$oObj->DisplayModifyForm($oPage, array('wizard_container' => true)); // wizard_container: display the wizard border and the title
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user