CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Resending a Pay Later Membership invoice from backend
Pages: [1]

Author Topic: Resending a Pay Later Membership invoice from backend  (Read 1445 times)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Resending a Pay Later Membership invoice from backend
September 01, 2011, 12:16:03 am
Hi - am I missing something really simple.

When someone Joins and Pay Later via front end they get a 'invoice' based on us putting

{if $is_pay_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} - {$title}

in the subject and

  <p>{if $is_pay_later}{ts}Tax Invoice{/ts}{else}{ts}Tax Receipt{/ts}{/if}: {$contributionID}</p>

in the header

If they then require us to resend an Invoice the route seems to be to go to Edit Membership and click on


Send Confirmation and Receipt

Except if it is still Pay Later then the subject etc is still wrong based on the following not checking to see if it is still Pay Later

So looks like we need

{if $is_pay_later}{ts}Invoice - Join Outdoors New Zealand{/ts}{elseif $receiptType EQ 'membership signup'} {ts}Membership Confirmation and Receipt{/ts} {elseif $receiptType EQ 'membership renewal'} {ts}Membership Renewal Confirmation and Receipt{/ts} {/if}

But then we also need to insert   
{if $is_pay_later}
     <p>{$pay_later_receipt}</p>

to get the Pay Later instructions etc

At which point I think, either there is an easier way - or this is something that should be possible and maybe we need to do this properly and if so - is this the right route - and if so - we should also rename the checkbox to 'send a receipt (or invoice for Pay Later)

Any suggestions? Does this make sense to try and get in to core so Pay Later is handled more system wide?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Resending a Pay Later Membership invoice from backend
October 04, 2011, 09:04:03 pm
Hi,

I'd like to propose the followin patch to make it possible to improve receipts here. The patch basically says "If the event is a paid event & the participant is pending assign the token 'payment_outstanding' to denote it isn't yet paid AND assign the token 'pay_later_receipt'"

I didn't go with 'is_pay_later' because often the records are 'pending due to incomplete transaction'.

I'm thinking we could assign the tokens in the first instance & later build up template logic as people elaborate on use cases. i.e in the cases I deal with we either have their money or we want the 'receipt' to be an invoice but I'm aware there are more complex scenarios like waitlists.


Index: CRM/Event/Form/Participant.php
===================================================================
--- CRM/Event/Form/Participant.php   (revision 36508)
+++ CRM/Event/Form/Participant.php   (working copy)
@@ -1543,7 +1543,6 @@
                 $this->assign( 'participantID', $participants[$num]->id );
 
                 $this->_id = $participants[$num]->id;
-               
                 if ( $this->_isPaidEvent ) {
                     // fix amount for each of participants ( for bulk mode )
                     $eventAmount = array();
@@ -1557,8 +1556,20 @@
                     //So we have to build amount as array.
                     $eventAmount = array_merge( $eventAmount, $additionalParticipantDetails );
                     $this->assign( 'amount', $eventAmount );
+                                 
+                                    require_once 'CRM/Event/PseudoConstant.php';
+                                    $participantStatuses = CRM_Event_PseudoConstant::participantStatusClass();
+                                    if($participantStatuses[$this->_statusId] == 'Pending'){
+                                      $this->assign('payment_outstanding', 1);
+                                    }
+                                    if ( $this->_eventId ) {
+                                      $returnProperties = array( 'pay_later_receipt' );
+                                      $eventdetails = array( );
+                                      CRM_Core_DAO::commonRetrieveAll( 'CRM_Event_DAO_Event', 'id', $this->_eventId, $eventdetails, $returnProperties );
+                                      $this->assign('pay_later_receipt',$eventdetails[$this->_eventId]['pay_later_receipt']);
+
+                                    }
                 }
-
                 $sendTemplateParams = array(
                     'groupName' => 'msg_tpl_workflow_event',
                     'valueName' => 'event_offline_receipt',
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Resending a Pay Later Membership invoice from backend
October 05, 2011, 04:18:46 pm
And this would be the relevant patch for membership - it depends on someone creating a pending contribution when they do a back-end receipt & then identifies that there is a payment outstanding. There is no way to select the relevant pay-later-text from a contribution form in this case

Code: [Select]
Index: CRM/Member/Form/Membership.php
===================================================================
--- CRM/Member/Form/Membership.php (revision 36549)
+++ CRM/Member/Form/Membership.php (working copy)
@@ -1451,7 +1451,9 @@
             }
 
             $this->assign( 'customValues', $customValues );
-
+            if(CRM_Utils_Array::value('record_contribution',$params) && CRM_Utils_Array::value('contribution_status_id',$params)  == 2){
+              $this->assign('payment_outstanding',1);
+            }
             require_once 'CRM/Core/BAO/MessageTemplates.php';
             list ($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate(
                 array(
@@ -1465,8 +1467,7 @@
                 )
             );
         }
-       
-       
+
         if ( ( $this->_action & CRM_Core_Action::UPDATE ) ) {
             //end date can be modified by hooks, so if end date is set then use it.
             $endDate = ( $membership->end_date ) ? $membership->end_date : $endDate ;
« Last Edit: October 05, 2011, 04:34:09 pm by Eileen »
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Resending a Pay Later Membership invoice from backend
October 05, 2011, 05:18:19 pm
Ok looks like on the event side of things it looks like only the contribution status is of interest - I tried assigning payment_outstanding but maybe we should just assign it as contribution_status & then people can build up logic like

{if !$contributionStatus || $contributionStatus eq 2}
This is an Invoice and either no contribution has been recorded against the membership or one has been & it's status is Pending so you need to send us money{/if}

Patch below also fixes inconsistent assignment of membership_id on back end receipts.

Index: CRM/Member/Form/Membership.php
===================================================================
--- CRM/Member/Form/Membership.php   (revision 36549)
+++ CRM/Member/Form/Membership.php   (working copy)
@@ -1438,7 +1438,7 @@
             }
             $this->assign( 'module', 'Membership' );
             $this->assign( 'contactID', $this->_contactID );
-            $this->assign( 'membershipID', CRM_Utils_Array::value('membership_id', $params) );
+            $this->assign( 'membershipID', CRM_Utils_Array::value('membership_id', $params,CRM_Utils_Array::value('membership_id',$this->_defaultValues) ) );
             $this->assign( 'contributionID', isset($contribution)? $contribution->id : null );
             $this->assign('receiptType', 'membership signup');
             $this->assign( 'receive_date', CRM_Utils_Array::value('receive_date', $params) );           
@@ -1451,7 +1451,10 @@
             }
 
             $this->assign( 'customValues', $customValues );
-
+            $contributionStatus = CRM_Utils_Array::value('contribution_status_id',$params,CRM_Utils_Array::value('contribution_status_id',$this->_defaultValues));
+            if( !empty($contributionStatus) && $contributionStatus == 2){
+              $this->assign('payment_outstanding',1);           
+            }
             require_once 'CRM/Core/BAO/MessageTemplates.php';
             list ($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate(
                 array(
@@ -1465,8 +1468,7 @@
                 )
             );
         }
-       
-       
+
         if ( ( $this->_action & CRM_Core_Action::UPDATE ) ) {
             //end date can be modified by hooks, so if end date is set then use it.
             $endDate = ( $membership->end_date ) ? $membership->end_date : $endDate ;
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Resending a Pay Later Membership invoice from backend
October 05, 2011, 07:22:11 pm
OK - so treating the payment as pay_later (rather than incomplete transaction) per

http://forum.civicrm.org/index.php/topic,19588.msg91419.html#msg91419

brings us a bit closer. In the patch I suggested above 'is_pay_later' would only be assigned to the template when the pending contribution is recorded & in conjunction with this one 'payment_outstanding' would be assigned whenever a pending contribution exists. However, contribution_status may still be more appropriate.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Resending a Pay Later Membership invoice from backend
October 06, 2011, 09:29:13 am
Let's finish discussion on IRC today as the which approach so you can file an issue and commit patches to 4.1.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Resending a Pay Later Membership invoice from backend

This forum was archived on 2017-11-26.