Browse Source

#583 Losing attachments when performing massive change

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2284 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 years ago
parent
commit
0b8f0da987
1 changed files with 7 additions and 1 deletions
  1. 7 1
      datamodels/1.x/itop-attachments/main.attachments.php

+ 7 - 1
datamodels/1.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))
 		{