mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°2901 Add log to help diagnose lost InlineImage
they are disabled by default, use this to enable: ``` 'log_level_min' => array( 'InlineImage' => LogAPI::LEVEL_TRACE, 'UserRequest' => LogAPI::LEVEL_TRACE, ), ```
This commit is contained in:
88
pages/UI.php
88
pages/UI.php
@@ -912,7 +912,16 @@ HTML
|
||||
$sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id');
|
||||
if ( empty($sClass) || empty($id)) // TO DO: check that the class name is valid !
|
||||
{
|
||||
throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'id'));
|
||||
IssueLog::Trace('Object not updated (empty class or id)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $id,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
|
||||
throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'id'));
|
||||
}
|
||||
$bDisplayDetails = true;
|
||||
$oObj = MetaModel::GetObject($sClass, $id, false);
|
||||
@@ -921,16 +930,34 @@ HTML
|
||||
$bDisplayDetails = false;
|
||||
$oP->set_title(Dict::S('UI:ErrorPageTitle'));
|
||||
$oP->P(Dict::S('UI:ObjectDoesNotExist'));
|
||||
|
||||
IssueLog::Trace('Object not updated (id not found)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $id,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
}
|
||||
elseif (!utils::IsTransactionValid($sTransactionId, false))
|
||||
{
|
||||
//TODO: since $bDisplayDetails= true, there will be an redirection, thus, the content generated here is ignored, only the $sMessage and $sSeverity are used afeter the redirection
|
||||
//TODO: since $bDisplayDetails= true, there will be an redirection, thus, the content generated here is ignored, only the $sMessage and $sSeverity are used afeter the redirection
|
||||
$sUser = UserRights::GetUser();
|
||||
IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser', class='$sClass'");
|
||||
$oP->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $oObj->GetRawName(), $sClassLabel)); // Set title will take care of the encoding
|
||||
$oP->p("<strong>".Dict::S('UI:Error:ObjectAlreadyUpdated')."</strong>\n");
|
||||
$sMessage = Dict::Format('UI:Error:ObjectAlreadyUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName());
|
||||
$sSeverity = 'error';
|
||||
|
||||
IssueLog::Trace('Object not updated (invalid transaction_id)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $id,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -943,9 +970,31 @@ HTML
|
||||
$oP->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $oObj->GetRawName(), $sClassLabel)); // Set title will take care of the encoding
|
||||
$sMessage = Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName());
|
||||
$sSeverity = 'info';
|
||||
|
||||
IssueLog::Trace('Object not updated (see either $aErrors or IsModified)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $id,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$aErrors' => $aErrors,
|
||||
'IsModified' => $oObj->IsModified(),
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
IssueLog::Trace('Object updated', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $id,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$aErrors' => $aErrors,
|
||||
'IsModified' => $oObj->IsModified(),
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
|
||||
try
|
||||
{
|
||||
if (!empty($aErrors))
|
||||
@@ -1118,6 +1167,14 @@ HTML
|
||||
$aWarnings = array();
|
||||
if ( empty($sClass) ) // TO DO: check that the class name is valid !
|
||||
{
|
||||
IssueLog::Trace('Object not created (empty class)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
|
||||
throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class'));
|
||||
}
|
||||
if (!utils::IsTransactionValid($sTransactionId, false))
|
||||
@@ -1125,6 +1182,14 @@ HTML
|
||||
$sUser = UserRights::GetUser();
|
||||
IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser', class='$sClass'");
|
||||
$oP->p("<strong>".Dict::S('UI:Error:ObjectAlreadyCreated')."</strong>\n");
|
||||
|
||||
IssueLog::Trace('Object not created (invalid transaction_id)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1155,11 +1220,30 @@ HTML
|
||||
{
|
||||
if (!empty($aErrors) || !empty($aWarnings))
|
||||
{
|
||||
IssueLog::Trace('Object not created (see $aErrors)', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$aErrors' => $aErrors,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
|
||||
throw new CoreCannotSaveObjectException(array('id' => $oObj->GetKey(), 'class' => $sClass, 'issues' => $aErrors));
|
||||
}
|
||||
|
||||
$oObj->DBInsertNoReload();// No need to reload
|
||||
|
||||
IssueLog::Trace('Object created', $sClass, array(
|
||||
'$operation' => $operation,
|
||||
'$id' => $oObj->GetKey(),
|
||||
'$sTransactionId' => $sTransactionId,
|
||||
'$aErrors' => $aErrors,
|
||||
'$sUser' => UserRights::GetUser(),
|
||||
'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'],
|
||||
'REQUEST_URI' => @$_SERVER['REQUEST_URI'],
|
||||
));
|
||||
|
||||
utils::RemoveTransaction($sTransactionId);
|
||||
$oP->set_title(Dict::S('UI:PageTitle:ObjectCreated'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user