2014-02-04 09:41:17 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Code for the Farm Log feature.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once 'farm_log.features.inc';
|
2014-11-13 21:53:13 +01:00
|
|
|
|
2014-12-02 19:07:26 +01:00
|
|
|
/**
|
|
|
|
* Implements hook_permission().
|
|
|
|
*/
|
|
|
|
function farm_log_permission() {
|
|
|
|
return array(
|
|
|
|
'view farm logs' => array(
|
|
|
|
'title' => t('View farm logs'),
|
|
|
|
'description' => t('View all farm-related log items.'),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-11-26 22:57:00 +01:00
|
|
|
/**
|
|
|
|
* Implements hook_menu_local_tasks_alter().
|
|
|
|
*/
|
|
|
|
function farm_log_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
|
|
|
|
|
|
|
// Define actions.
|
|
|
|
$actions = array(
|
2014-11-29 01:45:46 +01:00
|
|
|
'activity' => array(
|
2014-12-01 01:42:41 +01:00
|
|
|
'title' => t('Add an activity'),
|
2014-11-29 01:45:46 +01:00
|
|
|
'href' => 'log/add/farm_activity',
|
|
|
|
),
|
2014-11-26 22:57:00 +01:00
|
|
|
'movement' => array(
|
2014-12-01 01:42:41 +01:00
|
|
|
'title' => t('Add a movement'),
|
2014-11-26 22:57:00 +01:00
|
|
|
'href' => 'log/add/farm_movement',
|
|
|
|
),
|
2015-01-03 21:02:36 +01:00
|
|
|
'observation' => array(
|
|
|
|
'title' => t('Add an observation'),
|
|
|
|
'href' => 'log/add/farm_observation',
|
|
|
|
),
|
2014-11-26 22:57:00 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Define actions for various paths.
|
|
|
|
$path_actions = array(
|
2014-12-01 02:54:16 +01:00
|
|
|
'farm/area/%/activities' => array('activity'),
|
2015-01-03 21:02:36 +01:00
|
|
|
'farm/asset/%' => array('movement', 'observation'),
|
2014-12-01 02:54:16 +01:00
|
|
|
'farm/asset/%/movements' => array('movement'),
|
2015-01-03 21:02:36 +01:00
|
|
|
'farm/asset/%/observations' => array('observation'),
|
2015-03-03 22:48:53 +01:00
|
|
|
'farm' => array('activity', 'observation'),
|
2015-01-06 02:33:38 +01:00
|
|
|
'farm/plan/activities' => array('activity'),
|
|
|
|
'farm/plan/movements' => array('movement'),
|
|
|
|
'farm/plan/observations' => array('observation'),
|
2014-12-01 03:49:56 +01:00
|
|
|
'taxonomy/term/%' => array('activity'),
|
2014-11-26 22:57:00 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Add actions depending on the root path.
|
|
|
|
if (array_key_exists($root_path, $path_actions)) {
|
2014-11-29 01:44:58 +01:00
|
|
|
foreach ($path_actions[$root_path] as $action) {
|
|
|
|
$output = array(
|
|
|
|
'#theme' => 'menu_local_action',
|
|
|
|
'#link' => array(
|
|
|
|
'title' => $actions[$action]['title'],
|
|
|
|
'href' => $actions[$action]['href'],
|
|
|
|
'localized_options' => array(
|
|
|
|
'query' => array(
|
|
|
|
'destination' => $root_path,
|
|
|
|
),
|
2014-11-26 22:57:00 +01:00
|
|
|
),
|
|
|
|
),
|
2014-11-29 01:44:58 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// If this is a farm asset movements path...
|
|
|
|
if (in_array($root_path, array(
|
|
|
|
'farm/asset/%',
|
|
|
|
'farm/asset/%/movements'
|
|
|
|
))) {
|
|
|
|
|
|
|
|
// Get the asset id from the path.
|
|
|
|
$asset_id = check_plain(arg(2));
|
|
|
|
|
|
|
|
// Set the destination to the farm asset page.
|
|
|
|
$output['#link']['localized_options']['query']['destination'] = 'farm/asset/' . $asset_id;
|
|
|
|
|
|
|
|
// Set the farm_asset query string to the asset id. This will be used to
|
2014-12-01 03:49:46 +01:00
|
|
|
// prepopulate asset reference fields in log entities.
|
2014-11-29 01:44:58 +01:00
|
|
|
// See hook_form_alter() below
|
|
|
|
$output['#link']['localized_options']['query']['farm_asset'] = $asset_id;
|
|
|
|
}
|
|
|
|
|
2014-12-01 03:49:46 +01:00
|
|
|
// Or, if this is an area path...
|
|
|
|
elseif ($root_path == 'taxonomy/term/%' || substr($root_path, 0, 11) == 'farm/area/%') {
|
|
|
|
|
|
|
|
// Get the asset id from the path.
|
|
|
|
$area_id = check_plain(arg(2));
|
|
|
|
|
|
|
|
// Load the area.
|
|
|
|
$farm_area = taxonomy_term_load($area_id);
|
|
|
|
|
|
|
|
// If the taxonomy term is not a farm_area, bail.
|
|
|
|
if (empty($farm_area->vocabulary_machine_name) || $farm_area->vocabulary_machine_name != 'farm_areas') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the destination to the farm area page.
|
|
|
|
$output['#link']['localized_options']['query']['destination'] = 'taxonomy/term/' . $area_id;
|
|
|
|
|
|
|
|
// Set the farm_area query string to the area id. This will be used to
|
|
|
|
// prepopulate area reference fields in log entities.
|
|
|
|
// See hook_form_alter() below
|
|
|
|
$output['#link']['localized_options']['query']['farm_area'] = $area_id;
|
|
|
|
}
|
|
|
|
|
2014-11-29 01:44:58 +01:00
|
|
|
// Add the action output.
|
|
|
|
if (!empty($output)) {
|
|
|
|
$data['actions']['output'][] = $output;
|
|
|
|
}
|
|
|
|
}
|
2014-11-27 15:08:42 +01:00
|
|
|
}
|
2014-11-26 22:57:00 +01:00
|
|
|
}
|
|
|
|
|
2014-12-01 02:30:12 +01:00
|
|
|
/**
|
|
|
|
* Implements hook_farm_area_links().
|
|
|
|
*/
|
|
|
|
function farm_log_farm_area_links($id) {
|
|
|
|
return array(
|
2014-12-01 15:06:09 +01:00
|
|
|
array(
|
|
|
|
'title' => t('Activities'),
|
|
|
|
'href' => 'farm/area/' . $id . '/activities',
|
|
|
|
'weight' => -100,
|
|
|
|
),
|
2014-12-01 02:30:12 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-02-18 22:35:54 +01:00
|
|
|
/**
|
|
|
|
* Implements hook_entity_view_alter()
|
|
|
|
*/
|
|
|
|
function farm_log_entity_view_alter(&$build, $type) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Alter farm assets to display their current location.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// If it's not a farm_asset, bail.
|
|
|
|
if ($type != 'farm_asset') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the entity information isn't available, bail.
|
|
|
|
if (empty($build['#entity'])) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$asset = $build['#entity'];
|
|
|
|
|
|
|
|
// Start an output string.
|
|
|
|
$output = '<strong>Current location:</strong> ';
|
|
|
|
|
|
|
|
// Get the asset's location.
|
|
|
|
$area = farm_log_asset_location($asset);
|
|
|
|
|
|
|
|
// If a location was found, add a link to it.
|
|
|
|
if (!empty($area->tid)) {
|
|
|
|
$output .= l($area->name, 'taxonomy/term/' . $area->tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, none.
|
|
|
|
else {
|
|
|
|
$options = array(
|
|
|
|
'query' => array(
|
|
|
|
'destination' => 'farm/asset/' . $asset->id,
|
|
|
|
'farm_asset' => $asset->id,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
$link = l('add a movement', 'log/add/farm_movement', $options);
|
|
|
|
$output .= 'N/A (' . $link .')';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add it to the build array.
|
|
|
|
$build['location'] = array(
|
|
|
|
'#markup' => $output,
|
|
|
|
'#weight' => -100,
|
|
|
|
);
|
|
|
|
}
|
2014-12-01 02:30:12 +01:00
|
|
|
|
2014-11-13 21:53:13 +01:00
|
|
|
/**
|
|
|
|
* Implements hook_form_alter().
|
|
|
|
*/
|
|
|
|
function farm_log_form_alter(&$form, &$form_state, $form_id) {
|
|
|
|
|
2015-01-03 21:43:57 +01:00
|
|
|
// If this is a log form with an asset(s) reference field.
|
|
|
|
if ($form_id == 'log_form' && (!empty($form['field_farm_asset']) || !empty($form['field_farm_assets']))) {
|
|
|
|
|
|
|
|
// First choice is farm_asset, second is farm_assets.
|
2015-03-12 23:25:05 +01:00
|
|
|
$field_name = (!empty($form['field_farm_asset'])) ? 'field_farm_asset' : 'field_farm_assets';
|
2014-11-13 21:53:13 +01:00
|
|
|
|
2014-11-19 19:25:22 +01:00
|
|
|
// Alter the form using our helper function.
|
2015-01-03 21:43:57 +01:00
|
|
|
// ($asset is used below to for movement logs.)
|
2015-03-12 23:25:05 +01:00
|
|
|
$asset = farm_log_form_prepopulate_asset($form, $field_name);
|
2015-01-03 21:43:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// If this is a log form with an area(s) reference field...
|
|
|
|
if ($form_id == 'log_form' && (!empty($form['field_farm_area']) || !empty($form['field_farm_areas']))) {
|
|
|
|
|
|
|
|
// First choice is farm_area, second is farm_areas.
|
|
|
|
$field_name = (!empty($form['field_farm_area'])) ? 'field_farm_area' : 'field_farm_areas';
|
|
|
|
|
|
|
|
// Alter the form with the farm_log helper function.
|
|
|
|
farm_log_form_prepopulate_area($form, $field_name);
|
|
|
|
}
|
2014-11-19 19:25:22 +01:00
|
|
|
|
2015-01-03 21:43:57 +01:00
|
|
|
// If this is the farm_movement log form...
|
|
|
|
if ($form_id == 'log_form' && $form['#bundle'] == 'farm_movement') {
|
|
|
|
|
|
|
|
// If no asset was found above, don't continue.
|
2014-11-19 19:25:22 +01:00
|
|
|
if (empty($asset)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the "from" field is empty...
|
|
|
|
if (empty($form['field_farm_move_from'][LANGUAGE_NONE][0]['#default_value'])) {
|
2014-11-13 22:33:33 +01:00
|
|
|
|
2014-11-19 19:25:22 +01:00
|
|
|
// Look up the asset's last location and prepopulate the "from" field.
|
2014-12-22 23:07:36 +01:00
|
|
|
$area = farm_log_asset_location($asset);
|
|
|
|
if (!empty($area->name)) {
|
|
|
|
$form['field_farm_move_from'][LANGUAGE_NONE]['#default_value'] = $area->name;
|
2014-11-19 19:25:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-13 21:53:45 +01:00
|
|
|
|
2014-12-22 23:07:36 +01:00
|
|
|
/**
|
|
|
|
* Find the location of an asset.
|
|
|
|
*
|
|
|
|
* @param FarmAsset $asset
|
|
|
|
* The farm_asset object to look for.
|
2015-01-16 18:53:31 +01:00
|
|
|
* @param int $time
|
|
|
|
* Unix timestamp limiter. Only movement logs before this time will be
|
2015-02-18 22:35:54 +01:00
|
|
|
* included. Defaults to the current time. Set to 0 to load the absolute last.
|
2015-03-03 17:56:37 +01:00
|
|
|
* @param boolean $done
|
|
|
|
* Whether or not to only show movement logs that are marked as "done".
|
|
|
|
* Defaults to TRUE.
|
2014-12-22 23:07:36 +01:00
|
|
|
*
|
|
|
|
* @return area
|
|
|
|
* Returns the area that the asset is in.
|
|
|
|
*/
|
2015-03-03 17:56:37 +01:00
|
|
|
function farm_log_asset_location(FarmAsset $asset, $time = REQUEST_TIME, $done = TRUE) {
|
2014-12-22 23:07:36 +01:00
|
|
|
$query = new EntityFieldQuery();
|
|
|
|
$query->entityCondition('entity_type', 'log')
|
|
|
|
->entityCondition('bundle', 'farm_movement')
|
|
|
|
->fieldCondition('field_farm_asset', 'target_id', $asset->id)
|
2015-02-18 22:25:03 +01:00
|
|
|
->propertyOrderBy('timestamp', 'DESC')
|
2014-12-22 23:07:36 +01:00
|
|
|
->propertyOrderBy('id', 'DESC')
|
|
|
|
->range(0, 1);
|
2015-02-18 22:25:03 +01:00
|
|
|
if (!empty($time)) {
|
|
|
|
$query->propertyCondition('timestamp', $time, '<=');
|
|
|
|
}
|
2015-03-03 17:56:37 +01:00
|
|
|
if (!empty($done)) {
|
|
|
|
$query->propertyCondition('done', TRUE);
|
|
|
|
}
|
2014-12-22 23:07:36 +01:00
|
|
|
$result = $query->execute();
|
|
|
|
if (!empty($result['log'])) {
|
|
|
|
foreach ($result['log'] as $id => $entity) {
|
|
|
|
$log = log_load($id);
|
|
|
|
if (!empty($log->field_farm_move_to[LANGUAGE_NONE][0]['tid'])) {
|
|
|
|
$term = taxonomy_term_load($log->field_farm_move_to[LANGUAGE_NONE][0]['tid']);
|
|
|
|
if (!empty($term)) {
|
|
|
|
return $term;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-19 19:25:22 +01:00
|
|
|
/**
|
|
|
|
* Helper function for enabling asset prepopulation in log forms.
|
|
|
|
*
|
|
|
|
* @param $form
|
|
|
|
* The form array to modify, passed by reference.
|
|
|
|
* @param $field_name
|
|
|
|
* The machine name of the entity reference field that should be populated.
|
|
|
|
*
|
2014-11-26 22:57:29 +01:00
|
|
|
* @return FarmAsset farm_asset
|
2014-11-19 19:25:22 +01:00
|
|
|
* Returns the asset object, if found.
|
|
|
|
*/
|
|
|
|
function farm_log_form_prepopulate_asset(&$form, $field_name = 'field_farm_asset') {
|
|
|
|
$asset = NULL;
|
|
|
|
|
|
|
|
// If the "farm_asset" query parameter is set...
|
|
|
|
$params = drupal_get_query_parameters();
|
|
|
|
if (!empty($params['farm_asset'])) {
|
|
|
|
|
|
|
|
// Verify that the farm_asset is valid.
|
|
|
|
$asset = farm_asset_load($params['farm_asset']);
|
|
|
|
if ($asset) {
|
|
|
|
|
|
|
|
// Add the asset to the form.
|
|
|
|
$form['farm_asset'] = array(
|
|
|
|
'#type' => 'value',
|
|
|
|
'#value' => $asset,
|
|
|
|
);
|
|
|
|
|
2014-12-01 03:49:46 +01:00
|
|
|
// Prepopulate the asset reference field.
|
2014-11-19 19:25:22 +01:00
|
|
|
if (empty($form[$field_name][LANGUAGE_NONE][0]['target_id']['#default_value'])) {
|
|
|
|
$form[$field_name][LANGUAGE_NONE][0]['target_id']['#default_value'] = entity_label('farm_asset', $asset) . ' (' . $asset->id . ')';
|
2014-11-13 21:53:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-19 19:25:22 +01:00
|
|
|
|
2014-12-23 14:42:39 +01:00
|
|
|
// If the asset field is not empty, hide it so that it can't be changed.
|
|
|
|
if (!empty($form[$field_name][LANGUAGE_NONE][0]['target_id']['#default_value'])) {
|
|
|
|
$form[$field_name]['#access'] = FALSE;
|
|
|
|
}
|
|
|
|
|
2014-11-19 19:25:22 +01:00
|
|
|
return $asset;
|
2014-12-01 03:49:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function for enabling area prepopulation in log forms.
|
|
|
|
*
|
|
|
|
* @param $form
|
|
|
|
* The form array to modify, passed by reference.
|
|
|
|
* @param $field_name
|
|
|
|
* The machine name of the term reference field that should be populated.
|
|
|
|
*
|
|
|
|
* @return TaxonomyTerm term
|
|
|
|
* Returns the taxonomy term object, if found.
|
|
|
|
*/
|
|
|
|
function farm_log_form_prepopulate_area(&$form, $field_name = 'field_farm_area') {
|
|
|
|
$area = NULL;
|
|
|
|
|
|
|
|
// If the "farm_area" query parameter is set...
|
|
|
|
$params = drupal_get_query_parameters();
|
|
|
|
if (!empty($params['farm_area'])) {
|
|
|
|
|
|
|
|
// Verify that the farm_area is valid.
|
|
|
|
$area = taxonomy_term_load($params['farm_area']);
|
|
|
|
if ($area) {
|
|
|
|
|
|
|
|
// Add the area to the form.
|
|
|
|
$form['farm_area'] = array(
|
|
|
|
'#type' => 'value',
|
|
|
|
'#value' => $area,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Prepopulate the area reference field.
|
|
|
|
if (empty($form[$field_name][LANGUAGE_NONE]['#default_value'])) {
|
|
|
|
$form[$field_name][LANGUAGE_NONE]['#default_value'] = entity_label('taxonomy_term', $area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $area;
|
2014-12-22 23:33:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_action_info().
|
|
|
|
*/
|
|
|
|
function farm_log_action_info() {
|
|
|
|
return array(
|
|
|
|
'farm_log_asset_move_action' => array(
|
|
|
|
'type' => 'farm_asset',
|
|
|
|
'label' => t('Move'),
|
|
|
|
'configurable' => TRUE,
|
|
|
|
'triggers' => array('any'),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Asset move action configuration form.
|
|
|
|
*/
|
|
|
|
function farm_log_asset_move_action_form($context, $form_state) {
|
|
|
|
|
2015-03-12 16:24:34 +01:00
|
|
|
// Build a list of the assets being moved.
|
|
|
|
if (!empty($form_state['selection'])) {
|
|
|
|
$assets = array();
|
|
|
|
$query = db_select('farm_asset', 'a');
|
|
|
|
$query->addField('a', 'name');
|
|
|
|
$query->condition('a.id', $form_state['selection']);
|
|
|
|
$results = $query->execute();
|
|
|
|
foreach ($results as $result) {
|
|
|
|
$assets[] = $result->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If there is more than one asset, theme an item list.
|
|
|
|
if (count($assets) > 1) {
|
|
|
|
$markup = theme('item_list', array('items' => $assets, 'title' => t('Move Assets:')));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, display the one.
|
|
|
|
else {
|
|
|
|
$markup = '<h3>' . t('Move') . ' ' . reset($assets) . '</h3>';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display the asset(s) in the form.
|
|
|
|
$form['assets'] = array(
|
|
|
|
'#type' => 'markup',
|
|
|
|
'#markup' => $markup,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-12-22 23:33:34 +01:00
|
|
|
// "To" field: select list of areas.
|
|
|
|
$form['to'] = array(
|
|
|
|
'#type' => 'select',
|
|
|
|
'#title' => t('To'),
|
|
|
|
'#options' => taxonomy_allowed_values(field_info_field('field_farm_move_to')),
|
|
|
|
'#required' => TRUE,
|
|
|
|
);
|
|
|
|
|
2015-03-03 17:56:44 +01:00
|
|
|
// "Done" field: mark movements as done.
|
|
|
|
$form['done'] = array(
|
|
|
|
'#type' => 'checkbox',
|
|
|
|
'#title' => t('Movement is done'),
|
|
|
|
'#description' => t('Check this if the movement has already been done. Otherwise, you will need to mark the movement log item as done later.'),
|
2015-03-12 16:25:08 +01:00
|
|
|
'#default_value' => TRUE,
|
2015-03-03 17:56:44 +01:00
|
|
|
);
|
|
|
|
|
2014-12-22 23:33:34 +01:00
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Asset move action configuration form submit.
|
|
|
|
*/
|
|
|
|
function farm_log_asset_move_action_submit($form, $form_state) {
|
|
|
|
return array(
|
|
|
|
'to' => $form_state['values']['to'],
|
2015-03-03 17:56:44 +01:00
|
|
|
'done' => $form_state['values']['done'],
|
2014-12-22 23:33:34 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Action function for farm_log_asset_move_action.
|
|
|
|
*
|
|
|
|
* Creates a new movement record for the specified asset.
|
|
|
|
*
|
|
|
|
* @param object $entity
|
|
|
|
* An optional entity object.
|
|
|
|
* @param array $context
|
|
|
|
* Array with parameters for this action.
|
|
|
|
*/
|
|
|
|
function farm_log_asset_move_action($entity, $context = array()) {
|
|
|
|
|
|
|
|
// Pull the asset out of the context.
|
|
|
|
$asset = $context['farm_asset'];
|
|
|
|
|
|
|
|
// Create a new movement log entity.
|
|
|
|
$log = entity_create('log', array('type' => 'farm_movement'));
|
|
|
|
|
|
|
|
// Set the asset.
|
|
|
|
$log->field_farm_asset[LANGUAGE_NONE][] = array(
|
|
|
|
'target_id' => $asset->id,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Set the date.
|
2015-02-18 22:25:35 +01:00
|
|
|
$log->timestamp = REQUEST_TIME;
|
2014-12-22 23:33:34 +01:00
|
|
|
|
|
|
|
// Load the asset's current location.
|
|
|
|
$area = farm_log_asset_location($asset);
|
|
|
|
|
|
|
|
// If the asset has a current location, set the "from" area.
|
|
|
|
if (!empty($area->name) && !empty($area->tid)) {
|
|
|
|
$log->field_farm_move_from[LANGUAGE_NONE][] = array(
|
|
|
|
'tid' => $area->tid,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the "to" area.
|
|
|
|
$log->field_farm_move_to[LANGUAGE_NONE][] = array(
|
|
|
|
'tid' => $context['to'],
|
|
|
|
);
|
|
|
|
|
2015-03-03 17:56:44 +01:00
|
|
|
// Set the log's done status.
|
|
|
|
$log->done = (!empty($context['done'])) ? TRUE : FALSE;
|
|
|
|
|
2014-12-22 23:33:34 +01:00
|
|
|
// Save the movement.
|
|
|
|
log_save($log);
|
2015-03-03 22:48:53 +01:00
|
|
|
}
|