瀏覽代碼

#593 Losing attachments when performing massive change

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2301 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 年之前
父節點
當前提交
5f4237796c
共有 3 個文件被更改,包括 14 次插入4 次删除
  1. 6 2
      application/cmdbabstract.class.inc.php
  2. 7 1
      datamodels/2.x/itop-attachments/main.attachments.php
  3. 1 1
      pages/UI.php

+ 6 - 2
application/cmdbabstract.class.inc.php

@@ -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...

+ 7 - 1
datamodels/2.x/itop-attachments/main.attachments.php

@@ -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))
 		{

+ 1 - 1
pages/UI.php

@@ -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();