The verb DBObject::SetCurrentUser udpates an attribute with the id (integer value) of the current user.
What if you would like to record the login, or even the name or email of the associated contact?
A generic solution would be to let the developer specfiy the action as
SetFromTemplate('resolved_by', 'Resolved by $current_user->contactid->email$')
That would require three steps to implement:
1) Implement the new verb (SetFromTemplate or SetString?) in DBObject
2) Improve the templating to enable the placeholder current_user. This is the exact same need as for [#900]
3) Expose the new verb in the meta information (xml)
SetCurrentUser has been changed so that if the attribute is a string, it receives the user friendlyname (associated contact friendly name or the login if no contact is attached to the user).
SetCurrentPerson has been added and does the same: set the id or the friendly name depending on the type of the target attribute.
Committed as [r3616]
Now, SetFromTemplate would give more possibilities... decision???
Related
Commit: <Commit _id='5358055aa02bb175d1406271:3616' tree_id='af4cf07623ebd0c0cc79047d3838f96ca08e8157' committed=I{'date': datetime.datetime(2015, 7, 2, 9, 43, 15, 942000), 'email': '', 'name': 'romainq'} authored=I{'date': datetime.datetime(2015, 7, 2, 9, 43, 15, 942000), 'email': '', 'name': 'romainq'} message='New lifecycle action SetCurrentPerson. Also improved the existing lifecycle action SetCurrentUser to prevent from calling it on an external key that is not pointing to users (!= contact), and if the target attribute is a string, then store the friendlyname there.' parent_ids=I['5358055aa02bb175d1406271:3615'] child_ids=I['5358055aa02bb175d1406271:3617'] repo_ids=I[ObjectId('5358055aa02bb175d1406271')]>
Last edit: Romain Quetiez 2015-08-12
The need is fulfilled.
A new ticket has been created for SetFromTemplate: [#1132]
Related
Tickets: #1132