Index: modules/uc_recurring_order/uc_recurring_order.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_recurring/modules/uc_recurring_order/Attic/uc_recurring_order.module,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 uc_recurring_order.module
--- modules/uc_recurring_order/uc_recurring_order.module	11 Jul 2010 16:14:22 -0000	1.1.2.5
+++ modules/uc_recurring_order/uc_recurring_order.module	16 Jul 2010 16:38:19 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: uc_recurring_order.module,v 1.1.2.5 2010/07/11 16:14:22 univate Exp $
+// $Id: uc_recurring_order.module,v 1.1.2.2 2010/04/28 02:00:19 univate Exp $
 
 /**
  * @file
@@ -30,12 +30,33 @@ function uc_recurring_order_menu() {
  */
 function uc_recurring_order_settings_form($form_state) {
   drupal_set_title(t('Recurring Order Settings'));
-  $intervals = _uc_recurring_order_recurring_options();
+  $intoptions = _uc_recurring_order_recurring_options();
+  $form['pane_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Pane Text Settings'),
+    '#collapsible' => TRUE,
+  );
+  $form['pane_settings']['uc_recurring_order_pane_description'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Checkout pane message'),
+    '#default_value' => t(variable_get('uc_recurring_pane_description', 'Select to have this order automatically repeat,')),
+  );
+  $form['pane_settings']['uc_recurring_order_pane_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Checkout and Review Pane Title'),
+    '#default_value' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
+  );
+  $form['pane_settings']['uc_recurring_order_pane_empty'] = array(
+    '#type' => 'textarea',
+    '#title' => t('No Recurring Order Text'),
+    '#description' => t('Text to display on the order review page if customer has not signed up for a recurring order.'),
+    '#default_value' => t(variable_get('uc_recurring_order_pane_empty', 'This order will not repeat.')),
+  );
   $form['interval_options'] = array(
     '#type' => 'select',
     '#multiple' => TRUE,
-    '#options' => $intervals,
-    '#default_value' => array_keys(variable_get('uc_recurring_order_interval_options', $intervals)),
+    '#options' => $intoptions,
+    '#default_value' => variable_get('uc_recurring_order_interval_options', $intoptions),
     '#title' => t('Available Recurring Interval Options'),
   );
 
@@ -49,12 +70,16 @@ function uc_recurring_order_settings_for
 
 function uc_recurring_order_settings_form_submit($form, &$form_state) {
   $intervals = array();
-  foreach ($form_state['values']['interval_options'] as $option) {
-    $intervals[$option] = $form['interval_options']['#options'][$option];
+  foreach ($form_state['values']['interval_options'] as $int => $option) {
+    $intervals[check_plain($option)] = check_plain($option);
   }
   variable_set('uc_recurring_order_interval_options', $intervals);
+  variable_set('uc_recurring_pane_description', check_plain($form_state['values']['uc_recurring_order_pane_description']));
+  variable_set('uc_recurring_order_pane_title', check_plain($form_state['values']['uc_recurring_order_pane_title']));
+  variable_set('uc_recurring_order_pane_empty', check_plain($form_state['values']['uc_recurring_order_pane_empty']));
 }
 
+
 /**
  * Implementation of hook_cart_pane().
  */
@@ -74,16 +99,18 @@ function uc_recurring_order_cart_pane($i
  * Cart pane recurring form.
  */
 function uc_recurring_order_pane_cart($form_state) {
+  $options = array();
   $intervals = variable_get('uc_recurring_order_interval_options', _uc_recurring_order_recurring_options());
-  if (empty($intervals)) {
-    return;
+  $values = _uc_recurring_order_recurring_options();
+  foreach ($intervals as $int => $option) {
+    $options[$option] = $values[$option];
   }
 
   $form['recurring_option'] = array(
     '#type' => 'select',
-    '#title' => t('Recurring Order'),
-    '#description' => t('Select to have this order automatically repeat,'),
-    '#options' => $intervals,
+    '#title' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
+    '#description' => t(variable_get('uc_recurring_pane_description', 'Select to have this order automatically repeat,')),
+    '#options' => $options,
     '#default_value' => $_SESSION['recurring_option'],
   );
   $form['apply'] = array(
@@ -96,7 +123,7 @@ function uc_recurring_order_pane_cart($f
 function uc_recurring_order_pane_cart_submit($form, &$form_state) {
   if ($form_state['values']['recurring_option']) {
     $recurring_options = _uc_recurring_order_recurring_options();
-    $recurring_option = $form_state['values']['recurring_option'];
+    $recurring_option = check_plain($form_state['values']['recurring_option']);
     $next_renewal = strtotime('+'. $recurring_option);
     if ($next_renewal > 0) {
       $_SESSION['recurring_option'] = $recurring_option;
@@ -131,7 +158,7 @@ function uc_recurring_order_checkout_pan
   $panes[] = array(
     'id' => 'recurring',
     'callback' => 'uc_recurring_order_pane_checkout',
-    'title' => t('Recurring Order'),
+    'title' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
     'desc' => t("Allows shoppers to select to have their order automatically re-occur."),
     'weight' => 5,
     'process' => TRUE,
@@ -148,10 +175,13 @@ function uc_recurring_order_checkout_pan
 function uc_recurring_order_pane_checkout($op, &$arg1, $arg2) {
   switch ($op) {
     case 'view':
+      $options = array();
       $intervals = variable_get('uc_recurring_order_interval_options', _uc_recurring_order_recurring_options());
-      if (empty($intervals)) {
-        return;
+      $values = _uc_recurring_order_recurring_options();
+      foreach ($intervals as $int => $option) {
+        $options[$option] = $values[$option];
       }
+
       // Use recurring order info from cart pane if available.
       if ($_SESSION['recurring_option']) {
         $recurring = $_SESSION['recurring_option'];
@@ -161,28 +191,26 @@ function uc_recurring_order_pane_checkou
         $recurring = $arg1->data['recurring_option'];
       }
 
-      $description = t('Select to have this order automatically repeat.');
+      $description = t(variable_get('uc_recurring_pane_description', 'Would you like to have this order automatically shipped to your home or office?'));
       $contents['recurring_option'] = array(
         '#type' => 'select',
-        '#title' => t('Recurring Order'),
+        '#title' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
         '#default_value' => $recurring,
-        '#options' => $intervals,
+        '#options' => $options,
       );
       return array('description' => $description, 'contents' => $contents);
 
     case 'process':
       // Can't renew orders that include product with recurring payments.
-      if (module_exists('uc_recurring_product')) {
-        if (($products = uc_recurring_product_get_recurring_products_in_order($order))) {
-          unset($_SESSION['uc_recurring_order']);
-          drupal_set_message(t('Unable to create recurring order when it contains recurring products'), 'warning');
-          return FALSE;
-        }
+      if (($products = uc_recurring_get_recurring_products_in_order($order))) {
+        unset($_SESSION['uc_recurring_order']);
+        drupal_set_message(t('Unable to create recurring order when it contains recurring products'), 'warning');
+        return FALSE;
       }
 
       if ($arg2['recurring_option'] !== '0 months') {
         $recurring_options = _uc_recurring_order_recurring_options();
-        $recurring = $arg2['recurring_option'];
+        $recurring = check_plain($arg2['recurring_option']);
         $next_renewal = strtotime('+'. $recurring);
         if ($next_renewal > 0) {
           $arg1->data['recurring_option'] = $recurring;
@@ -197,11 +225,17 @@ function uc_recurring_order_pane_checkou
       if ($arg1->data['recurring_option']) {
         $next_renewal = strtotime('+'. $arg1->data['recurring_option']);
         $review[] = array(
-          'title' => t('Recurring Order'),
+          'title' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
           'data' => t('Your next order after this will occur on @next.', array('@recurring' => $arg1->data['recurring_option'], '@next' => format_date($next_renewal, 'short')))
         );
       }
-      return $review;
+      else {
+        $review[] = array(
+          'title' => t(variable_get('uc_recurring_order_pane_title', 'Recurring Order')),
+          'data' => t(variable_get('uc_recurring_order_pane_empty', 'This order will not repeat.'))
+        );
+      }
+     return $review;
   }
 }
 
@@ -212,12 +246,7 @@ function uc_recurring_order_order($op, &
   switch ($op) {
     // TODO: Allow admin to create a recurring order from "create order" page.
     case 'submit':
-      if (!isset($arg1->data['recurring_option'])) {
-        $recurring = $arg1->data['recurring_option'];
-      }
-      else {
-        $recurring = $_SESSION['recurring_option'];
-      }
+      $recurring = $arg1->data['recurring_option'];
       $next_renewal = strtotime('+'. $recurring);
       if ($next_renewal > time() && variable_get('uc_recurring_checkout_process', TRUE)) {
         if (uc_recurring_order_process_order($arg1, $recurring) === FALSE) {
