Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/README.txt,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 README.txt
--- README.txt	25 May 2008 14:06:48 -0000	1.1.2.1
+++ README.txt	25 May 2008 20:45:26 -0000
@@ -20,4 +20,4 @@
        admin/build/modules
    
 2. Settings - be sure you configure the payment engine first
-	   admin/settings/role_subscription
+     admin/settings/role_subscription
Index: role_subscription.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription.install,v
retrieving revision 1.1
diff -u -r1.1 role_subscription.install
--- role_subscription.install	24 May 2008 23:54:09 -0000	1.1
+++ role_subscription.install	25 May 2008 20:45:20 -0000
@@ -13,76 +13,76 @@
  * @todo, someone can implement pgsql support here if they want to
  */
 function role_subscription_install() {
-	switch($GLOBALS['db_type']) {
-		case 'mysql':// Use same as mysqli
-		case 'mysqli':
-		  db_query("
-			CREATE TABLE {role_subscription} (
-			  `id` int(11) NOT NULL auto_increment,
-			  `title` varchar(255) collate latin1_general_ci NOT NULL,
-			  `rid` int(11) NOT NULL,
-			  `role_subscription_group_id` int(11) NOT NULL,
-			  `price` decimal(10,2) NOT NULL,
-			  `trial_amount` decimal(10,2) default NULL,
-			  `total_occurrences` int(11) default NULL,
-			  `trial_occurrences` int(11) default NULL,
-			  `description` mediumtext collate latin1_general_ci NOT NULL,
-			  `weight` int(11) NOT NULL default '0',
-			  `status` enum('active','cancelled','inactive') collate latin1_general_ci NOT NULL,
-			  `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
-			  PRIMARY KEY  (`id`),
-			  KEY `title` (`title`),
-			  KEY `rid` (`rid`),
-			  KEY `price` (`price`),
-			  KEY `trial_amount` (`trial_amount`),
-			  KEY `total_occurrences` (`total_occurrences`),
-			  KEY `trial_occurrences` (`trial_occurrences`),
-			  KEY `created_at` (`created_at`),
-			  KEY `role_subscription_group_id` (`role_subscription_group_id`),
-			  KEY `weight` (`weight`),
-			  KEY `status` (`status`)
-			) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
-			
-		  db_query("
-			CREATE TABLE {role_subscription_group} (
-			  `id` int(11) NOT NULL auto_increment,
-			  `name` varchar(255) collate latin1_general_ci NOT NULL,
-			  `description` mediumtext collate latin1_general_ci NOT NULL,
-			  `length` int(11) NOT NULL,
-			  `unit` enum('days','months') collate latin1_general_ci NOT NULL,
-			  `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
-			  PRIMARY KEY  (`id`),
-			  KEY `name` (`name`),
-			  KEY `length` (`length`),
-			  KEY `unit` (`unit`),
-			  KEY `created_at` (`created_at`)
-			) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
-			
-		  db_query("
-			CREATE TABLE {role_subscription_user_payments} (
-			  `id` int(11) NOT NULL auto_increment,
-			  `role_subscription_id` int(11) NOT NULL,
-			  `uid` int(11) NOT NULL,
-			  `first_name` varchar(255) collate latin1_general_ci NOT NULL,
-			  `last_name` varchar(255) collate latin1_general_ci NOT NULL,
-			  `phone` varchar(255) collate latin1_general_ci NOT NULL,
-			  `invoice_id` bigint(18) NOT NULL,
-			  `merchant_id` varchar(255) collate latin1_general_ci NOT NULL,
-			  `status` enum('active','suspended','cancelled') collate latin1_general_ci NOT NULL,
-			  `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
-			  PRIMARY KEY  (`id`),
-			  KEY `role_subscription_id` (`role_subscription_id`),
-			  KEY `first_name` (`first_name`),
-			  KEY `last_name` (`last_name`),
-			  KEY `phone` (`phone`),
-			  KEY `invoice_id` (`invoice_id`),
-			  KEY `created_at` (`created_at`),
-			  KEY `merchant_id` (`merchant_id`),
-			  KEY `uid` (`uid`),
-			  KEY `status` (`status`)
-			) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
-		break;
-	}
+  switch($GLOBALS['db_type']) {
+    case 'mysql':// Use same as mysqli
+    case 'mysqli':
+      db_query("
+      CREATE TABLE {role_subscription} (
+        `id` int(11) NOT NULL auto_increment,
+        `title` varchar(255) collate latin1_general_ci NOT NULL,
+        `rid` int(11) NOT NULL,
+        `role_subscription_group_id` int(11) NOT NULL,
+        `price` decimal(10,2) NOT NULL,
+        `trial_amount` decimal(10,2) default NULL,
+        `total_occurrences` int(11) default NULL,
+        `trial_occurrences` int(11) default NULL,
+        `description` mediumtext collate latin1_general_ci NOT NULL,
+        `weight` int(11) NOT NULL default '0',
+        `status` enum('active','cancelled','inactive') collate latin1_general_ci NOT NULL,
+        `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
+        PRIMARY KEY  (`id`),
+        KEY `title` (`title`),
+        KEY `rid` (`rid`),
+        KEY `price` (`price`),
+        KEY `trial_amount` (`trial_amount`),
+        KEY `total_occurrences` (`total_occurrences`),
+        KEY `trial_occurrences` (`trial_occurrences`),
+        KEY `created_at` (`created_at`),
+        KEY `role_subscription_group_id` (`role_subscription_group_id`),
+        KEY `weight` (`weight`),
+        KEY `status` (`status`)
+      ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
+      
+      db_query("
+      CREATE TABLE {role_subscription_group} (
+        `id` int(11) NOT NULL auto_increment,
+        `name` varchar(255) collate latin1_general_ci NOT NULL,
+        `description` mediumtext collate latin1_general_ci NOT NULL,
+        `length` int(11) NOT NULL,
+        `unit` enum('days','months') collate latin1_general_ci NOT NULL,
+        `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
+        PRIMARY KEY  (`id`),
+        KEY `name` (`name`),
+        KEY `length` (`length`),
+        KEY `unit` (`unit`),
+        KEY `created_at` (`created_at`)
+      ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
+      
+      db_query("
+      CREATE TABLE {role_subscription_user_payments} (
+        `id` int(11) NOT NULL auto_increment,
+        `role_subscription_id` int(11) NOT NULL,
+        `uid` int(11) NOT NULL,
+        `first_name` varchar(255) collate latin1_general_ci NOT NULL,
+        `last_name` varchar(255) collate latin1_general_ci NOT NULL,
+        `phone` varchar(255) collate latin1_general_ci NOT NULL,
+        `invoice_id` bigint(18) NOT NULL,
+        `merchant_id` varchar(255) collate latin1_general_ci NOT NULL,
+        `status` enum('active','suspended','cancelled') collate latin1_general_ci NOT NULL,
+        `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+        PRIMARY KEY  (`id`),
+        KEY `role_subscription_id` (`role_subscription_id`),
+        KEY `first_name` (`first_name`),
+        KEY `last_name` (`last_name`),
+        KEY `phone` (`phone`),
+        KEY `invoice_id` (`invoice_id`),
+        KEY `created_at` (`created_at`),
+        KEY `merchant_id` (`merchant_id`),
+        KEY `uid` (`uid`),
+        KEY `status` (`status`)
+      ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
+    break;
+  }
 }
 
 /**
@@ -92,7 +92,7 @@
  *  for now this will just drop the tables
  */
 function role_subscription_uninstall() {
-	db_query("DROP TABLE {role_subscription}");
-	db_query("DROP TABLE {role_subscription_group}");
-	db_query("DROP TABLE {role_subscription_user_payments}");
+  db_query("DROP TABLE {role_subscription}");
+  db_query("DROP TABLE {role_subscription_group}");
+  db_query("DROP TABLE {role_subscription_user_payments}");
 }
\ No newline at end of file
Index: role_subscription.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription.module,v
retrieving revision 1.1
diff -u -r1.1 role_subscription.module
--- role_subscription.module	24 May 2008 23:54:09 -0000	1.1
+++ role_subscription.module	25 May 2008 20:45:06 -0000
@@ -21,7 +21,7 @@
  * @return array of permission strings
  */
 function role_subscription_perm() {
-	return array('access role_subscription', 'administer role_subscription');
+  return array('access role_subscription', 'administer role_subscription');
 }
 
 /**
@@ -30,58 +30,63 @@
  * @return array menu items
  */
 function role_subscription_menu($may_cache) {
-	global $user;
-	
-	$items = array();
-	
-	/**
-	 * Public role subscription
-	 */
-	 
-	$items[] = array('path' => 'role_subscription',
-		'title' => variable_get('role_subscription_main_page_title', ''),
-		'description' => variable_get('role_subscription_main_page_title', ''),
-		'callback' => 'role_subscription_subscription_home',
-		'access' => user_access('access role_subscription'),
-		'type' => MENU_NORMAL_ITEM
-    );
-    
-    $items[] = array('path' => 'role_subscription/subscribe',
-		'title' => variable_get('role_subscription_subscribe_title', ''),
-		'description' => variable_get('role_subscription_subscribe_title', ''),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_subscribe'),
-		'access' => user_access('access role_subscription'),
-		'type' => MENU_CALLBACK,
-    );
-    
-    $items[] = array('path' => 'role_subscription/pay',
-		'title' => variable_get('role_subscription_pay_title', ''),
-		'description' => variable_get('role_subscription_pay_title', ''),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_pay'),
-		'access' => user_access('access role_subscription'),
-		'type' => MENU_CALLBACK
-    );
+  global $user;
+  
+  $items = array();
+  
+  /**
+   * Public role subscription
+   */
+   
+  $items[] = array(
+    'path' => 'role_subscription',
+    'title' => variable_get('role_subscription_main_page_title', ''),
+    'description' => variable_get('role_subscription_main_page_title', ''),
+    'callback' => 'role_subscription_subscription_home',
+    'access' => user_access('access role_subscription'),
+    'type' => MENU_NORMAL_ITEM
+  );
     
-    $items[] = array('path' => 'role_subscription/pay/confirm',
-		'title' => 'Confirm Payment',
-		'description' => 'Confirm Payment',
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_pay_confirm'),
-		'access' => user_access('access role_subscription'),
-		'type' => MENU_CALLBACK
-    );
-    
-    $items[] = array('path' => 'role_subscription/pay/complete',
-		'title' => 'Complete Payment',
-		'description' => 'Complete Payment',
-		'callback' => 'role_subscription_pay_complete',
-		'access' => user_access('access role_subscription'),
-		'type' => MENU_CALLBACK
-    );
+  $items[] = array(
+    'path' => 'role_subscription/subscribe',
+    'title' => variable_get('role_subscription_subscribe_title', ''),
+    'description' => variable_get('role_subscription_subscribe_title', ''),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_subscribe'),
+    'access' => user_access('access role_subscription'),
+    'type' => MENU_CALLBACK,
+  );
+  
+  $items[] = array(
+    'path' => 'role_subscription/pay',
+    'title' => variable_get('role_subscription_pay_title', ''),
+    'description' => variable_get('role_subscription_pay_title', ''),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_pay'),
+    'access' => user_access('access role_subscription'),
+    'type' => MENU_CALLBACK,
+  );
+  
+  $items[] = array(
+    'path' => 'role_subscription/pay/confirm',
+    'title' => 'Confirm Payment',
+    'description' => 'Confirm Payment',
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_pay_confirm'),
+    'access' => user_access('access role_subscription'),
+    'type' => MENU_CALLBACK,
+  );
+  
+  $items[] = array(
+    'path' => 'role_subscription/pay/complete',
+    'title' => 'Complete Payment',
+    'description' => 'Complete Payment',
+    'callback' => 'role_subscription_pay_complete',
+    'access' => user_access('access role_subscription'),
+    'type' => MENU_CALLBACK,
+  );
 
-	return $items;
+  return $items;
 }
 
 /**
@@ -91,21 +96,21 @@
  * 
  * @return string themed output of subscription home
  */
-function role_subscription_subscription_home(){
-	global $user;
-	
-	/**
-	 * Fetch role subscriptions
-	 */
-	$data['subscription_groups'] = Role_subscription_db::find_all_in_groups();
-	$data['intro_text'] = variable_get('role_subscription_main_page_text', '');
-	
-	/**
-	 * Get all user subscriptions this user is subscribed to
-	 */
-	$data['user_subscriptions_subscribed'] = User_subscription_db::get_all_user_subscriptions($user->uid);
-	
-	return theme('role_subscription_subscription_home', $data);//theme page which can be overridden
+function role_subscription_subscription_home() {
+  global $user;
+  
+  /**
+   * Fetch role subscriptions
+   */
+  $data['subscription_groups'] = Role_subscription_db::find_all_in_groups();
+  $data['intro_text'] = variable_get('role_subscription_main_page_text', '');
+  
+  /**
+   * Get all user subscriptions this user is subscribed to
+   */
+  $data['user_subscriptions_subscribed'] = User_subscription_db::get_all_user_subscriptions($user->uid);
+  
+  return theme('role_subscription_subscription_home', $data);//theme page which can be overridden
 }
 
 /**
@@ -121,60 +126,64 @@
  * @return array subscribe form
  */
 function role_subscription_subscribe_form($data){
-	
-	$group_options = Role_subscription_form::group_subscription_radio_options();//get group options
-	
-	/**
-	 * No subscriptions found, return empty form
-	 */
-	if (!$group_options) {
-		$form['no_subscriptions'] = array(
-			'#prefix' => '<p>',
-			'#value' => t('Sorry no subscriptions were found.'),
-			'#suffix' => '</p>'
-		);
-		
-		return $form;	
-	}
-	
-	if ($group_options) {
-		foreach ($data['subscription_groups'] as $group_name => $group) {
-			$subscribed = FALSE;//default to false
-			
-			$options = $group_options[$group_name];
-			
-			/**
-			 * Look for intersection of user subscription and subscriptions in this group
-			 */
-			if (is_array($data['user_subscriptions_subscribed']))
-				foreach ($data['user_subscriptions_subscribed'] as $id => $user_subscription)
-					if ($options[$id])
-						$subscribed = $user_subscription;
-			
-			if ($subscribed) {
-				$form[$group_name] = array(
-					'#type' => 'item',
-					'#title' => $group_name,
-					'#value' => 'You are currently subscribed to '.$group_name. ' group, level <strong>'.$subscribed->title.'</strong>. Go to ' .
-								l('My subscriptions', 'role_subscription/my_subscriptions') . ' to view and manage your subscriptions.',
-				);
-			} else {
-				$subscriptions_available = TRUE;//for submit button
-				
-				$form[$group_name]['role_subscription_id'] = array(
-					'#type' => 'radios',
-					'#title' => t($group_name),
-					'#options' => $options,
-					'#DANGEROUS_SKIP_CHECK' => TRUE//so that we can split up subscription groups
-				);
-			}
-		}
-	}
-	
-	if ($subscriptions_available)
-		$form['submit'] = array('#type' => 'submit', '#value' => t('Continue'));
-	
-	return $form;
+  
+  $group_options = Role_subscription_form::group_subscription_radio_options();//get group options
+  
+  /**
+   * No subscriptions found, return empty form
+   */
+  if (!$group_options) {
+    $form['no_subscriptions'] = array(
+      '#prefix' => '<p>',
+      '#value' => t('Sorry no subscriptions were found.'),
+      '#suffix' => '</p>'
+    );
+    
+    return $form;  
+  }
+  
+  if ($group_options) {
+    foreach ($data['subscription_groups'] as $group_name => $group) {
+      $subscribed = FALSE;//default to false
+      
+      $options = $group_options[$group_name];
+      
+      /**
+       * Look for intersection of user subscription and subscriptions in this group
+       */
+      if (is_array($data['user_subscriptions_subscribed'])) {
+        foreach ($data['user_subscriptions_subscribed'] as $id => $user_subscription) {
+          if ($options[$id]) {
+            $subscribed = $user_subscription;
+          }
+        }
+      }
+      
+      if ($subscribed) {
+        $form[$group_name] = array(
+          '#type' => 'item',
+          '#title' => $group_name,
+          '#value' => 'You are currently subscribed to '. $group_name .' group, level <strong>'. $subscribed->title .'</strong>. Go to '.
+                l('My subscriptions', 'role_subscription/my_subscriptions') . ' to view and manage your subscriptions.',
+        );
+      } else {
+        $subscriptions_available = TRUE;//for submit button
+        
+        $form[$group_name]['role_subscription_id'] = array(
+          '#type' => 'radios',
+          '#title' => t($group_name),
+          '#options' => $options,
+          '#DANGEROUS_SKIP_CHECK' => TRUE//so that we can split up subscription groups
+        );
+      }
+    }
+  }
+  
+  if ($subscriptions_available) {
+    $form['submit'] = array('#type' => 'submit', '#value' => t('Continue'));
+  }
+  
+  return $form;
 }
 
 /**
@@ -189,16 +198,17 @@
  */
 function role_subscription_subscribe_form_submit($form_id, $form_values) {
 
-	/**
-	 * Role Subscription
-	 */
-	if (!ctype_digit($form_values['role_subscription_id'])) {
-		form_set_error('role_subscription_id', 'Role Subscription is required to continue.');
-		
-		return FALSE;
-	}
-	else
-		drupal_goto('role_subscription/subscribe/'.$form_values['role_subscription_id']);
+  /**
+   * Role Subscription
+   */
+  if (!ctype_digit($form_values['role_subscription_id'])) {
+    form_set_error('role_subscription_id', 'Role Subscription is required to continue.');
+    
+    return FALSE;
+  }
+  else {
+    drupal_goto('role_subscription/subscribe/'.$form_values['role_subscription_id']);
+  }
 }
 
 /**
@@ -208,44 +218,46 @@
  * 
  * @return array subscribe details form
  */
-function role_subscription_subscribe(){
-	global $user;
-	
-	$id = $data['id'] = arg(2);//get id from url
-	
-	drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription')));
-	
-	/**
-	 * Fetch role subscription
-	 */
-	if (!$sub = Role_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find subscription.');
-		drupal_goto('role_subscription');
-	}
-	
-	$form['terms'] = array(
-		'#type' => 'fieldset',
-		'#collapsible' => TRUE,
-		'#title' => t('Terms for '.$sub->title),
-		'#description' => $sub->description
-	);
-	
-	$form['terms']['subscription_terms'] = array(
-		'#value' => Role_subscription_form::get_subscription_info_html_table($sub),
-	);
-	
-	if ($user->uid)//user is logged in
-		$form['submit'] = array(
-			'#type' => 'submit',
-			'#value' => t('Subscribe to '.$sub->title)
-		);
-	else//anonymous user
-		$form['signup'] = array(
-			 '#value' => l('Create an account','user/register', NULL, 'destination=role_subscription/subscribe/'.$data['id']).' or '.
-						 l('login', 'user', NULL, 'destination=role_subscription/subscribe/'.$data['id']).' to subscribe to <em>'.$sub->title .'</em>.'
-		);
-	
-	return $form;
+function role_subscription_subscribe() {
+  global $user;
+  
+  $id = $data['id'] = arg(2);//get id from url
+  
+  drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription')));
+  
+  /**
+   * Fetch role subscription
+   */
+  if (!$sub = Role_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find subscription.');
+    drupal_goto('role_subscription');
+  }
+  
+  $form['terms'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#title' => t('Terms for '.$sub->title),
+    '#description' => $sub->description,
+  );
+  
+  $form['terms']['subscription_terms'] = array(
+    '#value' => Role_subscription_form::get_subscription_info_html_table($sub),
+  );
+  
+  if ($user->uid) { //user is logged in
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Subscribe to '. $sub->title),
+    );
+  }
+  else { //anonymous user
+    $form['signup'] = array(
+       '#value' => l('Create an account','user/register', NULL, 'destination=role_subscription/subscribe/'.$data['id']).' or '.
+             l('login', 'user', NULL, 'destination=role_subscription/subscribe/'.$data['id']).' to subscribe to <em>'.$sub->title .'</em>.'
+    );
+  }
+  
+  return $form;
 }
 
 /**
@@ -257,21 +269,21 @@
  * @param array $form_values subscribe form values
  * 
  */
-function role_subscription_subscribe_submit($form_id, $form_values){
-	$id = $data['id'] = arg(2);//get id from url
-	
-	/**
-	 * Fetch role subscription
-	 */
-	if (!$sub = Role_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find subscription.');
-		drupal_goto('role_subscription');
-	}
-	
-	/**
-	 * If subscription found go to payment screen
-	 */
-	drupal_goto('role_subscription/pay/'.$id);
+function role_subscription_subscribe_submit($form_id, $form_values) {
+  $id = $data['id'] = arg(2);//get id from url
+  
+  /**
+   * Fetch role subscription
+   */
+  if (!$sub = Role_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find subscription.');
+    drupal_goto('role_subscription');
+  }
+  
+  /**
+   * If subscription found go to payment screen
+   */
+  drupal_goto('role_subscription/pay/'.$id);
 }
 
 /**
@@ -286,25 +298,27 @@
  * @return array payment form data
  */
 function role_subscription_pay(){
-	if (!$id = arg(2)) {//get id from url
-		form_set_error('', 'Unable to find role subscription.');
-		drupal_goto('role_subscription');
-	}
-	
-	drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription'), 
-		l(variable_get('role_subscription_subscribe_title', ''), 'role_subscription/subscribe/'.$id)));
-	
-	/**
-	 * First attempt to get form values from session (if form has already been submitted)
-	 */
-	if (!$form_values = $_SESSION['role_subscription_pay_form']['form_values'])
-		/**
-		 * If dummy mode enabled, auto-populated form data with dummy content
-		 */
-		if (variable_get('role_subscription_demo_mode', ''))
-			$form_values = Role_subscription_form::get_dummy_payment_form_data();
-	
-	return Role_subscription_form::get_payment_form($form_values);
+  if (!$id = arg(2)) {//get id from url
+    form_set_error('', 'Unable to find role subscription.');
+    drupal_goto('role_subscription');
+  }
+  
+  drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription'), 
+    l(variable_get('role_subscription_subscribe_title', ''), 'role_subscription/subscribe/'.$id)));
+  
+  /**
+   * First attempt to get form values from session (if form has already been submitted)
+   */
+  if (!$form_values = $_SESSION['role_subscription_pay_form']['form_values']) {
+    /**
+     * If dummy mode enabled, auto-populated form data with dummy content
+     */
+    if (variable_get('role_subscription_demo_mode', '')) {
+      $form_values = Role_subscription_form::get_dummy_payment_form_data();
+    }
+  }
+  
+  return Role_subscription_form::get_payment_form($form_values);
 }
 
 /**
@@ -319,34 +333,34 @@
  * @return boolean FALSE if error or will redirect if success
  */
 function role_subscription_pay_submit($form_id, $form_values) {
-	
-	if (!_role_subscription_verify_engine()) return FALSE;
-	
-	/**
-	 * Find subscription
-	 */
-	if (!$subscription = Role_subscription_db::find(arg(2))) {
-		form_set_error('', 'Unable to find subscription.');
-		
-		return FALSE;//fail
-	}		
-	
-	/**
-	 * Validate form
-	 */
-	$result = Role_subscription_form::validate_payment_form($form_id, $form_values);
-	
-	if ($result !== FALSE) {//success
-		$_SESSION['role_subscription_pay_form']['form_values'] = $form_values;//store payment data (need encrypted session!)
-		$_SESSION['role_subscription_pay_form']['subscription'] = $subscription;//store subscription
-		
-		drupal_goto('role_subscription/pay/confirm');		
-	}//error
-	else {
-		form_set_error('', 'Unable to process payment. Please contact an administrator.');
-		
-		return FALSE;//fail
-	}
+  
+  if (!_role_subscription_verify_engine()) return FALSE;
+  
+  /**
+   * Find subscription
+   */
+  if (!$subscription = Role_subscription_db::find(arg(2))) {
+    form_set_error('', 'Unable to find subscription.');
+    
+    return FALSE;//fail
+  }    
+  
+  /**
+   * Validate form
+   */
+  $result = Role_subscription_form::validate_payment_form($form_id, $form_values);
+  
+  if ($result !== FALSE) {//success
+    $_SESSION['role_subscription_pay_form']['form_values'] = $form_values;//store payment data (need encrypted session!)
+    $_SESSION['role_subscription_pay_form']['subscription'] = $subscription;//store subscription
+    
+    drupal_goto('role_subscription/pay/confirm');    
+  }//error
+  else {
+    form_set_error('', 'Unable to process payment. Please contact an administrator.');
+    
+    return FALSE;//fail
+  }
 }
 
 /**
@@ -354,63 +368,63 @@
  * 
  * @return array payment form data
  */
-function role_subscription_pay_confirm(){
-	
-	/**
-	 * Check to see if payment form has been completed
-	 */
-	if (!$subscription = $_SESSION['role_subscription_pay_form']['subscription']) {//fail
-		form_set_error('', 'Unable to complete order, please try again. If problem persists please contact an administrator.');
-		drupal_goto('role_subscription');
-	}
-	
-	drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription'), 
-		l(variable_get('role_subscription_subscribe_title', ''), 'role_subscription/subscribe/'.$subscription->id), 
-		l('Payment Screen', 'role_subscription/pay/'.$subscription->id)));
-	
-	
-	$form['subscription_details'] = array(
-		'#type' => 'fieldset',
-		'#collapsible' => TRUE,
-		'#title' => t('Terms and Payment Details for '.$subscription->title),
-		'#description' => $subscription->description
-	);
-	
-	/**
-	 * Create Subscription HTML Table
-	 */
-	$form['subscription_details']['subscription_terms'] = array(
-		'#value' => Role_subscription_form::get_subscription_info_html_table($subscription)
-	);
-	
-	/**
-	 * Create Payment HTML Table
-	 */
-	$payment_info = $_SESSION['role_subscription_pay_form']['form_values'];
-	
-	$rows [] = array('First Name', $payment_info['first_name']);
-	$rows [] = array('Last Name', $payment_info['last_name']);
-	$rows [] = array('Billing Address', $payment_info['address']);
-	$rows [] = array('City', $payment_info['city']);
-	$rows [] = array('State', $payment_info['state']);
-	$rows [] = array('Zip', $payment_info['zip']);
-	$rows [] = array('Phone', $payment_info['phone']);
-	$rows [] = array('Credit Card Number', preg_replace('/^(\d{12})/', 'xxxx-xxxx-xxxx-', $payment_info['cc_number']));
-	$rows [] = array('Expiration Date', $payment_info['expiration_date']);
-	$rows [] = array('CVV Number', 'xxx');
-	
-	$form['subscription_details']['payment'] = array(
-		'#value' => theme('table', array(array('data' => t('Payment Information'), 'colspan' => 2)), $rows)
-	);
-	
-	$form['submit'] = array(
-		'#type' => 'submit',
-		'#value' => 'Complete Subscription Payment'
-	);
-	
-	$form['#redirect'] = 'role_subscription/pay/complete';//redirect user if form is submitted 
-	
-	return $form;
+function role_subscription_pay_confirm() {
+  
+  /**
+   * Check to see if payment form has been completed
+   */
+  if (!$subscription = $_SESSION['role_subscription_pay_form']['subscription']) {//fail
+    form_set_error('', 'Unable to complete order, please try again. If problem persists please contact an administrator.');
+    drupal_goto('role_subscription');
+  }
+  
+  drupal_set_breadcrumb(array(l('Home', ''), l(variable_get('role_subscription_main_page_title', ''), 'role_subscription'), 
+    l(variable_get('role_subscription_subscribe_title', ''), 'role_subscription/subscribe/'.$subscription->id), 
+    l('Payment Screen', 'role_subscription/pay/'.$subscription->id)));
+  
+  
+  $form['subscription_details'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#title' => t('Terms and Payment Details for '.$subscription->title),
+    '#description' => $subscription->description
+  );
+  
+  /**
+   * Create Subscription HTML Table
+   */
+  $form['subscription_details']['subscription_terms'] = array(
+    '#value' => Role_subscription_form::get_subscription_info_html_table($subscription)
+  );
+  
+  /**
+   * Create Payment HTML Table
+   */
+  $payment_info = $_SESSION['role_subscription_pay_form']['form_values'];
+  
+  $rows [] = array('First Name', $payment_info['first_name']);
+  $rows [] = array('Last Name', $payment_info['last_name']);
+  $rows [] = array('Billing Address', $payment_info['address']);
+  $rows [] = array('City', $payment_info['city']);
+  $rows [] = array('State', $payment_info['state']);
+  $rows [] = array('Zip', $payment_info['zip']);
+  $rows [] = array('Phone', $payment_info['phone']);
+  $rows [] = array('Credit Card Number', preg_replace('/^(\d{12})/', 'xxxx-xxxx-xxxx-', $payment_info['cc_number']));
+  $rows [] = array('Expiration Date', $payment_info['expiration_date']);
+  $rows [] = array('CVV Number', 'xxx');
+  
+  $form['subscription_details']['payment'] = array(
+    '#value' => theme('table', array(array('data' => t('Payment Information'), 'colspan' => 2)), $rows)
+  );
+  
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => 'Complete Subscription Payment'
+  );
+  
+  $form['#redirect'] = 'role_subscription/pay/complete';//redirect user if form is submitted 
+  
+  return $form;
 }
 
 /**
@@ -420,50 +434,52 @@
  * If fake payment enabled then 'demo' is stored in the payment database table
  * as the merchant ID. Will redirect regardless with success message or errors.
  */
-function role_subscription_pay_complete(){
-	global $user;
-	
-	if (!_role_subscription_verify_engine()) return FALSE;
-	
-	/**
-	 * Check to see if payment form has been completed
-	 */
-	if (!$_SESSION['role_subscription_pay_form']) {//fail
-		form_set_error('', 'Unable to complete order, please try again. If problem persists please contact an administrator.');
-		drupal_goto('role_subscription');
-	}
-	else {//get data from payment form
-		$form_values = $_SESSION['role_subscription_pay_form']['form_values'];
-		$subscription = $_SESSION['role_subscription_pay_form']['subscription'];
-	} 
-
-	$invoice_id = Role_subscription::generate_invoice_number();//add invoice number for tracking
-	
-	/**
-	 * Fake payment if set in admin config
-	 */
-	if (variable_get('role_subscription_fake_payment', '') == TRUE)
-		$merchant_id = 'demo';//return demo as fake merchant ID; 
-	/**
-	 * Initiate payment through merchant, get merchant id back
-	 */	
-	else
-		$merchant_id = module_invoke($engine, 'new_subscription_payment', $form_values, $subscription, $invoice_id);
-		
-	if ($merchant_id) {//merchant id means success!
-		$result = User_subscription_db::save_payment($form_values, $subscription, $merchant_id, $invoice_id);
-		
-		if ($result) {//success
-			Role_subscription::add_user_role($subscription->role, $user->uid);//add role to user				
-			
-			drupal_set_message(t('Subscription created successfully.'));
-			drupal_goto('role_subscription/my_subscriptions');//go back to role subscription page
-		}
-	}
-	else {
-		form_set_error('', 'Unable to process payment. Please contact an administrator.');
-		drupal_goto('role_subscription');
-	}
+function role_subscription_pay_complete() {
+  global $user;
+  
+  if (!_role_subscription_verify_engine()) return FALSE;
+  
+  /**
+   * Check to see if payment form has been completed
+   */
+  if (!$_SESSION['role_subscription_pay_form']) {//fail
+    form_set_error('', 'Unable to complete order, please try again. If problem persists please contact an administrator.');
+    drupal_goto('role_subscription');
+  }
+  else {//get data from payment form
+    $form_values = $_SESSION['role_subscription_pay_form']['form_values'];
+    $subscription = $_SESSION['role_subscription_pay_form']['subscription'];
+  } 
+
+  $invoice_id = Role_subscription::generate_invoice_number();//add invoice number for tracking
+  
+  /**
+   * Fake payment if set in admin config
+   */
+  if (variable_get('role_subscription_fake_payment', '') == TRUE) {
+    $merchant_id = 'demo';//return demo as fake merchant ID; 
+  }
+  /**
+   * Initiate payment through merchant, get merchant id back
+   */  
+  else {
+    $merchant_id = module_invoke($engine, 'new_subscription_payment', $form_values, $subscription, $invoice_id);
+  }
+  
+  if ($merchant_id) {//merchant id means success!
+    $result = User_subscription_db::save_payment($form_values, $subscription, $merchant_id, $invoice_id);
+    
+    if ($result) {//success
+      Role_subscription::add_user_role($subscription->role, $user->uid);//add role to user        
+      
+      drupal_set_message(t('Subscription created successfully.'));
+      drupal_goto('role_subscription/my_subscriptions');//go back to role subscription page
+    }
+  }
+  else {
+    form_set_error('', 'Unable to process payment. Please contact an administrator.');
+    drupal_goto('role_subscription');
+  }
 }
 
 /**
@@ -476,17 +492,17 @@
  * @return boolean FALSE if failure or will redirect if $redirect_path specified
  */
 function _role_subscription_verify_engine($redirect_path=NULL){
-	/**
-	 * Check to make sure payment engine is configured
-	 */
-	if (!$engine = variable_get('role_subscription_engine', '')) {
-		form_set_error('', 'No payment engine configured for Role Subscription. Please contact an administrator.');
-		
-		if ($redirect_path)
-			drupal_goto($redirect_path);
-		else
-			return FALSE;
-	}
-	else
-		return TRUE;	
+  /**
+   * Check to make sure payment engine is configured
+   */
+  if (!$engine = variable_get('role_subscription_engine', '')) {
+    form_set_error('', 'No payment engine configured for Role Subscription. Please contact an administrator.');
+    
+    if ($redirect_path)
+      drupal_goto($redirect_path);
+    else
+      return FALSE;
+  }
+  else
+    return TRUE;  
 }
\ No newline at end of file
Index: role_subscription.theme
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription.theme,v
retrieving revision 1.1
diff -u -r1.1 role_subscription.theme
--- role_subscription.theme	24 May 2008 23:54:09 -0000	1.1
+++ role_subscription.theme	25 May 2008 20:39:52 -0000
@@ -14,36 +14,37 @@
  * @return string output themed output of admin configure screen
  */
 function theme_role_subscription_admin_configure($form) {
-	$rows = array();
+  $rows = array();
 
-	/**
-	 * Copy engine options in rows for display in table
-	 */
-	foreach ($form as $module => $element) {
-    	if (isset($element['engine']) && is_array($element['engine'])) {
-	  		$rows[] = array(
-	    		drupal_render($form['role_subscription_engine'][$element['id']['#value']]),
-				drupal_render($element['engine']),
-				drupal_render($element['description']),
-				drupal_render($element['configure'])
-	      	);
-	      	
-	      	unset($form[$module]);
-	      	$engines_found = TRUE;
-    	}
-	}
-	/**
-	 * If payment engines found, output configuration form
-	 */
-	if ($engines_found) {
-		$header = array(t('Select'), t('Name'), t('Description'), array('data' => t('Operations'), 'colspan' => 1));
-		$output = theme('table', $header, $rows);
-		$output .= drupal_render($form);
-	}
-	else//no payment engines found
-		$output = '<p>No payment engines for role subscription are enabled. Did you remember to '.l('enable a payment engine','admin/build/modules').'?</p>';
+  /**
+   * Copy engine options in rows for display in table
+   */
+  foreach ($form as $module => $element) {
+    if (isset($element['engine']) && is_array($element['engine'])) {
+      $rows[] = array(
+        drupal_render($form['role_subscription_engine'][$element['id']['#value']]),
+        drupal_render($element['engine']),
+        drupal_render($element['description']),
+        drupal_render($element['configure']),
+      );
+        
+      unset($form[$module]);
+      $engines_found = TRUE;
+    }
+  }
+  /**
+   * If payment engines found, output configuration form
+   */
+  if ($engines_found) {
+    $header = array(t('Select'), t('Name'), t('Description'), array('data' => t('Operations'), 'colspan' => 1));
+    $output = theme('table', $header, $rows);
+    $output .= drupal_render($form);
+  }
+  else { //no payment engines found
+    $output = '<p>No payment engines for role subscription are enabled. Did you remember to '. l('enable a payment engine','admin/build/modules'). '?</p>';
+  }
 
-	return $output;
+  return $output;
 }
 
 /**
@@ -54,14 +55,14 @@
  * @return string output of themed subscribe form
  */
 function theme_role_subscription_subscribe_form($form){
-	/**
-	 * All this does right now is wraps the form in an ID to make it easy to style
-	 */
-	$output .= '<div id="role_subscription_main_subscription_form">';
-	$output .= drupal_render($form);
-	$output .= '</div>';
-	
-	return $output;
+  /**
+   * All this does right now is wraps the form in an ID to make it easy to style
+   */
+  $output .= '<div id="role_subscription_main_subscription_form">';
+  $output .= drupal_render($form);
+  $output .= '</div>';
+  
+  return $output;
 }
 
 /**
@@ -75,21 +76,21 @@
  * @return string output of subscription home
  */
 function theme_role_subscription_subscription_home($data) {
-	
-	/**
-	 * If stylesheet is configured, add it to drupal head
-	 */
-	if ($stylesheet = variable_get('role_subscription_stylesheet', '')){
-		drupal_add_css($stylesheet);	
-	}
-	
-	/**
-	 * Add intro text if set
-	 */
-	if ($data['intro_text'])
-		$output .= '<div id="role_subscription_main_subscription_intro">'.$data['intro_text'].'</div>';
+  
+  /**
+   * If stylesheet is configured, add it to drupal head
+   */
+  if ($stylesheet = variable_get('role_subscription_stylesheet', '')){
+    drupal_add_css($stylesheet);  
+  }
+  
+  /**
+   * Add intro text if set
+   */
+  if ($data['intro_text'])
+    $output .= '<div id="role_subscription_main_subscription_intro">'.$data['intro_text'].'</div>';
 
-	$output .= drupal_get_form('role_subscription_subscribe_form', $data);
-		
-	return $output;
+  $output .= drupal_get_form('role_subscription_subscribe_form', $data);
+    
+  return $output;
 }
Index: includes/role_subscription.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/includes/role_subscription.inc,v
retrieving revision 1.1
diff -u -r1.1 role_subscription.inc
--- includes/role_subscription.inc	24 May 2008 23:54:09 -0000	1.1
+++ includes/role_subscription.inc	25 May 2008 20:46:18 -0000
@@ -10,80 +10,80 @@
  * Common functions for role_subscription module
  */
 class Role_subscription {
-	
-	/**
-	 * Generate 9 digit invoice number with timestamp
-	 * 
-	 * @return string 9 digit invoice number that includes timestamp and 3 digit random number appended
-	 */
-	function generate_invoice_number(){
-		return date('Ymdhis').rand(111,999);
-	}
-	
-	/**
-	 * Add a user role
-	 * 
-	 * @param string $role name of role 
-	 * @param integer $uid user ID
-	 * 
-	 * @todo how do you tell if the user_save function fails? it always returns the user object
-	 * 
-	 * @return object user object
-	 */
-	function add_user_role($role, $uid){
-		/**
-		 * Find role ID for this role name (drupal is picky ab rid in user role list)
-		 */
-		$rid = self::_get_rid_for_role($role);
-		
-		$user = user_load(array('uid' => $uid));
+  
+  /**
+   * Generate 9 digit invoice number with timestamp
+   * 
+   * @return string 9 digit invoice number that includes timestamp and 3 digit random number appended
+   */
+  function generate_invoice_number(){
+    return date('Ymdhis').rand(111,999);
+  }
+  
+  /**
+   * Add a user role
+   * 
+   * @param string $role name of role 
+   * @param integer $uid user ID
+   * 
+   * @todo how do you tell if the user_save function fails? it always returns the user object
+   * 
+   * @return object user object
+   */
+  function add_user_role($role, $uid){
+    /**
+     * Find role ID for this role name (drupal is picky ab rid in user role list)
+     */
+    $rid = self::_get_rid_for_role($role);
+    
+    $user = user_load(array('uid' => $uid));
 
-		$user_roles = $user->roles;
-		
-		if (!in_array($role, $user_roles))//don't add twice
-			$user_roles[$rid]  = $role;
-		
-		return module_invoke('user', 'save', $user, array('roles' => $user_roles));
-	}
-	
-	/**
-	 * Get role ID for this role name
-	 * 
-	 * @param string $role name of role
-	 * @return integer role ID
-	 */
-	function _get_rid_for_role($role){
-		return db_fetch_object(db_query('select rid from {role} where name = "%s"', $role))->rid;
-	}
-	
-	/**
-	 * Remove a user role
-	 * 
-	 * @param string $role name of role 
-	 * @param integer $uid user ID
-	 * 
-	 * @todo how do you know if user_save function fails?
-	 * 
-	 * @return mixed user object or TRUE if no role to remove
-	 */
-	function remove_user_role($role, $uid) {
-		$user = user_load(array('uid' => $uid));
-		$user_roles = $user->roles;
-		
-		/**
-		 * Look for role
-		 */
-		if (in_array($role, $user_roles)) {
-			/**
-			 * Remove role from user list of roles
-			 */
-			foreach ($user_roles as $key => $val)
-				if ($val == $role)//find role
-					unset($user_roles[$key]);//remove from user role array
-					
-			return module_invoke('user', 'save', $user, array('roles' => $user_roles));
-		}
-		else
-			return TRUE;//no role to remove
-	}
+    $user_roles = $user->roles;
+    
+    if (!in_array($role, $user_roles))//don't add twice
+      $user_roles[$rid]  = $role;
+    
+    return module_invoke('user', 'save', $user, array('roles' => $user_roles));
+  }
+  
+  /**
+   * Get role ID for this role name
+   * 
+   * @param string $role name of role
+   * @return integer role ID
+   */
+  function _get_rid_for_role($role){
+    return db_fetch_object(db_query('select rid from {role} where name = "%s"', $role))->rid;
+  }
+  
+  /**
+   * Remove a user role
+   * 
+   * @param string $role name of role 
+   * @param integer $uid user ID
+   * 
+   * @todo how do you know if user_save function fails?
+   * 
+   * @return mixed user object or TRUE if no role to remove
+   */
+  function remove_user_role($role, $uid) {
+    $user = user_load(array('uid' => $uid));
+    $user_roles = $user->roles;
+    
+    /**
+     * Look for role
+     */
+    if (in_array($role, $user_roles)) {
+      /**
+       * Remove role from user list of roles
+       */
+      foreach ($user_roles as $key => $val)
+        if ($val == $role)//find role
+          unset($user_roles[$key]);//remove from user role array
+          
+      return module_invoke('user', 'save', $user, array('roles' => $user_roles));
+    }
+    else
+      return TRUE;//no role to remove
+  }
 }
\ No newline at end of file
Index: includes/role_subscription_db.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/includes/role_subscription_db.inc,v
retrieving revision 1.1
diff -u -r1.1 role_subscription_db.inc
--- includes/role_subscription_db.inc	24 May 2008 23:54:09 -0000	1.1
+++ includes/role_subscription_db.inc	25 May 2008 20:46:12 -0000
@@ -10,282 +10,282 @@
  * Functions for managing subscriptions and subscription groups
  */
 class Role_subscription_db {
-	/**
-	 * Check if a subscription has changed
-	 * 
-	 * @param array $form_values form values for role subscription
-	 * @param integer $id role subscription ID
-	 * @return bool TRUE or FALSE
-	 */
-	function subscription_has_changed($form_values, $id){
-		if (!$id) return FALSE;//no id error
-		if (!$subscription = Role_subscription_db::find($id)) return FALSE;//no record found
-		
-		$record_changed = FALSE;
-		
-		$subscription_cols = array('title', 'price', 'trial_amount', 'total_occurrences',
-								   'trial_occurrences', 'description', 'weight');//cols that will be updated
+  /**
+   * Check if a subscription has changed
+   * 
+   * @param array $form_values form values for role subscription
+   * @param integer $id role subscription ID
+   * @return bool TRUE or FALSE
+   */
+  function subscription_has_changed($form_values, $id){
+    if (!$id) return FALSE;//no id error
+    if (!$subscription = Role_subscription_db::find($id)) return FALSE;//no record found
+    
+    $record_changed = FALSE;
+    
+    $subscription_cols = array('title', 'price', 'trial_amount', 'total_occurrences',
+                   'trial_occurrences', 'description', 'weight');//cols that will be updated
 
-		/**
-		 * Go through each subscription field and compare form values with the db values
-		 * to see if the subscription has changed
-		 */
-		foreach ($subscription_cols as $col)
-			if ($form_values[$col] != $subscription->{$col})
-				$record_changed = TRUE;//if anything gets changed we have to resubmit
-				
-		return $record_changed;
-	}
-	
-	/**
-	 * Add role subscription
-	 * 
-	 * @param array $form_values form values to be inserted
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function add_subscription($form_values){
-		$f = $form_values;//shortcut var
-		
-		$query =  "insert into {role_subscription} (title, rid, role_subscription_group_id, price, " .
-			  	  "trial_amount, total_occurrences, trial_occurrences, description, weight, status) " .
-			  	  "values ('%s', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s');";
-	
-		return db_query($query, $f['title'], $f['rid'], $f['role_subscription_group_id'], $f['price'],
-								$f['trial_amount'], $f['total_occurrences'], $f['trial_occurrences'], 
-								$f['description'], $f['weight'], 'active');
-	}
-	
-	
-	/**
-	 * Edit subscription
-	 * 
-	 * @param array $form_values form values to be updated
-	 * @param integer $id role subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function edit_subscription($form_values, $id) {
-		if (!$id) return;//no id error
-		
-		$f = $form_values;//shortcut var
-	
-		$query = 'update {role_subscription} set title = "%s", price = "%s", trial_amount = "%s", ' .
-				 'total_occurrences = "%s", trial_occurrences = "%s", description = "%s", ' .
-				 'weight = "%d" where id = "%d" limit 1;';
-	
-		return db_query($query, $f['title'], $f['price'], $f['trial_amount'], $f['total_occurrences'], 
-								$f['trial_occurrences'], $f['description'], $f['weight'], $id);
-	}
-		
-	/**
-	 * Find role subscription for an ID
-	 * 
-	 * @return object role subscription data
-	 */
-	function find($id) {
-		if (!$id) return;
-	
-		$query = 'select rs.*, r.name as role, rsg.name as group_name, rsg.unit, rsg.length from {role_subscription} rs ' .
-				 'join {role_subscription_group} rsg on rs.role_subscription_group_id = rsg.id ' .
-				 'join {role} r on r.rid = rs.rid where rs.id = "%d" ' .
-				 'and status = "active"; ';
-		
-		return db_fetch_object(db_query($query, $id));	
-	}
-	
-	/**
-	 * Find all subscriptions
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function find_all(){
-		$query = 'select rs.*, r.name as role, rsg.name as group_name, rsg.unit, rsg.length ' .
-				 'from {role_subscription} rs ' .
-				 'join {role} r on r.rid = rs.rid ' .
-				 'join {role_subscription_group} rsg on rs.role_subscription_group_id = rsg.id ' .
-				 'where status = "active" order by rs.weight asc; ';
-		
-		return db_query($query);
-	}
-	
-	/**
-	 * Group role subscriptions by subscription groups
-	 * 
-	 * @return array associate array where the group name is the hash key which has an array of subscriptions as it's value
-	 */
-	function find_all_in_groups(){
-		$result = self::find_all();//get db result
-		
-		while ($row = db_fetch_object($result))
-			$groups [$row->group_name][] = $row;
-		
-		return $groups;
-	}
-	
-	/**
-	 * Deactivate a role subscription which marks it as inactive in the database
-	 * 
-	 * @param $id role subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly. 
-	 */
-	function deactivate($id){
-		if (!$id) return;//fail
-		
-		return db_query('update {role_subscription} set status = "inactive" where id = "%d" limit 1;', $id);
-	}
-	
-	/**
-	 * Cancel a role subscription in the database (will not delete but hide for reporting)
-	 * 
-	 * @param $id role subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function cancel($id){
-		if (!$id) return;//fail
-		
-		return db_query('update {role_subscription} set status = "cancelled" where id = "%d" limit 1;', $id);
-	}
-	
-	/**
-	 * Add a role subscription group
-	 * 
-	 * Unit and length cannot be changed once a group is created.
-	 * 
-	 * @param array $group_info hash of group form data
-	 *   - "name": name of group container
-	 *   - "description"
-	 *   - "unit": 'months' or 'days' will be used for all role subscriptions in this container
-	 *   - "length": 1-12 for months or 7-365 for days
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function add_group($group_info){
-		$query = 'insert into {role_subscription_group} (name, description, unit, length) values ("%s", "%s", "%s", "%d");';
-		
-		return db_query($query, $group_info['name'], $group_info['description'], $group_info['unit'], $group_info['length']);
-	}
-	
-	/**
-	 * Edit role subscription group
-	 * 
-	 * Note that this will not update unit or length. This cannot be changed for a group container. It has to be deleted
-	 * for these values to be changed.
-	 * 
-	 * @param array $group_info hash of group form data
-	 * @param integer $id role subscription group ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function edit_group($group_info, $id){
-		if (!$id) return;
-		
-		$query = 'update {role_subscription_group} set name = "%s", description = "%s" where id = "%d";';
-		
-		return db_query($query, $group_info['name'], $group_info['description'], $id);
-	}
-	
-	/**
-	 * Find all subscription groups
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function find_all_groups(){
-		$query = 'select rsg.* from {role_subscription_group} rsg; ';
-		
-		return db_query($query);
-	}
-	
-	/**
-	 * Get a count of existing subscription groups
-	 * 
-	 * @return integer count of how many subscription groups exist
-	 */
-	function get_groups_count(){
-		$query = 'select count(*) as count from {role_subscription_group} rsg; ';
-		
-		return db_fetch_object(db_query($query))->count;
-	}
-	
-	/**
-	 * Get all role subscriptions for a group in an options hash
-	 * 
-	 * @param integer $role_subscription_group_id group ID
-	 * 
-	 * @return array role subscriptions for a particular group
-	 */
-	function get_subscription_options_for_group($role_subscription_group_id){
-		if (!$role_subscription_group_id) return;//fail
-		
-		$query = 'select rs.* from {role_subscription} rs where rs.status = "active" AND rs.role_subscription_group_id = "%d";';
-		
-		$result = db_query($query, $role_subscription_group_id);
-		
-		while ($row = db_fetch_object($result))
-			$options [$row->id] = $row->title;
+    /**
+     * Go through each subscription field and compare form values with the db values
+     * to see if the subscription has changed
+     */
+    foreach ($subscription_cols as $col)
+      if ($form_values[$col] != $subscription->{$col})
+        $record_changed = TRUE;//if anything gets changed we have to resubmit
+        
+    return $record_changed;
+  }
+  
+  /**
+   * Add role subscription
+   * 
+   * @param array $form_values form values to be inserted
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function add_subscription($form_values){
+    $f = $form_values;//shortcut var
+    
+    $query =  "insert into {role_subscription} (title, rid, role_subscription_group_id, price, " .
+            "trial_amount, total_occurrences, trial_occurrences, description, weight, status) " .
+            "values ('%s', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s');";
+  
+    return db_query($query, $f['title'], $f['rid'], $f['role_subscription_group_id'], $f['price'],
+                $f['trial_amount'], $f['total_occurrences'], $f['trial_occurrences'], 
+                $f['description'], $f['weight'], 'active');
+  }
+  
+  
+  /**
+   * Edit subscription
+   * 
+   * @param array $form_values form values to be updated
+   * @param integer $id role subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function edit_subscription($form_values, $id) {
+    if (!$id) return;//no id error
+    
+    $f = $form_values;//shortcut var
+  
+    $query = 'update {role_subscription} set title = "%s", price = "%s", trial_amount = "%s", ' .
+         'total_occurrences = "%s", trial_occurrences = "%s", description = "%s", ' .
+         'weight = "%d" where id = "%d" limit 1;';
+  
+    return db_query($query, $f['title'], $f['price'], $f['trial_amount'], $f['total_occurrences'], 
+                $f['trial_occurrences'], $f['description'], $f['weight'], $id);
+  }
+    
+  /**
+   * Find role subscription for an ID
+   * 
+   * @return object role subscription data
+   */
+  function find($id) {
+    if (!$id) return;
+  
+    $query = 'select rs.*, r.name as role, rsg.name as group_name, rsg.unit, rsg.length from {role_subscription} rs ' .
+         'join {role_subscription_group} rsg on rs.role_subscription_group_id = rsg.id ' .
+         'join {role} r on r.rid = rs.rid where rs.id = "%d" ' .
+         'and status = "active"; ';
+    
+    return db_fetch_object(db_query($query, $id));  
+  }
+  
+  /**
+   * Find all subscriptions
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function find_all(){
+    $query = 'select rs.*, r.name as role, rsg.name as group_name, rsg.unit, rsg.length ' .
+         'from {role_subscription} rs ' .
+         'join {role} r on r.rid = rs.rid ' .
+         'join {role_subscription_group} rsg on rs.role_subscription_group_id = rsg.id ' .
+         'where status = "active" order by rs.weight asc; ';
+    
+    return db_query($query);
+  }
+  
+  /**
+   * Group role subscriptions by subscription groups
+   * 
+   * @return array associate array where the group name is the hash key which has an array of subscriptions as it's value
+   */
+  function find_all_in_groups(){
+    $result = self::find_all();//get db result
+    
+    while ($row = db_fetch_object($result))
+      $groups [$row->group_name][] = $row;
+    
+    return $groups;
+  }
+  
+  /**
+   * Deactivate a role subscription which marks it as inactive in the database
+   * 
+   * @param $id role subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly. 
+   */
+  function deactivate($id){
+    if (!$id) return;//fail
+    
+    return db_query('update {role_subscription} set status = "inactive" where id = "%d" limit 1;', $id);
+  }
+  
+  /**
+   * Cancel a role subscription in the database (will not delete but hide for reporting)
+   * 
+   * @param $id role subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function cancel($id){
+    if (!$id) return;//fail
+    
+    return db_query('update {role_subscription} set status = "cancelled" where id = "%d" limit 1;', $id);
+  }
+  
+  /**
+   * Add a role subscription group
+   * 
+   * Unit and length cannot be changed once a group is created.
+   * 
+   * @param array $group_info hash of group form data
+   *   - "name": name of group container
+   *   - "description"
+   *   - "unit": 'months' or 'days' will be used for all role subscriptions in this container
+   *   - "length": 1-12 for months or 7-365 for days
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function add_group($group_info){
+    $query = 'insert into {role_subscription_group} (name, description, unit, length) values ("%s", "%s", "%s", "%d");';
+    
+    return db_query($query, $group_info['name'], $group_info['description'], $group_info['unit'], $group_info['length']);
+  }
+  
+  /**
+   * Edit role subscription group
+   * 
+   * Note that this will not update unit or length. This cannot be changed for a group container. It has to be deleted
+   * for these values to be changed.
+   * 
+   * @param array $group_info hash of group form data
+   * @param integer $id role subscription group ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function edit_group($group_info, $id){
+    if (!$id) return;
+    
+    $query = 'update {role_subscription_group} set name = "%s", description = "%s" where id = "%d";';
+    
+    return db_query($query, $group_info['name'], $group_info['description'], $id);
+  }
+  
+  /**
+   * Find all subscription groups
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function find_all_groups(){
+    $query = 'select rsg.* from {role_subscription_group} rsg; ';
+    
+    return db_query($query);
+  }
+  
+  /**
+   * Get a count of existing subscription groups
+   * 
+   * @return integer count of how many subscription groups exist
+   */
+  function get_groups_count(){
+    $query = 'select count(*) as count from {role_subscription_group} rsg; ';
+    
+    return db_fetch_object(db_query($query))->count;
+  }
+  
+  /**
+   * Get all role subscriptions for a group in an options hash
+   * 
+   * @param integer $role_subscription_group_id group ID
+   * 
+   * @return array role subscriptions for a particular group
+   */
+  function get_subscription_options_for_group($role_subscription_group_id){
+    if (!$role_subscription_group_id) return;//fail
+    
+    $query = 'select rs.* from {role_subscription} rs where rs.status = "active" AND rs.role_subscription_group_id = "%d";';
+    
+    $result = db_query($query, $role_subscription_group_id);
+    
+    while ($row = db_fetch_object($result))
+      $options [$row->id] = $row->title;
 
-		return $options;
-	}
-	
-	/**
-	 * Find group
-	 * 
-	 * @param integer $id subscription group ID
-	 * 
-	 * @return object group data
-	 */
-	function find_group($id){
-		if (!$id) return;//fail
-		
-		$query = 'select rsg.* from {role_subscription_group} rsg where id = %d ';
-		
-		return db_fetch_object(db_query($query, $id));
-	}
-	
-	/**
-	 * Get dropdown array of groups
-	 * 
-	 * @return array groups as options array 
-	 */
-	function groups_dropdown(){
-		$result = self::find_all_groups();//get db resul
-		
-		$groups [''] = '';
-		
-		while ($row = db_fetch_object($result))
-			$groups [$row->id] = $row->name;
-		
-		return $groups;
-	}
-	
-	/**
-	 * Find all user roles
-	 * 
-	 * @todo is there not a drupal function for this?
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly. 
-	 */
-	function find_all_roles(){
-		return db_query('select * from {role} r');		
-	}
-	
-	/**
-	 * Function find all roles as options array
-	 * 
-	 * @todo is there not a drupal function for this?
-	 * 
-	 * @return array roles as options array
-	 */
-	function roles_dropdown(){
-		$result = self::find_all_roles();
-		
-		$roles [''] = '';
-		
-		while ($row = db_fetch_object($result))
-			$roles [$row->rid] = $row->name;
-			
-		return $roles;
-	}
+    return $options;
+  }
+  
+  /**
+   * Find group
+   * 
+   * @param integer $id subscription group ID
+   * 
+   * @return object group data
+   */
+  function find_group($id){
+    if (!$id) return;//fail
+    
+    $query = 'select rsg.* from {role_subscription_group} rsg where id = %d ';
+    
+    return db_fetch_object(db_query($query, $id));
+  }
+  
+  /**
+   * Get dropdown array of groups
+   * 
+   * @return array groups as options array 
+   */
+  function groups_dropdown(){
+    $result = self::find_all_groups();//get db resul
+    
+    $groups [''] = '';
+    
+    while ($row = db_fetch_object($result))
+      $groups [$row->id] = $row->name;
+    
+    return $groups;
+  }
+  
+  /**
+   * Find all user roles
+   * 
+   * @todo is there not a drupal function for this?
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly. 
+   */
+  function find_all_roles(){
+    return db_query('select * from {role} r');    
+  }
+  
+  /**
+   * Function find all roles as options array
+   * 
+   * @todo is there not a drupal function for this?
+   * 
+   * @return array roles as options array
+   */
+  function roles_dropdown(){
+    $result = self::find_all_roles();
+    
+    $roles [''] = '';
+    
+    while ($row = db_fetch_object($result))
+      $roles [$row->rid] = $row->name;
+      
+    return $roles;
+  }
 }
\ No newline at end of file
Index: includes/role_subscription_form.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/includes/role_subscription_form.inc,v
retrieving revision 1.1
diff -u -r1.1 role_subscription_form.inc
--- includes/role_subscription_form.inc	24 May 2008 23:54:09 -0000	1.1
+++ includes/role_subscription_form.inc	25 May 2008 20:46:04 -0000
@@ -4,510 +4,510 @@
  * Helper class for role subscription module, all methods called statically, acts as namespace
  */
 class Role_subscription_form {
-	/**
-	 * Helper function for role subscription add and edit forms
-	 * @param integer $form assoc array of form values
-	 * @param string $edit_mode either 'add' or 'update'
-	 * 
-	 * @return mixed assoc array of form items
-	 */
-	function get_form($form_values = NULL, $edit_mode = 'add'){
-		
-		$form['title'] = array(
-		    '#title' => t('Subscription Title'),
-			'#type' => 'textfield',
-		    '#size' => 60,
-		    '#maxlength' => 255,
-		    '#default_value' => $form_values['title'],
-		    '#description' => 'Choose a human readable title for this subscription.',
-		    '#required' => TRUE 
-		);
-		
-		if ($edit_mode == 'add') {
-			$form['rid'] = array(
-			    '#type' => 'select',
-			    '#title' => t('Role'),
-			    '#options' => Role_subscription_db::roles_dropdown(),
-			    '#default_value' => $form_values['rid'],
-			    '#description' => 'Choose the role that this subscription will grant, '.l('edit roles here', 'admin/user/roles').'.',
-			    '#required' => TRUE
-			);
-		}
-		/**
-		 * Can't modify role once subscription is created 
-		 */
-		else {
-			$form['role'] = array(
-			    '#type' => 'item',
-			    '#title' => t('Role'),
-			    '#value' => t($form_values['role']),
-			    '#description' => 'This role cannot be modified.',
-			);
-		}
-		
-		if ($edit_mode == 'add') {
-			$form['role_subscription_group_id'] = array(
-			    '#type' => 'select',
-			    '#title' => t('Subscription Group'),
-			    '#options' => Role_subscription_db::groups_dropdown(),
-			    '#default_value' => $form_values['role_subscription_group_id'],
-			    '#description' => 'Choose subscription group for this subscription role.',
-			    '#required' => TRUE
-			);
-		}
-		/**
-		 * Can't modify group once role subscription is created
-		 */
-		else {
-			$form['group'] = array(
-			    '#type' => 'item',
-			    '#title' => t('Subscription Group'),
-			    '#value' => $form_values['group_name'],
-			    '#description' => 'This group cannot be modified.'
-			);
-		}
-		
-		$form['price'] = array(
-		    '#title' => t('Subscription Price'),
-			'#type' => 'textfield',
-		    '#size' => 5,
-		    '#maxlength' => 5,
-		    '#default_value' => $form_values['price'],
-		    '#description' => 'The price of the subscription after it\'s initial trial period (if any).',
-		    '#required' => TRUE
-		);
-		
-		$form['trial_amount'] = array(
-		    '#title' => t('Trial Amount'),
-			'#type' => 'textfield',
-		    '#size' => 5,
-		    '#maxlength' => 5,
-		    '#default_value' => $form_values['trial_amount'],
-		    '#description' => 'The price of the subscription during it\'s trial period, if applicable.'
-		);
-		
-		$form['total_occurrences'] = array(
-		    '#title' => t('Total Occurrences'),
-			'#type' => 'textfield',
-		    '#size' => 3,
-		    '#maxlength' => 3,
-		    '#default_value' => $form_values['total_occurrences'],
-		    '#description' => 'Choose how many times the subscription will be billed. ' .
-		    				  'Leave blank if subscription is recurring until the user cancels.'
-		);
-		
-		$form['trial_occurrences'] = array(
-		    '#title' => t('Trial Occurrences'),
-			'#type' => 'textfield',
-		    '#size' => 3,
-		    '#maxlength' => 3,
-		    '#default_value' => $form_values['trial_occurrences'],
-		    '#description' => 'Choose how many times the subscription will be billed at the trial amount, if applicable. '
-		);
-		
-		$form['description'] = array(
-		    '#title' => t('Description'),
-			'#type' => 'textarea',
-		    '#default_value' => $form_values['description'],
-		    '#description' => 'Describe the subscription. This can include business rules set up by other modules.',
-		    '#required' => TRUE
-		);
-		
-		$form['weight'] = array(
-		    '#title' => t('Weight'),
-			'#type' => 'select',
-		    '#options' => array_combine(range(-10, 10), range(-10, 10)),
-		    '#default_value' => $form_values['weight'] ? $form_values['weight'] : 0,
-		    '#description' => 'Determine the order of the subscription when it is displayed. '
-		);
-		
-		$form['submit'] = array(
-			'#type' => 'submit',
-			'#value' => $edit_mode == 'add' ? t('Add Role Subscription') : t('Update Role Subscription'),
-		);
-		
-		return $form;
-	}
-	
-	/**
-	 * Common function for validating add and update subscripion forms
-	 * 
-	 * @return mixed
-	 */
-	function get_validate_form($form_id, $form_values, $edit_mode = 'add'){
-		/**
-		 * Title
-		 */
-		if (strlen($form_values['title']) > 255)
-			form_set_error('title', t('The Subscription Title cannot be longer than 255 characters.'));
-		
-		/**
-		 * Extra fields to validate if add mode
-		 */
-		if ($edit_mode == 'add') {
-			/**
-			 * User Role
-			 */
-			if (!ctype_digit($form_values['rid']))
-				form_set_error('rid', t('The Role you submitted is invalid, the value must be an integer.'));//this should never trigger
-			
-			/**
-			 * Subscription Group
-			 */
-			if (!ctype_digit($form_values['role_subscription_group_id']))
-				form_set_error('role_subscription_group_id', t('The Subscription Group you submitted is invalid, the value must be an integer.'));//this should never trigger
-		}	
-		
-		/**
-		 * Subscription Price
-		 */
-		if (!is_numeric($form_values['price']))
-			form_set_error('price', t('The Price must be a valid numeric value only.'));
-			
-		/**
-		 * Trial Amount
-		 */
-		if ($form_values['trial_amount']) {
-			if (!is_numeric($form_values['trial_amount']))
-				form_set_error('trial_amount', t('The Trial Amount must be a valid numeric value only.'));
-		}
-		
-		/**
-		 * Total Occurrences
-		 */
-		if ($form_values['total_occurrences']) {
-			if (!ctype_digit($form_values['total_occurrences']))
-				form_set_error('total_occurrences', t('The Total Occurrences value must be a valid number greater than zero only or left blank.'));
-		}
-		
-		/**
-		 * Trial Occurrences
-		 */
-		if ($form_values['trial_occurrences']) {
-			if (!ctype_digit($form_values['trial_occurrences']))
-				form_set_error('trial_occurrences', t('The Trial Occcurrences value must be a valid number greater than zero only or left blank.'));
-		}
-		
-		/**
-		 * Weight
-		 */
-		if (!is_numeric($form_values['weight']))
-			form_set_error('weight', t('Weight value must be a positive or negative number.'));
-	}
-	
-	/**
-	 * Return payment form items
-	 */
-	function get_payment_form($form_values=NULL){
-		$form['first_name'] = array(
-		    '#title' => t('First Name'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['first_name'],
-		    '#required' => TRUE
-		);
-		
-		$form['last_name'] = array(
-		    '#title' => t('Last Name'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['last_name'],
-		    '#required' => TRUE
-		);
-		
-		$form['address'] = array(
-		    '#title' => t('Billing Address'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['address'],
-		    '#required' => TRUE
-		);
-		
-		$form['city'] = array(
-		    '#title' => t('City'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['city'],
-		    '#required' => TRUE
-		);
-		
-		$form['state'] = array(
-		    '#type' => 'select',
-		    '#title' => t('State'),
-		    '#options' => array('' => '') + location_province_list_us(),//location module required, add blank
-		    '#default_value' => $form_values['state'],
-		    '#required' => TRUE 
-		);
-		
-		$form['zip'] = array(
-		    '#title' => t('Zip Code'),
-			'#type' => 'textfield',
-		    '#size' => 10,
-		    '#maxlength' => 10,
-		    '#default_value' => $form_values['zip'],
-		    '#required' => TRUE,
-		    '#description' => 'Valid format is 5 digit, e.g. xxxxx, or 5 digit plus 4, e.g. xxxxx-xxxx'
-		);
-		
-		$form['phone'] = array(
-		    '#title' => t('Phone'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['phone'],
-		    '#required' => TRUE,
-		    '#description' => 'Valid format is xxx-xxx-xxxx (extensions ok)'
-		);
-		
-		$form['cc_type'] = array(
-		    '#title' => t('Credit Card Type'),
-			'#type' => 'select',
-		    '#options' => array('' => '', 'ae' => 'American Express', 'd' => 'Discover', 'mc' => 'Mastercard', 'v' => 'Visa'),
-		    '#default_value' => $form_values['cc_type'],
-		    '#required' => TRUE
-		);
-		
-		$form['cc_logos'] = array(
-		    '#value' => sprintf('<img src="%s" alt="Visa Mastercard American Express Discover" width="239" height="40" />', url().drupal_get_path('module', 'role_subscription') .'/images/visa_mc_amex_disc_239x40.gif'),
-		);
-		
-		$form['cc_number'] = array(
-		    '#title' => t('Credit Card Number'),
-			'#type' => 'textfield',
-		    '#size' => 16,
-		    '#maxlength' => 16,
-		    '#default_value' => $form_values['cc_number'],
-		    '#required' => TRUE,
-		    '#description' => 'Typically 15 or 16 numbers, digits only, no spaces.'
-		);
-		
-		$form['expiration_date'] = array(
-		    '#title' => t('Expiration Date'),
-			'#type' => 'textfield',
-		    '#size' => 7,
-		    '#maxlength' => 7,
-		    '#default_value' => $form_values['expiration_date'],
-		    '#description' => 'Give the month and year of your card\'s expiration date, e.g. mm/yyyy',
-		    '#required' => TRUE
-		);
-		
-		$form['cvv'] = array(
-		    '#title' => t('CVV Number'),
-			'#type' => 'textfield',
-		    '#size' => 4,
-		    '#maxlength' => 4,
-		    '#default_value' => $form_values['cvv'],
-		    '#description' => 'The CVV number is located on the back of the card and is a 3 or 4 digit number',
-		    '#required' => TRUE
-		);
-		
-		$form['submit'] = array(
-			'#type' => 'submit',
-			'#value' => 'Continue to Confirmation Page'
-		);
-		
-		return $form;
-	}
-	
-	/**
-	 * Return dummy values for payment screen
-	 */
-	function get_dummy_payment_form_data(){
-		return array(
-			'first_name'	=> 'John',
-			'last_name'		=> 'Doe',
-			'address'		=> '1234 Rich Man Drive',
-			'city'			=> 'Little Rock',
-			'state'			=> 'AR',
-			'zip' 			=> '72113',
-			'phone'			=> '555-555-5555',
-			'cc_type'		=> 'v',
-			'cc_number'		=> '4111111111111111',//default fake credit card number
-			'expiration_date' => date('m/Y'),
-			'cvv'			=> '123'
-		);
-	}
+  /**
+   * Helper function for role subscription add and edit forms
+   * @param integer $form assoc array of form values
+   * @param string $edit_mode either 'add' or 'update'
+   * 
+   * @return mixed assoc array of form items
+   */
+  function get_form($form_values = NULL, $edit_mode = 'add'){
+    
+    $form['title'] = array(
+        '#title' => t('Subscription Title'),
+      '#type' => 'textfield',
+        '#size' => 60,
+        '#maxlength' => 255,
+        '#default_value' => $form_values['title'],
+        '#description' => 'Choose a human readable title for this subscription.',
+        '#required' => TRUE 
+    );
+    
+    if ($edit_mode == 'add') {
+      $form['rid'] = array(
+          '#type' => 'select',
+          '#title' => t('Role'),
+          '#options' => Role_subscription_db::roles_dropdown(),
+          '#default_value' => $form_values['rid'],
+          '#description' => 'Choose the role that this subscription will grant, '.l('edit roles here', 'admin/user/roles').'.',
+          '#required' => TRUE
+      );
+    }
+    /**
+     * Can't modify role once subscription is created 
+     */
+    else {
+      $form['role'] = array(
+          '#type' => 'item',
+          '#title' => t('Role'),
+          '#value' => t($form_values['role']),
+          '#description' => 'This role cannot be modified.',
+      );
+    }
+    
+    if ($edit_mode == 'add') {
+      $form['role_subscription_group_id'] = array(
+          '#type' => 'select',
+          '#title' => t('Subscription Group'),
+          '#options' => Role_subscription_db::groups_dropdown(),
+          '#default_value' => $form_values['role_subscription_group_id'],
+          '#description' => 'Choose subscription group for this subscription role.',
+          '#required' => TRUE
+      );
+    }
+    /**
+     * Can't modify group once role subscription is created
+     */
+    else {
+      $form['group'] = array(
+          '#type' => 'item',
+          '#title' => t('Subscription Group'),
+          '#value' => $form_values['group_name'],
+          '#description' => 'This group cannot be modified.'
+      );
+    }
+    
+    $form['price'] = array(
+        '#title' => t('Subscription Price'),
+      '#type' => 'textfield',
+        '#size' => 5,
+        '#maxlength' => 5,
+        '#default_value' => $form_values['price'],
+        '#description' => 'The price of the subscription after it\'s initial trial period (if any).',
+        '#required' => TRUE
+    );
+    
+    $form['trial_amount'] = array(
+        '#title' => t('Trial Amount'),
+      '#type' => 'textfield',
+        '#size' => 5,
+        '#maxlength' => 5,
+        '#default_value' => $form_values['trial_amount'],
+        '#description' => 'The price of the subscription during it\'s trial period, if applicable.'
+    );
+    
+    $form['total_occurrences'] = array(
+        '#title' => t('Total Occurrences'),
+      '#type' => 'textfield',
+        '#size' => 3,
+        '#maxlength' => 3,
+        '#default_value' => $form_values['total_occurrences'],
+        '#description' => 'Choose how many times the subscription will be billed. ' .
+                  'Leave blank if subscription is recurring until the user cancels.'
+    );
+    
+    $form['trial_occurrences'] = array(
+        '#title' => t('Trial Occurrences'),
+      '#type' => 'textfield',
+        '#size' => 3,
+        '#maxlength' => 3,
+        '#default_value' => $form_values['trial_occurrences'],
+        '#description' => 'Choose how many times the subscription will be billed at the trial amount, if applicable. '
+    );
+    
+    $form['description'] = array(
+        '#title' => t('Description'),
+      '#type' => 'textarea',
+        '#default_value' => $form_values['description'],
+        '#description' => 'Describe the subscription. This can include business rules set up by other modules.',
+        '#required' => TRUE
+    );
+    
+    $form['weight'] = array(
+        '#title' => t('Weight'),
+      '#type' => 'select',
+        '#options' => array_combine(range(-10, 10), range(-10, 10)),
+        '#default_value' => $form_values['weight'] ? $form_values['weight'] : 0,
+        '#description' => 'Determine the order of the subscription when it is displayed. '
+    );
+    
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => $edit_mode == 'add' ? t('Add Role Subscription') : t('Update Role Subscription'),
+    );
+    
+    return $form;
+  }
+  
+  /**
+   * Common function for validating add and update subscripion forms
+   * 
+   * @return mixed
+   */
+  function get_validate_form($form_id, $form_values, $edit_mode = 'add'){
+    /**
+     * Title
+     */
+    if (strlen($form_values['title']) > 255)
+      form_set_error('title', t('The Subscription Title cannot be longer than 255 characters.'));
+    
+    /**
+     * Extra fields to validate if add mode
+     */
+    if ($edit_mode == 'add') {
+      /**
+       * User Role
+       */
+      if (!ctype_digit($form_values['rid']))
+        form_set_error('rid', t('The Role you submitted is invalid, the value must be an integer.'));//this should never trigger
+      
+      /**
+       * Subscription Group
+       */
+      if (!ctype_digit($form_values['role_subscription_group_id']))
+        form_set_error('role_subscription_group_id', t('The Subscription Group you submitted is invalid, the value must be an integer.'));//this should never trigger
+    }  
+    
+    /**
+     * Subscription Price
+     */
+    if (!is_numeric($form_values['price']))
+      form_set_error('price', t('The Price must be a valid numeric value only.'));
+      
+    /**
+     * Trial Amount
+     */
+    if ($form_values['trial_amount']) {
+      if (!is_numeric($form_values['trial_amount']))
+        form_set_error('trial_amount', t('The Trial Amount must be a valid numeric value only.'));
+    }
+    
+    /**
+     * Total Occurrences
+     */
+    if ($form_values['total_occurrences']) {
+      if (!ctype_digit($form_values['total_occurrences']))
+        form_set_error('total_occurrences', t('The Total Occurrences value must be a valid number greater than zero only or left blank.'));
+    }
+    
+    /**
+     * Trial Occurrences
+     */
+    if ($form_values['trial_occurrences']) {
+      if (!ctype_digit($form_values['trial_occurrences']))
+        form_set_error('trial_occurrences', t('The Trial Occcurrences value must be a valid number greater than zero only or left blank.'));
+    }
+    
+    /**
+     * Weight
+     */
+    if (!is_numeric($form_values['weight']))
+      form_set_error('weight', t('Weight value must be a positive or negative number.'));
+  }
+  
+  /**
+   * Return payment form items
+   */
+  function get_payment_form($form_values=NULL){
+    $form['first_name'] = array(
+        '#title' => t('First Name'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['first_name'],
+        '#required' => TRUE
+    );
+    
+    $form['last_name'] = array(
+        '#title' => t('Last Name'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['last_name'],
+        '#required' => TRUE
+    );
+    
+    $form['address'] = array(
+        '#title' => t('Billing Address'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['address'],
+        '#required' => TRUE
+    );
+    
+    $form['city'] = array(
+        '#title' => t('City'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['city'],
+        '#required' => TRUE
+    );
+    
+    $form['state'] = array(
+        '#type' => 'select',
+        '#title' => t('State'),
+        '#options' => array('' => '') + location_province_list_us(),//location module required, add blank
+        '#default_value' => $form_values['state'],
+        '#required' => TRUE 
+    );
+    
+    $form['zip'] = array(
+        '#title' => t('Zip Code'),
+      '#type' => 'textfield',
+        '#size' => 10,
+        '#maxlength' => 10,
+        '#default_value' => $form_values['zip'],
+        '#required' => TRUE,
+        '#description' => 'Valid format is 5 digit, e.g. xxxxx, or 5 digit plus 4, e.g. xxxxx-xxxx'
+    );
+    
+    $form['phone'] = array(
+        '#title' => t('Phone'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['phone'],
+        '#required' => TRUE,
+        '#description' => 'Valid format is xxx-xxx-xxxx (extensions ok)'
+    );
+    
+    $form['cc_type'] = array(
+        '#title' => t('Credit Card Type'),
+      '#type' => 'select',
+        '#options' => array('' => '', 'ae' => 'American Express', 'd' => 'Discover', 'mc' => 'Mastercard', 'v' => 'Visa'),
+        '#default_value' => $form_values['cc_type'],
+        '#required' => TRUE
+    );
+    
+    $form['cc_logos'] = array(
+        '#value' => sprintf('<img src="%s" alt="Visa Mastercard American Express Discover" width="239" height="40" />', url().drupal_get_path('module', 'role_subscription') .'/images/visa_mc_amex_disc_239x40.gif'),
+    );
+    
+    $form['cc_number'] = array(
+        '#title' => t('Credit Card Number'),
+      '#type' => 'textfield',
+        '#size' => 16,
+        '#maxlength' => 16,
+        '#default_value' => $form_values['cc_number'],
+        '#required' => TRUE,
+        '#description' => 'Typically 15 or 16 numbers, digits only, no spaces.'
+    );
+    
+    $form['expiration_date'] = array(
+        '#title' => t('Expiration Date'),
+      '#type' => 'textfield',
+        '#size' => 7,
+        '#maxlength' => 7,
+        '#default_value' => $form_values['expiration_date'],
+        '#description' => 'Give the month and year of your card\'s expiration date, e.g. mm/yyyy',
+        '#required' => TRUE
+    );
+    
+    $form['cvv'] = array(
+        '#title' => t('CVV Number'),
+      '#type' => 'textfield',
+        '#size' => 4,
+        '#maxlength' => 4,
+        '#default_value' => $form_values['cvv'],
+        '#description' => 'The CVV number is located on the back of the card and is a 3 or 4 digit number',
+        '#required' => TRUE
+    );
+    
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => 'Continue to Confirmation Page'
+    );
+    
+    return $form;
+  }
+  
+  /**
+   * Return dummy values for payment screen
+   */
+  function get_dummy_payment_form_data(){
+    return array(
+      'first_name'  => 'John',
+      'last_name'    => 'Doe',
+      'address'    => '1234 Rich Man Drive',
+      'city'      => 'Little Rock',
+      'state'      => 'AR',
+      'zip'       => '72113',
+      'phone'      => '555-555-5555',
+      'cc_type'    => 'v',
+      'cc_number'    => '4111111111111111',//default fake credit card number
+      'expiration_date' => date('m/Y'),
+      'cvv'      => '123'
+    );
+  }
 
-	/**
-	 * Validate payment form
-	 */	
-	function validate_payment_form($form_id, $form_values){
+  /**
+   * Validate payment form
+   */  
+  function validate_payment_form($form_id, $form_values){
 
-		/**
-		 * First Name
-		 */
-		if (strlen($form_values['first_name']) > 255)
-			form_set_error('first_name', t('The First Name field cannot be more than 255 characters long.'));
-	
-		/**
-		 * Last Name
-		 */
-		if (strlen($form_values['last_name']) > 255)
-			form_set_error('last_name', t('The Last Name field cannot be more than 255 characters long.'));
-			
-		/**
-		 * Billing Address
-		 */
-		if (strlen($form_values['billing_address']) > 255)
-			form_set_error('billing_address', t('The Billing Address field cannot be more than 255 characters long.'));
-			
-		/**
-		 * City
-		 */
-		if (strlen($form_values['city']) > 255)
-			form_set_error('city', t('The Billing Address field cannot be more than 255 characters long.'));
-			
-		/**
-		 * State
-		 */
-		if (strlen($form_values['state']) != 2)
-			form_set_error('state', t('Invalid State selected.'));//should never trigger
-			
-		/**
-		 * ZIP Code
-		 */
-		if (!preg_match('/^(\d{5}-\d{4})|(\d{5})$/', $form_values['zip']))
-			form_set_error('zip', t('Invalid Zip Code entered. 5 digit and 5 digit plus 4 digit zip codes are valid.'));
-			
-		/**
-		 * Phone
-		 */
-		if (!preg_match('/^(\d){3}-(\d){3}-(\d){4}/', $form_values['phone']))
-			form_set_error('phone', t('Invalid Phone Number entered. xxx-xxx-xxxx is correct syntax, extensions are allowed.'));
-			
-		/**
-		 * Credit Card Type
-		 */
-		if (!in_array($form_values['cc_type'], array('ae', 'v', 'mc', 'd')))//validate cc symbol
-			form_set_error('cc_type', t('Invalid Credit Card type submitted.'));//should never trigger
-		
-		/**
-		 * Credit Card Number
-		 */	
-		if (strlen($form_values['cc_number']) > 16)
-			form_set_error('cc_number', t('The Credit Card number must be 16 numbers or less.'));
-		elseif(!ctype_digit($form_values['cc_number']))
-			form_set_error('cc_number', t('The Credit Card number must be digits only.'));
-			
-		/**
-		 * Expiration Date
-		 */
-		if (!preg_match('/^\d{1,2}\/\d{4}$/', $form_values['expiration_date']))
-			form_set_error('expiration_date', t('Invalid Expiration Date. Please enter in a 2 digit month and 4 digit year.'));
-			
-		/**
-		 * CVV
-		 */
-		if (!preg_match('/^\d{3,4}$/', $form_values['cvv']))
-			form_set_error('cvv', t('Invalid CVV Number. Please enter in a 3 or 4 digit number'));
-			
-		/**
-		 * Check for errors
-		 */
-		if (is_array(form_get_errors()))//fail
-			return FALSE;
-		else
-			return TRUE;//success
-	}
-	
-	/**
-	 * Get HTML table from subscription information
-	 */
-	function get_subscription_info_html_table($sub){
-		//price
-		$rows [] = array('Price', '$'.$sub->price.' billed every ' . $sub->length . ' ' . 
-					preg_replace('/s$/', '(s)', $sub->unit) . 
-					($sub->total_occurrences ? $sub->total_occurrences . ' times.' : '.'));
-		
-		//trial amount
-		if ($sub->trial_amount > 0)
-			$rows [] = array('Trial Amount', '$'.$sub->trial_amount.' billed for 1st '.$sub->trial_occurrences.' occurrences of the billing cycle.');
-		
-		$header = array(t('Term'), t('Description'));
-		$output .= theme('table', $header, $rows, NULL,'');
-		
-		return $output;
-	}
-	
-	/**
-	 * Get assoc array of form values for subscription group
-	 */
-	function get_group_form($form_values = NULL, $edit_mode = 'add'){
-		$form['name'] = array(
-		    '#title' => t('Name'),
-			'#type' => 'textfield',
-		    '#size' => 25,
-		    '#maxlength' => 25,
-		    '#default_value' => $form_values['name'],
-		    '#required' => TRUE,
-		    '#description' => 'Name the subscription group, e.g. "Book Club Membership".'
-		);
-		
-		$form['description'] = array(
-		    '#title' => t('Description'),
-			'#type' => 'textarea',
-		    '#default_value' => $form_values['description'],
-		    '#description' => 'Describe the subscription group. This will be shown on the public subscription page.',
-		    '#required' => TRUE
-		);
-		
-		/**
-		 * Cannot modify length and unit of groups once they have been created
-		 */
-		if ($edit_mode == 'add') {
-			$form['length'] = array(
-			    '#title' => t('Subscription Length'),
-				'#type' => 'textfield',
-			    '#size' => 3,
-			    '#maxlength' => 3,
-			    '#default_value' => $form_values['length'] ? $form_values['length'] : 1,//default to 1 if nothing selected
-			    '#description' => 'Choose length of billing cycle, 1-12 for monthly billing, 1-365 for daily billing. Note this cannot ' .
-			    				  'be changed once the group has been created.',
-			    '#required' => TRUE
-			);
-			
-			$form['unit'] = array(
-			    '#type' => 'select',
-			    '#title' => t('Unit'),
-			    '#options' => array('days' => 'days', 'months' => 'months'),
-			    '#default_value' => $form_values['unit'] ? $form_values['unit'] : 'months',//default to monthly if nothing selected
-			    '#description' => 'Choose at what interval billing will occur, days or months. Note this cannot be changed once the ' .
-			    				  'group has been created.',
-			    '#required' => TRUE 
-			);
-		}
-		else {//show uneditable values if edit mode
-			$form['length_and_unit'] = array(
-				'#type' => 'item',
-				'#title' => t('Subscription Length and Unit'),
-				'#value' => 'Billed every '.$form_values['length'] .' '.preg_replace('/s$/', '(s)', $form_values['unit']),//format nicer
-				'#description' => 'Cannot be modified'
-			);
-		}
-		
-		$form['submit'] = array(
-			'#type' => 'submit',
-			'#value' => $edit_mode == 'add' ? t('Add Subscription Group') : t('Update Subscription Group'),
-		);
-		
-		return $form;
-	}
-	
-	/**
-	 * Get grouped hash of role subscription data for display in radio options
-	 * 
-	 * @return array role subscription group names as the hash with the role subscription array being the value for each key
-	 */
-	function group_subscription_radio_options(){
-		$result = Role_subscription_db::find_all();//get db result
-		
-		while ($row = db_fetch_object($result)) 
-			$groups [$row->group_name][$row->id] = '<span>'.$row->title.'</span><div class="role_subscription_radio_options">'.$row->description.'</div>';
-		
-		return $groups;
-	}
+    /**
+     * First Name
+     */
+    if (strlen($form_values['first_name']) > 255)
+      form_set_error('first_name', t('The First Name field cannot be more than 255 characters long.'));
+  
+    /**
+     * Last Name
+     */
+    if (strlen($form_values['last_name']) > 255)
+      form_set_error('last_name', t('The Last Name field cannot be more than 255 characters long.'));
+      
+    /**
+     * Billing Address
+     */
+    if (strlen($form_values['billing_address']) > 255)
+      form_set_error('billing_address', t('The Billing Address field cannot be more than 255 characters long.'));
+      
+    /**
+     * City
+     */
+    if (strlen($form_values['city']) > 255)
+      form_set_error('city', t('The Billing Address field cannot be more than 255 characters long.'));
+      
+    /**
+     * State
+     */
+    if (strlen($form_values['state']) != 2)
+      form_set_error('state', t('Invalid State selected.'));//should never trigger
+      
+    /**
+     * ZIP Code
+     */
+    if (!preg_match('/^(\d{5}-\d{4})|(\d{5})$/', $form_values['zip']))
+      form_set_error('zip', t('Invalid Zip Code entered. 5 digit and 5 digit plus 4 digit zip codes are valid.'));
+      
+    /**
+     * Phone
+     */
+    if (!preg_match('/^(\d){3}-(\d){3}-(\d){4}/', $form_values['phone']))
+      form_set_error('phone', t('Invalid Phone Number entered. xxx-xxx-xxxx is correct syntax, extensions are allowed.'));
+      
+    /**
+     * Credit Card Type
+     */
+    if (!in_array($form_values['cc_type'], array('ae', 'v', 'mc', 'd')))//validate cc symbol
+      form_set_error('cc_type', t('Invalid Credit Card type submitted.'));//should never trigger
+    
+    /**
+     * Credit Card Number
+     */  
+    if (strlen($form_values['cc_number']) > 16)
+      form_set_error('cc_number', t('The Credit Card number must be 16 numbers or less.'));
+    elseif(!ctype_digit($form_values['cc_number']))
+      form_set_error('cc_number', t('The Credit Card number must be digits only.'));
+      
+    /**
+     * Expiration Date
+     */
+    if (!preg_match('/^\d{1,2}\/\d{4}$/', $form_values['expiration_date']))
+      form_set_error('expiration_date', t('Invalid Expiration Date. Please enter in a 2 digit month and 4 digit year.'));
+      
+    /**
+     * CVV
+     */
+    if (!preg_match('/^\d{3,4}$/', $form_values['cvv']))
+      form_set_error('cvv', t('Invalid CVV Number. Please enter in a 3 or 4 digit number'));
+      
+    /**
+     * Check for errors
+     */
+    if (is_array(form_get_errors()))//fail
+      return FALSE;
+    else
+      return TRUE;//success
+  }
+  
+  /**
+   * Get HTML table from subscription information
+   */
+  function get_subscription_info_html_table($sub){
+    //price
+    $rows [] = array('Price', '$'.$sub->price.' billed every ' . $sub->length . ' ' . 
+          preg_replace('/s$/', '(s)', $sub->unit) . 
+          ($sub->total_occurrences ? $sub->total_occurrences . ' times.' : '.'));
+    
+    //trial amount
+    if ($sub->trial_amount > 0)
+      $rows [] = array('Trial Amount', '$'.$sub->trial_amount.' billed for 1st '.$sub->trial_occurrences.' occurrences of the billing cycle.');
+    
+    $header = array(t('Term'), t('Description'));
+    $output .= theme('table', $header, $rows, NULL,'');
+    
+    return $output;
+  }
+  
+  /**
+   * Get assoc array of form values for subscription group
+   */
+  function get_group_form($form_values = NULL, $edit_mode = 'add'){
+    $form['name'] = array(
+        '#title' => t('Name'),
+      '#type' => 'textfield',
+        '#size' => 25,
+        '#maxlength' => 25,
+        '#default_value' => $form_values['name'],
+        '#required' => TRUE,
+        '#description' => 'Name the subscription group, e.g. "Book Club Membership".'
+    );
+    
+    $form['description'] = array(
+        '#title' => t('Description'),
+      '#type' => 'textarea',
+        '#default_value' => $form_values['description'],
+        '#description' => 'Describe the subscription group. This will be shown on the public subscription page.',
+        '#required' => TRUE
+    );
+    
+    /**
+     * Cannot modify length and unit of groups once they have been created
+     */
+    if ($edit_mode == 'add') {
+      $form['length'] = array(
+          '#title' => t('Subscription Length'),
+        '#type' => 'textfield',
+          '#size' => 3,
+          '#maxlength' => 3,
+          '#default_value' => $form_values['length'] ? $form_values['length'] : 1,//default to 1 if nothing selected
+          '#description' => 'Choose length of billing cycle, 1-12 for monthly billing, 1-365 for daily billing. Note this cannot ' .
+                    'be changed once the group has been created.',
+          '#required' => TRUE
+      );
+      
+      $form['unit'] = array(
+          '#type' => 'select',
+          '#title' => t('Unit'),
+          '#options' => array('days' => 'days', 'months' => 'months'),
+          '#default_value' => $form_values['unit'] ? $form_values['unit'] : 'months',//default to monthly if nothing selected
+          '#description' => 'Choose at what interval billing will occur, days or months. Note this cannot be changed once the ' .
+                    'group has been created.',
+          '#required' => TRUE 
+      );
+    }
+    else {//show uneditable values if edit mode
+      $form['length_and_unit'] = array(
+        '#type' => 'item',
+        '#title' => t('Subscription Length and Unit'),
+        '#value' => 'Billed every '.$form_values['length'] .' '.preg_replace('/s$/', '(s)', $form_values['unit']),//format nicer
+        '#description' => 'Cannot be modified'
+      );
+    }
+    
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => $edit_mode == 'add' ? t('Add Subscription Group') : t('Update Subscription Group'),
+    );
+    
+    return $form;
+  }
+  
+  /**
+   * Get grouped hash of role subscription data for display in radio options
+   * 
+   * @return array role subscription group names as the hash with the role subscription array being the value for each key
+   */
+  function group_subscription_radio_options(){
+    $result = Role_subscription_db::find_all();//get db result
+    
+    while ($row = db_fetch_object($result)) 
+      $groups [$row->group_name][$row->id] = '<span>'.$row->title.'</span><div class="role_subscription_radio_options">'.$row->description.'</div>';
+    
+    return $groups;
+  }
 }
\ No newline at end of file
Index: includes/user_subscription_db.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/includes/user_subscription_db.inc,v
retrieving revision 1.1
diff -u -r1.1 user_subscription_db.inc
--- includes/user_subscription_db.inc	24 May 2008 23:54:09 -0000	1.1
+++ includes/user_subscription_db.inc	25 May 2008 20:46:26 -0000
@@ -10,187 +10,187 @@
  * Functions for managing user subscriptions 
  */
 class User_subscription_db {
-	
-	/**
-	 * Cancel user subscription for ID
-	 * 
-	 * @param integer $id user subscription ID
-	 * 
-	 * @todo (add suspend/activate functionality if payment engine supports it)
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function cancel_subscription($id){
-		if (!$id) return;//fail
-		
-		return db_query('update {role_subscription_user_payments} set status = "cancelled" where id = "%d" limit 1;', $id);
-	}
-	
-	/**
-	 * Save payment data when a user subscribes and pays. This stores limited non-sensitive data ab the payment for reference, info
-	 *  about the subscription, and info connecting the merchant to drupal.
-	 * 
-	 * @param array $payment_info hash of payment info
-	 *   - "role_subscription_id" id of subscription being subscribed to
-	 *   - "first_name"
-	 *   - "last_name"
-	 *   - "phone"
-	 * 
-	 * @param object $subscription info about the subscription
-	 *   - "id" role subscription id
-	 * @param string merchant_id the id generated by the merchant that provides a link from this database to the payment engine (merchant)
-	 * @param integer invoice_id generated by helper function, a random number with a timestamp to act as a link from the payment engine
-	 *        to this database.
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function save_payment($payment_info, $subscription, $merchant_id, $invoice_id){
-		global $user;
-		
-		$query = "insert into {role_subscription_user_payments} (role_subscription_id, uid, first_name, last_name, phone, invoice_id, merchant_id) " .
-			     "values ('%d', '%d', '%s', '%s', '%s', '%s', '%s');";
-			   
-		return db_query($query, $subscription->id, $user->uid, $payment_info['first_name'], 
-								$payment_info['last_name'], $payment_info['phone'], $invoice_id, 
-								$merchant_id);//will return 1 if success
-	}
-	
-	/**
-	 * Update payment info in local database
-	 * 
-	 * @param array $payment_info form values for payment
-	 *   - "first_name"
-	 *   - "last_name"
-	 *   - "phone"
-	 *   
-	 * @param integer $id user subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function update_payment($payment_info, $id){
-		global $user;
-		
-		$query = "update {role_subscription_user_payments} set first_name = '%s', last_name = '%s', phone = '%s' where id = %d;";
-			   
-		return db_query($query, $payment_info['first_name'], $payment_info['last_name'], $payment_info['phone'], $id);//will return 1 if success
-	}
-	
-	/**
-	 * Find all user subscriptions
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */			
-	function find_all(){
-		$query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
-				"join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
-				"join {users} u on u.uid = rsp.uid " .
-				"where rsp.status = 'active'; ";
-	
-		return db_query($query);
-	}
-	
-	/**
-	 * Find all user subscriptions for a role subscription
-	 * 
-	 * @param integer $id role subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function find_all_for_subscription($id){
-		$query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
-				"join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
-				"join {users} u on u.uid = rsp.uid " .
-				"where rsp.status = 'active' and rs.id = %d; ";
-	
-		return db_query($query, $id);
-	}
-	
-	/**
-	 * Helper function to get all user subscriptions for a role subscription in an array
-	 * 
-	 * @param integer $id role subscription ID
-	 * 
-	 * @return array list of user subscriptions for role subscription
-	 */
-	function get_all_for_subscription($id){
-		$result = self::find_all_for_subscription($id);
-		
-		while ($row = db_fetch_object($result))
-			$subscriptions [] = $row;
-			
-		return $subscriptions;
-	}
-	
-	/**
-	 * Find user subscription
-	 * 
-	 * @param integer $id ID of user subscription
-	 * 
-	 * @return object user subscription data
-	 */
-	function find($id){
-		if (!$id) return;//fail
-		
-		$query = "select rsp.*, r.name as role, rs.title, u.name as username, rs.role_subscription_group_id from {role_subscription_user_payments} rsp " .
-				"join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
-				"join {users} u on u.uid = rsp.uid " .
-				"join {role} r on r.rid = rs.rid " .
-				"where rsp.status = 'active' and rsp.id = '%d';";
-	
-		return db_fetch_object(db_query($query, $id));
-	}
-	
-	/**
-	 * Find a user's subscriptions
-	 * 
-	 * @param integer $uid pass in user id
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function find_all_for_user($uid){
-		if (!$uid) return;//fail
-		
-		$query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
-				"join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
-				"join {users} u on u.uid = rsp.uid " .
-				"where rsp.status = 'active' and rsp.uid = %d; ";
-		
-		return db_query($query, $uid);
-	}
-	
-	/**
-	 * Get all user's subscriptions
-	 * 
-	 * @param integer $uid pass in user ID
-	 * 
-	 * @return array return associative array with role subscription ID's as the associative keys and the payment information
-	 *   as the value of each array item.
-	 */
-	function get_all_user_subscriptions($uid){
-		$result = self::find_all_for_user($uid);//get db result
-	
-		/**
-		 * Build hash
-		 */
-		while ($_ = db_fetch_object($result))
-			$user_subscriptions [$_->role_subscription_id] = $_;//assign role subscription as id
-			
-		return $user_subscriptions;
-	}
-	
-	/**
-	 * Change role subscription id for a user subscription (meaning that the user has chosen to upgrade/downgrade a subscription)
-	 * 
-	 * @param integer $id user subscription ID
-	 * @param integer $role_subscription_id role subscription ID
-	 * 
-	 * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
-	 */
-	function change_role_subscription($id, $role_subscription_id){
-		if (!$id OR !$role_subscription_id) return;//fail
-		
-		$query = 'update {role_subscription_user_payments} rsp set role_subscription_id = "%d" where id = "%d";';
-		
-		return db_query($query, $role_subscription_id, $id);	
-	}
+  
+  /**
+   * Cancel user subscription for ID
+   * 
+   * @param integer $id user subscription ID
+   * 
+   * @todo (add suspend/activate functionality if payment engine supports it)
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function cancel_subscription($id){
+    if (!$id) return;//fail
+    
+    return db_query('update {role_subscription_user_payments} set status = "cancelled" where id = "%d" limit 1;', $id);
+  }
+  
+  /**
+   * Save payment data when a user subscribes and pays. This stores limited non-sensitive data ab the payment for reference, info
+   *  about the subscription, and info connecting the merchant to drupal.
+   * 
+   * @param array $payment_info hash of payment info
+   *   - "role_subscription_id" id of subscription being subscribed to
+   *   - "first_name"
+   *   - "last_name"
+   *   - "phone"
+   * 
+   * @param object $subscription info about the subscription
+   *   - "id" role subscription id
+   * @param string merchant_id the id generated by the merchant that provides a link from this database to the payment engine (merchant)
+   * @param integer invoice_id generated by helper function, a random number with a timestamp to act as a link from the payment engine
+   *        to this database.
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function save_payment($payment_info, $subscription, $merchant_id, $invoice_id){
+    global $user;
+    
+    $query = "insert into {role_subscription_user_payments} (role_subscription_id, uid, first_name, last_name, phone, invoice_id, merchant_id) " .
+           "values ('%d', '%d', '%s', '%s', '%s', '%s', '%s');";
+         
+    return db_query($query, $subscription->id, $user->uid, $payment_info['first_name'], 
+                $payment_info['last_name'], $payment_info['phone'], $invoice_id, 
+                $merchant_id);//will return 1 if success
+  }
+  
+  /**
+   * Update payment info in local database
+   * 
+   * @param array $payment_info form values for payment
+   *   - "first_name"
+   *   - "last_name"
+   *   - "phone"
+   *   
+   * @param integer $id user subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function update_payment($payment_info, $id){
+    global $user;
+    
+    $query = "update {role_subscription_user_payments} set first_name = '%s', last_name = '%s', phone = '%s' where id = %d;";
+         
+    return db_query($query, $payment_info['first_name'], $payment_info['last_name'], $payment_info['phone'], $id);//will return 1 if success
+  }
+  
+  /**
+   * Find all user subscriptions
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */      
+  function find_all(){
+    $query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
+        "join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
+        "join {users} u on u.uid = rsp.uid " .
+        "where rsp.status = 'active'; ";
+  
+    return db_query($query);
+  }
+  
+  /**
+   * Find all user subscriptions for a role subscription
+   * 
+   * @param integer $id role subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function find_all_for_subscription($id){
+    $query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
+        "join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
+        "join {users} u on u.uid = rsp.uid " .
+        "where rsp.status = 'active' and rs.id = %d; ";
+  
+    return db_query($query, $id);
+  }
+  
+  /**
+   * Helper function to get all user subscriptions for a role subscription in an array
+   * 
+   * @param integer $id role subscription ID
+   * 
+   * @return array list of user subscriptions for role subscription
+   */
+  function get_all_for_subscription($id){
+    $result = self::find_all_for_subscription($id);
+    
+    while ($row = db_fetch_object($result))
+      $subscriptions [] = $row;
+      
+    return $subscriptions;
+  }
+  
+  /**
+   * Find user subscription
+   * 
+   * @param integer $id ID of user subscription
+   * 
+   * @return object user subscription data
+   */
+  function find($id){
+    if (!$id) return;//fail
+    
+    $query = "select rsp.*, r.name as role, rs.title, u.name as username, rs.role_subscription_group_id from {role_subscription_user_payments} rsp " .
+        "join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
+        "join {users} u on u.uid = rsp.uid " .
+        "join {role} r on r.rid = rs.rid " .
+        "where rsp.status = 'active' and rsp.id = '%d';";
+  
+    return db_fetch_object(db_query($query, $id));
+  }
+  
+  /**
+   * Find a user's subscriptions
+   * 
+   * @param integer $uid pass in user id
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function find_all_for_user($uid){
+    if (!$uid) return;//fail
+    
+    $query = "select rsp.*, rs.title, u.name as username from {role_subscription_user_payments} rsp " .
+        "join {role_subscription} rs on rs.id = rsp.role_subscription_id " .
+        "join {users} u on u.uid = rsp.uid " .
+        "where rsp.status = 'active' and rsp.uid = %d; ";
+    
+    return db_query($query, $uid);
+  }
+  
+  /**
+   * Get all user's subscriptions
+   * 
+   * @param integer $uid pass in user ID
+   * 
+   * @return array return associative array with role subscription ID's as the associative keys and the payment information
+   *   as the value of each array item.
+   */
+  function get_all_user_subscriptions($uid){
+    $result = self::find_all_for_user($uid);//get db result
+  
+    /**
+     * Build hash
+     */
+    while ($_ = db_fetch_object($result))
+      $user_subscriptions [$_->role_subscription_id] = $_;//assign role subscription as id
+      
+    return $user_subscriptions;
+  }
+  
+  /**
+   * Change role subscription id for a user subscription (meaning that the user has chosen to upgrade/downgrade a subscription)
+   * 
+   * @param integer $id user subscription ID
+   * @param integer $role_subscription_id role subscription ID
+   * 
+   * @return mixed a database query result resource, or FALSE if the query was not executed correctly.
+   */
+  function change_role_subscription($id, $role_subscription_id){
+    if (!$id OR !$role_subscription_id) return;//fail
+    
+    $query = 'update {role_subscription_user_payments} rsp set role_subscription_id = "%d" where id = "%d";';
+    
+    return db_query($query, $role_subscription_id, $id);  
+  }
 }
\ No newline at end of file
Index: role_subscription_admin/role_subscription_admin.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription_admin/role_subscription_admin.module,v
retrieving revision 1.1
diff -u -r1.1 role_subscription_admin.module
--- role_subscription_admin/role_subscription_admin.module	24 May 2008 23:54:09 -0000	1.1
+++ role_subscription_admin/role_subscription_admin.module	25 May 2008 20:46:46 -0000
@@ -12,14 +12,14 @@
 * @return help text for section
 */
 function role_subscription_admin_help($section='') {
-	switch ($section) {
-		case "admin/help#role_subscription":
-			$output = '<p>'.  t("Subscription, payments and role management all rolled into one."). '</p>';
-			break;
-		case 'admin/settings/role_subscription':
-      		return t('Manage your role subscriptions.');
-		case 'admin/settings/role_subscription/configure':
-      		return t('Select and configure payment engines here.');
+  switch ($section) {
+    case "admin/help#role_subscription":
+      $output = '<p>'.  t("Subscription, payments and role management all rolled into one."). '</p>';
+      break;
+    case 'admin/settings/role_subscription':
+          return t('Manage your role subscriptions.');
+    case 'admin/settings/role_subscription/configure':
+          return t('Select and configure payment engines here.');
   }
 
   return $output;
@@ -30,59 +30,59 @@
  * @param boolean $may_cache
  * @return array menu items
  */
-function role_subscription_admin_menu($may_cache) {	   
-	/**
-	 * Role subscription admin
-	 */	   
-	 
-	$items[] = array('path' => 'admin/settings/role_subscription',
-		'title' => t('Manage Role Subscriptions'),
-		'description' => t('Manage Role Subscriptions.'),
-		'callback' => 'role_subscription_admin_overview',
-		'access' => user_access('administer role_subscription'),
-    );
-	   
-	$items[] = array('path' => 'admin/settings/role_subscription/list',
-      	'weight' => 0,
-		'title' => t('List'),
-      	'callback' => 'role_subscription_admin_overview',
-      	'type' => MENU_DEFAULT_LOCAL_TASK,
-		'access' => user_access('administer role_subscription'),
+function role_subscription_admin_menu($may_cache) {     
+  /**
+   * Role subscription admin
+   */     
+   
+  $items[] = array('path' => 'admin/settings/role_subscription',
+    'title' => t('Manage Role Subscriptions'),
+    'description' => t('Manage Role Subscriptions.'),
+    'callback' => 'role_subscription_admin_overview',
+    'access' => user_access('administer role_subscription'),
+    );
+     
+  $items[] = array('path' => 'admin/settings/role_subscription/list',
+        'weight' => 0,
+    'title' => t('List'),
+        'callback' => 'role_subscription_admin_overview',
+        'type' => MENU_DEFAULT_LOCAL_TASK,
+    'access' => user_access('administer role_subscription'),
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/add',
-		'title' => t('Add Role Subscription'),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_admin_add_subscription'),
-		'type' => MENU_LOCAL_TASK,
-		'weight' => 1,
-		'access' => user_access('administer role_subscription'),
+    'title' => t('Add Role Subscription'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_admin_add_subscription'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 1,
+    'access' => user_access('administer role_subscription'),
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/edit',
-		'title' => t('Update Role Subscription'),
-		'description' => t('Update Role Subscription.'),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_admin_update_subscription'),
-		'access' => user_access('administer role_subscription'),
-		'type' => MENU_CALLBACK,
+    'title' => t('Update Role Subscription'),
+    'description' => t('Update Role Subscription.'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_admin_update_subscription'),
+    'access' => user_access('administer role_subscription'),
+    'type' => MENU_CALLBACK,
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/delete',
-		'title' => t('Delete role subscription'),
-		'description' => t('Delete Role Subscription.'),
-		'callback' => 'role_subscription_admin_delete_subscription',
-		'access' => user_access('administer role_subscription'),
-		'type' => MENU_CALLBACK,
+    'title' => t('Delete role subscription'),
+    'description' => t('Delete Role Subscription.'),
+    'callback' => 'role_subscription_admin_delete_subscription',
+    'access' => user_access('administer role_subscription'),
+    'type' => MENU_CALLBACK,
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/configure',
-      	'title' => t('Configure'),
-      	'weight' => 2,
-      	'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_admin_configure'),
-      	'type' => MENU_LOCAL_TASK,
-		'access' => user_access('administer role_subscription'),
+        'title' => t('Configure'),
+        'weight' => 2,
+        'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_admin_configure'),
+        'type' => MENU_LOCAL_TASK,
+    'access' => user_access('administer role_subscription'),
     );
     
     /**
@@ -90,20 +90,20 @@
      */
      
     $items[] = array('path' => 'admin/settings/role_subscription/group/add',
-		'title' => t('Add Subscription Group'),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_admin_add_group'),
-		'type' => MENU_LOCAL_TASK,
-		'weight' => 2,
-		'access' => user_access('administer role_subscription'),
+    'title' => t('Add Subscription Group'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_admin_add_group'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2,
+    'access' => user_access('administer role_subscription'),
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/group/edit',
-		'title' => t('Update Subscription Group'),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_admin_edit_group'),
-		'type' => MENU_CALLBACK,
-		'access' => user_access('administer role_subscription'),
+    'title' => t('Update Subscription Group'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_admin_edit_group'),
+    'type' => MENU_CALLBACK,
+    'access' => user_access('administer role_subscription'),
     );
     
     /**
@@ -111,28 +111,28 @@
      */
     
     $items[] = array('path' => 'admin/settings/role_subscription/user_subscriptions',
-		'title' => t('Manage User Subscriptions'),
-		'description' => t('Manage User Subscriptions.'),
-		'callback' => 'role_subscription_admin_user_subscription_overview',
-		'access' => user_access('administer role_subscription'),
+    'title' => t('Manage User Subscriptions'),
+    'description' => t('Manage User Subscriptions.'),
+    'callback' => 'role_subscription_admin_user_subscription_overview',
+    'access' => user_access('administer role_subscription'),
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/user_subscriptions/list',
-      	'title' => t('List'),
-      	'weight' => 0,
-      	'callback' => 'role_subscription_admin_user_subscription_overview',
-      	'type' => MENU_LOCAL_TASK,
-		'access' => user_access('administer role_subscription'),
+        'title' => t('List'),
+        'weight' => 0,
+        'callback' => 'role_subscription_admin_user_subscription_overview',
+        'type' => MENU_LOCAL_TASK,
+    'access' => user_access('administer role_subscription'),
     );
     
     $items[] = array('path' => 'admin/settings/role_subscription/user_subscriptions/cancel',
-      	'title' => t('Cancel User Subscription'),
-      	'callback' => 'role_subscription_admin_user_subscription_cancel',
-      	'type' => MENU_CALLBACK,
-		'access' => user_access('administer role_subscription'),
+        'title' => t('Cancel User Subscription'),
+        'callback' => 'role_subscription_admin_user_subscription_cancel',
+        'type' => MENU_CALLBACK,
+    'access' => user_access('administer role_subscription'),
     );
-		   
-	return $items;
+       
+  return $items;
 }
 
 /**
@@ -142,50 +142,50 @@
  * @return string output of admin content
  */
 function role_subscription_admin_overview(){
-	drupal_add_js('misc/collapse.js');
-	
-	/**
-	 * Fetch role subscriptions
-	 */
-	
-	if ($groups = Role_subscription_db::find_all_in_groups()) {
-		/**
-		 * Iterate through groups
-		 */
-		foreach ($groups as $group_name => $group) {
-			$rows = array();
-			
-			/**
-			 * Iterate through each subscription
-			 */
-			foreach ($group as $_) {
-				$rows [] = array($_->title, l($_->role, 'admin/user/roles/edit/'.$_->rid), 
-								'$'.$_->price, $_->description, date('m/d/Y',strtotime($_->created_at)),
-								l('edit', 'admin/settings/role_subscription/edit/'.$_->id), 
-								l('delete', 'admin/settings/role_subscription/delete/'.$_->id, 
-								array('onClick' => 'return confirm(\'Are you sure you want to delete this role subscription? This will ' .
-												   ' delete all user subscriptions for this role subscription. This cannot be undone.\');')));
-			}
-			
-			/**
-			 * Theme table with subscriptions for group
-			 */
-			if (count($rows) > 0) {
-				$header = array(t('Title'), t('Role'), t('Price'), t('Description'), t('Created On'), array('data' => t('Operations'), 'colspan' => 2));
-								
-				$table = theme('table', $header, $rows, array('width' => '100%'));
-								
-				$group_edit_link = l('Edit '.$group_name, 'admin/settings/role_subscription/group/edit/'.$_->role_subscription_group_id);
-				
-				$output .= '<fieldset class="collapsible">'."<legend>{$group_name}</legend>";
-				$output .= $table.'<div>'.$group_edit_link.'</div>'.'</fieldset>'."\n";
-			}
-		}
-	}
-	else
-		$output .= '<p>No role subscriptions found.</p>';
-	
-	return $output;
+  drupal_add_js('misc/collapse.js');
+  
+  /**
+   * Fetch role subscriptions
+   */
+  
+  if ($groups = Role_subscription_db::find_all_in_groups()) {
+    /**
+     * Iterate through groups
+     */
+    foreach ($groups as $group_name => $group) {
+      $rows = array();
+      
+      /**
+       * Iterate through each subscription
+       */
+      foreach ($group as $_) {
+        $rows [] = array($_->title, l($_->role, 'admin/user/roles/edit/'.$_->rid), 
+                '$'.$_->price, $_->description, date('m/d/Y',strtotime($_->created_at)),
+                l('edit', 'admin/settings/role_subscription/edit/'.$_->id), 
+                l('delete', 'admin/settings/role_subscription/delete/'.$_->id, 
+                array('onClick' => 'return confirm(\'Are you sure you want to delete this role subscription? This will ' .
+                           ' delete all user subscriptions for this role subscription. This cannot be undone.\');')));
+      }
+      
+      /**
+       * Theme table with subscriptions for group
+       */
+      if (count($rows) > 0) {
+        $header = array(t('Title'), t('Role'), t('Price'), t('Description'), t('Created On'), array('data' => t('Operations'), 'colspan' => 2));
+                
+        $table = theme('table', $header, $rows, array('width' => '100%'));
+                
+        $group_edit_link = l('Edit '.$group_name, 'admin/settings/role_subscription/group/edit/'.$_->role_subscription_group_id);
+        
+        $output .= '<fieldset class="collapsible">'."<legend>{$group_name}</legend>";
+        $output .= $table.'<div>'.$group_edit_link.'</div>'.'</fieldset>'."\n";
+      }
+    }
+  }
+  else
+    $output .= '<p>No role subscriptions found.</p>';
+  
+  return $output;
 }
 
 /**
@@ -193,104 +193,104 @@
  * @return array return system settings form
  */
 function role_subscription_admin_configure() {
-	/**
-	 * Output payment engine options
-	 */
-	if ($modules = module_implements('engine_info') AND count($modules) > 0) {
-		/**
-		 * Iterate through modules that implement hook engine_info
-		 */
-		foreach ($modules as $m) {
-			if (!$info = module_invoke($m, 'engine_info')) continue;
-			
-			$options[$m] = '';
-			
-			$form[$m]['id'] = array('#value' => $m);
-		    $form[$m]['engine'] = array('#value' => $info['label']);
-		    $form[$m]['description'] = array('#value' => $info['description']);
-		    $form[$m]['configure'] = array('#value' => l(t('configure'), 'admin/settings/role_subscription/'. $m));
-		}
-	}
-	
-	$form['role_subscription_main_page_title'] = array(
-	    '#title' => t('Main Subscription Page Title'),
-		'#type' => 'textfield',
-	    '#size' => 50,
-	    '#maxlength' => 50,
-	    '#default_value' => variable_get('role_subscription_main_page_title', 'Subscribe to Role Subscriptions'),
-	    '#description' => 'This title will be displayed on the main public subscription page.'
-	);
-	
-	$form['role_subscription_main_page_text'] = array(
-	    '#title' => t('Main Subscription Page Text'),
-		'#type' => 'textarea',
-	    '#default_value' => variable_get('role_subscription_main_page_text', ''),
-	    '#description' => 'This text will be displayed at the top of the main public subscription page.'
-	);
-	
-	$form['role_subscription_subscribe_title'] = array(
-	    '#title' => t('Subscribe Page Title'),
-		'#type' => 'textfield',
-	    '#size' => 50,
-	    '#maxlength' => 50,
-	    '#default_value' => variable_get('role_subscription_subscribe_title', 'Subscribe Details Page'),
-	    '#description' => 'This title will be display on the subscribe details page.'
-	);
-	
-	$form['role_subscription_pay_title'] = array(
-	    '#title' => t('Payment Page Title'),
-		'#type' => 'textfield',
-	    '#size' => 50,
-	    '#maxlength' => 50,
-	    '#default_value' => variable_get('role_subscription_pay_title', 'Billing Information'),
-	    '#description' => 'This title will be display on the payment page.'
-	);
-	
-	$form['role_subscription_demo_mode'] = array(
-	    '#title' => t('Demo Mode?'),
-		'#type' => 'checkbox',
-	    '#default_value' => variable_get('role_subscription_demo_mode', ''),
-	    '#description' => 'This will create dummy billing data on the payment screen.'
-	);
-	
-	$form['role_subscription_fake_payment'] = array(
-	    '#title' => t('Fake Merchant Payment Engine Calls?'),
-		'#type' => 'checkbox',
-	    '#default_value' => variable_get('role_subscription_fake_payment', ''),
-	    '#description' => 'This will fake the web service calls between the drupal client application and the merchant payment engine. ' .
-	    				  'The merchant ID for these transactions will be "demo". Payment data is still stored in the database and roles are still ' .
-	    				  'granted.'
-	);
-	
-	$form['role_subscription_stylesheet'] = array(
-	    '#title' => t('Module Stylesheet'),
-		'#type' => 'textfield',
-	    '#size' => 60,
-	    '#default_value' => variable_get('role_subscription_stylesheet', 'sites/all/modules/role_subscription/css/default.css'),
-	    '#description' => 'Select your stylesheet, use default, custom css or none.'
-	); 
-	
-	$form['role_subscription_engine'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('role_subscription_engine', ''));
-	
-	return system_settings_form($form);
+  /**
+   * Output payment engine options
+   */
+  if ($modules = module_implements('engine_info') AND count($modules) > 0) {
+    /**
+     * Iterate through modules that implement hook engine_info
+     */
+    foreach ($modules as $m) {
+      if (!$info = module_invoke($m, 'engine_info')) continue;
+      
+      $options[$m] = '';
+      
+      $form[$m]['id'] = array('#value' => $m);
+        $form[$m]['engine'] = array('#value' => $info['label']);
+        $form[$m]['description'] = array('#value' => $info['description']);
+        $form[$m]['configure'] = array('#value' => l(t('configure'), 'admin/settings/role_subscription/'. $m));
+    }
+  }
+  
+  $form['role_subscription_main_page_title'] = array(
+      '#title' => t('Main Subscription Page Title'),
+    '#type' => 'textfield',
+      '#size' => 50,
+      '#maxlength' => 50,
+      '#default_value' => variable_get('role_subscription_main_page_title', 'Subscribe to Role Subscriptions'),
+      '#description' => 'This title will be displayed on the main public subscription page.'
+  );
+  
+  $form['role_subscription_main_page_text'] = array(
+      '#title' => t('Main Subscription Page Text'),
+    '#type' => 'textarea',
+      '#default_value' => variable_get('role_subscription_main_page_text', ''),
+      '#description' => 'This text will be displayed at the top of the main public subscription page.'
+  );
+  
+  $form['role_subscription_subscribe_title'] = array(
+      '#title' => t('Subscribe Page Title'),
+    '#type' => 'textfield',
+      '#size' => 50,
+      '#maxlength' => 50,
+      '#default_value' => variable_get('role_subscription_subscribe_title', 'Subscribe Details Page'),
+      '#description' => 'This title will be display on the subscribe details page.'
+  );
+  
+  $form['role_subscription_pay_title'] = array(
+      '#title' => t('Payment Page Title'),
+    '#type' => 'textfield',
+      '#size' => 50,
+      '#maxlength' => 50,
+      '#default_value' => variable_get('role_subscription_pay_title', 'Billing Information'),
+      '#description' => 'This title will be display on the payment page.'
+  );
+  
+  $form['role_subscription_demo_mode'] = array(
+      '#title' => t('Demo Mode?'),
+    '#type' => 'checkbox',
+      '#default_value' => variable_get('role_subscription_demo_mode', ''),
+      '#description' => 'This will create dummy billing data on the payment screen.'
+  );
+  
+  $form['role_subscription_fake_payment'] = array(
+      '#title' => t('Fake Merchant Payment Engine Calls?'),
+    '#type' => 'checkbox',
+      '#default_value' => variable_get('role_subscription_fake_payment', ''),
+      '#description' => 'This will fake the web service calls between the drupal client application and the merchant payment engine. ' .
+                'The merchant ID for these transactions will be "demo". Payment data is still stored in the database and roles are still ' .
+                'granted.'
+  );
+  
+  $form['role_subscription_stylesheet'] = array(
+      '#title' => t('Module Stylesheet'),
+    '#type' => 'textfield',
+      '#size' => 60,
+      '#default_value' => variable_get('role_subscription_stylesheet', 'sites/all/modules/role_subscription/css/default.css'),
+      '#description' => 'Select your stylesheet, use default, custom css or none.'
+  ); 
+  
+  $form['role_subscription_engine'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('role_subscription_engine', ''));
+  
+  return system_settings_form($form);
 }
 
 /**
  * Add a role subscription form
  * @return array role subscription form
  */
-function role_subscription_admin_add_subscription() {	
-	/**
-	 * Redirect to add group page if no subscription groups found
-	 */
-	if (!Role_subscription_db::get_groups_count()) {
-		drupal_set_message('No subscription groups were found, please add a subscription group first.');
-		drupal_goto('admin/settings/role_subscription/group/add');
-	}
-	
-	$form = Role_subscription_form::get_form(NULL, 'add');
-	
-	return $form;
+function role_subscription_admin_add_subscription() {  
+  /**
+   * Redirect to add group page if no subscription groups found
+   */
+  if (!Role_subscription_db::get_groups_count()) {
+    drupal_set_message('No subscription groups were found, please add a subscription group first.');
+    drupal_goto('admin/settings/role_subscription/group/add');
+  }
+  
+  $form = Role_subscription_form::get_form(NULL, 'add');
+  
+  return $form;
 }
 
 /**
@@ -304,8 +304,8 @@
  * @return boolean return FALSE if validation failed
  */
 function role_subscription_admin_add_subscription_validate($form_id, $form_values) {
-	
-	return Role_subscription_form::get_validate_form($form_id, $form_values, 'add');
+  
+  return Role_subscription_form::get_validate_form($form_id, $form_values, 'add');
 }
 
 /**
@@ -319,20 +319,20 @@
  * @return boolean return FALSE if failed or redirect if successful
  */
 function role_subscription_admin_add_subscription_submit($form_id, $form_values) {
-	
-	/**
-	 * Try to add subscription to database
-	 */
-	if ($result = Role_subscription_db::add_subscription($form_values)) {
-		drupal_set_message(t('Role subscription added successfully.'));
-		drupal_goto('admin/settings/role_subscription');	
-	}
-	else {
-		form_set_error('', t('A database error has occurred. Please look in the error logs ' .
-		 					'and log an issue with a detailed explanation at drupal.org.'));
-		
-		return FALSE;
-	}
+  
+  /**
+   * Try to add subscription to database
+   */
+  if ($result = Role_subscription_db::add_subscription($form_values)) {
+    drupal_set_message(t('Role subscription added successfully.'));
+    drupal_goto('admin/settings/role_subscription');  
+  }
+  else {
+    form_set_error('', t('A database error has occurred. Please look in the error logs ' .
+               'and log an issue with a detailed explanation at drupal.org.'));
+    
+    return FALSE;
+  }
 }
 
 
@@ -341,22 +341,22 @@
  * 
  * @return array role subscription update form
  */
-function role_subscription_admin_update_subscription() {	
-	if (!$id = arg(4)) return FALSE;//get id from url
-	
-	/**
-	 * Find role subscription
-	 */
-	if (!$role_subscription = Role_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find role subscription.');
-		drupal_goto('admin/settings/role_subscription');
-	}
-	
-	if (!$_POST) $form_values = (array) $role_subscription;//If the form hasn't been submitted get values from database
-
-	$form = Role_subscription_form::get_form($form_values, 'edit');//cast form values as assoc array
-	
-	return $form;
+function role_subscription_admin_update_subscription() {  
+  if (!$id = arg(4)) return FALSE;//get id from url
+  
+  /**
+   * Find role subscription
+   */
+  if (!$role_subscription = Role_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find role subscription.');
+    drupal_goto('admin/settings/role_subscription');
+  }
+  
+  if (!$_POST) $form_values = (array) $role_subscription;//If the form hasn't been submitted get values from database
+
+  $form = Role_subscription_form::get_form($form_values, 'edit');//cast form values as assoc array
+  
+  return $form;
 }
 
 /**
@@ -370,15 +370,15 @@
  * @return boolean return FALSE if failed or redirect if successful 
  */
 function role_subscription_admin_update_subscription_validate($form_id, $form_values) {
-	if (!$id = arg(4)) {//get id from url
-		form_set_error('', 'No role subscription specified.');
-		
-		return FALSE;
-	}
+  if (!$id = arg(4)) {//get id from url
+    form_set_error('', 'No role subscription specified.');
+    
+    return FALSE;
+  }
 
-	if (!_role_subscription_verify_engine()) return FALSE;//verify engine is configured before continuing
+  if (!_role_subscription_verify_engine()) return FALSE;//verify engine is configured before continuing
 
-	return Role_subscription_form::get_validate_form($form_id, $form_values, 'edit', $id);//pass id
+  return Role_subscription_form::get_validate_form($form_id, $form_values, 'edit', $id);//pass id
 }
 
 /**
@@ -391,70 +391,70 @@
  * @return boolean return FALSE if failed or redirect if successful
  */
 function role_subscription_admin_update_subscription_submit($form_id, $form_values) {
-	if (!$id = arg(4)) return FALSE;//get id from url
-	
-	/**
-	 * Find role subscription
-	 */
-	if (!$role_subscription = Role_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find role subscription.');
-		
-		return FALSE;
-	}
-	
-	/**
-	 * Verify that subscription has changed before continuing
-	 */
-	if (!Role_subscription_db::subscription_has_changed($form_values, $id)) {
-		drupal_set_message(t('No change was made. No update needed.'));
-		return FALSE;//abort
-	}
-	
-	/**
-	 * Show error if unable to update subscription in database
-	 */
-	if (!$result = Role_subscription_db::edit_subscription($form_values, $id)) {
-		form_set_error('', t('A database error has occurred. Please look in the error logs ' .
-		 					'and log an issue with a detailed explanation at drupal.org.'));
-		return FALSE;
-	}
-	
-	/**
-	 * Look for user subscriptions using this subscription
-	 */
-	if (!$user_subscriptions = User_subscription_db::get_all_for_subscription($id))
-		drupal_set_message("No user subscriptions found, no payment engine updates needed.");
-	else {//user subscriptions found
-		/**
-		 * Go through each subscription and update in payment engine
-		 */
-		foreach ($user_subscriptions as $row) {
-			/**
-			 * If fake payment mode not enabled, call payment engine update terms hook
-			 */
-			if (variable_get('role_subscription_fake_payment', '') != TRUE)
-				/**
-				 * Invoke update terms for merchant subscription to match updated role subscription.
-				 * If there is an error this is a problem bc the database was just updated but the user's
-				 * subscription in the payment engine is now out of sync. This will log a severe error to watchdog,
-				 * which can be corrected a few different ways: a) modifying/fixing the subscription in the payment engine, b) running
-				 * this update again and it working again, c) fixing the user's subscription record if it has the issue, etc.
-				 */
-				if (!$result = module_invoke($engine, 'update_terms', $role_subscription, $row->merchant_id)) {
-					$error = "Unable to update subsciption invoice id #{$row->invoice_id} in remote payment engine.";
-					
-					form_set_error('', $error);
-					watchdog('error', $error, WATCHDOG_ERROR);//log error
-					
-					continue;//go to next
-				}
-				
-			drupal_set_message("User subscription invoice id #{$row->invoice_id} updated successfully.");//set success message for each subscription
-		}
-	}
-	
-	drupal_set_message(t('Role subscription updated successfully.'));
-	drupal_goto('admin/settings/role_subscription');
+  if (!$id = arg(4)) return FALSE;//get id from url
+  
+  /**
+   * Find role subscription
+   */
+  if (!$role_subscription = Role_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find role subscription.');
+    
+    return FALSE;
+  }
+  
+  /**
+   * Verify that subscription has changed before continuing
+   */
+  if (!Role_subscription_db::subscription_has_changed($form_values, $id)) {
+    drupal_set_message(t('No change was made. No update needed.'));
+    return FALSE;//abort
+  }
+  
+  /**
+   * Show error if unable to update subscription in database
+   */
+  if (!$result = Role_subscription_db::edit_subscription($form_values, $id)) {
+    form_set_error('', t('A database error has occurred. Please look in the error logs ' .
+               'and log an issue with a detailed explanation at drupal.org.'));
+    return FALSE;
+  }
+  
+  /**
+   * Look for user subscriptions using this subscription
+   */
+  if (!$user_subscriptions = User_subscription_db::get_all_for_subscription($id))
+    drupal_set_message("No user subscriptions found, no payment engine updates needed.");
+  else {//user subscriptions found
+    /**
+     * Go through each subscription and update in payment engine
+     */
+    foreach ($user_subscriptions as $row) {
+      /**
+       * If fake payment mode not enabled, call payment engine update terms hook
+       */
+      if (variable_get('role_subscription_fake_payment', '') != TRUE)
+        /**
+         * Invoke update terms for merchant subscription to match updated role subscription.
+         * If there is an error this is a problem bc the database was just updated but the user's
+         * subscription in the payment engine is now out of sync. This will log a severe error to watchdog,
+         * which can be corrected a few different ways: a) modifying/fixing the subscription in the payment engine, b) running
+         * this update again and it working again, c) fixing the user's subscription record if it has the issue, etc.
+         */
+        if (!$result = module_invoke($engine, 'update_terms', $role_subscription, $row->merchant_id)) {
+          $error = "Unable to update subsciption invoice id #{$row->invoice_id} in remote payment engine.";
+          
+          form_set_error('', $error);
+          watchdog('error', $error, WATCHDOG_ERROR);//log error
+          
+          continue;//go to next
+        }
+        
+      drupal_set_message("User subscription invoice id #{$row->invoice_id} updated successfully.");//set success message for each subscription
+    }
+  }
+  
+  drupal_set_message(t('Role subscription updated successfully.'));
+  drupal_goto('admin/settings/role_subscription');
 }
 
 /**
@@ -467,70 +467,70 @@
  * 
  * @return boolean FALSE if failed or sometimes will redirect
  */
-function role_subscription_admin_delete_subscription() {	
-	if (!$id = arg(4)) return FALSE;//get id from url
-	
-	if (!_role_subscription_verify_engine()) return FALSE;//verify engine is configured before continuing
-	
-	/**
-	 * Attempt to cancel subscription
-	 */
-	if (!$result = Role_subscription_db::cancel($id)) {//error or couldn't find
-		form_set_error('', 'Unable to delete role subscription.');
-		drupal_goto('admin/settings/role_subscription');
-	}
-	
-	/**
-	 * Look for user subscriptions using this subscription
-	 */
-	if (!$user_subscriptions = User_subscription_db::get_all_for_subscription($id))
-		drupal_set_message("No user subscriptions found, no payment engine cancellations needed.");
-	else {//user subscriptions found
-		/**
-		 * Go through each subscription and cancel subscription in db payment engine
-		 */
-		foreach ($user_subscriptions as $row) {
-			/**
-			 * Cancel user subscription in database
-			 * 
-			 * If the database call fails, this is serious bc the payment is still active in the database
-			 * and payment engine so this will be logged as the most severe error and will have to be corrected manually
-			 */
-			if (!$result = User_subscription_db::cancel_subscription($row->id)) {
-				$error = "Unable to cancel subsciption invoice id #{$row->invoice_id} in database.";
-					
-				form_set_error('', $error);
-				watchdog('error', $error, WATCHDOG_ERROR);//log error
-				
-				continue;//go to next
-			}
-			
-			/**
-			 * If fake payment mode not enabled, call payment engine cancel_subscription hook
-			 */
-			if (variable_get('role_subscription_fake_payment', '') != TRUE)
-				
-				/**
-				 * Cancel user subscription in payment engine
-				 * 
-				 * If the payment engine call fails this is serious, so log most severe error and an admin will
-				 * most likely have to clean this up manually in the db, merchant payment engine or some combination
-				 */
-				if (!$result = module_invoke($engine, 'cancel_subscription', $row->merchant_id)) {
-					$error = "Unable to cancel subsciption invoice id #{$row->invoice_id} in remote payment engine.";
-					
-					form_set_error('', $error);
-					watchdog('error', $error, WATCHDOG_ERROR);//log error
-					
-					continue;//go to next
-				}
-				
-			drupal_set_message("User subscription invoice id #{$row->invoice_id} cancelled successfully.");//set success message for each subscription
-		}
-	}
-	
-	drupal_set_message(t('Role subscription deleted successfully.'));
-	drupal_goto('admin/settings/role_subscription');
+function role_subscription_admin_delete_subscription() {  
+  if (!$id = arg(4)) return FALSE;//get id from url
+  
+  if (!_role_subscription_verify_engine()) return FALSE;//verify engine is configured before continuing
+  
+  /**
+   * Attempt to cancel subscription
+   */
+  if (!$result = Role_subscription_db::cancel($id)) {//error or couldn't find
+    form_set_error('', 'Unable to delete role subscription.');
+    drupal_goto('admin/settings/role_subscription');
+  }
+  
+  /**
+   * Look for user subscriptions using this subscription
+   */
+  if (!$user_subscriptions = User_subscription_db::get_all_for_subscription($id))
+    drupal_set_message("No user subscriptions found, no payment engine cancellations needed.");
+  else {//user subscriptions found
+    /**
+     * Go through each subscription and cancel subscription in db payment engine
+     */
+    foreach ($user_subscriptions as $row) {
+      /**
+       * Cancel user subscription in database
+       * 
+       * If the database call fails, this is serious bc the payment is still active in the database
+       * and payment engine so this will be logged as the most severe error and will have to be corrected manually
+       */
+      if (!$result = User_subscription_db::cancel_subscription($row->id)) {
+        $error = "Unable to cancel subsciption invoice id #{$row->invoice_id} in database.";
+          
+        form_set_error('', $error);
+        watchdog('error', $error, WATCHDOG_ERROR);//log error
+        
+        continue;//go to next
+      }
+      
+      /**
+       * If fake payment mode not enabled, call payment engine cancel_subscription hook
+       */
+      if (variable_get('role_subscription_fake_payment', '') != TRUE)
+        
+        /**
+         * Cancel user subscription in payment engine
+         * 
+         * If the payment engine call fails this is serious, so log most severe error and an admin will
+         * most likely have to clean this up manually in the db, merchant payment engine or some combination
+         */
+        if (!$result = module_invoke($engine, 'cancel_subscription', $row->merchant_id)) {
+          $error = "Unable to cancel subsciption invoice id #{$row->invoice_id} in remote payment engine.";
+          
+          form_set_error('', $error);
+          watchdog('error', $error, WATCHDOG_ERROR);//log error
+          
+          continue;//go to next
+        }
+        
+      drupal_set_message("User subscription invoice id #{$row->invoice_id} cancelled successfully.");//set success message for each subscription
+    }
+  }
+  
+  drupal_set_message(t('Role subscription deleted successfully.'));
+  drupal_goto('admin/settings/role_subscription');
 }
 
 /**
@@ -543,31 +543,31 @@
  * @return string output of user subscription admin page
  */
 function role_subscription_admin_user_subscription_overview(){
-	
-	$result = User_subscription_db::find_all();//return query result
-	
-	while ($_ = db_fetch_object($result)) {
-		//$action = $_->status == 'active' ? 'suspend' : 'activate';
-		
-		$rows [] = array(l($_->title, 'admin/settings/role_subscription/edit/'.$_->role_subscription_id), l($_->username, 'user/'.$_->uid), 
-						$_->phone, $_->invoice_id, date('m/d/Y', strtotime($_->created_at)),
-						//l($action, 'admin/settings/role_subscription/user_subscriptions/'.$action.'/'.$_->id), 
-						l('cancel', 'admin/settings/role_subscription/user_subscriptions/cancel/'.$_->id, 
-						array('onClick' => 'return confirm(\'Are you sure you want to cancel this user subscription?\');')));
-	}
-
-	/**
-	 * If user subscriptions found
-	 */
-	if ($rows) {
-		$header = array(t('Subscription'), t('Username'), t('Phone'), t('Invoice ID'), t('Created On'), array('data' => t('Operations'), 'colspan' => 1));
-				
-		$output .= theme('table', $header, $rows);
-	}
-	else//none found
-		$output .= '<p>No user subscriptions found.</p>'."\n";
-	
-	return $output;
+  
+  $result = User_subscription_db::find_all();//return query result
+  
+  while ($_ = db_fetch_object($result)) {
+    //$action = $_->status == 'active' ? 'suspend' : 'activate';
+    
+    $rows [] = array(l($_->title, 'admin/settings/role_subscription/edit/'.$_->role_subscription_id), l($_->username, 'user/'.$_->uid), 
+            $_->phone, $_->invoice_id, date('m/d/Y', strtotime($_->created_at)),
+            //l($action, 'admin/settings/role_subscription/user_subscriptions/'.$action.'/'.$_->id), 
+            l('cancel', 'admin/settings/role_subscription/user_subscriptions/cancel/'.$_->id, 
+            array('onClick' => 'return confirm(\'Are you sure you want to cancel this user subscription?\');')));
+  }
+
+  /**
+   * If user subscriptions found
+   */
+  if ($rows) {
+    $header = array(t('Subscription'), t('Username'), t('Phone'), t('Invoice ID'), t('Created On'), array('data' => t('Operations'), 'colspan' => 1));
+        
+    $output .= theme('table', $header, $rows);
+  }
+  else//none found
+    $output .= '<p>No user subscriptions found.</p>'."\n";
+  
+  return $output;
 }
 
 /**
@@ -576,47 +576,47 @@
  * Will cancel the user's subscription in the db and payment engine and redirect
  */
 function role_subscription_admin_user_subscription_cancel(){
-	global $user;
-	
-	_role_subscription_verify_engine('admin/settings/role_subscription/user_subscriptions');//verify that payment engine is configured
-	
-	$id = arg(5); //get id from url
-	
-	/**
-	 * Look for user subscription
-	 */
-	if (!$user_subscription = User_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('admin/settings/role_subscription/user_subscriptions');
-	}
-	
-	/**
-	 * Fake cancel if set in admin config
-	 */
-	if (variable_get('role_subscription_fake_payment', '') == TRUE)
-		$result = TRUE;
-	/**
-	 * Call payment engine cancel method
-	 */
-	else
-		$result = module_invoke($engine, 'cancel_subscription', $user_subscription->merchant_id);
-	
-	/**
-	 * If payment engine call successful then cancel in database
-	 */
-	if ($result)
-		$result = User_subscription_db::cancel_subscription($id);
-	
-	if ($result) {
-		Role_subscription::remove_user_role($user_subscription->role, $user->uid);//remove user role
-		
-		drupal_set_message(t('User subscription cancelled successfully.'));
-	}
-	else//error or couldn't find
-		form_set_error('', 'Unable to cancel user subscription.');
-	
-	drupal_goto('admin/settings/role_subscription/user_subscriptions');//redirect	
+  global $user;
+  
+  _role_subscription_verify_engine('admin/settings/role_subscription/user_subscriptions');//verify that payment engine is configured
+  
+  $id = arg(5); //get id from url
+  
+  /**
+   * Look for user subscription
+   */
+  if (!$user_subscription = User_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('admin/settings/role_subscription/user_subscriptions');
+  }
+  
+  /**
+   * Fake cancel if set in admin config
+   */
+  if (variable_get('role_subscription_fake_payment', '') == TRUE)
+    $result = TRUE;
+  /**
+   * Call payment engine cancel method
+   */
+  else
+    $result = module_invoke($engine, 'cancel_subscription', $user_subscription->merchant_id);
+  
+  /**
+   * If payment engine call successful then cancel in database
+   */
+  if ($result)
+    $result = User_subscription_db::cancel_subscription($id);
+  
+  if ($result) {
+    Role_subscription::remove_user_role($user_subscription->role, $user->uid);//remove user role
+    
+    drupal_set_message(t('User subscription cancelled successfully.'));
+  }
+  else//error or couldn't find
+    form_set_error('', 'Unable to cancel user subscription.');
+  
+  drupal_goto('admin/settings/role_subscription/user_subscriptions');//redirect  
 }
 
 /**
@@ -628,9 +628,9 @@
  * @return array group form
  */
 function role_subscription_admin_add_group(){
-	$form = Role_subscription_form::get_group_form();
-	
-	return $form;
+  $form = Role_subscription_form::get_group_form();
+  
+  return $form;
 }
 
 /**
@@ -644,19 +644,19 @@
  * @return boolean return FALSE if failed or redirect if successful
  */
 function role_subscription_admin_add_group_validate($form_id, $form_values){
-	
-	/**
-	 * Subscription Length
-	 */
-	if (!ctype_digit($form_values['length'])) {
-		form_set_error('length', t('The Subscription Length must be a valid number only.'));
-	}
-	
-	/**
-	 * Susbcription Unit
-	 */
-	if (!in_array($form_values['unit'], array('days', 'months')))
-		form_set_error('unit', t('The Subscription Unit value can only be "days" or "months".'));
+  
+  /**
+   * Subscription Length
+   */
+  if (!ctype_digit($form_values['length'])) {
+    form_set_error('length', t('The Subscription Length must be a valid number only.'));
+  }
+  
+  /**
+   * Susbcription Unit
+   */
+  if (!in_array($form_values['unit'], array('days', 'months')))
+    form_set_error('unit', t('The Subscription Unit value can only be "days" or "months".'));
 }
 
 /**
@@ -670,17 +670,17 @@
  * @return boolean return FALSE if failed or redirect if successful
  */
 function role_subscription_admin_add_group_submit($form_id, $form_values){
-	/**
-	 * Try to add group
-	 */
-	if (Role_subscription_db::add_group($form_values)) {
-		drupal_set_message(t('Subscription group added successfully.'));
-		drupal_goto('admin/settings/role_subscription');//go back to role subscription page
-	} else {
-		form_set_error('', 'Unable to add subscription group. Please contact an administrator.');
-		
-		return FALSE;//fail
-	}
+  /**
+   * Try to add group
+   */
+  if (Role_subscription_db::add_group($form_values)) {
+    drupal_set_message(t('Subscription group added successfully.'));
+    drupal_goto('admin/settings/role_subscription');//go back to role subscription page
+  } else {
+    form_set_error('', 'Unable to add subscription group. Please contact an administrator.');
+    
+    return FALSE;//fail
+  }
 }
 
 /**
@@ -690,11 +690,11 @@
  */
 function role_subscription_admin_edit_group(){
 
-	$form_values = (array) Role_subscription_db::find_group(arg(5));//get group data
-	
-	$form = Role_subscription_form::get_group_form($form_values, 'edit');
-	
-	return $form;
+  $form_values = (array) Role_subscription_db::find_group(arg(5));//get group data
+  
+  $form = Role_subscription_form::get_group_form($form_values, 'edit');
+  
+  return $form;
 }
 
 /**
@@ -708,15 +708,15 @@
  * @return boolean return FALSE if failed or redirect if successful
  */
 function role_subscription_admin_edit_group_submit($form_id, $form_values){
-	/**
-	 * Try to add group
-	 */
-	if (Role_subscription_db::edit_group($form_values, arg(5))) {
-		drupal_set_message(t('Subscription group updated successfully.'));
-		drupal_goto('admin/settings/role_subscription');//go back to role subscription page
-	} else {
-		form_set_error('', 'Unable to update subscription group. Please contact an administrator.');
-		
-		return FALSE;//fail
-	}
+  /**
+   * Try to add group
+   */
+  if (Role_subscription_db::edit_group($form_values, arg(5))) {
+    drupal_set_message(t('Subscription group updated successfully.'));
+    drupal_goto('admin/settings/role_subscription');//go back to role subscription page
+  } else {
+    form_set_error('', 'Unable to update subscription group. Please contact an administrator.');
+    
+    return FALSE;//fail
+  }
 }
\ No newline at end of file
Index: role_subscription_authorize_net/role_subscription_authorize_net.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription_authorize_net/role_subscription_authorize_net.module,v
retrieving revision 1.1
diff -u -r1.1 role_subscription_authorize_net.module
--- role_subscription_authorize_net/role_subscription_authorize_net.module	24 May 2008 23:54:09 -0000	1.1
+++ role_subscription_authorize_net/role_subscription_authorize_net.module	25 May 2008 20:47:00 -0000
@@ -13,10 +13,10 @@
  * @return help text for section
  */
 function role_subscription_authorize_net_help($section) {
-	switch ($section) {
-		case 'admin/settings/role_subscription/role_subscription_authorize_net':
-			return t('Configure Authorize.net settings here. All settings are required to create subscriptions for this payment engine.');
-	}
+  switch ($section) {
+    case 'admin/settings/role_subscription/role_subscription_authorize_net':
+      return t('Configure Authorize.net settings here. All settings are required to create subscriptions for this payment engine.');
+  }
 }
 
 /**
@@ -25,18 +25,18 @@
  * @return array menu items
  */
 function role_subscription_authorize_net_menu($may_cache) {
-	$items = array();
-	   
-	$items[] = array('path' => 'admin/settings/role_subscription/role_subscription_authorize_net',
-		'title' => t('Authorize.net Engine Settings'),
-		'description' => t('Configure Authorize.net Engine.'),
-		'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_authorize_net_settings'),
-		'access' => user_access('administer role_subscription'),
-		'type' => MENU_CALLBACK,
+  $items = array();
+     
+  $items[] = array('path' => 'admin/settings/role_subscription/role_subscription_authorize_net',
+    'title' => t('Authorize.net Engine Settings'),
+    'description' => t('Configure Authorize.net Engine.'),
+    'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_authorize_net_settings'),
+    'access' => user_access('administer role_subscription'),
+    'type' => MENU_CALLBACK,
     );
         
-	return $items;
+  return $items;
 }
 
 /**
@@ -45,34 +45,34 @@
  * @return array of system form settings for this payment engine
  */
 function role_subscription_authorize_net_settings(){
-	$form['authorize_login_name'] = array(
-	    '#title' => t('Authorize.net ARB Login Name'),
-		'#type' => 'textfield',
-	    '#size' => 25,
-	    '#maxlength' => 25,
-	    '#default_value' => variable_get('authorize_login_name', ''),
-	    '#description' => t('This is the login name you get from the ARB admin after you create an account.')
-	);
-  
-	$form['authorize_transaction_key'] = array(
-	    '#title' => t('Authorize.net ARB Transaction Key'),
-		'#type' => 'textfield',
-	    '#size' => 25,
-	    '#maxlength' => 25,
-	    '#default_value' => variable_get('authorize_transaction_key', ''),
-	    '#description' => t('This is the transaction key you get from the ARB admin after you create an account.')
-	);
-	
-	$form['authorize_web_service_wsdl'] = array(
-	    '#title' => t('Authorize.net ARB Web Service WSDL'),
-		'#type' => 'textfield',
-	    '#size' => 60,
-	    '#maxlength' => 100,
-	    '#default_value' => variable_get('authorize_web_service_wsdl', 'https://apitest.authorize.net/soap/v1/service.asmx?wsdl'),
-	    '#description' => t('This is the SOAP WSDL URL you use to call ARB methods. This defaults to the test WSDL that authorize provides.')
-	);
-	
-	return system_settings_form($form);
+  $form['authorize_login_name'] = array(
+      '#title' => t('Authorize.net ARB Login Name'),
+    '#type' => 'textfield',
+      '#size' => 25,
+      '#maxlength' => 25,
+      '#default_value' => variable_get('authorize_login_name', ''),
+      '#description' => t('This is the login name you get from the ARB admin after you create an account.')
+  );
+  
+  $form['authorize_transaction_key'] = array(
+      '#title' => t('Authorize.net ARB Transaction Key'),
+    '#type' => 'textfield',
+      '#size' => 25,
+      '#maxlength' => 25,
+      '#default_value' => variable_get('authorize_transaction_key', ''),
+      '#description' => t('This is the transaction key you get from the ARB admin after you create an account.')
+  );
+  
+  $form['authorize_web_service_wsdl'] = array(
+      '#title' => t('Authorize.net ARB Web Service WSDL'),
+    '#type' => 'textfield',
+      '#size' => 60,
+      '#maxlength' => 100,
+      '#default_value' => variable_get('authorize_web_service_wsdl', 'https://apitest.authorize.net/soap/v1/service.asmx?wsdl'),
+      '#description' => t('This is the SOAP WSDL URL you use to call ARB methods. This defaults to the test WSDL that authorize provides.')
+  );
+  
+  return system_settings_form($form);
 }
 
 /**
@@ -84,10 +84,10 @@
  *   - "description": The description of this engine.
  */
 function role_subscription_authorize_net_engine_info(){
-	return array(
-      	'label' => 'Authorize.net ARB Payment Engine',
-		'description' => t('This engine uses the '.l('Authorize.net', 'http://authorize.net').' '. l('ARB payment engine', 'http://authorize.net/arb').' to manage subscriptions.'),
-    );	
+  return array(
+        'label' => 'Authorize.net ARB Payment Engine',
+    'description' => t('This engine uses the '.l('Authorize.net', 'http://authorize.net').' '. l('ARB payment engine', 'http://authorize.net/arb').' to manage subscriptions.'),
+    );  
 }
 
 /**
@@ -103,33 +103,33 @@
  */
 function role_subscription_authorize_net_cancel_subscription($merchant_id){
 
-	$ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
-	
-	$req = new ARBCancelSubscription();
-	
-	$req->merchantAuthentication = _populate_merchant_authentication();//authenticate
-	$req->subscriptionId = $merchant_id;//pass merchant id
-	
-	try {
-		$response = $ws->ARBCancelSubscription($req);
-
-		if ("Ok" == $response->ARBCancelSubscriptionResult->resultCode) {
-			return TRUE;//success!
-		} else {//errors
-			
-			foreach($response->ARBCancelSubscriptionResult->messages->MessagesTypeMessage as $error)
-				$error_msg .= ($error->text ? $error->text : $error)."<br />";
-			
-			form_set_error('', $error_msg);
-			watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
-			return FALSE;
-		}
-	} catch (SoapFault $exception) {//soap problem
-		form_set_error('', 'Unable to connect to Authorize.net payment engine');//user friendly error
-		watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
-		
-		return FALSE;
-	}
+  $ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
+  
+  $req = new ARBCancelSubscription();
+  
+  $req->merchantAuthentication = _populate_merchant_authentication();//authenticate
+  $req->subscriptionId = $merchant_id;//pass merchant id
+  
+  try {
+    $response = $ws->ARBCancelSubscription($req);
+
+    if ("Ok" == $response->ARBCancelSubscriptionResult->resultCode) {
+      return TRUE;//success!
+    } else {//errors
+      
+      foreach($response->ARBCancelSubscriptionResult->messages->MessagesTypeMessage as $error)
+        $error_msg .= ($error->text ? $error->text : $error)."<br />";
+      
+      form_set_error('', $error_msg);
+      watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
+      return FALSE;
+    }
+  } catch (SoapFault $exception) {//soap problem
+    form_set_error('', 'Unable to connect to Authorize.net payment engine');//user friendly error
+    watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
+    
+    return FALSE;
+  }
 }
 
 /**
@@ -154,42 +154,42 @@
  * @return FALSE for failure, TRUE for success 
  */
 function role_subscription_authorize_net_new_subscription_payment($payment_info, $subscription, $invoice_id){
-	
-	$ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
-	
-	$req = new ARBCreateSubscription();
-	
-	$req->merchantAuthentication = _populate_merchant_authentication();//authenticate
-	
-	$req->subscription = _prep_arb_payment($payment_info, $subscription, $invoice_id);
-	
-	try {
-
-		$response = $ws->ARBCreateSubscription($req);
-		
-		/**
-		 * If success return the subscription ID, otherwise send back error
-		 */
-		if ("Ok" == $response->ARBCreateSubscriptionResult->resultCode)
-			return $response->ARBCreateSubscriptionResult->subscriptionId;
-		else {
-			
-			foreach($response->ARBCreateSubscriptionResult->messages->MessagesTypeMessage as $error)
-				$error_msg .= ($error->text ? $error->text : $error)."<br />";
-			
-			form_set_error('', $error_msg);
-			watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
-			return FALSE;
-		}
-	}
-	/**
-	 * If soap fault, send back error
-	 */
-	catch (SoapFault $exception) {
-		form_set_error('', $exception->getMessage());
-		watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
-		return FALSE;
-	}	
+  
+  $ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
+  
+  $req = new ARBCreateSubscription();
+  
+  $req->merchantAuthentication = _populate_merchant_authentication();//authenticate
+  
+  $req->subscription = _prep_arb_payment($payment_info, $subscription, $invoice_id);
+  
+  try {
+
+    $response = $ws->ARBCreateSubscription($req);
+    
+    /**
+     * If success return the subscription ID, otherwise send back error
+     */
+    if ("Ok" == $response->ARBCreateSubscriptionResult->resultCode)
+      return $response->ARBCreateSubscriptionResult->subscriptionId;
+    else {
+      
+      foreach($response->ARBCreateSubscriptionResult->messages->MessagesTypeMessage as $error)
+        $error_msg .= ($error->text ? $error->text : $error)."<br />";
+      
+      form_set_error('', $error_msg);
+      watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
+      return FALSE;
+    }
+  }
+  /**
+   * If soap fault, send back error
+   */
+  catch (SoapFault $exception) {
+    form_set_error('', $exception->getMessage());
+    watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
+    return FALSE;
+  }  
 }
 
 /**
@@ -216,35 +216,35 @@
  */
 function role_subscription_authorize_net_update_subscription_payment($payment_info, $merchant_id){
 
-	$ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
-	$req = new ARBUpdateSubscription();
-	
-	$req->merchantAuthentication = _populate_merchant_authentication();//authenticate
-	$req->subscriptionId = $merchant_id;
-	
-	$req->subscription = _update_arb_payment($payment_info);
-	
-	try {
-		$response = $ws->ARBUpdateSubscription($req);
-		
-		/**
-		 * If success return the subscription ID, otherwise send back error
-		 */
-		if ("Ok" == $response->ARBUpdateSubscriptionResult->resultCode)
-			return TRUE;//success!
-		else {//error
-			foreach($response->ARBUpdateSubscriptionResult->messages->MessagesTypeMessage as $error)
-				$error_msg .= ($error->text ? $error->text : $error)."<br />";
-			
-			form_set_error('', $error_msg);
-			watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
-			return FALSE;
-		}
-	} catch (SoapFault $exception) {//soap problem
-		form_set_error('', $exception->getMessage());
-		watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
-		return FALSE;
-	}		
+  $ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
+  $req = new ARBUpdateSubscription();
+  
+  $req->merchantAuthentication = _populate_merchant_authentication();//authenticate
+  $req->subscriptionId = $merchant_id;
+  
+  $req->subscription = _update_arb_payment($payment_info);
+  
+  try {
+    $response = $ws->ARBUpdateSubscription($req);
+    
+    /**
+     * If success return the subscription ID, otherwise send back error
+     */
+    if ("Ok" == $response->ARBUpdateSubscriptionResult->resultCode)
+      return TRUE;//success!
+    else {//error
+      foreach($response->ARBUpdateSubscriptionResult->messages->MessagesTypeMessage as $error)
+        $error_msg .= ($error->text ? $error->text : $error)."<br />";
+      
+      form_set_error('', $error_msg);
+      watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
+      return FALSE;
+    }
+  } catch (SoapFault $exception) {//soap problem
+    form_set_error('', $exception->getMessage());
+    watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
+    return FALSE;
+  }    
 }
 
 /**
@@ -259,36 +259,36 @@
  */
 function role_subscription_authorize_net_update_terms($subscription, $merchant_id){
 
-	$ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
-	$req = new ARBUpdateSubscription();
-	
-	$req->merchantAuthentication = _populate_merchant_authentication();//authenticate
-	$req->subscriptionId = $merchant_id;
-	
-	$req->subscription = _update_arb_terms($subscription);//update subscription terms
-	
-	try {
-		$response = $ws->ARBUpdateSubscription($req);
-		
-		/**
-		 * If success return the subscription ID, otherwise send back error
-		 */
-		if ("Ok" == $response->ARBUpdateSubscriptionResult->resultCode)
-			return TRUE;//success!
-		else {//error
-			foreach($response->ARBUpdateSubscriptionResult->messages->MessagesTypeMessage as $error)
-				$error_msg .= ($error->text ? $error->text : $error)."<br />";
-			
-			form_set_error('', $error_msg);
-			watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
-			
-			return FALSE;
-		}
-	} catch (SoapFault $exception) {//soap problem
-		form_set_error('', $exception->getMessage());
-		watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
-		return FALSE;
-	}		
+  $ws = new AuthorizeNetWS(variable_get('authorize_web_service_wsdl', ''));
+  $req = new ARBUpdateSubscription();
+  
+  $req->merchantAuthentication = _populate_merchant_authentication();//authenticate
+  $req->subscriptionId = $merchant_id;
+  
+  $req->subscription = _update_arb_terms($subscription);//update subscription terms
+  
+  try {
+    $response = $ws->ARBUpdateSubscription($req);
+    
+    /**
+     * If success return the subscription ID, otherwise send back error
+     */
+    if ("Ok" == $response->ARBUpdateSubscriptionResult->resultCode)
+      return TRUE;//success!
+    else {//error
+      foreach($response->ARBUpdateSubscriptionResult->messages->MessagesTypeMessage as $error)
+        $error_msg .= ($error->text ? $error->text : $error)."<br />";
+      
+      form_set_error('', $error_msg);
+      watchdog('error', $error_msg, WATCHDOG_ERROR);//log errors
+      
+      return FALSE;
+    }
+  } catch (SoapFault $exception) {//soap problem
+    form_set_error('', $exception->getMessage());
+    watchdog('error', $exception->getMessage(), WATCHDOG_ERROR);//log specific error
+    return FALSE;
+  }    
 }
 
 /**
@@ -303,11 +303,11 @@
  *   - "transactionKey": transaction key
  */
 function _populate_merchant_authentication() {
-	$auth = new MerchantAuthenticationType();
-	$auth->name = variable_get('authorize_login_name', '');
-	$auth->transactionKey = variable_get('authorize_transaction_key', '');
-	
-	return $auth;	
+  $auth = new MerchantAuthenticationType();
+  $auth->name = variable_get('authorize_login_name', '');
+  $auth->transactionKey = variable_get('authorize_transaction_key', '');
+  
+  return $auth;  
 }
 
 /**
@@ -325,19 +325,19 @@
  * @return object subscription term data for SOAP update subscription method
  */
 function _update_arb_terms($subscription){
-	$sub = new ARBSubscriptionType();
+  $sub = new ARBSubscriptionType();
 
-	$sub->name = $subscription->title;
+  $sub->name = $subscription->title;
 
-	$sub->amount = $subscription->price;
-	$sub->trial_amount = $subscription->trial_amount;
+  $sub->amount = $subscription->price;
+  $sub->trial_amount = $subscription->trial_amount;
 
-	$sub->paymentSchedule->totalOccurrences = $subscription->total_occurrences ? $subscription->total_occurrences : 9999;//set to 9999 if indefinate
-		
-	if ($subscription->trial_occurrences)	
-		$sub->paymentSchedule->trialOccurrences = $subscription->trial_occurrences;
+  $sub->paymentSchedule->totalOccurrences = $subscription->total_occurrences ? $subscription->total_occurrences : 9999;//set to 9999 if indefinate
+    
+  if ($subscription->trial_occurrences)  
+    $sub->paymentSchedule->trialOccurrences = $subscription->trial_occurrences;
 
-	return $sub;
+  return $sub;
 }
 
 /**
@@ -352,23 +352,23 @@
  * @return object subscription object for SOAP method call
  */
 function _update_arb_payment($payment_info){
-	$sub = new ARBSubscriptionType();
-	$creditCard = new CreditCardSimpleType();
+  $sub = new ARBSubscriptionType();
+  $creditCard = new CreditCardSimpleType();
 
-	$creditCard->cardNumber = $payment_info['cc_number'];//test # 4111111111111111
-	
-	list($exp_year, $exp_month) = explode('/', $payment_info['expiration_date']);
-	
-	$creditCard->expirationDate = $exp_year.'-'.$exp_month;  // required format for API is YYYY-MM, test date 2020-08
-		
-	$sub->payment = new PaymentType();
-	$sub->payment->creditCard = $creditCard;
-
-	$sub->billTo = new NameAndAddressType();
-	$sub->billTo->firstName = $payment_info['first_name'];
-	$sub->billTo->lastName = $payment_info['last_name'];
-	
-	return $sub;
+  $creditCard->cardNumber = $payment_info['cc_number'];//test # 4111111111111111
+  
+  list($exp_year, $exp_month) = explode('/', $payment_info['expiration_date']);
+  
+  $creditCard->expirationDate = $exp_year.'-'.$exp_month;  // required format for API is YYYY-MM, test date 2020-08
+    
+  $sub->payment = new PaymentType();
+  $sub->payment->creditCard = $creditCard;
+
+  $sub->billTo = new NameAndAddressType();
+  $sub->billTo->firstName = $payment_info['first_name'];
+  $sub->billTo->lastName = $payment_info['last_name'];
+  
+  return $sub;
 }
 
 /**
@@ -391,42 +391,42 @@
  * @return object subscription object for SOAP method call
  */
 function _prep_arb_payment($payment_info, $subscription, $invoice_id){
-	$sub = new ARBSubscriptionType();
-	$creditCard = new CreditCardSimpleType();
+  $sub = new ARBSubscriptionType();
+  $creditCard = new CreditCardSimpleType();
 
-	$sub->name = $subscription->title;
+  $sub->name = $subscription->title;
 
-	$creditCard->cardNumber = $payment_info['cc_number'];//test # 4111111111111111
-	
-	list($exp_year, $exp_month) = explode('/', $payment_info['expiration_date']);
-	
-	$creditCard->expirationDate = $exp_year.'-'.$exp_month;  // required format for API is YYYY-MM, test date 2020-08
-		
-	$sub->payment = new PaymentType();
-	$sub->payment->creditCard = $creditCard;
-
-	$sub->billTo = new NameAndAddressType();
-	$sub->billTo->firstName = $payment_info['first_name'];
-	$sub->billTo->lastName = $payment_info['last_name'];
-
-	$sub->amount = $subscription->price;
-	$sub->trial_amount = $subscription->trial_amount;
-
-	$sub->paymentSchedule = new PaymentScheduleType();
-	$sub->paymentSchedule->startDate = date('Y-m-d'); // required format for API is YYYY-MM-DD
-	
-	$sub->paymentSchedule->totalOccurrences = $subscription->total_occurrences ? $subscription->total_occurrences : 9999;//set to 9999 if indefinate
-		
-	if ($subscription->trial_occurrences)	
-		$sub->paymentSchedule->trialOccurrences = $subscription->trial_occurrences;
-
-	// Interval can't be updated once a subscription is created.
-	$sub->paymentSchedule->interval = new PaymentScheduleTypeInterval();
-	$sub->paymentSchedule->interval->length = $subscription->length;
-	$sub->paymentSchedule->interval->unit = $subscription->unit;
-	
-	$sub->orderType = new OrderType();
-	$sub->orderType->invoiceNumber = $invoice_id;
-	
-	return $sub;
+  $creditCard->cardNumber = $payment_info['cc_number'];//test # 4111111111111111
+  
+  list($exp_year, $exp_month) = explode('/', $payment_info['expiration_date']);
+  
+  $creditCard->expirationDate = $exp_year.'-'.$exp_month;  // required format for API is YYYY-MM, test date 2020-08
+    
+  $sub->payment = new PaymentType();
+  $sub->payment->creditCard = $creditCard;
+
+  $sub->billTo = new NameAndAddressType();
+  $sub->billTo->firstName = $payment_info['first_name'];
+  $sub->billTo->lastName = $payment_info['last_name'];
+
+  $sub->amount = $subscription->price;
+  $sub->trial_amount = $subscription->trial_amount;
+
+  $sub->paymentSchedule = new PaymentScheduleType();
+  $sub->paymentSchedule->startDate = date('Y-m-d'); // required format for API is YYYY-MM-DD
+  
+  $sub->paymentSchedule->totalOccurrences = $subscription->total_occurrences ? $subscription->total_occurrences : 9999;//set to 9999 if indefinate
+    
+  if ($subscription->trial_occurrences)  
+    $sub->paymentSchedule->trialOccurrences = $subscription->trial_occurrences;
+
+  // Interval can't be updated once a subscription is created.
+  $sub->paymentSchedule->interval = new PaymentScheduleTypeInterval();
+  $sub->paymentSchedule->interval->length = $subscription->length;
+  $sub->paymentSchedule->interval->unit = $subscription->unit;
+  
+  $sub->orderType = new OrderType();
+  $sub->orderType->invoiceNumber = $invoice_id;
+  
+  return $sub;
 }
\ No newline at end of file
Index: role_subscription_authorize_net/lib/api_authorize_net_soap_v1.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription_authorize_net/lib/api_authorize_net_soap_v1.php,v
retrieving revision 1.1
diff -u -r1.1 api_authorize_net_soap_v1.php
--- role_subscription_authorize_net/lib/api_authorize_net_soap_v1.php	24 May 2008 23:54:10 -0000	1.1
+++ role_subscription_authorize_net/lib/api_authorize_net_soap_v1.php	25 May 2008 20:47:10 -0000
@@ -12,11 +12,11 @@
  * IsAliveResponse
  */
 class IsAliveResponse {
-	/**
-	 * @access public
-	 * @var ANetApiResponseType
-	 */
-	public $IsAliveResult;
+  /**
+   * @access public
+   * @var ANetApiResponseType
+   */
+  public $IsAliveResult;
 }}
 
 if (!class_exists("ANetApiResponseType")) {
@@ -24,16 +24,16 @@
  * ANetApiResponseType
  */
 class ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var tnsMessageTypeEnum
-	 */
-	public $resultCode;
-	/**
-	 * @access public
-	 * @var ArrayOfMessagesTypeMessage
-	 */
-	public $messages;
+  /**
+   * @access public
+   * @var tnsMessageTypeEnum
+   */
+  public $resultCode;
+  /**
+   * @access public
+   * @var ArrayOfMessagesTypeMessage
+   */
+  public $messages;
 }}
 
 if (!class_exists("MessageTypeEnum")) {
@@ -48,16 +48,16 @@
  * MessagesTypeMessage
  */
 class MessagesTypeMessage {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $code;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $text;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $code;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $text;
 }}
 
 if (!class_exists("AuthenticateTest")) {
@@ -65,11 +65,11 @@
  * AuthenticateTest
  */
 class AuthenticateTest {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
 }}
 
 if (!class_exists("MerchantAuthenticationType")) {
@@ -77,16 +77,16 @@
  * MerchantAuthenticationType
  */
 class MerchantAuthenticationType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $name;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $transactionKey;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $name;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $transactionKey;
 }}
 
 if (!class_exists("AuthenticateTestResponse")) {
@@ -94,11 +94,11 @@
  * AuthenticateTestResponse
  */
 class AuthenticateTestResponse {
-	/**
-	 * @access public
-	 * @var ANetApiResponseType
-	 */
-	public $AuthenticateTestResult;
+  /**
+   * @access public
+   * @var ANetApiResponseType
+   */
+  public $AuthenticateTestResult;
 }}
 
 if (!class_exists("ARBCreateSubscription")) {
@@ -106,16 +106,16 @@
  * ARBCreateSubscription
  */
 class ARBCreateSubscription {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var ARBSubscriptionType
-	 */
-	public $subscription;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var ARBSubscriptionType
+   */
+  public $subscription;
 }}
 
 if (!class_exists("ARBSubscriptionType")) {
@@ -123,51 +123,51 @@
  * ARBSubscriptionType
  */
 class ARBSubscriptionType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $name;
-	/**
-	 * @access public
-	 * @var PaymentScheduleType
-	 */
-	public $paymentSchedule;
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $amount;
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $trialAmount;
-	/**
-	 * @access public
-	 * @var PaymentType
-	 */
-	public $payment;
-	/**
-	 * @access public
-	 * @var OrderType
-	 */
-	public $order;
-	/**
-	 * @access public
-	 * @var CustomerType
-	 */
-	public $customer;
-	/**
-	 * @access public
-	 * @var NameAndAddressType
-	 */
-	public $billTo;
-	/**
-	 * @access public
-	 * @var NameAndAddressType
-	 */
-	public $shipTo;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $name;
+  /**
+   * @access public
+   * @var PaymentScheduleType
+   */
+  public $paymentSchedule;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $amount;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $trialAmount;
+  /**
+   * @access public
+   * @var PaymentType
+   */
+  public $payment;
+  /**
+   * @access public
+   * @var OrderType
+   */
+  public $order;
+  /**
+   * @access public
+   * @var CustomerType
+   */
+  public $customer;
+  /**
+   * @access public
+   * @var NameAndAddressType
+   */
+  public $billTo;
+  /**
+   * @access public
+   * @var NameAndAddressType
+   */
+  public $shipTo;
 }}
 
 if (!class_exists("PaymentScheduleType")) {
@@ -175,26 +175,26 @@
  * PaymentScheduleType
  */
 class PaymentScheduleType {
-	/**
-	 * @access public
-	 * @var PaymentScheduleTypeInterval
-	 */
-	public $interval;
-	/**
-	 * @access public
-	 * @var sdate
-	 */
-	public $startDate;
-	/**
-	 * @access public
-	 * @var sshort
-	 */
-	public $totalOccurrences;
-	/**
-	 * @access public
-	 * @var sshort
-	 */
-	public $trialOccurrences;
+  /**
+   * @access public
+   * @var PaymentScheduleTypeInterval
+   */
+  public $interval;
+  /**
+   * @access public
+   * @var sdate
+   */
+  public $startDate;
+  /**
+   * @access public
+   * @var sshort
+   */
+  public $totalOccurrences;
+  /**
+   * @access public
+   * @var sshort
+   */
+  public $trialOccurrences;
 }}
 
 if (!class_exists("PaymentScheduleTypeInterval")) {
@@ -202,16 +202,16 @@
  * PaymentScheduleTypeInterval
  */
 class PaymentScheduleTypeInterval {
-	/**
-	 * @access public
-	 * @var sshort
-	 */
-	public $length;
-	/**
-	 * @access public
-	 * @var tnsARBSubscriptionUnitEnum
-	 */
-	public $unit;
+  /**
+   * @access public
+   * @var sshort
+   */
+  public $length;
+  /**
+   * @access public
+   * @var tnsARBSubscriptionUnitEnum
+   */
+  public $unit;
 }}
 
 if (!class_exists("ARBSubscriptionUnitEnum")) {
@@ -226,16 +226,16 @@
  * PaymentType
  */
 class PaymentType {
-	/**
-	 * @access public
-	 * @var CreditCardType
-	 */
-	public $creditCard;
-	/**
-	 * @access public
-	 * @var BankAccountType
-	 */
-	public $bankAccount;
+  /**
+   * @access public
+   * @var CreditCardType
+   */
+  public $creditCard;
+  /**
+   * @access public
+   * @var BankAccountType
+   */
+  public $bankAccount;
 }}
 
 if (!class_exists("CreditCardType")) {
@@ -243,16 +243,16 @@
  * CreditCardType
  */
 class CreditCardType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $cardNumber;
-	/**
-	 * @access public
-	 * @var sgYearMonth
-	 */
-	public $expirationDate;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $cardNumber;
+  /**
+   * @access public
+   * @var sgYearMonth
+   */
+  public $expirationDate;
 }}
 
 if (!class_exists("CreditCardSimpleType")) {
@@ -260,16 +260,16 @@
  * CreditCardSimpleType
  */
 class CreditCardSimpleType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $cardNumber;
-	/**
-	 * @access public
-	 * @var sgYearMonth
-	 */
-	public $expirationDate;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $cardNumber;
+  /**
+   * @access public
+   * @var sgYearMonth
+   */
+  public $expirationDate;
 }}
 
 if (!class_exists("BankAccountBaseType")) {
@@ -277,26 +277,26 @@
  * BankAccountBaseType
  */
 class BankAccountBaseType {
-	/**
-	 * @access public
-	 * @var tnsBankAccountTypeEnum
-	 */
-	public $accountType;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $nameOnAccount;
-	/**
-	 * @access public
-	 * @var tnsEcheckTypeEnum
-	 */
-	public $echeckType;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $bankName;
+  /**
+   * @access public
+   * @var tnsBankAccountTypeEnum
+   */
+  public $accountType;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $nameOnAccount;
+  /**
+   * @access public
+   * @var tnsEcheckTypeEnum
+   */
+  public $echeckType;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $bankName;
 }}
 
 if (!class_exists("BankAccountTypeEnum")) {
@@ -318,16 +318,16 @@
  * OrderType
  */
 class OrderType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $invoiceNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $description;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $invoiceNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $description;
 }}
 
 if (!class_exists("CustomerType")) {
@@ -335,41 +335,41 @@
  * CustomerType
  */
 class CustomerType {
-	/**
-	 * @access public
-	 * @var tnsCustomerTypeEnum
-	 */
-	public $type;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $id;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $email;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $phoneNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $faxNumber;
-	/**
-	 * @access public
-	 * @var DriversLicenseType
-	 */
-	public $driversLicense;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $taxId;
+  /**
+   * @access public
+   * @var tnsCustomerTypeEnum
+   */
+  public $type;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $id;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $email;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $phoneNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $faxNumber;
+  /**
+   * @access public
+   * @var DriversLicenseType
+   */
+  public $driversLicense;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $taxId;
 }}
 
 if (!class_exists("CustomerTypeEnum")) {
@@ -384,11 +384,11 @@
  * DriversLicenseBaseType
  */
 class DriversLicenseBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $state;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $state;
 }}
 
 if (!class_exists("NameAndAddressType")) {
@@ -396,46 +396,46 @@
  * NameAndAddressType
  */
 class NameAndAddressType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $firstName;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $lastName;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $company;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $address;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $city;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $state;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $zip;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $country;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $firstName;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $lastName;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $company;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $address;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $city;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $state;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $zip;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $country;
 }}
 
 if (!class_exists("ARBCreateSubscriptionResponse")) {
@@ -443,11 +443,11 @@
  * ARBCreateSubscriptionResponse
  */
 class ARBCreateSubscriptionResponse {
-	/**
-	 * @access public
-	 * @var ARBCreateSubscriptionResponseType
-	 */
-	public $ARBCreateSubscriptionResult;
+  /**
+   * @access public
+   * @var ARBCreateSubscriptionResponseType
+   */
+  public $ARBCreateSubscriptionResult;
 }}
 
 if (!class_exists("ARBCreateSubscriptionResponseType")) {
@@ -455,11 +455,11 @@
  * ARBCreateSubscriptionResponseType
  */
 class ARBCreateSubscriptionResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $subscriptionId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $subscriptionId;
 }}
 
 if (!class_exists("ARBUpdateSubscription")) {
@@ -467,21 +467,21 @@
  * ARBUpdateSubscription
  */
 class ARBUpdateSubscription {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $subscriptionId;
-	/**
-	 * @access public
-	 * @var ARBSubscriptionType
-	 */
-	public $subscription;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $subscriptionId;
+  /**
+   * @access public
+   * @var ARBSubscriptionType
+   */
+  public $subscription;
 }}
 
 if (!class_exists("ARBUpdateSubscriptionResponse")) {
@@ -489,11 +489,11 @@
  * ARBUpdateSubscriptionResponse
  */
 class ARBUpdateSubscriptionResponse {
-	/**
-	 * @access public
-	 * @var ARBUpdateSubscriptionResponseType
-	 */
-	public $ARBUpdateSubscriptionResult;
+  /**
+   * @access public
+   * @var ARBUpdateSubscriptionResponseType
+   */
+  public $ARBUpdateSubscriptionResult;
 }}
 
 if (!class_exists("ARBUpdateSubscriptionResponseType")) {
@@ -508,16 +508,16 @@
  * ARBCancelSubscription
  */
 class ARBCancelSubscription {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $subscriptionId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $subscriptionId;
 }}
 
 if (!class_exists("ARBCancelSubscriptionResponse")) {
@@ -525,11 +525,11 @@
  * ARBCancelSubscriptionResponse
  */
 class ARBCancelSubscriptionResponse {
-	/**
-	 * @access public
-	 * @var ARBCancelSubscriptionResponseType
-	 */
-	public $ARBCancelSubscriptionResult;
+  /**
+   * @access public
+   * @var ARBCancelSubscriptionResponseType
+   */
+  public $ARBCancelSubscriptionResult;
 }}
 
 if (!class_exists("ARBCancelSubscriptionResponseType")) {
@@ -544,16 +544,16 @@
  * CreateCustomerProfile
  */
 class CreateCustomerProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var CustomerProfileType
-	 */
-	public $profile;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var CustomerProfileType
+   */
+  public $profile;
 }}
 
 if (!class_exists("CustomerProfileBaseType")) {
@@ -561,21 +561,21 @@
  * CustomerProfileBaseType
  */
 class CustomerProfileBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $merchantCustomerId;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $description;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $email;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $merchantCustomerId;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $description;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $email;
 }}
 
 if (!class_exists("CustomerPaymentProfileBaseType")) {
@@ -583,16 +583,16 @@
  * CustomerPaymentProfileBaseType
  */
 class CustomerPaymentProfileBaseType {
-	/**
-	 * @access public
-	 * @var tnsCustomerTypeEnum
-	 */
-	public $customerType;
-	/**
-	 * @access public
-	 * @var CustomerAddressType
-	 */
-	public $billTo;
+  /**
+   * @access public
+   * @var tnsCustomerTypeEnum
+   */
+  public $customerType;
+  /**
+   * @access public
+   * @var CustomerAddressType
+   */
+  public $billTo;
 }}
 
 if (!class_exists("CustomerAddressType")) {
@@ -600,16 +600,16 @@
  * CustomerAddressType
  */
 class CustomerAddressType extends NameAndAddressType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $phoneNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $faxNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $phoneNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $faxNumber;
 }}
 
 if (!class_exists("PaymentSimpleType")) {
@@ -617,16 +617,16 @@
  * PaymentSimpleType
  */
 class PaymentSimpleType {
-	/**
-	 * @access public
-	 * @var CreditCardSimpleType
-	 */
-	public $creditCard;
-	/**
-	 * @access public
-	 * @var BankAccountType
-	 */
-	public $bankAccount;
+  /**
+   * @access public
+   * @var CreditCardSimpleType
+   */
+  public $creditCard;
+  /**
+   * @access public
+   * @var BankAccountType
+   */
+  public $bankAccount;
 }}
 
 if (!class_exists("CreateCustomerProfileResponse")) {
@@ -634,11 +634,11 @@
  * CreateCustomerProfileResponse
  */
 class CreateCustomerProfileResponse {
-	/**
-	 * @access public
-	 * @var CreateCustomerProfileResponseType
-	 */
-	public $CreateCustomerProfileResult;
+  /**
+   * @access public
+   * @var CreateCustomerProfileResponseType
+   */
+  public $CreateCustomerProfileResult;
 }}
 
 if (!class_exists("CreateCustomerProfileResponseType")) {
@@ -646,11 +646,11 @@
  * CreateCustomerProfileResponseType
  */
 class CreateCustomerProfileResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
 }}
 
 if (!class_exists("CreateCustomerPaymentProfile")) {
@@ -658,26 +658,26 @@
  * CreateCustomerPaymentProfile
  */
 class CreateCustomerPaymentProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var CustomerPaymentProfileType
-	 */
-	public $paymentProfile;
-	/**
-	 * @access public
-	 * @var tnsValidationModeEnum
-	 */
-	public $validationMode;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var CustomerPaymentProfileType
+   */
+  public $paymentProfile;
+  /**
+   * @access public
+   * @var tnsValidationModeEnum
+   */
+  public $validationMode;
 }}
 
 if (!class_exists("ValidationModeEnum")) {
@@ -692,11 +692,11 @@
  * CreateCustomerPaymentProfileResponse
  */
 class CreateCustomerPaymentProfileResponse {
-	/**
-	 * @access public
-	 * @var CreateCustomerPaymentProfileResponseType
-	 */
-	public $CreateCustomerPaymentProfileResult;
+  /**
+   * @access public
+   * @var CreateCustomerPaymentProfileResponseType
+   */
+  public $CreateCustomerPaymentProfileResult;
 }}
 
 if (!class_exists("CreateCustomerPaymentProfileResponseType")) {
@@ -704,16 +704,16 @@
  * CreateCustomerPaymentProfileResponseType
  */
 class CreateCustomerPaymentProfileResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $validationDirectResponse;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $validationDirectResponse;
 }}
 
 if (!class_exists("CreateCustomerShippingAddress")) {
@@ -721,21 +721,21 @@
  * CreateCustomerShippingAddress
  */
 class CreateCustomerShippingAddress {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var CustomerAddressType
-	 */
-	public $address;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var CustomerAddressType
+   */
+  public $address;
 }}
 
 if (!class_exists("CreateCustomerShippingAddressResponse")) {
@@ -743,11 +743,11 @@
  * CreateCustomerShippingAddressResponse
  */
 class CreateCustomerShippingAddressResponse {
-	/**
-	 * @access public
-	 * @var CreateCustomerShippingAddressResponseType
-	 */
-	public $CreateCustomerShippingAddressResult;
+  /**
+   * @access public
+   * @var CreateCustomerShippingAddressResponseType
+   */
+  public $CreateCustomerShippingAddressResult;
 }}
 
 if (!class_exists("CreateCustomerShippingAddressResponseType")) {
@@ -755,11 +755,11 @@
  * CreateCustomerShippingAddressResponseType
  */
 class CreateCustomerShippingAddressResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerAddressId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerAddressId;
 }}
 
 if (!class_exists("GetCustomerProfile")) {
@@ -767,16 +767,16 @@
  * GetCustomerProfile
  */
 class GetCustomerProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
 }}
 
 if (!class_exists("GetCustomerProfileResponse")) {
@@ -784,11 +784,11 @@
  * GetCustomerProfileResponse
  */
 class GetCustomerProfileResponse {
-	/**
-	 * @access public
-	 * @var GetCustomerProfileResponseType
-	 */
-	public $GetCustomerProfileResult;
+  /**
+   * @access public
+   * @var GetCustomerProfileResponseType
+   */
+  public $GetCustomerProfileResult;
 }}
 
 if (!class_exists("GetCustomerProfileResponseType")) {
@@ -796,11 +796,11 @@
  * GetCustomerProfileResponseType
  */
 class GetCustomerProfileResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var CustomerProfileMaskedType
-	 */
-	public $profile;
+  /**
+   * @access public
+   * @var CustomerProfileMaskedType
+   */
+  public $profile;
 }}
 
 if (!class_exists("CustomerProfileExType")) {
@@ -808,11 +808,11 @@
  * CustomerProfileExType
  */
 class CustomerProfileExType extends CustomerProfileBaseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
 }}
 
 if (!class_exists("CustomerPaymentProfileMaskedType")) {
@@ -820,26 +820,26 @@
  * CustomerPaymentProfileMaskedType
  */
 class CustomerPaymentProfileMaskedType extends CustomerPaymentProfileBaseType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
-	/**
-	 * @access public
-	 * @var PaymentMaskedType
-	 */
-	public $payment;
-	/**
-	 * @access public
-	 * @var DriversLicenseMaskedType
-	 */
-	public $driversLicense;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $taxId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var PaymentMaskedType
+   */
+  public $payment;
+  /**
+   * @access public
+   * @var DriversLicenseMaskedType
+   */
+  public $driversLicense;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $taxId;
 }}
 
 if (!class_exists("PaymentMaskedType")) {
@@ -847,16 +847,16 @@
  * PaymentMaskedType
  */
 class PaymentMaskedType {
-	/**
-	 * @access public
-	 * @var BankAccountMaskedType
-	 */
-	public $bankAccount;
-	/**
-	 * @access public
-	 * @var CreditCardMaskedType
-	 */
-	public $creditCard;
+  /**
+   * @access public
+   * @var BankAccountMaskedType
+   */
+  public $bankAccount;
+  /**
+   * @access public
+   * @var CreditCardMaskedType
+   */
+  public $creditCard;
 }}
 
 if (!class_exists("BankAccountMaskedType")) {
@@ -864,16 +864,16 @@
  * BankAccountMaskedType
  */
 class BankAccountMaskedType extends BankAccountBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $routingNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $accountNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $routingNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $accountNumber;
 }}
 
 if (!class_exists("CreditCardMaskedType")) {
@@ -881,16 +881,16 @@
  * CreditCardMaskedType
  */
 class CreditCardMaskedType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $cardNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $expirationDate;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $cardNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $expirationDate;
 }}
 
 if (!class_exists("DriversLicenseMaskedType")) {
@@ -898,16 +898,16 @@
  * DriversLicenseMaskedType
  */
 class DriversLicenseMaskedType extends DriversLicenseBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $number;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $dateOfBirth;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $number;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $dateOfBirth;
 }}
 
 if (!class_exists("CustomerAddressExType")) {
@@ -915,11 +915,11 @@
  * CustomerAddressExType
  */
 class CustomerAddressExType extends CustomerAddressType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerAddressId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerAddressId;
 }}
 
 if (!class_exists("GetCustomerPaymentProfile")) {
@@ -927,21 +927,21 @@
  * GetCustomerPaymentProfile
  */
 class GetCustomerPaymentProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
 }}
 
 if (!class_exists("GetCustomerPaymentProfileResponse")) {
@@ -949,11 +949,11 @@
  * GetCustomerPaymentProfileResponse
  */
 class GetCustomerPaymentProfileResponse {
-	/**
-	 * @access public
-	 * @var GetCustomerPaymentProfileResponseType
-	 */
-	public $GetCustomerPaymentProfileResult;
+  /**
+   * @access public
+   * @var GetCustomerPaymentProfileResponseType
+   */
+  public $GetCustomerPaymentProfileResult;
 }}
 
 if (!class_exists("GetCustomerPaymentProfileResponseType")) {
@@ -961,11 +961,11 @@
  * GetCustomerPaymentProfileResponseType
  */
 class GetCustomerPaymentProfileResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var CustomerPaymentProfileMaskedType
-	 */
-	public $paymentProfile;
+  /**
+   * @access public
+   * @var CustomerPaymentProfileMaskedType
+   */
+  public $paymentProfile;
 }}
 
 if (!class_exists("GetCustomerShippingAddress")) {
@@ -973,21 +973,21 @@
  * GetCustomerShippingAddress
  */
 class GetCustomerShippingAddress {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerAddressId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerAddressId;
 }}
 
 if (!class_exists("GetCustomerShippingAddressResponse")) {
@@ -995,11 +995,11 @@
  * GetCustomerShippingAddressResponse
  */
 class GetCustomerShippingAddressResponse {
-	/**
-	 * @access public
-	 * @var GetCustomerShippingAddressResponseType
-	 */
-	public $GetCustomerShippingAddressResult;
+  /**
+   * @access public
+   * @var GetCustomerShippingAddressResponseType
+   */
+  public $GetCustomerShippingAddressResult;
 }}
 
 if (!class_exists("GetCustomerShippingAddressResponseType")) {
@@ -1007,11 +1007,11 @@
  * GetCustomerShippingAddressResponseType
  */
 class GetCustomerShippingAddressResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var CustomerAddressExType
-	 */
-	public $address;
+  /**
+   * @access public
+   * @var CustomerAddressExType
+   */
+  public $address;
 }}
 
 if (!class_exists("UpdateCustomerProfile")) {
@@ -1019,16 +1019,16 @@
  * UpdateCustomerProfile
  */
 class UpdateCustomerProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var CustomerProfileExType
-	 */
-	public $profile;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var CustomerProfileExType
+   */
+  public $profile;
 }}
 
 if (!class_exists("UpdateCustomerProfileResponse")) {
@@ -1036,11 +1036,11 @@
  * UpdateCustomerProfileResponse
  */
 class UpdateCustomerProfileResponse {
-	/**
-	 * @access public
-	 * @var UpdateCustomerProfileResponseType
-	 */
-	public $UpdateCustomerProfileResult;
+  /**
+   * @access public
+   * @var UpdateCustomerProfileResponseType
+   */
+  public $UpdateCustomerProfileResult;
 }}
 
 if (!class_exists("UpdateCustomerProfileResponseType")) {
@@ -1055,21 +1055,21 @@
  * UpdateCustomerPaymentProfile
  */
 class UpdateCustomerPaymentProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var CustomerPaymentProfileExType
-	 */
-	public $paymentProfile;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var CustomerPaymentProfileExType
+   */
+  public $paymentProfile;
 }}
 
 if (!class_exists("UpdateCustomerPaymentProfileResponse")) {
@@ -1077,11 +1077,11 @@
  * UpdateCustomerPaymentProfileResponse
  */
 class UpdateCustomerPaymentProfileResponse {
-	/**
-	 * @access public
-	 * @var UpdateCustomerPaymentProfileResponseType
-	 */
-	public $UpdateCustomerPaymentProfileResult;
+  /**
+   * @access public
+   * @var UpdateCustomerPaymentProfileResponseType
+   */
+  public $UpdateCustomerPaymentProfileResult;
 }}
 
 if (!class_exists("UpdateCustomerPaymentProfileResponseType")) {
@@ -1096,21 +1096,21 @@
  * UpdateCustomerShippingAddress
  */
 class UpdateCustomerShippingAddress {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var CustomerAddressExType
-	 */
-	public $address;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var CustomerAddressExType
+   */
+  public $address;
 }}
 
 if (!class_exists("UpdateCustomerShippingAddressResponse")) {
@@ -1118,11 +1118,11 @@
  * UpdateCustomerShippingAddressResponse
  */
 class UpdateCustomerShippingAddressResponse {
-	/**
-	 * @access public
-	 * @var UpdateCustomerShippingAddressResponseType
-	 */
-	public $UpdateCustomerShippingAddressResult;
+  /**
+   * @access public
+   * @var UpdateCustomerShippingAddressResponseType
+   */
+  public $UpdateCustomerShippingAddressResult;
 }}
 
 if (!class_exists("UpdateCustomerShippingAddressResponseType")) {
@@ -1137,16 +1137,16 @@
  * DeleteCustomerProfile
  */
 class DeleteCustomerProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
 }}
 
 if (!class_exists("DeleteCustomerProfileResponse")) {
@@ -1154,11 +1154,11 @@
  * DeleteCustomerProfileResponse
  */
 class DeleteCustomerProfileResponse {
-	/**
-	 * @access public
-	 * @var DeleteCustomerProfileResponseType
-	 */
-	public $DeleteCustomerProfileResult;
+  /**
+   * @access public
+   * @var DeleteCustomerProfileResponseType
+   */
+  public $DeleteCustomerProfileResult;
 }}
 
 if (!class_exists("DeleteCustomerProfileResponseType")) {
@@ -1173,21 +1173,21 @@
  * DeleteCustomerPaymentProfile
  */
 class DeleteCustomerPaymentProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
 }}
 
 if (!class_exists("DeleteCustomerPaymentProfileResponse")) {
@@ -1195,11 +1195,11 @@
  * DeleteCustomerPaymentProfileResponse
  */
 class DeleteCustomerPaymentProfileResponse {
-	/**
-	 * @access public
-	 * @var DeleteCustomerPaymentProfileResponseType
-	 */
-	public $DeleteCustomerPaymentProfileResult;
+  /**
+   * @access public
+   * @var DeleteCustomerPaymentProfileResponseType
+   */
+  public $DeleteCustomerPaymentProfileResult;
 }}
 
 if (!class_exists("DeleteCustomerPaymentProfileResponseType")) {
@@ -1214,21 +1214,21 @@
  * DeleteCustomerShippingAddress
  */
 class DeleteCustomerShippingAddress {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerAddressId;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerAddressId;
 }}
 
 if (!class_exists("DeleteCustomerShippingAddressResponse")) {
@@ -1236,11 +1236,11 @@
  * DeleteCustomerShippingAddressResponse
  */
 class DeleteCustomerShippingAddressResponse {
-	/**
-	 * @access public
-	 * @var DeleteCustomerShippingAddressResponseType
-	 */
-	public $DeleteCustomerShippingAddressResult;
+  /**
+   * @access public
+   * @var DeleteCustomerShippingAddressResponseType
+   */
+  public $DeleteCustomerShippingAddressResult;
 }}
 
 if (!class_exists("DeleteCustomerShippingAddressResponseType")) {
@@ -1255,21 +1255,21 @@
  * CreateCustomerProfileTransaction
  */
 class CreateCustomerProfileTransaction {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var ProfileTransactionType
-	 */
-	public $transaction;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $extraOptions;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var ProfileTransactionType
+   */
+  public $transaction;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $extraOptions;
 }}
 
 if (!class_exists("ProfileTransactionType")) {
@@ -1277,21 +1277,21 @@
  * ProfileTransactionType
  */
 class ProfileTransactionType {
-	/**
-	 * @access public
-	 * @var ProfileTransAuthOnlyType
-	 */
-	public $profileTransAuthOnly;
-	/**
-	 * @access public
-	 * @var ProfileTransCaptureOnlyType
-	 */
-	public $profileTransCaptureOnly;
-	/**
-	 * @access public
-	 * @var ProfileTransAuthCaptureType
-	 */
-	public $profileTransAuthCapture;
+  /**
+   * @access public
+   * @var ProfileTransAuthOnlyType
+   */
+  public $profileTransAuthOnly;
+  /**
+   * @access public
+   * @var ProfileTransCaptureOnlyType
+   */
+  public $profileTransCaptureOnly;
+  /**
+   * @access public
+   * @var ProfileTransAuthCaptureType
+   */
+  public $profileTransAuthCapture;
 }}
 
 if (!class_exists("ProfileTransAmountType")) {
@@ -1299,31 +1299,31 @@
  * ProfileTransAmountType
  */
 class ProfileTransAmountType {
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $amount;
-	/**
-	 * @access public
-	 * @var ExtendedAmountType
-	 */
-	public $tax;
-	/**
-	 * @access public
-	 * @var ExtendedAmountType
-	 */
-	public $shipping;
-	/**
-	 * @access public
-	 * @var ExtendedAmountType
-	 */
-	public $duty;
-	/**
-	 * @access public
-	 * @var LineItemType[]
-	 */
-	public $lineItems;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $amount;
+  /**
+   * @access public
+   * @var ExtendedAmountType
+   */
+  public $tax;
+  /**
+   * @access public
+   * @var ExtendedAmountType
+   */
+  public $shipping;
+  /**
+   * @access public
+   * @var ExtendedAmountType
+   */
+  public $duty;
+  /**
+   * @access public
+   * @var LineItemType[]
+   */
+  public $lineItems;
 }}
 
 if (!class_exists("ExtendedAmountType")) {
@@ -1331,21 +1331,21 @@
  * ExtendedAmountType
  */
 class ExtendedAmountType {
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $amount;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $name;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $description;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $amount;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $name;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $description;
 }}
 
 if (!class_exists("LineItemType")) {
@@ -1353,36 +1353,36 @@
  * LineItemType
  */
 class LineItemType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $itemId;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $name;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $description;
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $quantity;
-	/**
-	 * @access public
-	 * @var sdecimal
-	 */
-	public $unitPrice;
-	/**
-	 * @access public
-	 * @var sboolean
-	 */
-	public $taxable;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $itemId;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $name;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $description;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $quantity;
+  /**
+   * @access public
+   * @var sdecimal
+   */
+  public $unitPrice;
+  /**
+   * @access public
+   * @var sboolean
+   */
+  public $taxable;
 }}
 
 if (!class_exists("OrderExType")) {
@@ -1390,11 +1390,11 @@
  * OrderExType
  */
 class OrderExType extends OrderType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $purchaseOrderNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $purchaseOrderNumber;
 }}
 
 if (!class_exists("CreateCustomerProfileTransactionResponse")) {
@@ -1402,11 +1402,11 @@
  * CreateCustomerProfileTransactionResponse
  */
 class CreateCustomerProfileTransactionResponse {
-	/**
-	 * @access public
-	 * @var CreateCustomerProfileTransactionResponseType
-	 */
-	public $CreateCustomerProfileTransactionResult;
+  /**
+   * @access public
+   * @var CreateCustomerProfileTransactionResponseType
+   */
+  public $CreateCustomerProfileTransactionResult;
 }}
 
 if (!class_exists("CreateCustomerProfileTransactionResponseType")) {
@@ -1414,11 +1414,11 @@
  * CreateCustomerProfileTransactionResponseType
  */
 class CreateCustomerProfileTransactionResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $directResponse;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $directResponse;
 }}
 
 if (!class_exists("ValidateCustomerPaymentProfile")) {
@@ -1426,31 +1426,31 @@
  * ValidateCustomerPaymentProfile
  */
 class ValidateCustomerPaymentProfile {
-	/**
-	 * @access public
-	 * @var MerchantAuthenticationType
-	 */
-	public $merchantAuthentication;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerShippingAddressId;
-	/**
-	 * @access public
-	 * @var tnsValidationModeEnum
-	 */
-	public $validationMode;
+  /**
+   * @access public
+   * @var MerchantAuthenticationType
+   */
+  public $merchantAuthentication;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerShippingAddressId;
+  /**
+   * @access public
+   * @var tnsValidationModeEnum
+   */
+  public $validationMode;
 }}
 
 if (!class_exists("ValidateCustomerPaymentProfileResponse")) {
@@ -1458,11 +1458,11 @@
  * ValidateCustomerPaymentProfileResponse
  */
 class ValidateCustomerPaymentProfileResponse {
-	/**
-	 * @access public
-	 * @var ValidateCustomerPaymentProfileResponseType
-	 */
-	public $ValidateCustomerPaymentProfileResult;
+  /**
+   * @access public
+   * @var ValidateCustomerPaymentProfileResponseType
+   */
+  public $ValidateCustomerPaymentProfileResult;
 }}
 
 if (!class_exists("ValidateCustomerPaymentProfileResponseType")) {
@@ -1470,11 +1470,11 @@
  * ValidateCustomerPaymentProfileResponseType
  */
 class ValidateCustomerPaymentProfileResponseType extends ANetApiResponseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $directResponse;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $directResponse;
 }}
 
 if (!class_exists("CreditCardType")) {
@@ -1482,11 +1482,11 @@
  * CreditCardType
  */
 class CreditCardType extends CreditCardSimpleType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $cardCode;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $cardCode;
 }}
 
 if (!class_exists("BankAccountType")) {
@@ -1494,16 +1494,16 @@
  * BankAccountType
  */
 class BankAccountType extends BankAccountBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $routingNumber;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $accountNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $routingNumber;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $accountNumber;
 }}
 
 if (!class_exists("DriversLicenseType")) {
@@ -1511,16 +1511,16 @@
  * DriversLicenseType
  */
 class DriversLicenseType extends DriversLicenseBaseType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $number;
-	/**
-	 * @access public
-	 * @var sdate
-	 */
-	public $dateOfBirth;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $number;
+  /**
+   * @access public
+   * @var sdate
+   */
+  public $dateOfBirth;
 }}
 
 if (!class_exists("CustomerProfileType")) {
@@ -1528,16 +1528,16 @@
  * CustomerProfileType
  */
 class CustomerProfileType extends CustomerProfileBaseType {
-	/**
-	 * @access public
-	 * @var ArrayOfCustomerPaymentProfileType
-	 */
-	public $paymentProfiles;
-	/**
-	 * @access public
-	 * @var ArrayOfCustomerAddressType
-	 */
-	public $shipToList;
+  /**
+   * @access public
+   * @var ArrayOfCustomerPaymentProfileType
+   */
+  public $paymentProfiles;
+  /**
+   * @access public
+   * @var ArrayOfCustomerAddressType
+   */
+  public $shipToList;
 }}
 
 if (!class_exists("CustomerPaymentProfileType")) {
@@ -1545,21 +1545,21 @@
  * CustomerPaymentProfileType
  */
 class CustomerPaymentProfileType extends CustomerPaymentProfileBaseType {
-	/**
-	 * @access public
-	 * @var PaymentSimpleType
-	 */
-	public $payment;
-	/**
-	 * @access public
-	 * @var DriversLicenseType
-	 */
-	public $driversLicense;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $taxId;
+  /**
+   * @access public
+   * @var PaymentSimpleType
+   */
+  public $payment;
+  /**
+   * @access public
+   * @var DriversLicenseType
+   */
+  public $driversLicense;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $taxId;
 }}
 
 if (!class_exists("CustomerProfileMaskedType")) {
@@ -1567,16 +1567,16 @@
  * CustomerProfileMaskedType
  */
 class CustomerProfileMaskedType extends CustomerProfileExType {
-	/**
-	 * @access public
-	 * @var ArrayOfCustomerPaymentProfileMaskedType
-	 */
-	public $paymentProfiles;
-	/**
-	 * @access public
-	 * @var ArrayOfCustomerAddressExType
-	 */
-	public $shipToList;
+  /**
+   * @access public
+   * @var ArrayOfCustomerPaymentProfileMaskedType
+   */
+  public $paymentProfiles;
+  /**
+   * @access public
+   * @var ArrayOfCustomerAddressExType
+   */
+  public $shipToList;
 }}
 
 if (!class_exists("CustomerPaymentProfileExType")) {
@@ -1584,11 +1584,11 @@
  * CustomerPaymentProfileExType
  */
 class CustomerPaymentProfileExType extends CustomerPaymentProfileType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
 }}
 
 if (!class_exists("ProfileTransOrderType")) {
@@ -1596,41 +1596,41 @@
  * ProfileTransOrderType
  */
 class ProfileTransOrderType extends ProfileTransAmountType {
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerPaymentProfileId;
-	/**
-	 * @access public
-	 * @var slong
-	 */
-	public $customerShippingAddressId;
-	/**
-	 * @access public
-	 * @var OrderExType
-	 */
-	public $order;
-	/**
-	 * @access public
-	 * @var sboolean
-	 */
-	public $taxExempt;
-	/**
-	 * @access public
-	 * @var sboolean
-	 */
-	public $recurringBilling;
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $cardCode;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerPaymentProfileId;
+  /**
+   * @access public
+   * @var slong
+   */
+  public $customerShippingAddressId;
+  /**
+   * @access public
+   * @var OrderExType
+   */
+  public $order;
+  /**
+   * @access public
+   * @var sboolean
+   */
+  public $taxExempt;
+  /**
+   * @access public
+   * @var sboolean
+   */
+  public $recurringBilling;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $cardCode;
 }}
 
 if (!class_exists("ProfileTransAuthCaptureType")) {
@@ -1645,11 +1645,11 @@
  * ProfileTransCaptureOnlyType
  */
 class ProfileTransCaptureOnlyType extends ProfileTransOrderType {
-	/**
-	 * @access public
-	 * @var sstring
-	 */
-	public $approvalCode;
+  /**
+   * @access public
+   * @var sstring
+   */
+  public $approvalCode;
 }}
 
 if (!class_exists("ProfileTransAuthOnlyType")) {
@@ -1665,529 +1665,529 @@
  * @author WSDLInterpreter
  */
 class AuthorizeNetWS extends SoapClient {
-	/**
-	 * Default class map for wsdl=>php
-	 * @access private
-	 * @var array
-	 */
-	private static $classmap = array(
-		"IsAlive" => "IsAlive",
-		"IsAliveResponse" => "IsAliveResponse",
-		"ANetApiResponseType" => "ANetApiResponseType",
-		"MessageTypeEnum" => "MessageTypeEnum",
-		"MessagesTypeMessage" => "MessagesTypeMessage",
-		"AuthenticateTest" => "AuthenticateTest",
-		"MerchantAuthenticationType" => "MerchantAuthenticationType",
-		"AuthenticateTestResponse" => "AuthenticateTestResponse",
-		"ARBCreateSubscription" => "ARBCreateSubscription",
-		"ARBSubscriptionType" => "ARBSubscriptionType",
-		"PaymentScheduleType" => "PaymentScheduleType",
-		"PaymentScheduleTypeInterval" => "PaymentScheduleTypeInterval",
-		"ARBSubscriptionUnitEnum" => "ARBSubscriptionUnitEnum",
-		"PaymentType" => "PaymentType",
-		"CreditCardType" => "CreditCardType",
-		"CreditCardSimpleType" => "CreditCardSimpleType",
-		"BankAccountType" => "BankAccountType",
-		"BankAccountBaseType" => "BankAccountBaseType",
-		"BankAccountTypeEnum" => "BankAccountTypeEnum",
-		"EcheckTypeEnum" => "EcheckTypeEnum",
-		"OrderType" => "OrderType",
-		"CustomerType" => "CustomerType",
-		"CustomerTypeEnum" => "CustomerTypeEnum",
-		"DriversLicenseType" => "DriversLicenseType",
-		"DriversLicenseBaseType" => "DriversLicenseBaseType",
-		"NameAndAddressType" => "NameAndAddressType",
-		"ARBCreateSubscriptionResponse" => "ARBCreateSubscriptionResponse",
-		"ARBCreateSubscriptionResponseType" => "ARBCreateSubscriptionResponseType",
-		"ARBUpdateSubscription" => "ARBUpdateSubscription",
-		"ARBUpdateSubscriptionResponse" => "ARBUpdateSubscriptionResponse",
-		"ARBUpdateSubscriptionResponseType" => "ARBUpdateSubscriptionResponseType",
-		"ARBCancelSubscription" => "ARBCancelSubscription",
-		"ARBCancelSubscriptionResponse" => "ARBCancelSubscriptionResponse",
-		"ARBCancelSubscriptionResponseType" => "ARBCancelSubscriptionResponseType",
-		"CreateCustomerProfile" => "CreateCustomerProfile",
-		"CustomerProfileType" => "CustomerProfileType",
-		"CustomerProfileBaseType" => "CustomerProfileBaseType",
-		"CustomerPaymentProfileType" => "CustomerPaymentProfileType",
-		"CustomerPaymentProfileBaseType" => "CustomerPaymentProfileBaseType",
-		"CustomerAddressType" => "CustomerAddressType",
-		"PaymentSimpleType" => "PaymentSimpleType",
-		"CreateCustomerProfileResponse" => "CreateCustomerProfileResponse",
-		"CreateCustomerProfileResponseType" => "CreateCustomerProfileResponseType",
-		"CreateCustomerPaymentProfile" => "CreateCustomerPaymentProfile",
-		"ValidationModeEnum" => "ValidationModeEnum",
-		"CreateCustomerPaymentProfileResponse" => "CreateCustomerPaymentProfileResponse",
-		"CreateCustomerPaymentProfileResponseType" => "CreateCustomerPaymentProfileResponseType",
-		"CreateCustomerShippingAddress" => "CreateCustomerShippingAddress",
-		"CreateCustomerShippingAddressResponse" => "CreateCustomerShippingAddressResponse",
-		"CreateCustomerShippingAddressResponseType" => "CreateCustomerShippingAddressResponseType",
-		"GetCustomerProfile" => "GetCustomerProfile",
-		"GetCustomerProfileResponse" => "GetCustomerProfileResponse",
-		"GetCustomerProfileResponseType" => "GetCustomerProfileResponseType",
-		"CustomerProfileMaskedType" => "CustomerProfileMaskedType",
-		"CustomerProfileExType" => "CustomerProfileExType",
-		"CustomerPaymentProfileMaskedType" => "CustomerPaymentProfileMaskedType",
-		"PaymentMaskedType" => "PaymentMaskedType",
-		"BankAccountMaskedType" => "BankAccountMaskedType",
-		"CreditCardMaskedType" => "CreditCardMaskedType",
-		"DriversLicenseMaskedType" => "DriversLicenseMaskedType",
-		"CustomerAddressExType" => "CustomerAddressExType",
-		"GetCustomerPaymentProfile" => "GetCustomerPaymentProfile",
-		"GetCustomerPaymentProfileResponse" => "GetCustomerPaymentProfileResponse",
-		"GetCustomerPaymentProfileResponseType" => "GetCustomerPaymentProfileResponseType",
-		"GetCustomerShippingAddress" => "GetCustomerShippingAddress",
-		"GetCustomerShippingAddressResponse" => "GetCustomerShippingAddressResponse",
-		"GetCustomerShippingAddressResponseType" => "GetCustomerShippingAddressResponseType",
-		"UpdateCustomerProfile" => "UpdateCustomerProfile",
-		"UpdateCustomerProfileResponse" => "UpdateCustomerProfileResponse",
-		"UpdateCustomerProfileResponseType" => "UpdateCustomerProfileResponseType",
-		"UpdateCustomerPaymentProfile" => "UpdateCustomerPaymentProfile",
-		"CustomerPaymentProfileExType" => "CustomerPaymentProfileExType",
-		"UpdateCustomerPaymentProfileResponse" => "UpdateCustomerPaymentProfileResponse",
-		"UpdateCustomerPaymentProfileResponseType" => "UpdateCustomerPaymentProfileResponseType",
-		"UpdateCustomerShippingAddress" => "UpdateCustomerShippingAddress",
-		"UpdateCustomerShippingAddressResponse" => "UpdateCustomerShippingAddressResponse",
-		"UpdateCustomerShippingAddressResponseType" => "UpdateCustomerShippingAddressResponseType",
-		"DeleteCustomerProfile" => "DeleteCustomerProfile",
-		"DeleteCustomerProfileResponse" => "DeleteCustomerProfileResponse",
-		"DeleteCustomerProfileResponseType" => "DeleteCustomerProfileResponseType",
-		"DeleteCustomerPaymentProfile" => "DeleteCustomerPaymentProfile",
-		"DeleteCustomerPaymentProfileResponse" => "DeleteCustomerPaymentProfileResponse",
-		"DeleteCustomerPaymentProfileResponseType" => "DeleteCustomerPaymentProfileResponseType",
-		"DeleteCustomerShippingAddress" => "DeleteCustomerShippingAddress",
-		"DeleteCustomerShippingAddressResponse" => "DeleteCustomerShippingAddressResponse",
-		"DeleteCustomerShippingAddressResponseType" => "DeleteCustomerShippingAddressResponseType",
-		"CreateCustomerProfileTransaction" => "CreateCustomerProfileTransaction",
-		"ProfileTransactionType" => "ProfileTransactionType",
-		"ProfileTransAuthOnlyType" => "ProfileTransAuthOnlyType",
-		"ProfileTransOrderType" => "ProfileTransOrderType",
-		"ProfileTransAmountType" => "ProfileTransAmountType",
-		"ExtendedAmountType" => "ExtendedAmountType",
-		"LineItemType" => "LineItemType",
-		"OrderExType" => "OrderExType",
-		"ProfileTransAuthCaptureType" => "ProfileTransAuthCaptureType",
-		"ProfileTransCaptureOnlyType" => "ProfileTransCaptureOnlyType",
-		"CreateCustomerProfileTransactionResponse" => "CreateCustomerProfileTransactionResponse",
-		"CreateCustomerProfileTransactionResponseType" => "CreateCustomerProfileTransactionResponseType",
-		"ValidateCustomerPaymentProfile" => "ValidateCustomerPaymentProfile",
-		"ValidateCustomerPaymentProfileResponse" => "ValidateCustomerPaymentProfileResponse",
-		"ValidateCustomerPaymentProfileResponseType" => "ValidateCustomerPaymentProfileResponseType",
-	);
-
-	/**
-	 * Constructor using wsdl location and options array
-	 * @param string $wsdl WSDL location for this service
-	 * @param array $options Options for the SoapClient
-	 */
-	public function __construct($wsdl, $options=array()) {
-		foreach(self::$classmap as $wsdlClassName => $phpClassName) {
-		    if(!isset($options['classmap'][$wsdlClassName])) {
-		        $options['classmap'][$wsdlClassName] = $phpClassName;
-		    }
-		}
-		parent::__construct($wsdl, $options);
-	}
-
-	/**
-	 * Checks if an argument list matches against a valid argument type list
-	 * @param array $arguments The argument list to check
-	 * @param array $validParameters A list of valid argument types
-	 * @return boolean true if arguments match against validParameters
-	 * @throws Exception invalid function signature message
-	 */
-	public function _checkArguments($arguments, $validParameters) {
-		$variables = "";
-		foreach ($arguments as $arg) {
-		    $type = gettype($arg);
-		    if ($type == "object") {
-		        $type = get_class($arg);
-		    }
-		    $variables .= "(".$type.")";
-		}
-		if (!in_array($variables, $validParameters)) {
-		    throw new Exception("Invalid parameter types: ".str_replace(")(", ", ", $variables));
-		}
-		return true;
-	}
-
-	/**
-	 * Service Call: IsAlive
-	 * Parameter options:
-	 * (IsAlive) parameters
-	 * (IsAlive) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return IsAliveResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function IsAlive($mixed = null) {
-		$validParameters = array(
-			"(IsAlive)",
-			"(IsAlive)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("IsAlive", $args);
-	}
-
-
-	/**
-	 * Service Call: AuthenticateTest
-	 * Parameter options:
-	 * (AuthenticateTest) parameters
-	 * (AuthenticateTest) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return AuthenticateTestResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function AuthenticateTest($mixed = null) {
-		$validParameters = array(
-			"(AuthenticateTest)",
-			"(AuthenticateTest)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("AuthenticateTest", $args);
-	}
-
-
-	/**
-	 * Service Call: ARBCreateSubscription
-	 * Parameter options:
-	 * (ARBCreateSubscription) parameters
-	 * (ARBCreateSubscription) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return ARBCreateSubscriptionResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function ARBCreateSubscription($mixed = null) {
-		$validParameters = array(
-			"(ARBCreateSubscription)",
-			"(ARBCreateSubscription)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("ARBCreateSubscription", $args);
-	}
-
-
-	/**
-	 * Service Call: ARBUpdateSubscription
-	 * Parameter options:
-	 * (ARBUpdateSubscription) parameters
-	 * (ARBUpdateSubscription) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return ARBUpdateSubscriptionResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function ARBUpdateSubscription($mixed = null) {
-		$validParameters = array(
-			"(ARBUpdateSubscription)",
-			"(ARBUpdateSubscription)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("ARBUpdateSubscription", $args);
-	}
-
-
-	/**
-	 * Service Call: ARBCancelSubscription
-	 * Parameter options:
-	 * (ARBCancelSubscription) parameters
-	 * (ARBCancelSubscription) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return ARBCancelSubscriptionResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function ARBCancelSubscription($mixed = null) {
-		$validParameters = array(
-			"(ARBCancelSubscription)",
-			"(ARBCancelSubscription)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("ARBCancelSubscription", $args);
-	}
-
-
-	/**
-	 * Service Call: CreateCustomerProfile
-	 * Parameter options:
-	 * (CreateCustomerProfile) parameters
-	 * (CreateCustomerProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return CreateCustomerProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function CreateCustomerProfile($mixed = null) {
-		$validParameters = array(
-			"(CreateCustomerProfile)",
-			"(CreateCustomerProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("CreateCustomerProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: CreateCustomerPaymentProfile
-	 * Parameter options:
-	 * (CreateCustomerPaymentProfile) parameters
-	 * (CreateCustomerPaymentProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return CreateCustomerPaymentProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function CreateCustomerPaymentProfile($mixed = null) {
-		$validParameters = array(
-			"(CreateCustomerPaymentProfile)",
-			"(CreateCustomerPaymentProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("CreateCustomerPaymentProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: CreateCustomerShippingAddress
-	 * Parameter options:
-	 * (CreateCustomerShippingAddress) parameters
-	 * (CreateCustomerShippingAddress) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return CreateCustomerShippingAddressResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function CreateCustomerShippingAddress($mixed = null) {
-		$validParameters = array(
-			"(CreateCustomerShippingAddress)",
-			"(CreateCustomerShippingAddress)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("CreateCustomerShippingAddress", $args);
-	}
-
-
-	/**
-	 * Service Call: GetCustomerProfile
-	 * Parameter options:
-	 * (GetCustomerProfile) parameters
-	 * (GetCustomerProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return GetCustomerProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function GetCustomerProfile($mixed = null) {
-		$validParameters = array(
-			"(GetCustomerProfile)",
-			"(GetCustomerProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("GetCustomerProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: GetCustomerPaymentProfile
-	 * Parameter options:
-	 * (GetCustomerPaymentProfile) parameters
-	 * (GetCustomerPaymentProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return GetCustomerPaymentProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function GetCustomerPaymentProfile($mixed = null) {
-		$validParameters = array(
-			"(GetCustomerPaymentProfile)",
-			"(GetCustomerPaymentProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("GetCustomerPaymentProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: GetCustomerShippingAddress
-	 * Parameter options:
-	 * (GetCustomerShippingAddress) parameters
-	 * (GetCustomerShippingAddress) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return GetCustomerShippingAddressResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function GetCustomerShippingAddress($mixed = null) {
-		$validParameters = array(
-			"(GetCustomerShippingAddress)",
-			"(GetCustomerShippingAddress)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("GetCustomerShippingAddress", $args);
-	}
-
-
-	/**
-	 * Service Call: UpdateCustomerProfile
-	 * Parameter options:
-	 * (UpdateCustomerProfile) parameters
-	 * (UpdateCustomerProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return UpdateCustomerProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function UpdateCustomerProfile($mixed = null) {
-		$validParameters = array(
-			"(UpdateCustomerProfile)",
-			"(UpdateCustomerProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("UpdateCustomerProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: UpdateCustomerPaymentProfile
-	 * Parameter options:
-	 * (UpdateCustomerPaymentProfile) parameters
-	 * (UpdateCustomerPaymentProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return UpdateCustomerPaymentProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function UpdateCustomerPaymentProfile($mixed = null) {
-		$validParameters = array(
-			"(UpdateCustomerPaymentProfile)",
-			"(UpdateCustomerPaymentProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("UpdateCustomerPaymentProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: UpdateCustomerShippingAddress
-	 * Parameter options:
-	 * (UpdateCustomerShippingAddress) parameters
-	 * (UpdateCustomerShippingAddress) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return UpdateCustomerShippingAddressResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function UpdateCustomerShippingAddress($mixed = null) {
-		$validParameters = array(
-			"(UpdateCustomerShippingAddress)",
-			"(UpdateCustomerShippingAddress)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("UpdateCustomerShippingAddress", $args);
-	}
-
-
-	/**
-	 * Service Call: DeleteCustomerProfile
-	 * Parameter options:
-	 * (DeleteCustomerProfile) parameters
-	 * (DeleteCustomerProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return DeleteCustomerProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function DeleteCustomerProfile($mixed = null) {
-		$validParameters = array(
-			"(DeleteCustomerProfile)",
-			"(DeleteCustomerProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("DeleteCustomerProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: DeleteCustomerPaymentProfile
-	 * Parameter options:
-	 * (DeleteCustomerPaymentProfile) parameters
-	 * (DeleteCustomerPaymentProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return DeleteCustomerPaymentProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function DeleteCustomerPaymentProfile($mixed = null) {
-		$validParameters = array(
-			"(DeleteCustomerPaymentProfile)",
-			"(DeleteCustomerPaymentProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("DeleteCustomerPaymentProfile", $args);
-	}
-
-
-	/**
-	 * Service Call: DeleteCustomerShippingAddress
-	 * Parameter options:
-	 * (DeleteCustomerShippingAddress) parameters
-	 * (DeleteCustomerShippingAddress) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return DeleteCustomerShippingAddressResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function DeleteCustomerShippingAddress($mixed = null) {
-		$validParameters = array(
-			"(DeleteCustomerShippingAddress)",
-			"(DeleteCustomerShippingAddress)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("DeleteCustomerShippingAddress", $args);
-	}
-
-
-	/**
-	 * Service Call: CreateCustomerProfileTransaction
-	 * Parameter options:
-	 * (CreateCustomerProfileTransaction) parameters
-	 * (CreateCustomerProfileTransaction) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return CreateCustomerProfileTransactionResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function CreateCustomerProfileTransaction($mixed = null) {
-		$validParameters = array(
-			"(CreateCustomerProfileTransaction)",
-			"(CreateCustomerProfileTransaction)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("CreateCustomerProfileTransaction", $args);
-	}
-
-
-	/**
-	 * Service Call: ValidateCustomerPaymentProfile
-	 * Parameter options:
-	 * (ValidateCustomerPaymentProfile) parameters
-	 * (ValidateCustomerPaymentProfile) parameters
-	 * @param mixed,... See function description for parameter options
-	 * @return ValidateCustomerPaymentProfileResponse
-	 * @throws Exception invalid function signature message
-	 */
-	public function ValidateCustomerPaymentProfile($mixed = null) {
-		$validParameters = array(
-			"(ValidateCustomerPaymentProfile)",
-			"(ValidateCustomerPaymentProfile)",
-		);
-		$args = func_get_args();
-		$this->_checkArguments($args, $validParameters);
-		return $this->__soapCall("ValidateCustomerPaymentProfile", $args);
-	}
+  /**
+   * Default class map for wsdl=>php
+   * @access private
+   * @var array
+   */
+  private static $classmap = array(
+    "IsAlive" => "IsAlive",
+    "IsAliveResponse" => "IsAliveResponse",
+    "ANetApiResponseType" => "ANetApiResponseType",
+    "MessageTypeEnum" => "MessageTypeEnum",
+    "MessagesTypeMessage" => "MessagesTypeMessage",
+    "AuthenticateTest" => "AuthenticateTest",
+    "MerchantAuthenticationType" => "MerchantAuthenticationType",
+    "AuthenticateTestResponse" => "AuthenticateTestResponse",
+    "ARBCreateSubscription" => "ARBCreateSubscription",
+    "ARBSubscriptionType" => "ARBSubscriptionType",
+    "PaymentScheduleType" => "PaymentScheduleType",
+    "PaymentScheduleTypeInterval" => "PaymentScheduleTypeInterval",
+    "ARBSubscriptionUnitEnum" => "ARBSubscriptionUnitEnum",
+    "PaymentType" => "PaymentType",
+    "CreditCardType" => "CreditCardType",
+    "CreditCardSimpleType" => "CreditCardSimpleType",
+    "BankAccountType" => "BankAccountType",
+    "BankAccountBaseType" => "BankAccountBaseType",
+    "BankAccountTypeEnum" => "BankAccountTypeEnum",
+    "EcheckTypeEnum" => "EcheckTypeEnum",
+    "OrderType" => "OrderType",
+    "CustomerType" => "CustomerType",
+    "CustomerTypeEnum" => "CustomerTypeEnum",
+    "DriversLicenseType" => "DriversLicenseType",
+    "DriversLicenseBaseType" => "DriversLicenseBaseType",
+    "NameAndAddressType" => "NameAndAddressType",
+    "ARBCreateSubscriptionResponse" => "ARBCreateSubscriptionResponse",
+    "ARBCreateSubscriptionResponseType" => "ARBCreateSubscriptionResponseType",
+    "ARBUpdateSubscription" => "ARBUpdateSubscription",
+    "ARBUpdateSubscriptionResponse" => "ARBUpdateSubscriptionResponse",
+    "ARBUpdateSubscriptionResponseType" => "ARBUpdateSubscriptionResponseType",
+    "ARBCancelSubscription" => "ARBCancelSubscription",
+    "ARBCancelSubscriptionResponse" => "ARBCancelSubscriptionResponse",
+    "ARBCancelSubscriptionResponseType" => "ARBCancelSubscriptionResponseType",
+    "CreateCustomerProfile" => "CreateCustomerProfile",
+    "CustomerProfileType" => "CustomerProfileType",
+    "CustomerProfileBaseType" => "CustomerProfileBaseType",
+    "CustomerPaymentProfileType" => "CustomerPaymentProfileType",
+    "CustomerPaymentProfileBaseType" => "CustomerPaymentProfileBaseType",
+    "CustomerAddressType" => "CustomerAddressType",
+    "PaymentSimpleType" => "PaymentSimpleType",
+    "CreateCustomerProfileResponse" => "CreateCustomerProfileResponse",
+    "CreateCustomerProfileResponseType" => "CreateCustomerProfileResponseType",
+    "CreateCustomerPaymentProfile" => "CreateCustomerPaymentProfile",
+    "ValidationModeEnum" => "ValidationModeEnum",
+    "CreateCustomerPaymentProfileResponse" => "CreateCustomerPaymentProfileResponse",
+    "CreateCustomerPaymentProfileResponseType" => "CreateCustomerPaymentProfileResponseType",
+    "CreateCustomerShippingAddress" => "CreateCustomerShippingAddress",
+    "CreateCustomerShippingAddressResponse" => "CreateCustomerShippingAddressResponse",
+    "CreateCustomerShippingAddressResponseType" => "CreateCustomerShippingAddressResponseType",
+    "GetCustomerProfile" => "GetCustomerProfile",
+    "GetCustomerProfileResponse" => "GetCustomerProfileResponse",
+    "GetCustomerProfileResponseType" => "GetCustomerProfileResponseType",
+    "CustomerProfileMaskedType" => "CustomerProfileMaskedType",
+    "CustomerProfileExType" => "CustomerProfileExType",
+    "CustomerPaymentProfileMaskedType" => "CustomerPaymentProfileMaskedType",
+    "PaymentMaskedType" => "PaymentMaskedType",
+    "BankAccountMaskedType" => "BankAccountMaskedType",
+    "CreditCardMaskedType" => "CreditCardMaskedType",
+    "DriversLicenseMaskedType" => "DriversLicenseMaskedType",
+    "CustomerAddressExType" => "CustomerAddressExType",
+    "GetCustomerPaymentProfile" => "GetCustomerPaymentProfile",
+    "GetCustomerPaymentProfileResponse" => "GetCustomerPaymentProfileResponse",
+    "GetCustomerPaymentProfileResponseType" => "GetCustomerPaymentProfileResponseType",
+    "GetCustomerShippingAddress" => "GetCustomerShippingAddress",
+    "GetCustomerShippingAddressResponse" => "GetCustomerShippingAddressResponse",
+    "GetCustomerShippingAddressResponseType" => "GetCustomerShippingAddressResponseType",
+    "UpdateCustomerProfile" => "UpdateCustomerProfile",
+    "UpdateCustomerProfileResponse" => "UpdateCustomerProfileResponse",
+    "UpdateCustomerProfileResponseType" => "UpdateCustomerProfileResponseType",
+    "UpdateCustomerPaymentProfile" => "UpdateCustomerPaymentProfile",
+    "CustomerPaymentProfileExType" => "CustomerPaymentProfileExType",
+    "UpdateCustomerPaymentProfileResponse" => "UpdateCustomerPaymentProfileResponse",
+    "UpdateCustomerPaymentProfileResponseType" => "UpdateCustomerPaymentProfileResponseType",
+    "UpdateCustomerShippingAddress" => "UpdateCustomerShippingAddress",
+    "UpdateCustomerShippingAddressResponse" => "UpdateCustomerShippingAddressResponse",
+    "UpdateCustomerShippingAddressResponseType" => "UpdateCustomerShippingAddressResponseType",
+    "DeleteCustomerProfile" => "DeleteCustomerProfile",
+    "DeleteCustomerProfileResponse" => "DeleteCustomerProfileResponse",
+    "DeleteCustomerProfileResponseType" => "DeleteCustomerProfileResponseType",
+    "DeleteCustomerPaymentProfile" => "DeleteCustomerPaymentProfile",
+    "DeleteCustomerPaymentProfileResponse" => "DeleteCustomerPaymentProfileResponse",
+    "DeleteCustomerPaymentProfileResponseType" => "DeleteCustomerPaymentProfileResponseType",
+    "DeleteCustomerShippingAddress" => "DeleteCustomerShippingAddress",
+    "DeleteCustomerShippingAddressResponse" => "DeleteCustomerShippingAddressResponse",
+    "DeleteCustomerShippingAddressResponseType" => "DeleteCustomerShippingAddressResponseType",
+    "CreateCustomerProfileTransaction" => "CreateCustomerProfileTransaction",
+    "ProfileTransactionType" => "ProfileTransactionType",
+    "ProfileTransAuthOnlyType" => "ProfileTransAuthOnlyType",
+    "ProfileTransOrderType" => "ProfileTransOrderType",
+    "ProfileTransAmountType" => "ProfileTransAmountType",
+    "ExtendedAmountType" => "ExtendedAmountType",
+    "LineItemType" => "LineItemType",
+    "OrderExType" => "OrderExType",
+    "ProfileTransAuthCaptureType" => "ProfileTransAuthCaptureType",
+    "ProfileTransCaptureOnlyType" => "ProfileTransCaptureOnlyType",
+    "CreateCustomerProfileTransactionResponse" => "CreateCustomerProfileTransactionResponse",
+    "CreateCustomerProfileTransactionResponseType" => "CreateCustomerProfileTransactionResponseType",
+    "ValidateCustomerPaymentProfile" => "ValidateCustomerPaymentProfile",
+    "ValidateCustomerPaymentProfileResponse" => "ValidateCustomerPaymentProfileResponse",
+    "ValidateCustomerPaymentProfileResponseType" => "ValidateCustomerPaymentProfileResponseType",
+  );
+
+  /**
+   * Constructor using wsdl location and options array
+   * @param string $wsdl WSDL location for this service
+   * @param array $options Options for the SoapClient
+   */
+  public function __construct($wsdl, $options=array()) {
+    foreach(self::$classmap as $wsdlClassName => $phpClassName) {
+        if(!isset($options['classmap'][$wsdlClassName])) {
+            $options['classmap'][$wsdlClassName] = $phpClassName;
+        }
+    }
+    parent::__construct($wsdl, $options);
+  }
+
+  /**
+   * Checks if an argument list matches against a valid argument type list
+   * @param array $arguments The argument list to check
+   * @param array $validParameters A list of valid argument types
+   * @return boolean true if arguments match against validParameters
+   * @throws Exception invalid function signature message
+   */
+  public function _checkArguments($arguments, $validParameters) {
+    $variables = "";
+    foreach ($arguments as $arg) {
+        $type = gettype($arg);
+        if ($type == "object") {
+            $type = get_class($arg);
+        }
+        $variables .= "(".$type.")";
+    }
+    if (!in_array($variables, $validParameters)) {
+        throw new Exception("Invalid parameter types: ".str_replace(")(", ", ", $variables));
+    }
+    return true;
+  }
+
+  /**
+   * Service Call: IsAlive
+   * Parameter options:
+   * (IsAlive) parameters
+   * (IsAlive) parameters
+   * @param mixed,... See function description for parameter options
+   * @return IsAliveResponse
+   * @throws Exception invalid function signature message
+   */
+  public function IsAlive($mixed = null) {
+    $validParameters = array(
+      "(IsAlive)",
+      "(IsAlive)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("IsAlive", $args);
+  }
+
+
+  /**
+   * Service Call: AuthenticateTest
+   * Parameter options:
+   * (AuthenticateTest) parameters
+   * (AuthenticateTest) parameters
+   * @param mixed,... See function description for parameter options
+   * @return AuthenticateTestResponse
+   * @throws Exception invalid function signature message
+   */
+  public function AuthenticateTest($mixed = null) {
+    $validParameters = array(
+      "(AuthenticateTest)",
+      "(AuthenticateTest)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("AuthenticateTest", $args);
+  }
+
+
+  /**
+   * Service Call: ARBCreateSubscription
+   * Parameter options:
+   * (ARBCreateSubscription) parameters
+   * (ARBCreateSubscription) parameters
+   * @param mixed,... See function description for parameter options
+   * @return ARBCreateSubscriptionResponse
+   * @throws Exception invalid function signature message
+   */
+  public function ARBCreateSubscription($mixed = null) {
+    $validParameters = array(
+      "(ARBCreateSubscription)",
+      "(ARBCreateSubscription)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("ARBCreateSubscription", $args);
+  }
+
+
+  /**
+   * Service Call: ARBUpdateSubscription
+   * Parameter options:
+   * (ARBUpdateSubscription) parameters
+   * (ARBUpdateSubscription) parameters
+   * @param mixed,... See function description for parameter options
+   * @return ARBUpdateSubscriptionResponse
+   * @throws Exception invalid function signature message
+   */
+  public function ARBUpdateSubscription($mixed = null) {
+    $validParameters = array(
+      "(ARBUpdateSubscription)",
+      "(ARBUpdateSubscription)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("ARBUpdateSubscription", $args);
+  }
+
+
+  /**
+   * Service Call: ARBCancelSubscription
+   * Parameter options:
+   * (ARBCancelSubscription) parameters
+   * (ARBCancelSubscription) parameters
+   * @param mixed,... See function description for parameter options
+   * @return ARBCancelSubscriptionResponse
+   * @throws Exception invalid function signature message
+   */
+  public function ARBCancelSubscription($mixed = null) {
+    $validParameters = array(
+      "(ARBCancelSubscription)",
+      "(ARBCancelSubscription)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("ARBCancelSubscription", $args);
+  }
+
+
+  /**
+   * Service Call: CreateCustomerProfile
+   * Parameter options:
+   * (CreateCustomerProfile) parameters
+   * (CreateCustomerProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return CreateCustomerProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function CreateCustomerProfile($mixed = null) {
+    $validParameters = array(
+      "(CreateCustomerProfile)",
+      "(CreateCustomerProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("CreateCustomerProfile", $args);
+  }
+
+
+  /**
+   * Service Call: CreateCustomerPaymentProfile
+   * Parameter options:
+   * (CreateCustomerPaymentProfile) parameters
+   * (CreateCustomerPaymentProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return CreateCustomerPaymentProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function CreateCustomerPaymentProfile($mixed = null) {
+    $validParameters = array(
+      "(CreateCustomerPaymentProfile)",
+      "(CreateCustomerPaymentProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("CreateCustomerPaymentProfile", $args);
+  }
+
+
+  /**
+   * Service Call: CreateCustomerShippingAddress
+   * Parameter options:
+   * (CreateCustomerShippingAddress) parameters
+   * (CreateCustomerShippingAddress) parameters
+   * @param mixed,... See function description for parameter options
+   * @return CreateCustomerShippingAddressResponse
+   * @throws Exception invalid function signature message
+   */
+  public function CreateCustomerShippingAddress($mixed = null) {
+    $validParameters = array(
+      "(CreateCustomerShippingAddress)",
+      "(CreateCustomerShippingAddress)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("CreateCustomerShippingAddress", $args);
+  }
+
+
+  /**
+   * Service Call: GetCustomerProfile
+   * Parameter options:
+   * (GetCustomerProfile) parameters
+   * (GetCustomerProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return GetCustomerProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function GetCustomerProfile($mixed = null) {
+    $validParameters = array(
+      "(GetCustomerProfile)",
+      "(GetCustomerProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("GetCustomerProfile", $args);
+  }
+
+
+  /**
+   * Service Call: GetCustomerPaymentProfile
+   * Parameter options:
+   * (GetCustomerPaymentProfile) parameters
+   * (GetCustomerPaymentProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return GetCustomerPaymentProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function GetCustomerPaymentProfile($mixed = null) {
+    $validParameters = array(
+      "(GetCustomerPaymentProfile)",
+      "(GetCustomerPaymentProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("GetCustomerPaymentProfile", $args);
+  }
+
+
+  /**
+   * Service Call: GetCustomerShippingAddress
+   * Parameter options:
+   * (GetCustomerShippingAddress) parameters
+   * (GetCustomerShippingAddress) parameters
+   * @param mixed,... See function description for parameter options
+   * @return GetCustomerShippingAddressResponse
+   * @throws Exception invalid function signature message
+   */
+  public function GetCustomerShippingAddress($mixed = null) {
+    $validParameters = array(
+      "(GetCustomerShippingAddress)",
+      "(GetCustomerShippingAddress)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("GetCustomerShippingAddress", $args);
+  }
+
+
+  /**
+   * Service Call: UpdateCustomerProfile
+   * Parameter options:
+   * (UpdateCustomerProfile) parameters
+   * (UpdateCustomerProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return UpdateCustomerProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function UpdateCustomerProfile($mixed = null) {
+    $validParameters = array(
+      "(UpdateCustomerProfile)",
+      "(UpdateCustomerProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("UpdateCustomerProfile", $args);
+  }
+
+
+  /**
+   * Service Call: UpdateCustomerPaymentProfile
+   * Parameter options:
+   * (UpdateCustomerPaymentProfile) parameters
+   * (UpdateCustomerPaymentProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return UpdateCustomerPaymentProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function UpdateCustomerPaymentProfile($mixed = null) {
+    $validParameters = array(
+      "(UpdateCustomerPaymentProfile)",
+      "(UpdateCustomerPaymentProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("UpdateCustomerPaymentProfile", $args);
+  }
+
+
+  /**
+   * Service Call: UpdateCustomerShippingAddress
+   * Parameter options:
+   * (UpdateCustomerShippingAddress) parameters
+   * (UpdateCustomerShippingAddress) parameters
+   * @param mixed,... See function description for parameter options
+   * @return UpdateCustomerShippingAddressResponse
+   * @throws Exception invalid function signature message
+   */
+  public function UpdateCustomerShippingAddress($mixed = null) {
+    $validParameters = array(
+      "(UpdateCustomerShippingAddress)",
+      "(UpdateCustomerShippingAddress)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("UpdateCustomerShippingAddress", $args);
+  }
+
+
+  /**
+   * Service Call: DeleteCustomerProfile
+   * Parameter options:
+   * (DeleteCustomerProfile) parameters
+   * (DeleteCustomerProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return DeleteCustomerProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function DeleteCustomerProfile($mixed = null) {
+    $validParameters = array(
+      "(DeleteCustomerProfile)",
+      "(DeleteCustomerProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("DeleteCustomerProfile", $args);
+  }
+
+
+  /**
+   * Service Call: DeleteCustomerPaymentProfile
+   * Parameter options:
+   * (DeleteCustomerPaymentProfile) parameters
+   * (DeleteCustomerPaymentProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return DeleteCustomerPaymentProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function DeleteCustomerPaymentProfile($mixed = null) {
+    $validParameters = array(
+      "(DeleteCustomerPaymentProfile)",
+      "(DeleteCustomerPaymentProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("DeleteCustomerPaymentProfile", $args);
+  }
+
+
+  /**
+   * Service Call: DeleteCustomerShippingAddress
+   * Parameter options:
+   * (DeleteCustomerShippingAddress) parameters
+   * (DeleteCustomerShippingAddress) parameters
+   * @param mixed,... See function description for parameter options
+   * @return DeleteCustomerShippingAddressResponse
+   * @throws Exception invalid function signature message
+   */
+  public function DeleteCustomerShippingAddress($mixed = null) {
+    $validParameters = array(
+      "(DeleteCustomerShippingAddress)",
+      "(DeleteCustomerShippingAddress)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("DeleteCustomerShippingAddress", $args);
+  }
+
+
+  /**
+   * Service Call: CreateCustomerProfileTransaction
+   * Parameter options:
+   * (CreateCustomerProfileTransaction) parameters
+   * (CreateCustomerProfileTransaction) parameters
+   * @param mixed,... See function description for parameter options
+   * @return CreateCustomerProfileTransactionResponse
+   * @throws Exception invalid function signature message
+   */
+  public function CreateCustomerProfileTransaction($mixed = null) {
+    $validParameters = array(
+      "(CreateCustomerProfileTransaction)",
+      "(CreateCustomerProfileTransaction)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("CreateCustomerProfileTransaction", $args);
+  }
+
+
+  /**
+   * Service Call: ValidateCustomerPaymentProfile
+   * Parameter options:
+   * (ValidateCustomerPaymentProfile) parameters
+   * (ValidateCustomerPaymentProfile) parameters
+   * @param mixed,... See function description for parameter options
+   * @return ValidateCustomerPaymentProfileResponse
+   * @throws Exception invalid function signature message
+   */
+  public function ValidateCustomerPaymentProfile($mixed = null) {
+    $validParameters = array(
+      "(ValidateCustomerPaymentProfile)",
+      "(ValidateCustomerPaymentProfile)",
+    );
+    $args = func_get_args();
+    $this->_checkArguments($args, $validParameters);
+    return $this->__soapCall("ValidateCustomerPaymentProfile", $args);
+  }
 
 
 }}
Index: role_subscription_user/role_subscription_user.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_subscription/role_subscription_user/role_subscription_user.module,v
retrieving revision 1.1
diff -u -r1.1 role_subscription_user.module
--- role_subscription_user/role_subscription_user.module	24 May 2008 23:54:10 -0000	1.1
+++ role_subscription_user/role_subscription_user.module	25 May 2008 20:47:22 -0000
@@ -12,54 +12,54 @@
  * @return array menu items
  */
 function role_subscription_user_menu($may_cache) {
-	global $user;
-	
-	$items = array();
-	
+  global $user;
+  
+  $items = array();
+  
     /**
      * My subscriptions user section
      */
-	
-	$items[] = array('path' => 'role_subscription/my_subscriptions',
-		'title' => t('Manage Subscriptions for '.$user->name),
-		'description' => t('Manage My Subscriptions.'),
-		'callback' => 'role_subscription_user_subscriptions_home',
-		'access' => user_access('access role_subscription') AND user_access('authenticated user'),
-		'type' => MENU_NORMAL_ITEM
+  
+  $items[] = array('path' => 'role_subscription/my_subscriptions',
+    'title' => t('Manage Subscriptions for '.$user->name),
+    'description' => t('Manage My Subscriptions.'),
+    'callback' => 'role_subscription_user_subscriptions_home',
+    'access' => user_access('access role_subscription') AND user_access('authenticated user'),
+    'type' => MENU_NORMAL_ITEM
     );
-	   
-	$items[] = array('path' => 'role_subscription/my_subscriptions/list',
-      	'weight' => 0,
-		'title' => t('List'),
-      	'callback' => 'role_subscription_user_subscriptions_home',
-      	'type' => MENU_DEFAULT_LOCAL_TASK,
-		'access' => user_access('access role_subscription') AND user_access('authenticated user'),
+     
+  $items[] = array('path' => 'role_subscription/my_subscriptions/list',
+        'weight' => 0,
+    'title' => t('List'),
+        'callback' => 'role_subscription_user_subscriptions_home',
+        'type' => MENU_DEFAULT_LOCAL_TASK,
+    'access' => user_access('access role_subscription') AND user_access('authenticated user'),
     );
-	
-	$items[] = array('path' => 'role_subscription/my_subscriptions/payment/edit',
-		'title' => t('Edit My Subscription'),
-      	'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_user_edit_subscription'),
-      	'type' => MENU_CALLBACK,
-		'access' => user_access('access role_subscription') AND user_access('authenticated user'),
+  
+  $items[] = array('path' => 'role_subscription/my_subscriptions/payment/edit',
+    'title' => t('Edit My Subscription'),
+        'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_user_edit_subscription'),
+        'type' => MENU_CALLBACK,
+    'access' => user_access('access role_subscription') AND user_access('authenticated user'),
     );
     
     $items[] = array('path' => 'role_subscription/my_subscriptions/change',
-		'title' => t('Change My Subscription'),
-      	'callback' => 'drupal_get_form',
-		'callback arguments' => array('role_subscription_user_change_subscription'),
-      	'type' => MENU_CALLBACK,
-		'access' => user_access('access role_subscription') AND user_access('authenticated user'),
+    'title' => t('Change My Subscription'),
+        'callback' => 'drupal_get_form',
+    'callback arguments' => array('role_subscription_user_change_subscription'),
+        'type' => MENU_CALLBACK,
+    'access' => user_access('access role_subscription') AND user_access('authenticated user'),
     );
     
     $items[] = array('path' => 'role_subscription/my_subscriptions/cancel',
-		'title' => t('Cancel My Subscription'),
-      	'callback' => 'role_subscription_user_cancel_subscription',
-		'access' => user_access('access role_subscription') AND user_access('authenticated user'),
-		'type' => MENU_CALLBACK
+    'title' => t('Cancel My Subscription'),
+        'callback' => 'role_subscription_user_cancel_subscription',
+    'access' => user_access('access role_subscription') AND user_access('authenticated user'),
+    'type' => MENU_CALLBACK
     );
-	   
-	return $items;
+     
+  return $items;
 }
 
 /**
@@ -70,29 +70,29 @@
  * @return string output of subscription home
  */
 function role_subscription_user_subscriptions_home(){
-	global $user;
-	
-	$result = User_subscription_db::find_all_for_user($user->uid);//return query result
-	
-	while ($_ = db_fetch_object($result))
-		$rows [] = array($_->title,	$_->phone, $_->invoice_id, date('m/d/Y', strtotime($_->created_at)),
-						l('change', 'role_subscription/my_subscriptions/change/'.$_->id),//edit
-						l('edit payment', 'role_subscription/my_subscriptions/payment/edit/'.$_->id),//edit payment 
-						l('cancel', 'role_subscription/my_subscriptions/cancel/'.$_->id, //cancel
-						array('onClick' => 'return confirm(\'Are you sure you want to cancel this subscription?\');')));
-
-	/**
-	 * If user subscriptions found
-	 */
-	if ($rows) {
-		$header = array(t('Subscription'), t('Phone'), t('Invoice ID'), t('Created On'), array('data' => t('Operations'), 'colspan' => 3));
-				
-		$output .= theme('table', $header, $rows);
-	}
-	else//none found
-		$output .= '<p>No user subscriptions found. '.l('View all subscriptions','role_subscription').'.</p>'."\n";
-	
-	return $output;
+  global $user;
+  
+  $result = User_subscription_db::find_all_for_user($user->uid);//return query result
+  
+  while ($_ = db_fetch_object($result))
+    $rows [] = array($_->title,  $_->phone, $_->invoice_id, date('m/d/Y', strtotime($_->created_at)),
+            l('change', 'role_subscription/my_subscriptions/change/'.$_->id),//edit
+            l('edit payment', 'role_subscription/my_subscriptions/payment/edit/'.$_->id),//edit payment 
+            l('cancel', 'role_subscription/my_subscriptions/cancel/'.$_->id, //cancel
+            array('onClick' => 'return confirm(\'Are you sure you want to cancel this subscription?\');')));
+
+  /**
+   * If user subscriptions found
+   */
+  if ($rows) {
+    $header = array(t('Subscription'), t('Phone'), t('Invoice ID'), t('Created On'), array('data' => t('Operations'), 'colspan' => 3));
+        
+    $output .= theme('table', $header, $rows);
+  }
+  else//none found
+    $output .= '<p>No user subscriptions found. '.l('View all subscriptions','role_subscription').'.</p>'."\n";
+  
+  return $output;
 }
 
 /**
@@ -101,44 +101,44 @@
  * Will cancel subscription in db and in payment engine and redirect thereafter.
  */
 function role_subscription_user_cancel_subscription(){
-	global $user;
-	
-	_role_subscription_verify_engine('role_subscription/my_subscriptions');//verify that payment engine is configured
-	
-	$id = arg(3);//get id from url
-	
-	/**
-	 * Look for user subscription
-	 */
-	if (!$user_subscription = User_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-	
-	/**
-	 * Fake cancel if set in admin config
-	 */
-	if (variable_get('role_subscription_fake_payment', '') == TRUE)
-		$result = TRUE;
-	/**
-	 * Call payment engine cancel method
-	 */
-	else
-		$result = module_invoke($engine, 'cancel_subscription', $user_subscription->merchant_id);
-	
-	if ($result)
-		$result = User_subscription_db::cancel_subscription($id);
-	
-	if ($result) {
-		Role_subscription::remove_user_role($user_subscription->role, $user->uid);//remove user role
-		
-		drupal_set_message(t('User subscription cancelled successfully.'));
-	}
-	else//error or couldn't find
-		form_set_error('', 'Unable to cancel subscription.');
-	
-	drupal_goto('role_subscription/my_subscriptions');//redirect	
+  global $user;
+  
+  _role_subscription_verify_engine('role_subscription/my_subscriptions');//verify that payment engine is configured
+  
+  $id = arg(3);//get id from url
+  
+  /**
+   * Look for user subscription
+   */
+  if (!$user_subscription = User_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+  
+  /**
+   * Fake cancel if set in admin config
+   */
+  if (variable_get('role_subscription_fake_payment', '') == TRUE)
+    $result = TRUE;
+  /**
+   * Call payment engine cancel method
+   */
+  else
+    $result = module_invoke($engine, 'cancel_subscription', $user_subscription->merchant_id);
+  
+  if ($result)
+    $result = User_subscription_db::cancel_subscription($id);
+  
+  if ($result) {
+    Role_subscription::remove_user_role($user_subscription->role, $user->uid);//remove user role
+    
+    drupal_set_message(t('User subscription cancelled successfully.'));
+  }
+  else//error or couldn't find
+    form_set_error('', 'Unable to cancel subscription.');
+  
+  drupal_goto('role_subscription/my_subscriptions');//redirect  
 }
 
 /**
@@ -154,15 +154,15 @@
  * @return payment form data
  */
 function role_subscription_user_edit_subscription(){
-	if (!$form_values = User_subscription_db::find(arg(4))) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-	
-	$form = Role_subscription_form::get_payment_form((array) $form_values);
-	
-	return $form;
+  if (!$form_values = User_subscription_db::find(arg(4))) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+  
+  $form = Role_subscription_form::get_payment_form((array) $form_values);
+  
+  return $form;
 }
 
 /**
@@ -174,30 +174,30 @@
  * @return change form data
  */
 function role_subscription_user_change_subscription(){
-	if (!$user_subscription = User_subscription_db::find(arg(3))) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-	
-	$form['role_subscription_id'] = array(
-		'#type' => 'select',
-		'#title' => t('Subscription'),
-		'#options' => Role_subscription_db::get_subscription_options_for_group($user_subscription->role_subscription_group_id),//find all subscriptions in this container
-		'#default_value' => $user_subscription->role_subscription_id,//default to existing user subscription group
-		'#description' => 'You can change your subscription within the subscription group you are currently subscribed.'
-	);
-	
-	$form['submit'] = array(
-		'#type' => 'submit',
-		'#value' => 'Modify Subscription'
-	);
-	
-	$form['#attributes'] = array(
-		'onSubmit' => 'return confirm(\'Are you sure you want to modify this subscription?\');'
-	);
-	
-	return $form;
+  if (!$user_subscription = User_subscription_db::find(arg(3))) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+  
+  $form['role_subscription_id'] = array(
+    '#type' => 'select',
+    '#title' => t('Subscription'),
+    '#options' => Role_subscription_db::get_subscription_options_for_group($user_subscription->role_subscription_group_id),//find all subscriptions in this container
+    '#default_value' => $user_subscription->role_subscription_id,//default to existing user subscription group
+    '#description' => 'You can change your subscription within the subscription group you are currently subscribed.'
+  );
+  
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => 'Modify Subscription'
+  );
+  
+  $form['#attributes'] = array(
+    'onSubmit' => 'return confirm(\'Are you sure you want to modify this subscription?\');'
+  );
+  
+  return $form;
 }
 
 /**
@@ -215,75 +215,75 @@
  * @return boolean FALSE if failure or will redirect if success
  */
 function role_subscription_user_change_subscription_submit($form_id, $form_values){
-	
-	if (!_role_subscription_verify_engine()) return FALSE;
-	 
-	if (!$user_subscription = User_subscription_db::find(arg(3))) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-	
-	/**
-	 * Check to see if subscription was actually changed
-	 */
-	if ($form_values['role_subscription_id'] == $user_subscription->role_subscription_id) {
-		drupal_set_message('You are currently subscribed to this subscription, no change needed.');
-		return;
-	}
-	
-	/**
-	 * Find new role subscription this user is subscribing to
-	 */
-	if (!$new_role_subscription = Role_subscription_db::find($form_values['role_subscription_id'])) {
-		form_set_error('', 'Unable to find role subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-	
-	/**
-	 * If fake payment mode not enabled, call payment engine update terms hook
-	 */
-	if (variable_get('role_subscription_fake_payment', '') != TRUE)
-		/**
-		 * Invoke update terms for merchant subscription to match new role subscription
-		 */
-		if (!$result = module_invoke($engine, 'update_terms', $new_role_subscription, $user_subscription->merchant_id)) {
-			form_set_error('', 'Unable to update subsciption. If this problem persists, please contact an administrator.');
-			
-			return FALSE;//fail	
-		}
-	
-	/**
-	 * Change user subscription to new role subscriptions
-	 * 
-	 * @TODO add logging bc if any of these steps fail it's bad news bc the subscription gets out of sync 
-	 */
-	if (!$result = User_subscription_db::change_role_subscription($user_subscription->id, $new_role_subscription->id)){
-		form_set_error('', 'Unable to update subsciption. If this problem persists, please contact an administrator.');
-			
-		return FALSE;//fail
-	}
-
-	/**
-	 * Remove existing role
-	 */
-	if (!$result = Role_subscription::remove_user_role($user_subscription->role, $user_subscription->uid)){
-		form_set_error('', 'Unable to update user account. Please contact an administrator.');
-			
-		return FALSE;//fail
-	}
-
-	/**
-	 * Add new user role attached to new role subscription
-	 */
-	if (!$result = Role_subscription::add_user_role($new_role_subscription->role, $user_subscription->uid)){
-		form_set_error('', 'Unable to update user account. Please contact an administrator.');
-			
-		return FALSE;//fail
-	}
-	
-	drupal_set_message('Your subscription has been update successfully');//success!!
+  
+  if (!_role_subscription_verify_engine()) return FALSE;
+   
+  if (!$user_subscription = User_subscription_db::find(arg(3))) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+  
+  /**
+   * Check to see if subscription was actually changed
+   */
+  if ($form_values['role_subscription_id'] == $user_subscription->role_subscription_id) {
+    drupal_set_message('You are currently subscribed to this subscription, no change needed.');
+    return;
+  }
+  
+  /**
+   * Find new role subscription this user is subscribing to
+   */
+  if (!$new_role_subscription = Role_subscription_db::find($form_values['role_subscription_id'])) {
+    form_set_error('', 'Unable to find role subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+  
+  /**
+   * If fake payment mode not enabled, call payment engine update terms hook
+   */
+  if (variable_get('role_subscription_fake_payment', '') != TRUE)
+    /**
+     * Invoke update terms for merchant subscription to match new role subscription
+     */
+    if (!$result = module_invoke($engine, 'update_terms', $new_role_subscription, $user_subscription->merchant_id)) {
+      form_set_error('', 'Unable to update subsciption. If this problem persists, please contact an administrator.');
+      
+      return FALSE;//fail  
+    }
+  
+  /**
+   * Change user subscription to new role subscriptions
+   * 
+   * @TODO add logging bc if any of these steps fail it's bad news bc the subscription gets out of sync 
+   */
+  if (!$result = User_subscription_db::change_role_subscription($user_subscription->id, $new_role_subscription->id)){
+    form_set_error('', 'Unable to update subsciption. If this problem persists, please contact an administrator.');
+      
+    return FALSE;//fail
+  }
+
+  /**
+   * Remove existing role
+   */
+  if (!$result = Role_subscription::remove_user_role($user_subscription->role, $user_subscription->uid)){
+    form_set_error('', 'Unable to update user account. Please contact an administrator.');
+      
+    return FALSE;//fail
+  }
+
+  /**
+   * Add new user role attached to new role subscription
+   */
+  if (!$result = Role_subscription::add_user_role($new_role_subscription->role, $user_subscription->uid)){
+    form_set_error('', 'Unable to update user account. Please contact an administrator.');
+      
+    return FALSE;//fail
+  }
+  
+  drupal_set_message('Your subscription has been update successfully');//success!!
 }
 
 /**
@@ -301,51 +301,51 @@
  * @return boolean FALSE if failure or sometimes redirects
  */
 function role_subscription_user_edit_subscription_submit($form_id, $form_values){
-	if (!_role_subscription_verify_engine()) return FALSE;
-	
-	$id = arg(4);//get id from url
-	
-	/**
-	 * Find subscription payment
-	 */
-	if (!$subscription_payment = User_subscription_db::find($id)) {
-		form_set_error('', 'Unable to find user subscription.');
-		
-		drupal_goto('role_subscription/my_subscriptions');
-	}
-
-	/**
-	 * Validate form
-	 */
-	$result = Role_subscription_form::validate_payment_form($form_id, $form_values);
-	
-	if ($result !== FALSE) {//success
-
-		/**
-		 * Fake update if set in admin config
-		 */
-		if (variable_get('role_subscription_fake_payment', '') == TRUE)
-			$result = TRUE;
-		/**
-		 * Invoke payment engine update
-		 */
-		else
-			$result = module_invoke($engine, 'update_subscription_payment', $form_values, $subscription_payment->merchant_id);
-
-		if ($result) {
-			$result = User_subscription_db::update_payment($form_values, $id);
-			
-			if ($result) {//success
-				drupal_set_message(t('Subscription updated successfully.'));
-				drupal_goto('role_subscription/my_subscriptions');//go back to role subscription page
-			}
-		}
-		else 
-			form_set_error('', 'Unable to process payment. Please contact an administrator.');		
-	}//error
-	else {
-		form_set_error('', 'Unable to process payment. Please contact an administrator.');
-		
-		return FALSE;//fail
-	}	
+  if (!_role_subscription_verify_engine()) return FALSE;
+  
+  $id = arg(4);//get id from url
+  
+  /**
+   * Find subscription payment
+   */
+  if (!$subscription_payment = User_subscription_db::find($id)) {
+    form_set_error('', 'Unable to find user subscription.');
+    
+    drupal_goto('role_subscription/my_subscriptions');
+  }
+
+  /**
+   * Validate form
+   */
+  $result = Role_subscription_form::validate_payment_form($form_id, $form_values);
+  
+  if ($result !== FALSE) {//success
+
+    /**
+     * Fake update if set in admin config
+     */
+    if (variable_get('role_subscription_fake_payment', '') == TRUE)
+      $result = TRUE;
+    /**
+     * Invoke payment engine update
+     */
+    else
+      $result = module_invoke($engine, 'update_subscription_payment', $form_values, $subscription_payment->merchant_id);
+
+    if ($result) {
+      $result = User_subscription_db::update_payment($form_values, $id);
+      
+      if ($result) {//success
+        drupal_set_message(t('Subscription updated successfully.'));
+        drupal_goto('role_subscription/my_subscriptions');//go back to role subscription page
+      }
+    }
+    else 
+      form_set_error('', 'Unable to process payment. Please contact an administrator.');    
+  }//error
+  else {
+    form_set_error('', 'Unable to process payment. Please contact an administrator.');
+    
+    return FALSE;//fail
+  }  
 }
\ No newline at end of file
