Details
-
Type:
Bug
-
Status: Done/Fixed
-
Priority:
Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.2.0
-
Component/s: None
-
Labels:None
Description
I went back to the discussion we had about #now & other macros to try to populate UFGroup.create properly (who created & when)
I wrote the spec using the "normal" $session & date() functions, works ok.
Assigning to you see if you get a better idea (eg. obviously, setting this default is in the form & not in the bao, hence the duplication)
Also, I'm wondering if it's a good idea to let (when using ajax) the caller set the owner/date they want, but that's a way more general problem than the UFGroup only. We might need to introduce a new api.override that applies only is ajax (or check_permission in general)?
So pretty trivial
function _civicrm_api3_uf_group_create_spec(&$params)
{ $session = CRM_Core_Session::singleton(); $params['title']['api.required'] = 1; $params['is_active']['api.default'] = 1; $params['is_update_dupe']['api.default'] = 1; $params['created_id']['api.default'] = $session->get('userID'); $params['created_date']['api.default'] = date('YmdHis'); }but seems to do what I wanted