Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-15914

API setvalue call passes incomplete DAO to post hook

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 4.5.5, 4.6
    • Fix Version/s: None
    • Component/s: CiviCRM API
    • Labels:
      None
    • Documentation Required?:
      None

      Description

      When a post hook is fired as a result of a 'create' call, the object passed in the parameter objectRef has all fields filled, even if only one field was changed.

      After the fix made in CRM-14969, when the hook is fired as a result of a 'setvalue' call, objectRef has only the entity ID and the changed field filled. watchdog/print_r has shown that the other fields on the object are left empty. This is because the values are copied from the parameters to the setvalue call rather than looking up the entity in the database.

      An implementation of the post hook does not know whether (when editing an existing entity) it was called as a result of a 'create' or a 'setvalue'. I'd therefore suggest passing complete data in setvalue by adding $entityDAO->find(TRUE);

      PR to follow.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              DaveFF David Knoll
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: