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

Logging activities from search actions insert incorrect activity_id

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2, 3.2.1, 3.2.2, 3.2.3
    • Fix Version/s: 3.3.alpha
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      There seems to be an error with the 'Record activity' search results task.
      When recording an activity from search results, sometimes the $this->_actviityId property in the CRM_Activity_Form_Activity class is set. This means when you click the save button, a FK error can appear as the activity ID does not match a row from the civicrm_activity table.
      The activity id is populated form CRM_Utils_Request::retrieve( 'id', 'Positive', $this ), so presumably it's picking up something else from the form post values? I'm not sure. In my case it kept picking up the value 7 for this?

      I can't reproduce this error on the sandbox demo site, but it still seems there could still be the possibility of an error which needs to be trapped?

      The offending lines are 248-250 in CRM\Form\Activity.php:
      if ( $this->_action != CRM_Core_Action::ADD )

      { $this->_activityId = CRM_Utils_Request::retrieve( 'id', 'Positive', $this ); }

      In civicrm 3.1, this code was:
      if ($this->_context != 'search') {
      // if we're not adding new one, there must be an id to
      // an activity we're trying to work on.
      if ( $this->_action != CRM_Core_Action::ADD )

      { $this->_activityId = CRM_Utils_Request::retrieve( 'id', 'Positive', $this ); }

      }

      which prevented the problem I described. Has this been removed intentionally or is it a regression error?

        Attachments

          Activity

            People

            • Assignee:
              neha.saraph Neha Kulkarni
              Reporter:
              grahamgilchrist Graham Gilchrist
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: