From aa1cd1419b2b75e62ab9b2c22f2c3b399f5bfcc8 Mon Sep 17 00:00:00 2001
From: Jamie McClelland <jm@mayfirst.org>
Date: Tue, 16 Oct 2018 12:09:48 -0400
Subject: [PATCH] invoice_id cannot be counted on

It is not installed on new installations and should probably
be dropped in a future version (perhaps when we drop the email
column from civicrm_stripe_customers)
---
 api/v3/StripeCustomer.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/v3/StripeCustomer.php b/api/v3/StripeCustomer.php
index bb227c9b..c4f9219c 100644
--- a/api/v3/StripeCustomer.php
+++ b/api/v3/StripeCustomer.php
@@ -115,7 +115,7 @@ function civicrm_api3_stripe_customer_updatecontactids($params) {
         $sql = "SELECT c.id
           FROM civicrm_contribution_recur rc
             JOIN civicrm_stripe_subscriptions sc ON
-              ( rc.id = sc.contribution_recur_id OR rc.invoice_id = sc.invoice_id)
+              rc.id = sc.contribution_recur_id
             JOIN civicrm_contact c ON c.id = rc.contact_id
           WHERE c.is_deleted = 0 AND customer_id = %0
           ORDER BY start_date DESC LIMIT 1";
-- 
GitLab