I got this error when I try to edit a custom-created recurring fee

Fatal error: Call to undefined function uc_recurring_order_get_intervals() in C:\*********\sites\all\modules\contrib\uc_recurring\uc_recurring.admin.inc on line 288

Basically, in uc_recurring.admin.inc, you only handle two cases: recurring from uc_recurring_product and recurring from others.

    if ($fee->module == 'uc_recurring_product') {
      list($fee->regular_interval_value, $fee->regular_interval_unit) = explode(' ', $fee->regular_interval);

      $form['regular']['regular_interval_value'] = array(
        '#type' => 'select',
        '#options' => drupal_map_assoc(range(1, 52)),
        '#default_value' => $fee->regular_interval_value,
      );
      $form['regular']['regular_interval_unit'] = array(
        '#type' => 'select',
        '#options' => array(
          'days' => t('day(s)'),
          'weeks' => t('week(s)'),
          'months' => t('month(s)'),
          'years' => t('year(s)'),
        ),
        '#default_value' => $fee->regular_interval_unit,
      );
    }
    else {
      $form['regular']['regular_interval'] = array(
        '#type' => 'select',
        '#options' => uc_recurring_order_get_intervals(),
        '#default_value' => $fee->regular_interval,
      );
    }

It should be something like this:

    if ($fee->module == 'uc_recurring_product') {
      list($fee->regular_interval_value, $fee->regular_interval_unit) = explode(' ', $fee->regular_interval);

      $form['regular']['regular_interval_value'] = array(
        '#type' => 'select',
        '#options' => drupal_map_assoc(range(1, 52)),
        '#default_value' => $fee->regular_interval_value,
      );
      $form['regular']['regular_interval_unit'] = array(
        '#type' => 'select',
        '#options' => array(
          'days' => t('day(s)'),
          'weeks' => t('week(s)'),
          'months' => t('month(s)'),
          'years' => t('year(s)'),
        ),
        '#default_value' => $fee->regular_interval_unit,
      );
    }
    elseif ($fee->module =='uc_recurring_order') {
      $form['regular']['regular_interval'] = array(
        '#type' => 'select',
        '#options' => uc_recurring_order_get_intervals(),
        '#default_value' => $fee->regular_interval,
      );
    }
    else {
      // Do something ?
    }

I also think that uc_recurring should not handle the interval directly, the module owner of the fee should handle how to present the interval of the fee. Or we should have a united form of recurring interval, no matter what kind of module owner.

Comments

nquocbao’s picture

Priority: Normal » Major