Index: uc_recurring.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_recurring/uc_recurring.admin.inc,v
retrieving revision 1.1.4.3
diff -w -r1.1.4.3 uc_recurring.admin.inc
10c10,12
< // Displays a table for the administration of recurring fees.
---
> /**
>  * Displays a table for the administration of recurring fees.
>  */
46a49
> 
73c76,78
< // Filter by a specific order ID.
---
> /**
>  * Filter by a specific order ID.
>  */
107c112,115
< // Confirm a recurring fee charge.
---
> 
> /**
>  * Confirm a recurring fee charge.
>  */
142c150,153
< // Let an admin edit a recurring fee.
---
> 
> /**
>  * Let an admin edit a recurring fee.
>  */
221c232,235
< // Confirm a recurring fee deletion.
---
> 
> /**
>  * Confirm a recurring fee deletion.
>  */
238d251
< 
Index: uc_recurring.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_recurring/uc_recurring.module,v
retrieving revision 1.1.4.17
diff -w -r1.1.4.17 uc_recurring.module
2c2
< // $Id: uc_recurring.module,v 1.1.4.17 2009/06/22 01:35:35 univate Exp $
---
> // $Id: uc_recurring.module,v 1.1.4.16 2009/06/19 23:28:55 univate Exp $
42a43
>     'file' => 'uc_recurring.pages.inc',
153a155,166
>  * Implements hook_theme()
>  */
> function uc_recurring_theme() {
>   return array(
>     'uc_recurring_user_table' => array(
>       'arguments' => array($uid => NULL),
>       'file' => 'uc_recurring.pages.inc',
>     ),
>   );
> }
> 
> /**
272,273c285
<     $order_id = uc_recurring_renew($fee);
<     if ($order_id) {
---
>     if (uc_recurring_renew($fee)) {
275,276d286
<       // update the status which will invoke any hooks that respond to completed status
<       uc_order_update_status($new_id, 'completed');
345c355,358
<     module_invoke_all('recurring_renew', $new_order, $fee);
---
>     foreach (module_implements('recurring_renew_alter') as $module) {
>       $function = $module .'_recurring_renew_alter';
>       $function($new_order, $fee);
>     }
398a412,413
>       // update the status which will invoke any hooks that respond to completed status
>       uc_order_update_status($new_id, 'completed');
466,471c481
< /**
<  * Display users recurrings fees
<  */
< function uc_recurring_user_fees($user) {
<   return theme('uc_recurring_user_table', $user->uid);
< }
---
> 
482c492
<     case 'submit':
---
>     case 'approved':
486a497
> 
590c601,603
< // Builds the form to display for adding or editing a recurring fee.
---
> /**
>  * Builds the form to display for adding or editing a recurring fee.
>  */
786c799,802
< // Adds the settings for the recurring module on the feature settings form.
---
> 
> /**
>  * Adds the settings for the recurring module on the feature settings form.
>  */
867,877d882
< /**
<  * Implements hook_theme() 
<  */
< function uc_recurring_theme() {
<   return array(
<     'uc_recurring_user_table' => array(
<       'arguments' => array($uid => NULL),
<     ),
<   );
< }
< 
879,920d883
< // Displays a table for users to administer their recurring fees.
< function theme_uc_recurring_user_table($uid) {
<   $rows = array();
<   $output = '';
< 
<   // Set up a header array for the table.
<   $header = array(t('Order'), t('Amount'), t('Interval'), t('Next charge'), t('Remaining'), t('Operations'));
< 
<   $context = array(
<     'revision' => 'themed-original',
<     'location' => 'recurring-user-table',
<   );
< 
<   // Loop through the fees sorted by the order ID descending.
<   $result = db_query("SELECT * FROM {uc_recurring_users} WHERE uid = %d AND (remaining_intervals > 0 OR remaining_intervals IS NULL) ORDER BY order_id DESC", $uid);
<   while ($fee = db_fetch_array($result)) {
<     $ops = array();
< 
<     // Get the $ops from the module implementing the handler.
<     $callback = 'uc_recurring_'. $fee['fee_handler'] .'_fee_ops';
<     if (function_exists($callback)) {
<       $ops = $callback('user', $fee);
<     }
< 
<     // Add the row to the table for display.
<     $rows[] = array(
<       l($fee['order_id'], 'user/'. $uid .'/order/'. $fee['order_id']),
<       uc_price($fee['fee_amount'], $context),
<       array('data' => check_plain($fee['regular_interval']), 'nowrap' => 'nowrap'),
<       format_date($fee['next_charge'], 'small'),
<       $fee['remaining_intervals'] === NULL ? t('till cancelled') : $fee['remaining_intervals'],
<       array('data' => implode(' ', $ops), 'nowrap' => 'nowrap'),
<     );
<   }
< 
<   // Only display the table if fees were found.
<   if (count($rows) > 0) {
<     $output = theme('table', $header, $rows);
<   }
< 
<   return $output;
< }
968a932
> 
992,993d955
< 
<       if ($fee['fee_handler'] == 'uc_recurring') {
995a958
>       if ($fee['fee_handler'] == 'uc_recurring') {
1012a976
> 
1032a997
> 
1042a1008
> 
1069c1035
<                       WHERE rp.model IN ('". implode("', '", $models) ."') OR (rp.model = '' AND pf.nid IN ('". implode("', '", $nids) ."'))");
---
>                       WHERE pf.fid='recurring' AND (rp.model IN ('". implode("', '", $models) ."') OR (rp.model = '' AND pf.nid IN ('". implode("', '", $nids) ."')))");
1083a1050
> 
1101c1068,1071
<   if ($handler($order, $fee) == TRUE) {
---
>   if ($result = $handler($order, $fee)) {
>     if (is_array($result) && count($result)) {
>       $fee->data = array_merge($result, (array)$fee->data);
>     }
1124c1094,1099
<     uc_order_comment_save($order->order_id, 0, t('Recurring fee <a href="!url">!fee</a> added to order.', array('!url' => url('admin/store/orders/recurring/view/fee/'. $user_fee['rfid']), '!fee' => $user_fee['rfid'])));
---
>     if ($fee->data['order_comment_extra']) {
>       $comment_extra = $fee->data['order_comment_extra'];
>       unset($fee->data['order_comment_extra']);
>     }
> 
>     uc_order_comment_save($order->order_id, 0, t('Recurring fee <a href="!url">!fee</a> added to order. !extra', array('!url' => url('admin/store/orders/recurring/view/fee/'. $user_fee['rfid']), '!fee' => $user_fee['rfid'], '!extra' => $comment_extra)));
Index: uc_recurring.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_recurring/uc_recurring.pages.inc,v
retrieving revision 1.1.4.1
diff -w -r1.1.4.1 uc_recurring.pages.inc
10c10,20
< // Displays the confirm form for cancelling a recurring fee.
---
> /**
>  * Display users recurrings fees
>  */
> function uc_recurring_user_fees($user) {
>   return theme('uc_recurring_user_table', $user->uid);
> }
> 
> 
> /**
>  * Displays the confirm form for cancelling a recurring fee.
>  */
32a43,88
> 
> 
> /**
>  * Displays a table for users to administer their recurring fees.
>  */
> function theme_uc_recurring_user_table($uid) {
>   $rows = array();
>   $output = '';
> 
>   // Set up a header array for the table.
>   $header = array(t('Order'), t('Amount'), t('Interval'), t('Next charge'), t('Remaining'), t('Operations'));
> 
>   $context = array(
>     'revision' => 'themed-original',
>     'location' => 'recurring-user-table',
>   );
> 
>   // Loop through the fees sorted by the order ID descending.
>   $result = db_query("SELECT * FROM {uc_recurring_users} WHERE uid = %d AND (remaining_intervals > 0 OR remaining_intervals IS NULL) ORDER BY order_id DESC", $uid);
>   while ($fee = db_fetch_array($result)) {
>     $ops = array();
> 
>     // Get the $ops from the module implementing the handler.
>     $callback = 'uc_recurring_'. $fee['fee_handler'] .'_fee_ops';
>     if (function_exists($callback)) {
>       $ops = $callback('user', $fee);
>     }
> 
>     // Add the row to the table for display.
>     $rows[] = array(
>       l($fee['order_id'], 'user/'. $uid .'/order/'. $fee['order_id']),
>       uc_price($fee['fee_amount'], $context),
>       array('data' => check_plain($fee['regular_interval']), 'nowrap' => 'nowrap'),
>       format_date($fee['next_charge'], 'small'),
>       $fee['remaining_intervals'] === NULL ? t('till cancelled') : $fee['remaining_intervals'],
>       array('data' => implode(' ', $ops), 'nowrap' => 'nowrap'),
>     );
>   }
> 
>   // Only display the table if fees were found.
>   if (count($rows) > 0) {
>     $output = theme('table', $header, $rows);
>   }
> 
>   return $output;
> }
