diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 6fac02369..7750a545c 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -8575,6 +8575,22 @@ class AttributeBlob extends AttributeDefinition return utils::IsNotNullOrEmptyString($proposedValue->GetData()) && utils::IsNotNullOrEmptyString($proposedValue->GetFileName()); } + /** + * @inheritDoc + * @param \ormDocument $original + * @param \ormDocument $value + * @since N°6502 + */ + public function RecordAttChange(DBObject $oObject, $original, $value): void + { + // N°6502 Don't record history if only the download count has changed + if ($original->EqualsExceptDownloadsCount($value)) { + return; + } + + parent::RecordAttChange($oObject, $original, $value); + } + protected function GetChangeRecordAdditionalData(CMDBChangeOp $oMyChangeOp, DBObject $oObject, $original, $value): void { if (is_null($original)) { diff --git a/core/ormdocument.class.inc.php b/core/ormdocument.class.inc.php index da96f0737..2ee6dfd33 100644 --- a/core/ormdocument.class.inc.php +++ b/core/ormdocument.class.inc.php @@ -86,6 +86,33 @@ class ormDocument { return ($this->m_data == null); } + + /** + * @param \ormDocument $oCompared + * + * @return bool True if the current ormDocument is equals to $oCompared EXCEPT for its download count. False if any other property is different OR if count is the same. + * @since 3.1.0 N°6502 + */ + public function EqualsExceptDownloadsCount(ormDocument $oCompared): bool + { + // First checking equality on others properties + if ($oCompared->GetData() !== $this->GetData()) { + return false; + } + if ($oCompared->GetMimeType() !== $this->GetMimeType()) { + return false; + } + if ($oCompared->GetFileName() !== $this->GetFileName()) { + return false; + } + + // Finally check equality of the download count + if ($oCompared->GetDownloadsCount() === $this->GetDownloadsCount()) { + return false; + } else { + return true; + } + } public function GetMimeType() {