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

batch update participants saves participant as "cancelled" when "no show" is selected if event fee is pending AND undefined var in BaseIPN.php

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 4.3.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      In trunk (4.3) there are two issues ...

      1. Notice: Undefined variable: input in cancelled() (line 212 of /Users/dgg/svn/crm_v4.3/CRM/Core/Payment/BaseIPN.php)
      14: CRM_Core_Payment_BaseIPN->cancelled() (Array, 2 elements)
      13: CRM_Core_Payment_BaseIPN::updateContributionStatus() (Array, 2 elements)
      12: CRM_Event_Form_Task_Batch::updatePendingOnlineContribution() (Array, 2 elements)
      11: CRM_Event_Form_Task_Batch->postProcess() (Array, 2 elements)

      I don't see $input passed in from anywhere - might be a misnamed variable or ???

      2. Participant status should not be "automatically" set to Cancelled when user sets it to No-show in Batch Update (Jamie's original issue).

      In order to fix this I think we need to add an optional parameter that gets passed by CRM_Event_Form_Task_Batch into CRM_Core_Payment_BaseIPN::updateContributionStatus - telling it to NOT update participant statuses. That function would then pass it to CRM_Core_Payment_BaseIPN::cancelled - so that the if statement on line 233 return false and the participant status isn't changed to cancelled.

      — How to replicate (from Jamie) ----
      I replicated on the demo site by:

      • Changing the Rain Forest event to allow pay later option
      • Registered with pay later option
      • Clicked Manage Events, then for Rain Forest event, selected to list all participants that are registered, attended or pending pay later
      • Chose all participants and selected Batch update
      • Found the pay later participant that I created
      • Changed to No-show
      • Updated

      The result is that the participant record status is changed to canceled rather than no show. Although I didn't test it on the demo, we've gotten reports that it will generate a cancel email to the participant (which is confusing).

      The problem starts on line 377 of CRM/Event/Form/Task/Batch.php:

      $updatedStatusId = CRM_Core_Payment_BaseIPN::updateContributionStatus($params);

      On line 612 of CRM/Core/Payment/BaseIPN.php:

      if ($statusId == array_search('Cancelled', $contributionStatuses))

      { $baseIPN->cancelled($objects, $transaction); $transaction->commit(); return $statusId; }

      This seems reasonable.

      However, on line 234 of CRM/Core/Payment/BaseIPN.php, the cancelled function includes:

      if ($participant)

      { $participant->status_id = 4; $participant->save(); }

      In other words, if the contribution is cancelled it automatically sets the participation record to cancelled. But in this case, the participation record should be set to No Show.

      I'm not sure the best solution.

        Attachments

          Activity

            People

            • Assignee:
              ravish.nair Ravish Nair
              Reporter:
              jamie Jamie McClelland
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: