- Issue created by @luke.stewart
1.0 Problem/Motivation
Case:
We are loading an activity (activity1=x) onto a form then submitting the form. In this case the date is used to populate additional fields on additional activities that are created.
During testing we noticed that loading the activity with the datetime but field set with no time component sets the time to the current time on submission - even if you don't change the activity date.
2.0 Detailed steps to reproduce (embed screenshots)
Create a Webform,
Enable CiviCRM processing
Add one contact - firstname,lastname (as per default)
Add one activity - add the Activity Date field.
Save
Head to the build screen edit the Activity Date field - set time component to none.
Save
You should have something like the below.
Submit form with date set to something other than today to make it clear what is happening.
Find activity id in results. Note the date and time.
View form with ?activity1=[aid] where aid is the activity id from your submission.
Note it shows the submitted date as displayed in CiviCRM.
Submit the form (Make no changes)
View the activity in CiviCRM - note that the activity time has changed (but date is constant).
civicrm_1_contact_1_fieldset_fieldset:
'#type': fieldset
'#title': 'Contact 1'
'#form_key': civicrm_1_contact_1_fieldset_fieldset
civicrm_1_contact_1_contact_existing:
'#type': civicrm_contact
'#search_prompt': '- Choose existing -'
'#widget': hidden
'#form_key': civicrm_1_contact_1_contact_existing
'#allow_create': 1
'#none_prompt': '+ Create new +'
'#default': user
'#contact_type': individual
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#extra': { }
'#title': 'Existing Contact'
civicrm_1_contact_1_contact_first_name:
'#type': textfield
'#counter_type': character
'#counter_maximum': 64
'#counter_maximum_message': ' '
'#contact_type': individual
'#form_key': civicrm_1_contact_1_contact_first_name
'#extra':
width: 20
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': 'First Name'
civicrm_1_contact_1_contact_last_name:
'#type': textfield
'#counter_type': character
'#counter_maximum': 64
'#counter_maximum_message': ' '
'#contact_type': individual
'#form_key': civicrm_1_contact_1_contact_last_name
'#extra':
width: 20
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': 'Last Name'
civicrm_1_activity_1_fieldset_fieldset:
'#type': fieldset
'#title': Activity
'#form_key': civicrm_1_activity_1_fieldset_fieldset
civicrm_1_activity_1_activity_activity_date_time:
'#type': datetime
'#title': 'Activity Date'
'#default_value': now
'#date_time_element': none
'#form_key': civicrm_1_activity_1_activity_activity_date_time
'#parent': civicrm_1_activity_1_fieldset_fieldset
'#extra': { }
3.0 Proposed resolution
Either:
A) Note this on this ticket. Close and hope it never causes a problem.
B) Add a warning somewhere relevant - probably on the screen where you remove the time component.
C) Should we be able to not set a time component? Probably
D) Do lots of work and ensure we don't update the date with a new time if the time wasn't set on the form.
Active
6.0
CiviCRM Data Handling