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) »
  • Renewal emails on reminder_date AND end_date
Pages: [1]

Author Topic: Renewal emails on reminder_date AND end_date  (Read 5483 times)

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Renewal emails on reminder_date AND end_date
November 05, 2007, 08:14:35 am
Right now, the UpdateMembershipRecord script is limited to sending renewal emails on the reminder_date alone. I would like to have it send reminder emails on the renewal date + the end date. The renewal date is configured for 30 days prior to end_date. This addition would give the members two reminders (they probably need six).

I altered lines 104/5 to:

Code: [Select]
if ( ( $dao->reminder_date && ( $dao->reminder_date <= $today ) ) || ( $dao->end_date == $today ) ) {
and also changed the $query (lines 65-73) to include the end_date field. It looks to me like that should do it -- it should kick the script into the renewal email code on either the reminder_date or the end_date. But it's not working -- still does it for the reminder_date, but not the end_date. Any ideas on what I'm missing?

-Brian
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Renewal emails on reminder_date AND end_date
November 05, 2007, 09:15:11 am

end_date is not being retrieved by the query, and hence is not part of the dao object. Change the query to (line 65 or so)

Code: [Select]
SELECT civicrm_membership.id                 as membership_id,
       civicrm_membership.is_override        as is_override,
       civicrm_membership.reminder_date    as reminder_date,
       civicrm_membership.end_date           as end_date,
       civicrm_membership.membership_type_id as membership_type_id,
       civicrm_contact.id                    as contact_id
FROM   civicrm_membership, civicrm_contact
WHERE  civicrm_membership.contact_id = civicrm_contact.id
       AND civicrm_contact.domain_id = %1


lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Renewal emails on reminder_date AND end_date
November 05, 2007, 09:20:50 am
I did that already (see comment below code block in previous post), and it doesn't work. Any other reason you might see why that chunk of code wouldn't send the email out?
-Brian
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Renewal emails on reminder_date AND end_date
November 05, 2007, 09:29:08 am

apologies for not reading the entire post before replying :(

I would add a debug statement before the conditional and print the values of reminder_date, end_date and today. Not sure why it does not work currently, the code seems right (though i dont really like the fact that we use string comparison to compare dates, we should be using date routines (like the compare function from packages/Date.php). I'll file an issue and we'll fix in 2.0

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

philraymond

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 2
Re: Renewal emails on reminder_date AND end_date
August 15, 2009, 02:47:16 pm
I am sorry to revive such an old post, but this is exactly what I need: multiple automatic renewal emails to be sent at specified date intervals. Is this not a common need? (I know, everyone thinks that their need must be a common need).

Brian, did you get this working?

Thanks,
Phil

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Renewal emails on reminder_date AND end_date
August 25, 2009, 06:43:22 am
My solution was very simplified -- I think I triggered an email on the expiration date + the configurable 30 days prior. I was able to do it directly from the UpdateMembershipRecord.php script.

But it was a while ago, with an earlier version of Civi, so my code is outdated. But if you look through that file, you should be able to locate where the email trigger occurs and play with it. The only thing you need to be careful of is that there is a reminder_date field in membership records that is changed to NULL after the reminder email is sent. So you'd need to figure out how to send your first email without harming that value, so that the second time it's sent, the value is changed to NULL. Or else come up with some other way to work with that value.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

philraymond

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 2
Re: Renewal emails on reminder_date AND end_date
October 14, 2009, 02:19:40 pm
Below is the part of the UpdateMembershipRecord.php file that seems to be a candidate for editing in order to get it to send 2 (or more) automatic renewal emails instead of just 1. Seems to me this functionality should eventually be included out of the box. Anyone else interested in this?

I wonder if there is someone with more coding knowledge than me who can give me some ideas on how I might start changing this code to send more than 1 renewal email, X number of days apart.

Thanks very much,
Phil

Quote
            //send reminder for membership renewal
            if ( $dao->reminder_date &&
                 $dao->reminder_date != '0000-00-00' &&
                 ( $reminder_date <= $today_date ) ) {
                $memType =& new CRM_Member_BAO_MembershipType( );
               
                $memType->id = $dao->membership_type_id;
                if ( $memType->find( true ) &&
                     $memType->renewal_msg_id ) {
                    $toEmail  = CRM_Contact_BAO_Contact::getPrimaryEmail( $dao->contact_id );
                   
                    if ( $toEmail ) {
                        // Set the FROM email address for reminder emails here.
                        // This must be a valid account for your SMTP service. changed by philnauta
                        $from = "email-here@domain.com";
                        $result = CRM_Core_BAO_MessageTemplates::sendReminder( $dao->contact_id,
                                                                               $toEmail,
                                                                               $memType->renewal_msg_id,
                                                                               $from );

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Renewal emails on reminder_date AND end_date
October 14, 2009, 08:04:08 pm

If you dont have any coding experience, i'd recommend you hire someone from http://civicrm.org/professional/ to look into it and make the fix

If the patch is generic, would be great to submit to core so that other folks can benefit

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

wsta

  • I’m new here
  • *
  • Posts: 3
  • Karma: 2
Re: Renewal emails on reminder_date AND end_date
January 30, 2010, 03:49:13 pm
I modified the UpdateMembershipRecord.php (script which when run by a cron job or triggered manually sends renewal notices) with code to support multiple reminders - below is a link to the other topic

http://forum.civicrm.org/index.php/topic,6176.msg51193.html#msg51193

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Renewal emails on reminder_date AND end_date

This forum was archived on 2017-11-26.