You are here

function uc_recurring_update_6005 in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 uc_recurring.install \uc_recurring_update_6005()

Add fee_title to {uc_recurring_users}, add default extensions.

File

./uc_recurring.install, line 427
Installs the Recurring Fee module.

Code

function uc_recurring_update_6005() {
  $ret = array();
  db_add_field('uc_recurring_users', 'fee_title', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field('uc_recurring_extensions', 'pfid', 'pfid', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => FALSE,
    'default' => NULL,
  ));

  // Add default extensions
  // Note: These are incorrect on purpose, see http://drupal.org/node/729066.
  $defaults = array(
    1 => strtotime("+3 days", 0),
    2 => strtotime("+5 days", 0),
    3 => 0,
  );
  foreach ($defaults as $attempt => $time) {
    db_insert('uc_recurring_extensions')
      ->fields(array(
      'pfid' => NULL,
      'rebill_attempt' => $attempt,
      'time_to_extend' => $time,
    ))
      ->execute();
  }
}