Add checkbox to set the movement log status.

This commit is contained in:
Paul Weidner 2020-07-07 09:04:21 -07:00 committed by Michael Stenta
parent f06cb357bc
commit 210268a74e
1 changed files with 11 additions and 1 deletions

View File

@ -19,6 +19,13 @@ function farm_livestock_move_form($form, &$form_state) {
// Make the form a tree.
$form['move']['#tree'] = TRUE;
// Movement status.
$form['move']['done'] = array(
'#type' => 'checkbox',
'#title' => t('Completed'),
'#default_value' => TRUE,
);
// Define the date format for logs.
$date_format = 'Y-m-d';
@ -331,6 +338,9 @@ function farm_livestock_move_form_next_location_ajax($form, $form_state) {
*/
function farm_livestock_move_form_submit($form, &$form_state) {
// Get the movement status.
$done = $form_state['values']['move']['done'];
// Get the movement timestamp.
$timestamp = strtotime($form_state['values']['move']['date']);
@ -424,7 +434,7 @@ function farm_livestock_move_form_submit($form, &$form_state) {
}
// Create activity log with asset movement to areas and specific geometry.
$movement_log = farm_movement_create($asset, $areas, $timestamp, 'farm_activity', TRUE, $geom);
$movement_log = farm_movement_create($asset, $areas, $timestamp, 'farm_activity', $done, $geom);
// Save the movement log.
log_save($movement_log);