diff --git a/modules/itop-attachments/de.dict.attachments.php b/modules/itop-attachments/de.dict.attachments.php index cf5605641..1a2636cfb 100644 --- a/modules/itop-attachments/de.dict.attachments.php +++ b/modules/itop-attachments/de.dict.attachments.php @@ -36,5 +36,6 @@ Dict::Add('EN US', 'English', 'English', array( 'Attachment:Max_Go' => '(Maximale Datei-Größe: %1$s Go)', 'Attachment:Max_Mo' => '(Maximale Datei-Größe: %1$s Mo)', 'Attachment:Max_Ko' => '(Maximale Datei-Größe: %1$s Ko)', + 'Attachments:NoAttachment' => 'Kein Attachment.', )); ?> diff --git a/modules/itop-attachments/en.dict.attachments.php b/modules/itop-attachments/en.dict.attachments.php index 1c90556ea..acc673bfd 100644 --- a/modules/itop-attachments/en.dict.attachments.php +++ b/modules/itop-attachments/en.dict.attachments.php @@ -35,5 +35,6 @@ Dict::Add('EN US', 'English', 'English', array( 'Attachment:Max_Go' => '(Maximum file size: %1$s Go)', 'Attachment:Max_Mo' => '(Maximum file size: %1$s Mo)', 'Attachment:Max_Ko' => '(Maximum file size: %1$s Ko)', + 'Attachments:NoAttachment' => 'No attachment. ', )); ?> diff --git a/modules/itop-attachments/fr.dict.attachments.php b/modules/itop-attachments/fr.dict.attachments.php index 5f10a613a..f92c7841f 100644 --- a/modules/itop-attachments/fr.dict.attachments.php +++ b/modules/itop-attachments/fr.dict.attachments.php @@ -35,5 +35,6 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Attachment:Max_Go' => '(Taille de fichier max.: %1$s Gb)', 'Attachment:Max_Mo' => '(Taille de fichier max.: %1$s Mb)', 'Attachment:Max_Ko' => '(Taille de fichier max.: %1$s Kb)', + 'Attachments:NoAttachment' => 'Aucune pièce jointe.', )); ?> \ No newline at end of file diff --git a/modules/itop-attachments/model.attachments.php b/modules/itop-attachments/model.attachments.php index 6d4446fb0..d89a689a7 100644 --- a/modules/itop-attachments/model.attachments.php +++ b/modules/itop-attachments/model.attachments.php @@ -394,7 +394,7 @@ EOF function ajaxFileUpload() { //starting setting some animation when the ajax starts and completes - $("#loading").ajaxStart(function(){ + $("#attachment_loading").ajaxStart(function(){ $(this).show(); }).ajaxComplete(function(){ $(this).hide(); @@ -462,9 +462,9 @@ EOF $oPage->add(''); $oPage->add('
'); $sMaxUpload = $this->GetMaxUpload(); - $oPage->p(Dict::S('Attachments:AddAttachment').' '.$sMaxUpload); + $oPage->p(Dict::S('Attachments:AddAttachment').' '.$sMaxUpload); //$oPage->p(''); - $oPage->p(''); + $oPage->p(''); $oPage->add(''); if ($this->m_bDeleteEnabled) { @@ -474,14 +474,21 @@ EOF else { $oPage->add(''); - while ($oAttachment = $oSet->Fetch()) + if ($oSet->Count() == 0) { - $iAttId = $oAttachment->GetKey(); - $oDoc = $oAttachment->Get('contents'); - $sFileName = $oDoc->GetFileName(); - $sIcon = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($sFileName); - $sDownloadLink = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php/?operation=download_document&class=Attachment&id='.$iAttId.'&field=contents'; - $oPage->add('

'.$sFileName.'

  
'); + $oPage->add(Dict::S('Attachments:NoAttachment')); + } + else + { + while ($oAttachment = $oSet->Fetch()) + { + $iAttId = $oAttachment->GetKey(); + $oDoc = $oAttachment->Get('contents'); + $sFileName = $oDoc->GetFileName(); + $sIcon = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($sFileName); + $sDownloadLink = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php/?operation=download_document&class=Attachment&id='.$iAttId.'&field=contents'; + $oPage->add('

'.$sFileName.'

  
'); + } } } } diff --git a/modules/itop-attachments/module.attachments.php b/modules/itop-attachments/module.attachments.php index 149fe7e12..2ae724e98 100644 --- a/modules/itop-attachments/module.attachments.php +++ b/modules/itop-attachments/module.attachments.php @@ -99,11 +99,12 @@ class AttachmentInstaller extends ModuleInstallerAPI // // Prerequisite: change null into 0 (workaround to the fact that we cannot use IS NULL in OQL) SetupWebPage::log_info("Initializing attachment/item_org_id - null to zero"); - $sRepair = "UPDATE `Attachment` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL"; + $sTableName = MetaModel::DBGetTable('Attachment'); + $sRepair = "UPDATE `$sTableName` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL"; CMDBSource::Query($sRepair); - SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container"); - $oSearch = DBObjectSearch::FromOQL('SELECT Attachment WHERE item_org_id = 0'); + SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container"); + $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_org_id = 0"); $oSet = new DBObjectSet($oSearch); $iUpdated = 0; while ($oAttachment = $oSet->Fetch())