mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 05:55:16 +01:00
Allow to to disable the saving of changed or deleted data.
Also it is possible to only save the information which fields were changed, not the data in it.
This commit is contained in:
@@ -68,7 +68,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
||||
*/
|
||||
public function hasChangedFieldsInfo(): bool
|
||||
{
|
||||
return $this->hasOldDataInformations();
|
||||
return isset($this->extra['f']) || $this->hasOldDataInformations();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,26 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
||||
*/
|
||||
public function getChangedFields(): array
|
||||
{
|
||||
return array_keys($this->getOldData());
|
||||
if ($this->hasOldDataInformations()) {
|
||||
return array_keys($this->getOldData());
|
||||
}
|
||||
|
||||
if (isset($this->extra['f'])) {
|
||||
return $this->extra['f'];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fields that were changed during this element change.
|
||||
* @param string[] $changed_fields The names of the fields that were changed during the elements
|
||||
* @return $this
|
||||
*/
|
||||
public function setChangedFields(array $changed_fields): self
|
||||
{
|
||||
$this->extra['f'] = $changed_fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user