mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 10:18:56 +02: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:
parent
2bc6a2be3c
commit
b5bc096972
4 changed files with 76 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue