History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CRM-1594
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed/Completed
Priority: Major Major
Assignee: Shailesh Lende
Reporter: Patrick Hayes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
CiviCRM

Associate PHP Code with Custom Data Group

Created: 12/Feb/07 11:48 AM   Updated: 19/Sep/08 03:52 AM
Component/s: Core CiviCRM
Affects Version/s: 2.0
Fix Version/s: 2.1

Time Tracking:
Not Specified

Verified for 2.1: Yes


 Description  « Hide
Current thinking is that we might do this with a hook, OR store PHP code associated with a "group" of custom fields in the database.

--- original post ----
It would be astoundingly helpful to implement a custom data type that is "php code". Much in the same way that we can ask drupal to display blocks according to whether a set of php code returns true or false, we could have php code that returns a value and CiviCRM would fill in the value of that custom field with the value returned by the function. This would be especially useful if various variables and functions relating to the contact where available to the php code.

For myself, I would love to create a php snippet that automatically assigns a members home constituency based on their primary address.

Thanks!

Patrick Hayes

 All   Comments   Work Log   Change History   FishEye      Sort Order:
David Greenberg - 22/Aug/07 04:52 PM
Deferring to 2.1 at this time - need to tackle this AFTER the custom data refactoring. Will move back to 2.0 if time allows.

David Greenberg - 05/Feb/08 02:40 PM
If possible - this implementation should allow someone to add PHP logic to an existing field type as well. An example of this use case would be setting a default value for a custom field based on retrieving a GET param value - described here:
http://forum.civicrm.org/index.php/topic,2234.0/topicseen.html

Donald A. Lobo - 02/Jun/08 10:00 PM

setting default values is entered as a new issue for 2.2: http://issues.civicrm.org/jira/browse/CRM-3176 (might do it in 2.1)

Details for this issue is documented here: http://civicrm.org/node/356


Shailesh Lende - 28/Jul/08 09:47 AM
Tested and verified for 2.1 rev-16174.