* @public
*/
function _getRecurPaymentFields($fields) {
- $payments = $this->_getParam('frequency_interval');
- $cycle = $this->_getParam('frequency_unit');
-
/* Translate billing cycle from CiviCRM -> TC */
- switch($cycle) {
- case 'day':
- $cycle = 'd';
- break;
- case 'week':
- $cycle = 'w';
- break;
- case 'month':
- $cycle = 'm';
- break;
- case 'year':
- $cycle = 'y';
- break;
- }
-
+ $cycle_map = array(
+ 'day' => 'd',
+ 'week' => 'w',
+ 'month' => 'm',
+ 'year' => 'y'
+ );
+ $cycle = $cycle_map[$this->_getParam('frequency_unit')];
+
+
/* Translate frequency interval from CiviCRM -> TC
* Payments are the same, HOWEVER a payment of 1 (forever) should be 0 in TC */
+ $payments = $this->_getParam('frequency_interval');
if($payments == 1) {
$payments = 0;
}