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

$frequencyUnits in assignToTemplate( ) should get the 'value' of 'recur_frequency_units' option

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: Unscheduled
    • Fix Version/s: Unscheduled
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      There is a case when CiviCRM developer/user customized the 'label' column to have
      daily, weekly, monthly, yearly
      entries to match their custom message on the Contribution pages.

      After such customization, none of the recurring contribution work.
      The sample 'Help Support CiviCRM' page with 'Recurring contributions' box checked and it throws error like-
      Payment Processor Error message
      : 11518:Invalid billing period. Billing period must be one of Day, Week, SemiMonth, or Year

      For comparison purpose, the out-of-box 'label' column has the following entries:
      day, week, month, year.

      Such customization on the 'label' made the assignToTemplate( ) function in
      CRM/Contribute/Form/ContributionBase.php sending
      'daily', or 'weekly', or 'monthly' or 'yearly' to PayPal Pro.
      And thus PayPal returns the 11518 error message.

      A closer look at around line 592 in the assignToTemplate( ) function of the
      ContributionBase.php showed the $frequencyUnits is getting the 'label' entries
      of the 'recur_frequency_units' option:

      $frequencyUnits = CRM_Core_OptionGroup::values( 'recur_frequency_units' );

      I think the original intend is for $frequencyUnits to get the 'value' entries of the 'recur_frequency_units' option.
      The 'value' entries of the 'recur_frequency_units' option are
      day, week, month, year.
      And the function call to get $frequencyUnits should be

      $frequencyUnits = CRM_Core_OptionGroup::values( 'recur_frequency_units',
      /* $flip = / false, / $grouping = / false, / $localize = / false, / $condition = */ null,
      /* $valueColumnName = */ 'value');

      The above modification allows CiviCRM developer using any custom 'label' on the
      Contribution page while passing the correct billing period to PayPal.

      The above change fixed the special customization problem.

      I can upload the fix for 3.4.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              elmobile Stacy Liou
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified