--- ecommerce.orig/contrib/paypalpro/paypalpro.module	2006-04-07 05:04:26.000000000 -0400
+++ ecommerce/contrib/paypalpro/paypalpro.module	2006-05-19 05:56:34.000000000 -0400
@@ -306,26 +306,113 @@ function paypalpro_form($txnid) {
   $months = drupal_map_assoc(array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'));
 
   // the name as it appears on the card
-  $group = form_textfield(t('First name'), 'cc_first_name', $edit['cc_first_name'], 21, 42, '', NULL, TRUE);
-  $group .= form_textfield(t('Middle name or initial'), 'cc_middle_name', $edit['cc_middle_name'], 21, 42, '');
-  $group .= form_textfield(t('Last name'), 'cc_last_name', $edit['cc_last_name'], 21, 42, '', NULL, TRUE);
-  $form = form_group('Enter your name as it appears on the card', $group);
+  $form['cc_first_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('First name'),
+    '#default_value' => $edit['cc_first_name'],
+    '#size' => 21,
+    '#maxlength' => 42,
+    '#description' => '',
+    '#attributes' => NULL,
+    '#required' => TRUE,
+  );
+  $form['cc_middle_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Middle name or initial'),
+    '#default_value' => $edit['cc_middle_name'],
+    '#size' => 21,
+    '#maxlength' => 42,
+    '#description' => '',
+  );
+  $form['cc_last_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Last name'),
+    '#default_value' => $edit['cc_last_name'],
+    '#size' => 21,
+    '#maxlength' => 42,
+    '#description' => '',
+    '#attributes' => NULL,
+    '#required' => TRUE,
+  );
+  $form[] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Enter your name as it appears on the card',
+  );
 
   // the card type and card numbers
-  $group = form_radios(t('Card type'), 'cc_type', $edit['cc_type'], $paypalpro_cc_types, t('Select the type of credit card you would like to use to make your payment.'), NULL, NULL, TRUE);
+  $form['cc_type'] = array(
+    '#type' => 'radios',
+    '#title' => t('Card type'),
+    '#default_value' => $edit['cc_type'],
+    '#options' => $paypalpro_cc_types,
+    '#description' => t('Select the type of credit card you would like to use to make your payment.'),
+    '#required' => NULL,
+    '#attributes' => NULL,
+  );
   // todo: allow numbers with spaces and dashes (convert on-the-fly)
-  $group .= form_textfield(t('Card number'), 'cc_number', $edit['cc_number'], 21, 21, t('Please enter your credit card number without any spaces or dashes.'), NULL, TRUE);
-  $group .= form_textfield(t('CCV2'), 'cvv2', $edit['cvv2'], 3, 4, t('The CCV2 is a 3 digit number located on the back of Visa, MasterCard and Discover credit cards in the signature panel, and a 4 digit number located on the front of an American Express card above and to the right of the imprinted card number.  This number is used to provide additional security to internet orders.'), NULL, TRUE);
-  $form .= form_group('Select a credit card type and enter your card number', $group);
+  $form['cc_number'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Card number'),
+    '#default_value' => $edit['cc_number'],
+    '#size' => 21,
+    '#maxlength' => 21,
+    '#description' => t('Please enter your credit card number without any spaces or dashes.'),
+    '#attributes' => NULL,
+    '#required' => TRUE,
+  );
+  $form['cvv2'] = array(
+    '#type' => 'textfield',
+    '#title' => t('CCV2'),
+    '#default_value' => $edit['cvv2'],
+    '#size' => 3,
+    '#maxlength' => 4,
+    '#description' => t('The CCV2 is a 3 digit number located on the back of Visa, MasterCard and Discover credit cards in the signature panel, and a 4 digit number located on the front of an American Express card above and to the right of the imprinted card number.  This number is used to provide additional security to internet orders.'),
+    '#attributes' => NULL,
+    '#required' => TRUE,
+  );
+  $form[] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Select a credit card type and enter your card number',
+  );
 
   // the expiration date
-  $group = form_select(t('Month'), 'cc_month', ($edit['cc_month'] ? $edit['cc_month'] : date('m')), $months, NULL, 0, false, TRUE);
-  $group .= form_select(t('Year'), 'cc_year', ($edit['cc_year'] ? $edit['cc_year'] : date('Y')), $years, NULL, 0, false, TRUE);
-  $form .= form_group(t('Select your credit card\'s expiration date'), $group);
-
-  $output .= form_group(t('Credit card details'), $form);
-  $output .= form_hidden('txnid', $txnid);
-  $output .= form_submit(t('Place your order'));
+  $form['cc_month'] = array(
+    '#type' => 'select',
+    '#title' => t('Month'),
+    '#default_value' => ($edit['cc_month'] ? $edit['cc_month'] : date('m')),
+    '#options' => $months,
+    '#description' => NULL,
+    '#extra' => 0,
+    '#multiple' => false,
+    '#required' => TRUE,
+  );
+  $form['cc_year'] = array(
+    '#type' => 'select',
+    '#title' => t('Year'),
+    '#default_value' => ($edit['cc_year'] ? $edit['cc_year'] : date('Y')),
+    '#options' => $years,
+    '#description' => NULL,
+    '#extra' => 0,
+    '#multiple' => false,
+    '#required' => TRUE,
+  );
+  $form[] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Select your credit card\'s expiration date'),
+  );
+
+  $form[] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Credit card details'),
+  );
+  $form['txnid'] = array(
+    '#type' => 'hidden',
+    '#value' => $txnid,
+  );
+  $form[] = array(
+    '#type' => 'submit',
+    '#value' => t('Place your order'),
+  );
 
   if (variable_get('paypalpro_secure', 1)) {
     $base = str_replace('http://', 'https://', $base_url);
@@ -334,7 +421,9 @@ function paypalpro_form($txnid) {
     $base = $base_url;
   }
 
-  return form($output, 'POST', $base .'/'. url("paypalpro/form/". $txnid));
+  $form['#method'] = 'POST';
+  $form['#action'] = $base .'/'. url("paypalpro/form/". $txnid);
+  $output = drupal_get_form('paypalpro', $form);
 }
 
 /**
