Index: lm_paypal_subscriptions.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/lm_paypal/lm_paypal_subscriptions.module,v
retrieving revision 1.30
diff -c -r1.30 lm_paypal_subscriptions.module
*** lm_paypal_subscriptions.module	27 Feb 2007 15:42:08 -0000	1.30
--- lm_paypal_subscriptions.module	4 May 2007 10:35:25 -0000
***************
*** 1783,1793 ****
--- 1783,1797 ----
      $sql = "SELECT * FROM {lm_paypal_subscribers} WHERE subscr_id = '%s'";
      $subs = db_query($sql, $ipn->subscr_id);
      if (db_num_rows($subs) <= 0) {
+ // Try and track problem maybe caused by multiple subscr_signups
+ watchdog(LM_PAYPAL_SUBSCRIPTIONS, t('new subscr_signup subscr_id %sid', array('%sid' => $ipn->subscr_id)));
        // Not already present. 
        // Create an entry in the subscribers table.
        lm_paypal_add_subscriber($so->kind, $uid, $other, $subid, $ipn->subscr_id, LM_PAYPAL_SUBSCRIPTIONS_STATUS_SIGNEDUP);
      }
      else {
+ // Try and track problem maybe caused by multiple subscr_signups
+ watchdog(LM_PAYPAL_SUBSCRIPTIONS, t('repeat subscr_signup subscr_id %sid', array('%sid' => $ipn->subscr_id)));
        // It is already present
        $ss = db_fetch_object($subs);
        if (!$ss) {
***************
*** 1809,1815 ****
--- 1813,1828 ----
            watchdog(LM_PAYPAL_SUBSCRIPTIONS, t('Attempt to signup to ended subscription, ignored %status', array('%status' => $ss->status)), WATCHDOG_ERROR, $link);
            return;
  
+         // Some users are reporting symptoms that suggest multiple
+         // subscr_signup's are arriving. Ignore the duplicates here.
+         case LM_PAYPAL_SUBSCRIPTIONS_STATUS_LIVE:
+         case LM_PAYPAL_SUBSCRIPTIONS_STATUS_SIGNEDUP:
+           watchdog(LM_PAYPAL_SUBSCRIPTIONS, t('Signup received but subscription  live or signedup, ignoring'), WATCHDOG_ERROR, $link);
+           return;
+ 
+         // A payment arrived first. Now obey the signup
          case LM_PAYPAL_SUBSCRIPTIONS_STATUS_PAID:
+           watchdog(LM_PAYPAL_SUBSCRIPTIONS, t('Signup received after payment'));
            break;
        }
      }
