3
0
Fork 0
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:
Michael Stenta 2023-09-25 22:54:34 -04:00
parent 473a7181a7
commit 890b5211c6
3 changed files with 10 additions and 1 deletions

View file

@ -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.',
];
}
}
/**

View file

@ -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());
}
}

View file

@ -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());
}
}