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

print pdf of contributions does not include membership data

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.1.3
    • Fix Version/s: 3.2
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      When printing pdfs receipts information about membership is not included. This is because the code from BaseIPN is used which has been exiting when it cannot establish a payment processor.

      Re-ordering the code so that it creates the objects for the 'optional components' before processing the core objects related to payment processing means that these objects are available for the receipts printed from the contribution screen.

      Note that future improvements would ideally include:
      1) spliting the functions being used by both payment processing & creating receipts into a more generic class
      2) create an alternative to printing pdf receipts which e-mails them
      3) look at using the html template rather than the text template for pdf receipts
      4) change the print pdf receipts so that 'pending' & 'offline' contributions are not rejected (pending ones should have different text assigned - e.g. 'invoice' or other configurable).
      5) allow sending e-mails rather than just printing letters.

      Index: CRM/Core/Payment/BaseIPN.php
      ===================================================================
      — CRM/Core/Payment/BaseIPN.php (revision 26715)
      +++ CRM/Core/Payment/BaseIPN.php (working copy)
      @@ -117,29 +117,10 @@
      $objects['contributionType'] = $contributionType;
      $paymentProcessorID = null;
      if ( $input['component'] == 'contribute' ) {

      • // get the contribution page id from the contribution
      • // and then initialize the payment processor from it
      • if ( ! $contribution->contribution_page_id ) {
      • if ( !CRM_Utils_Array::value( 'pledge_payment', $ids ) ) {
      • // return if we are just doing an optional validation
      • if ( ! $required ) { - return true; - }
      • CRM_Core_Error::debug_log_message( "Could not find contribution page for contribution record: $contributionID" );
      • echo "Failure: Could not find contribution page for contribution record: $contributionID<p>";
      • return false;
      • }
      • }
      • //for offline pldedge we dont have contribution page.
      • if ( !CRM_Utils_Array::value( 'pledge_payment', $ids ) ) { - // get the payment processor id from contribution page - $paymentProcessorID = CRM_Core_DAO::getFieldValue( 'CRM_Contribute_DAO_ContributionPage', - $contribution->contribution_page_id, - 'payment_processor_id' ); - }
      • // now retrieve the other optional objects
        + // fetching optional objects
        + // have moved this befor the 'important' payment processor related objects
        + // as this code is also used by Contribute/Task/PDF.php to generate receipts
        + // and these should be returned also for off-line components
        if ( isset( $ids['membership'] ) ) { require_once 'CRM/Member/DAO/Membership.php'; $membership = new CRM_Member_DAO_Membership( ); @@ -184,6 +165,30 @@ }

        $objects['contributionRecur'] =& $recur;
        }
        +
        + // get the contribution page id from the contribution
        + // and then initialize the payment processor from it
        + if ( ! $contribution->contribution_page_id ) {
        + if ( !CRM_Utils_Array::value( 'pledge_payment', $ids ) )

        Unknown macro: {+ // return if we are just doing an optional validation+ if ( ! $required ) { + return true; + }+ + CRM_Core_Error}

        + }
        + //for offline pldedge we dont have contribution page.
        + if ( !CRM_Utils_Array::value( 'pledge_payment', $ids ) )

        { + // get the payment processor id from contribution page + $paymentProcessorID = CRM_Core_DAO::getFieldValue( 'CRM_Contribute_DAO_ContributionPage', + $contribution->contribution_page_id, + 'payment_processor_id' ); + }

        +
        +
        } else {
        // we are in event mode
        // make sure event exists and is valid

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: