Index: ec_recurring.alloc.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ec_recurring/ec_recurring.alloc.inc,v
retrieving revision 1.6
diff -u -r1.6 ec_recurring.alloc.inc
--- ec_recurring.alloc.inc	7 Jun 2009 13:24:03 -0000	1.6
+++ ec_recurring.alloc.inc	10 Jan 2010 19:30:19 -0000
@@ -9,29 +9,43 @@
  * Implementation of hook_alloc_get_recurring().
  */
 function ec_recurring_alloc_get_recurring($txn) {
-  if (isset($txn->recurring) && $txn->recurring) {
-    if ($recurring_products = array_filter($txn->items, 'ec_recurring_filter_recurring_products')) {
-      module_load_include('inc', 'ec_recurring');
-      
-      // Only use the first recurring product as there should only ever be one recurring product in
-      // in a transaction.
-      $item = reset($recurring_products);
-      
-      $recurring = array(
+////// my additions
+  if( ($txn->type=='donation') && ($txn->schedule >0) ) { // this is a donation transaction
+    module_load_include('inc', 'ec_recurring');
+    $recurring = array(
+        'name' => $txn->schedule['name'],
+        'start_date' => _ec_recurring_expiry_calc($txn->schedule),
+        'price' => $txn->gross,
+        'period' => $txn->schedule['numunits'],
+        'unit' => $txn->schedule['unit'],
+        'repeat' => $txn->schedule['cycles'],
+        'description' => 'Donation of ' .$txn->gross. ' recurring every ' .$txn->schedule['numunits']. ' ' .$txn->schedule['unit'],
+    );
+    return $recurring;
+  }
+  //////
+
+  if ($recurring_products = array_filter($txn->items, 'ec_recurring_filter_recurring_products')) {
+    module_load_include('inc', 'ec_recurring');
+
+    // Only use the first recurring product as there should only ever be one recurring product in
+    // in a transaction.
+    $item = reset($recurring_products);
+
+    $recurring = array(
         'id' => $item->nid,
         'start_date' => _ec_recurring_expiry_calc($item->schedule),
         'price' => $txn->recurring['price'],
         'period' => $item->schedule['numunits'],
         'unit' => $item->schedule['unit'],
         'description' => theme('recurring_schedule', $item->schedule),
-      );
-      
-      if ($item->schedule['cycles'] >= 1) {
-        $recurring['repeat'] = $item->schedule['cycles'];
-      }
-      
-      return $recurring;
+    );
+
+    if ($item->schedule['cycles'] >= 1) {
+      $recurring['repeat'] = $item->schedule['cycles'];
     }
+
+    return $recurring;
   }
 }
 
@@ -40,19 +54,19 @@
  */
 function ec_recurring_alloc_update_recurring_payment($txn, $receipt) {
   if ($recurring_products = array_filter($txn->items, 'ec_recurring_filter_recurring_products')) {
-    // Only use the first recurring product as there should only ever be one recurring product in
-    // in a transaction.
+  // Only use the first recurring product as there should only ever be one recurring product in
+  // in a transaction.
     $item = reset($recurring_products);
-    
+
     $params = array(
-      'ecid' => isset($txn->ecid) ? $txn->ecid : $txn->customer->ecid,
-      'items' => array($item->nid => $item),
+        'ecid' => isset($txn->ecid) ? $txn->ecid : $txn->customer->ecid,
+        'items' => array($item->nid => $item),
     );
-    
+
     if ($recurring_txn = ec_checkout_create_transaction('ec_recurring', $params)) {
       $alloc[] = array(
-        'type' => 'transaction',
-        'id' => $recurring_txn->txnid,
+          'type' => 'transaction',
+          'id' => $recurring_txn->txnid,
       );
       ec_receipt_allocate($receipt, $alloc);
     }
