mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Add a revision log message to imported assets and logs.
This commit is contained in:
parent
473a7181a7
commit
890b5211c6
|
@ -67,7 +67,14 @@ abstract class CsvImportMigrationBase extends DeriverBase implements ContainerDe
|
|||
* The entity bundle.
|
||||
*/
|
||||
protected function alterProcessMapping(array &$mapping, string $bundle): void {
|
||||
// Do nothing.
|
||||
|
||||
// If this is a log or asset, add a revision log message.
|
||||
if (in_array($this->entityType, ['asset', 'log'])) {
|
||||
$mapping['revision_log_message'] = [
|
||||
'plugin' => 'default_value',
|
||||
'default_value' => 'Imported via CSV.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,6 +95,7 @@ class AssetCsvImportTest extends CsvImportTestBase {
|
|||
$this->assertEquals($expected_values[$id]['notes'], $asset->get('notes')->value);
|
||||
$this->assertEquals('default', $asset->get('notes')->format);
|
||||
$this->assertEquals($expected_values[$id]['status'], $asset->get('status')->value);
|
||||
$this->assertEquals('Imported via CSV.', $asset->getRevisionLogMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ class LogCsvImportTest extends CsvImportTestBase {
|
|||
}
|
||||
}
|
||||
$this->assertEquals($expected_values[$id]['status'], $log->get('status')->value);
|
||||
$this->assertEquals('Imported via CSV.', $log->getRevisionLogMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue