#593 Losing attachments when performing massive change

SVN:trunk[2301]
This commit is contained in:
Romain Quetiez
2012-10-19 15:11:53 +00:00
parent ab6cfb56b4
commit 27fec353dd
3 changed files with 14 additions and 4 deletions

View File

@@ -210,9 +210,13 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
{
$aFieldsMap = $this->GetBareProperties($oPage, $bEditMode, $sPrefix, $aExtraParams);
foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance)
if (!isset($aExtraParams['disable_plugins']) || !$aExtraParams['disable_plugins'])
{
$oExtensionInstance->OnDisplayProperties($this, $oPage, $bEditMode);
foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance)
{
$oExtensionInstance->OnDisplayProperties($this, $oPage, $bEditMode);
}
}
// Special case to display the case log, if any...

View File

@@ -357,7 +357,7 @@ EOF
$sMaxUpload = $this->GetMaxUpload();
$oPage->p(Dict::S('Attachments:AddAttachment').'<input type="file" name="file" id="file" onChange="ajaxFileUpload();"><span style="display:none;" id="attachment_loading">&nbsp;<img src="../images/indicator.gif"></span> '.$sMaxUpload);
$oPage->p('<span style="display:none;" id="attachment_loading">Loading, please wait...</span>');
$oPage->p('<input type="hidden" id="attachment_plugin"/>');
$oPage->p('<input type="hidden" id="attachment_plugin" name="attachment_plugin"/>');
$oPage->add('</fieldset>');
if ($this->m_bDeleteEnabled)
{
@@ -388,6 +388,12 @@ EOF
protected static function UpdateAttachments($oObject, $oChange = null)
{
if (utils::ReadParam('attachment_plugin', 'not-in-form') == 'not-in-form')
{
// Workaround to an issue in iTop < 2.0
// Leave silently if there is no trace of the attachment form
return;
}
$iTransactionId = utils::ReadParam('transaction_id', null);
if (!is_null($iTransactionId))
{

View File

@@ -943,7 +943,7 @@ try
$oP->add("</div>\n");
$oP->add("<div class=\"wizContainer\">\n");
$oDummyObj->DisplayModifyForm($oP, array('fieldsComments' => $aComments, 'noRelations' => true, 'custom_operation' => 'preview_or_modify_all', 'custom_button' => Dict::S('UI:Button:PreviewModifications'), 'selectObj' => $sSelectedObj, 'filter' => $sFilter, 'preview_mode' => true, 'disabled_fields' => '{}'));
$oDummyObj->DisplayModifyForm($oP, array('fieldsComments' => $aComments, 'noRelations' => true, 'custom_operation' => 'preview_or_modify_all', 'custom_button' => Dict::S('UI:Button:PreviewModifications'), 'selectObj' => $sSelectedObj, 'filter' => $sFilter, 'preview_mode' => true, 'disabled_fields' => '{}', 'disable_plugins' => true));
$oP->add("</div>\n");
$oP->add_ready_script($sReadyScript);
$sURL = "./UI.php?operation=search&filter=".urlencode($sFilter)."&".$oAppContext->GetForLink();