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 CiviContribute (Moderator: Donald Lobo) »
  • CiviPledge payment import can't process overdue payments
Pages: [1]

Author Topic: CiviPledge payment import can't process overdue payments  (Read 1275 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
CiviPledge payment import can't process overdue payments
May 04, 2009, 05:12:20 pm
CiviPledge can't process overdue payments. On the contact/view...pledge screen the overdue payments can't be viewed or edited. On contribute/import the overdue pledge payments fail to be imported.

This is very restrictive on work practices. Our accounting is always a few weeks behind, because we rely on a volunteer who comes in once a week.

Why is this restriction in place? If I change my code from "process pending" to "process pending or overdue" is there any problem with that?

Ken
« Last Edit: May 07, 2009, 05:11:53 pm by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviPledge payment import can't process overdue payments
May 05, 2009, 06:57:27 pm
It turns out I had 2 problems:
 - the value for the "Overdue" contribution status in the option-value table had a NULL name.
 - the contribution import logic excludes "Overdue" payments

When I set the "name" field in the "Overdue" contribution status in the option-value table to "Overdue", I was able to edit etc the overdue payments on the pledge screens. Is this a problem in the upgrade scripts, or am I the only victim?

To fix the contribution import logic to process "Overdue" payments, I made changes to CRM/Pledge/BAO/Payment.php and CRM/Pledge/BAO/Pledge.php. The changed code is only invoked during the contribution import, so it's quite safe.

Code: [Select]
--- administrator/components/com_civicrm/civicrm/CRM/Pledge/BAO/Payment.php 2009-03-14 18:52:17.000000000 +1100
+++ local/php/CRM/Pledge/BAO/Payment.php 2009-05-05 16:19:13.000000000 +1000
@@ -402,14 +402,19 @@
      */
     static function getOldestPledgePayment( $pledgeID )
     {
-        //get pending status
-        $pendingStatusID = CRM_Core_OptionGroup::getValue( 'contribution_status', 'Pending', 'name' ); 
+        $pledgeStatuses = CRM_Core_OptionGroup::values( 'contribution_status');
+
+        //get pending and overdue payments
+        $status[] = array_search( 'Pending', $pledgeStatuses );
+        $status[] = array_search( 'Overdue', $pledgeStatuses ); // <KW: import for Overdue pledges/>
+
+        $statusClause = " IN (" . implode( ',', $status ) . ")";   
         
         $query = "
 SELECT civicrm_pledge_payment.id id, civicrm_pledge_payment.scheduled_amount amount
 FROM civicrm_pledge, civicrm_pledge_payment
 WHERE civicrm_pledge.id = civicrm_pledge_payment.pledge_id
-  AND civicrm_pledge_payment.status_id = {$pendingStatusID}       
+  AND civicrm_pledge_payment.status_id {$statusClause}
   AND civicrm_pledge.id = %1
 ORDER BY civicrm_pledge_payment.scheduled_date ASC
 LIMIT 0, 1 

Code: [Select]
--- administrator/components/com_civicrm/civicrm/CRM/Pledge/BAO/Pledge.php 2009-03-14 18:52:17.000000000 +1100
+++ local/php/CRM/Pledge/BAO/Pledge.php 2009-05-05 15:53:48.000000000 +1000
@@ -658,6 +658,7 @@
         //get pending and in progress status
         $status[] = array_search( 'Pending', $pledgeStatuses );
         $status[] = array_search( 'In Progress', $pledgeStatuses );
+        $status[] = array_search( 'Overdue', $pledgeStatuses ); // <KW: import for Overdue pledges/>
 
         $statusClause = " IN (" . implode( ',', $status ) .")";   
 
« Last Edit: May 07, 2009, 05:14:10 pm by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviPledge payment import can't process overdue payments
May 07, 2009, 05:11:02 pm
Regarding the NULL "name" field in the "Overdue" contribution status in the option-value table: I reviewed the upgrade scripts, and they set the name to "Overdue", so I'm not sure why mine was NULL.
« Last Edit: May 07, 2009, 05:14:32 pm by ken »

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviPledge payment import can't process overdue payments
May 07, 2009, 08:27:49 pm
For tracking purpose: http://issues.civicrm.org/jira/browse/CRM-4466

thanx for the patch.

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • CiviPledge payment import can't process overdue payments

This forum was archived on 2017-11-26.