You are here

function uc_recurring_admin_edit_form_submit in Ubercart 5

File

payment/uc_recurring/uc_recurring.module, line 811
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_admin_edit_form_submit($form_id, $form_values) {
  $interval = $form_values['regular_interval_value'] . ' ' . $form_values['regular_interval_unit'];
  db_query("UPDATE {uc_recurring_users} SET fee_amount = %f, regular_interval = '%s', " . "remaining_intervals = %d WHERE rfid = %d", $form_values['fee_amount'], $interval, $form_values['remaining_intervals'], arg(4));
  if ($form_values['reset_next_charge']) {
    $next_charge = strtotime('+' . $interval);
    db_query("UPDATE {uc_recurring_users} SET next_charge = %d WHERE rfid = %d", $next_charge, arg(4));
  }
  drupal_set_message(t('The changes to the fee have been saved.'));
  return 'admin/store/orders/recurring/view/fee/' . arg(4);
}