Fix bulk move/group action log names when unsetting location/group #669

This commit is contained in:
Michael Stenta 2023-04-13 17:03:45 -04:00
parent a13a0de10a
commit 2b3bb21683
3 changed files with 12 additions and 2 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- [Fix bulk move/group action log names when unsetting location/group #669](https://github.com/farmOS/farmOS/pull/669)
### Security
- Update Drupal core to 9.5.8 for [SA-CORE-2023-005](https://www.drupal.org/sa-core-2023-005)

View File

@ -200,7 +200,10 @@ class AssetGroupActionForm extends ConfirmFormBase {
// Generate a name for the log.
$asset_names = farm_log_asset_names_summary($accessible_entities);
$group_names = farm_log_asset_names_summary($groups);
$log_name = $this->t('Group @assets into @groups', ['@assets' => $asset_names, '@groups' => $group_names]);
$log_name = $this->t('Clear group membership of @assets', ['@assets' => $asset_names]);
if (!empty($group_names)) {
$log_name = $this->t('Group @assets into @groups', ['@assets' => $asset_names, '@groups' => $group_names]);
}
// Create the log.
$log = Log::create([

View File

@ -230,7 +230,10 @@ class AssetMoveActionForm extends ConfirmFormBase {
// Generate a name for the log.
$asset_names = farm_log_asset_names_summary($accessible_entities);
$location_names = farm_log_asset_names_summary($locations);
$log_name = $this->t('Move @assets to @locations', ['@assets' => $asset_names, '@locations' => $location_names]);
$log_name = $this->t('Clear location of @assets', ['@assets' => $asset_names]);
if (!empty($location_names)) {
$log_name = $this->t('Move @assets to @locations', ['@assets' => $asset_names, '@locations' => $location_names]);
}
// Create the log.
$log = Log::create([