Use asset names helper function to generate log names when using the group/move actions.
This commit is contained in:
parent
835209e5a2
commit
8f98db20b6
|
@ -6,3 +6,4 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_entity
|
||||
- farm:farm_location
|
||||
- farm:farm_log
|
||||
|
|
|
@ -201,9 +201,14 @@ class AssetGroupActionForm extends ConfirmFormBase {
|
|||
$date = $form_state->getValue('date');
|
||||
$done = (bool) $form_state->getValue('done', FALSE);
|
||||
|
||||
// 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]);
|
||||
|
||||
// Create the log.
|
||||
// @todo Populate the log name with a summary helper function.
|
||||
$log = Log::create([
|
||||
'name' => $log_name,
|
||||
'type' => 'observation',
|
||||
'timestamp' => $date->getTimestamp(),
|
||||
'asset' => $accessible_entities,
|
||||
|
|
|
@ -200,9 +200,14 @@ class AssetMoveActionForm extends ConfirmFormBase {
|
|||
$date = $form_state->getValue('date');
|
||||
$done = (bool) $form_state->getValue('done', FALSE);
|
||||
|
||||
// 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]);
|
||||
|
||||
// Create the log.
|
||||
// @todo Populate the log name with a summary helper function.
|
||||
$log = Log::create([
|
||||
'name' => $log_name,
|
||||
'type' => 'activity',
|
||||
'timestamp' => $date->getTimestamp(),
|
||||
'asset' => $accessible_entities,
|
||||
|
|
Loading…
Reference in New Issue