Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16448 Improvements to CiviMail
  3. CRM-21316

Refactor getRecipients fn by creating a new fn getMailRecipients, that will be used ONLY to fetch and store mail recipients

    Details

    • Type: Sub-task
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.25
    • Fix Version/s: 4.7.31
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds
    • Verified?:
      Yes

      Description

      This function getMailRecipients is created after simplifying the code of self::getRecipients(..) and these are the changes made:

      1. Takes mailing ID as the only parameter, and remove dependency on mailing Job
      2. This function ONLY fetches and store mailing recipients, doesn't handle SMS mode
      3. Use less JOINs in underlying queries.
      4. Simplifies code to fetch contacts from selected mailing smart group(s).
      5. Doesn't execute query needlessly, e.g.
      a) if SG (smart groups) are selected then ONLY queries responsible to fetch contacts from SG are executed
      b) If no 'Include' groups are selected then simply return as this also means no groups are selected to fetch recipients.
      6. Refreshes smart group contact cache at once.
      7. Keeping both the function for now to reduce any unintended regressions

      This function is later called via mailing.create API using a special parameter

      {get_recipients: TRUE}

      , for now, it's been used by angularJs services to avoid any rollbacks and fetch mailing recipients of selected groups.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              monish.deb Monish Deb
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: