--- payment.module.old 2006-05-02 22:13:13.000000000 +0200 +++ payment.module 2006-01-14 16:47:00.000000000 +0100 @@ -90,49 +90,180 @@ function payment_checkoutapi(&$txn, $op, function payment_settings() { drupal_set_title(t('Payment settings')); - $group = form_textfield(t('Currency symbol'), 'payment_symbol', variable_get('payment_symbol', '$'), 3, 5, t('Enter the currency symbol you wish to associate with your price. This will be displayed in front of the price. Default is the dollar symbol.')); - $group .= form_radios(t('Position of currency symbol'), 'payment_symbol_position', variable_get('payment_symbol_position', 1), array(t('Right'), t('Left')), t('This option places the currency symbol of the left or right side of the price.')); - $group .= form_textfield(t('Thousands separator'), 'payment_thousands', variable_get('payment_thousands', ','), 3, 5, t('Enter the sign for the thousands separator.')); - $group .= form_textfield(t('Decimal separator'), 'payment_decimal', variable_get('payment_decimal', '.'), 3, 5, t('Enter the sign to seperate real numbers from floating numbers.')); - $group .= form_textfield(t('Number of places after the decimal separator'), 'payment_decimal_places', variable_get('payment_decimal_places', 2), 3, 5, t('How many number slots are needed after decimal separator?')); - $output = form_group_collapsible(t('Price formatting'), $group, TRUE); - - $group = form_textfield(t('Subject of invoice e-mail'), 'payment_new_subject', variable_get('payment_new_subject', 'Your %site order'), 70, 180); - $group .= form_textarea(t('Customer invoice e-mail'), 'payment_new', variable_get('payment_new', payment_help('Customer invoice email')), 70, 10, t('This text will be emailed to customers after they make a purchase.')); - $group .= form_textfield(t('Subject of error e-mail'), 'payment_error_subject', variable_get('payment_error_subject', 'Purchase Problem, %site'), 70, 180); - $group .= form_textarea('Payment error e-mail', 'payment_error', variable_get('payment_error', payment_help('Processing error')), 70, 10, t('This text will be e-mailed to customers if their is a payment processing problem.')); - $output .= form_group_collapsible(t('E-mail notifications'), $group, TRUE); + $form['priceformatting'] = array( + '#type' => 'fieldset', + '#title' => t('Price formatting'), + '#tree' => TRUE, + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['priceformatting']['payment_symbol'] = array( + '#title' => t('Currency symbol'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_symbol', '$'), + '#size' => 3, + '#maxlength' => 5, + '#required' => TRUE, + '#description' => t('Enter the currency symbol you wish to associate with your price. This will be displayed in front of the price. Default is the dollar symbol.'), + ); + $form['priceformatting']['payment_thousands'] = array( + '#title' => t('Thousands separator'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_thousands', ','), + '#size' => 3, + '#maxlength' => 5, + '#required' => TRUE, + '#description' => t('Enter the sign for the thousands separator.'), + ); + $form['priceformatting']['payment_symbol_position'] = array( + '#type' => 'radios', + '#title' => t('Position of currency symbol'), + '#default_value' => variable_get('payment_symbol_position', 0), + '#options' => array(t('Right'), t('Left')), + '#description' => t('This option places the currency symbol of the left or right side of the price.'), + ); + $form['priceformatting']['payment_decimal'] = array( + '#title' => t('Decimal separator'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_decimal', '.'), + '#size' => 3, + '#maxlength' => 5, + '#required' => TRUE, + '#description' => t('Enter the sign to seperate real numbers from floating numbers.'), + ); + $form['priceformatting']['payment_decimal_places'] = array( + '#title' => t('Number of places after the decimal separator'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_decimal_places', '2'), + '#size' => 3, + '#maxlength' => 5, + '#required' => TRUE, + '#description' => t('How many number slots are needed after decimal separator?'), + ); - $output .= form_group(t('Recurring payments'), form_radios(t('Recurring payments'), 'payment_recurring', variable_get('payment_recurring', 0), array(t('Disabled'), t('Enabled')), t('If enabled, you\'ll be asked about billing cycle details on the product creation form. If disabled, no recurring payments will take place.'))); + #$group = form_textfield(t('Currency symbol'), 'payment_symbol', variable_get('payment_symbol', '$'), 3, 5, t('Enter the currency symbol you wish to associate with your price. This will be displayed in front of the price. Default is the dollar symbol.')); + #$group .= form_radios(t('Position of currency symbol'), 'payment_symbol_position', variable_get('payment_symbol_position', 1), array(t('Right'), t('Left')), t('This option places the currency symbol of the left or right side of the price.')); + + #$group .= form_textfield(t('Thousands separator'), 'payment_thousands', variable_get('payment_thousands', ','), 3, 5, t('Enter the sign for the thousands separator.')); + #$group .= form_textfield(t('Decimal separator'), 'payment_decimal', variable_get('payment_decimal', '.'), 3, 5, t('Enter the sign to seperate real numbers from floating numbers.')); + #$group .= form_textfield(t('Number of places after the decimal separator'), 'payment_decimal_places', variable_get('payment_decimal_places', 2), 3, 5, t('How many number slots are needed after decimal separator?')); + #$output = form_group_collapsible(t('Price formatting'), $group, TRUE); + + $form['emailnotifications'] = array( + '#type' => 'fieldset', + '#title' => t('E-mail notifications'), + '#tree' => TRUE, + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['emailnotifications']['payment_new_subject'] = array( + '#title' => t('Subject of invoice e-mail'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_new_subject', 'Your %site order'), + '#size' => 70, + '#maxlength' => 180, + '#required' => TRUE, + '#description' => t('Enter the sign for the thousands separator.'), + ); + $form['emailnotifications']['payment_new'] = array( + '#title' => t('Customer invoice e-mail'), + '#type' => 'textarea', + '#default_value' => variable_get('payment_new', payment_help('Customer invoice email')), + '#size' => 70, + '#required' => TRUE, + '#description' => t('This text will be emailed to customers after they make a purchase.'), + ); + $form['emailnotifications']['payment_error_subject'] = array( + '#title' => t('Subject of error e-mail'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_error_subject', 'Purchase Problem, %site'), + '#size' => 70, + '#maxlength' => 180, + '#required' => TRUE, + ); + $form['emailnotifications']['payment_error'] = array( + '#title' => t('Customer invoice e-mail'), + '#type' => 'textarea', + '#default_value' => variable_get('payment_error', payment_help('Processing error')), + '#size' => 70, + '#required' => TRUE, + '#description' => t('This text will be emailed to customers after they make a purchase.'), + ); + #$group = form_textfield(t('Subject of invoice e-mail'), 'payment_new_subject', variable_get('payment_new_subject', 'Your %site order'), 70, 180); + #$group .= form_textarea(t('Customer invoice e-mail'), 'payment_new', variable_get('payment_new', payment_help('Customer invoice email')), 70, 10, t('This text will be emailed to customers after they make a purchase.')); + #$group .= form_textfield(t('Subject of error e-mail'), 'payment_error_subject', variable_get('payment_error_subject', 'Purchase Problem, %site'), 70, 180); + #$group .= form_textarea('Payment error e-mail', 'payment_error', variable_get('payment_error', payment_help('Processing error')), 70, 10, t('This text will be e-mailed to customers if their is a payment processing problem.')); + #$output .= form_group_collapsible(t('E-mail notifications'), $group, TRUE); + + #$output .= form_group(t('Recurring payments'), form_radios(t('Recurring payments'), 'payment_recurring', variable_get('payment_recurring', 0), array(t('Disabled'), t('Enabled')), t('If enabled, you\'ll be asked about billing cycle details on the product creation form. If disabled, no recurring payments will take place.'))); + + $form['payment_recurring_group'] = array( + '#type' => 'fieldset', + '#title' => t('Recurring payment settings'), + '#tree' => TRUE, + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['payment_recurring_group']['payment_recurring'] = array( + '#type' => 'radios', + '#title' => t('Preview comment'), + '#required' => TRUE, + '#default_value' => variable_get('payment_recurring', 0), + '#options' => array(t('Disabled'), t('Enabled')), + ); if (variable_get('payment_recurring', 0)) { - $group = ''; - $group .= form_checkboxes(t('Role inheritance'), 'on_payment_roles', variable_get('on_payment_roles', ''), user_roles(1), t('Optionally, select the roles an user is assigned when they purchase a recurring payment item. The user will be removed from these roles when the item expires. Note: requires cron.')); - $group .= form_textfield(t('Subject of recurring payment notice e-mail'), 'payment_recurring_subject', variable_get('payment_recurring_subject', 'Your %site renewal'), 70, 180); - $group .= form_textarea('Recurring payment notice e-mail', 'payment_recurring_email', variable_get('payment_recurring_email', payment_help('recurring payment')), 70, 10, t('This text will be e-mailed to customers before their recurring payment expires.')); + #$group = ''; +// #$group .= form_checkboxes(t('Role inheritance'),'on_payment_roles', variable_get('on_payment_roles', ''), user_roles(1), t('Optionally, select the roles an user is assigned when they purchase a recurring payment item. The user will be removed from these roles when the item expires. Note: requires cron.')); + $form['payment_recurring_group']['on_payment_roles'] = array( + '#type' => 'checkboxes', + '#title' => t('Role inheritance'), + '#default_value' => variable_get('on_payment_roles', ''), + '#options' => user_roles(1), + '#description' => t('Optionally, select the roles an user is assigned when they purchase a recurring payment item. The user will be removed from these roles when the item expires. Note: requires cron.'), + ); + $form['payment_recurring_group']['payment_recurring_subject'] = array( + '#title' => t('Subject of recurring payment notice e-mail'), + '#type' => 'textfield', + '#default_value' => variable_get('payment_recurring_subject', 'Your %site renewal'), + '#size' => 70, + '#maxlength' => 180, + '#required' => TRUE, + ); + $form['payment_recurring_group']['payment_recurring_email'] = array( + '#title' => t('Recurring payment notice e-mail'), + '#type' => 'textarea', + '#default_value' => variable_get('payment_recurring_email', payment_help('recurring payment')), + '#size' => 70, + '#required' => TRUE, + '#description' => t('This text will be e-mailed to customers before their recurring payment expires.'), + ); - $group .= t('
You can send up to 5 renewal notifications to the customer. Choose at the interval each notfication is sent before the product expires.
'); + #$group .= form_textfield(t('Subject of recurring payment notice e-mail'), 'payment_recurring_subject', variable_get('payment_recurring_subject', 'Your %site renewal'), 70, 180); + #$group .= form_textarea('Recurring payment notice e-mail', 'payment_recurring_email', variable_get('payment_recurring_email', payment_help('recurring payment')), 70, 10, t('This text will be e-mailed to customers before their recurring payment expires.')); - //$group = form_checkboxes(t('Frequency of renewal notifications'), 'payment_recurring_notices', $values, $options, $description = NULL, $attributes = NULL, $required = FALSE); - $interval = drupal_map_assoc(range(0, 31)); - $interval[0] = '--'; - $unit = array(0 => t('-please choose-'), 'D' => t('Day(s)'), 'W' => t('Week(s)'), 'M' => t('Month(s)'), 'Y' => t('Year(s)')); - - $sub_group = ''; - for ($i = 1; $i <= 2; $i++) { - $sub_group .= form_select(t('Interval'), $i. '_price_interval', variable_get($i. '_price_interval', ''), $interval); - $sub_group .= form_select(t('Unit'), $i. '_price_unit', variable_get($i. '_price_unit', ''), $unit); - $sub_group .= form_checkbox(t('Check to enable'), $i. '_price_status', 1, variable_get($i. '_price_status', 0)); - $group .= form_group(t('Settings for recurring payment notice %number', array('%number' => $i)), $sub_group); - $sub_group = ''; - } + #$group .= t('You can send up to 5 renewal notifications to the customer. Choose at the interval each notfication is sent before the product expires.
'); - $group .= form_textfield(t('Subject of recurring payment expiration e-mail'), 'payment_recurring_expiration_subject', variable_get('payment_recurring_expiration_subject', 'Your %site renewal has expired'), 70, 180); - $group .= form_textarea('Recurring payment expiration e-mail', 'payment_recurring_expiration_email', variable_get('payment_recurring_expiration_email', payment_help('recurring payment expired')), 70, 10, t('This text will be e-mailed to customers when their recurring payment expires.')); - $output .= form_group(t('Recurring payment settings'), $group); + //$group = form_checkboxes(t('Frequency of renewal notifications'), 'payment_recurring_notices', $values, $options, $description = NULL, $attributes = NULL, $required = FALSE); + #$interval = drupal_map_assoc(range(0, 31)); + #$interval[0] = '--'; + #$unit = array(0 => t('-please choose-'), 'D' => t('Day(s)'), 'W' => t('Week(s)'), 'M' => t('Month(s)'), 'Y' => t('Year(s)')); + + #$sub_group = ''; + #for ($i = 1; $i <= 2; $i++) { + #$sub_group .= form_select(t('Interval'), $i. '_price_interval', variable_get($i. '_price_interval', ''), $interval); + #$sub_group .= form_select(t('Unit'), $i. '_price_unit', variable_get($i. '_price_unit', ''), $unit); + #$sub_group .= form_checkbox(t('Check to enable'), $i. '_price_status', 1, variable_get($i. '_price_status', 0)); + #$group .= form_group(t('Settings for recurring payment notice %number', array('%number' => $i)), $sub_group); + #$sub_group = ''; + #} + + #$group .= form_textfield(t('Subject of recurring payment expiration e-mail'), 'payment_recurring_expiration_subject', variable_get('payment_recurring_expiration_subject', 'Your %site renewal has expired'), 70, 180); + #$group .= form_textarea('Recurring payment expiration e-mail', 'payment_recurring_expiration_email', variable_get('payment_recurring_expiration_email', payment_help('recurring payment expired')), 70, 10, t('This text will be e-mailed to customers when their recurring payment expires.')); + #$output .= form_group(t('Recurring payment settings'), $group); } - - return $output; + return $form; + #return $output; } /**