3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Issue #2871165: Any log can be a movement

This commit is contained in:
Michael Stenta 2017-04-27 14:12:11 -04:00
parent d108d75cf8
commit 87378418ee
4 changed files with 61 additions and 5 deletions

View file

@ -593,7 +593,7 @@ function farm_livestock_field_default_field_instances() {
'progress_indicator' => 'bar',
),
'type' => 'file_generic',
'weight' => 5,
'weight' => 7,
),
);
@ -643,7 +643,40 @@ function farm_livestock_field_default_field_instances() {
'progress_indicator' => 'bar',
),
'type' => 'image_image',
'weight' => 4,
'weight' => 6,
),
);
// Exported field_instance: 'log-farm_medical-field_farm_movement'.
$field_instances['log-farm_medical-field_farm_movement'] = array(
'bundle' => 'farm_medical',
'default_value' => NULL,
'deleted' => 0,
'description' => 'Use these fields to record a movement with this log entry. This will be used to define the location of any referenced assets. The current location of any asset is determined by the most recently completed movement log. Only the "to" field is required.',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'field_collection',
'settings' => array(
'view_mode' => 'full',
),
'type' => 'field_collection_fields',
'weight' => 5,
),
),
'entity_type' => 'log',
'field_name' => 'field_farm_movement',
'label' => 'Movement',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'field_collection',
'settings' => array(),
'type' => 'field_collection_embed',
'weight' => 5,
),
);
@ -696,6 +729,7 @@ function farm_livestock_field_default_field_instances() {
t('ID Tag(s)');
t('List any identification tags that this animal has. These can be ear tags, tattoos, leg bands, etc. Use the fields below to describe the type, location, and ID of each.');
t('List any nickname(s) of this animal.');
t('Movement');
t('Nickname(s)');
t('Notes');
t('Parent(s)');
@ -704,6 +738,7 @@ function farm_livestock_field_default_field_instances() {
t('Specify the parent(s) of this animal.');
t('Tag Type');
t('Type');
t('Use these fields to record a movement with this log entry. This will be used to define the location of any referenced assets. The current location of any asset is determined by the most recently completed movement log. Only the "to" field is required.');
t('What assets do this medical log pertain to?');
t('What is the species/breed of this animal? You can manage the list of available species/breeds in the ' . l('Animal Species/Breeds', 'farm/assets/animals/types') . ' vocabulary.');

View file

@ -12,6 +12,7 @@ dependencies[] = farm_asset
dependencies[] = farm_asset_children
dependencies[] = farm_fields
dependencies[] = farm_log
dependencies[] = farm_log_movement
dependencies[] = farm_map
dependencies[] = features
dependencies[] = field_collection
@ -58,6 +59,7 @@ features[field_instance][] = field_collection_item-field_farm_animal_tag-field_f
features[field_instance][] = log-farm_medical-field_farm_asset
features[field_instance][] = log-farm_medical-field_farm_files
features[field_instance][] = log-farm_medical-field_farm_images
features[field_instance][] = log-farm_medical-field_farm_movement
features[field_instance][] = log-farm_medical-field_farm_notes
features[log_type][] = farm_medical
features[taxonomy][] = farm_animal_groups

View file

@ -4,6 +4,18 @@
* Farm livestock install file.
*/
/**
* Implements hook_update_dependencies().
*/
function farm_livestock_update_dependencies() {
// Update 7003 (add movement field to medical logs) depends on
// farm_log_movement_update_7000().
$dependencies['farm_livestock'][7003] = array('farm_log_movement' => 7000);
return $dependencies;
}
/**
* Migrate Animal Description field to plain Description field (from farm_fields).
*/
@ -52,3 +64,10 @@ function farm_livestock_update_7001(&$sandbox) {
function farm_livestock_update_7002(&$sandbox) {
features_revert(array('farm_livestock' => array('field_base', 'field_instance')));
}
/**
* Add new movement field to medical logs.
*/
function farm_livestock_update_7003(&$sandbox) {
features_revert(array('farm_livestock' => array('field_instance')));
}

View file

@ -465,7 +465,7 @@ function farm_livestock_views_default_views() {
$handler->display->display_options['fields']['field_farm_description']['alter']['more_link'] = TRUE;
$handler->display->display_options['fields']['field_farm_description']['alter']['strip_tags'] = TRUE;
$handler->display->display_options['fields']['field_farm_description']['alter']['trim'] = TRUE;
/* Field: Log: To */
/* Field: Field: To */
$handler->display->display_options['fields']['field_farm_move_to']['id'] = 'field_farm_move_to';
$handler->display->display_options['fields']['field_farm_move_to']['table'] = 'field_data_field_farm_move_to';
$handler->display->display_options['fields']['field_farm_move_to']['field'] = 'field_farm_move_to';
@ -502,7 +502,7 @@ function farm_livestock_views_default_views() {
$handler->display->display_options['sorts']['field_farm_animal_tag_id_value']['relationship'] = 'field_farm_animal_tag_value';
$handler->display->display_options['sorts']['field_farm_animal_tag_id_value']['exposed'] = TRUE;
$handler->display->display_options['sorts']['field_farm_animal_tag_id_value']['expose']['label'] = 'ID Tag';
/* Contextual filter: Log: To (field_farm_move_to) */
/* Contextual filter: Field: To (field_farm_move_to) */
$handler->display->display_options['arguments']['field_farm_move_to_tid']['id'] = 'field_farm_move_to_tid';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['table'] = 'field_data_field_farm_move_to';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['field'] = 'field_farm_move_to_tid';
@ -608,7 +608,7 @@ function farm_livestock_views_default_views() {
$handler->display->display_options['filters']['field_farm_animal_group_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_farm_animal_group_tid']['vocabulary'] = 'farm_animal_groups';
$handler->display->display_options['filters']['field_farm_animal_group_tid']['hierarchy'] = 1;
/* Filter criterion: Log: To (field_farm_move_to) */
/* Filter criterion: Field: To (field_farm_move_to) */
$handler->display->display_options['filters']['field_farm_move_to_tid']['id'] = 'field_farm_move_to_tid';
$handler->display->display_options['filters']['field_farm_move_to_tid']['table'] = 'field_data_field_farm_move_to';
$handler->display->display_options['filters']['field_farm_move_to_tid']['field'] = 'field_farm_move_to_tid';