return $params;
}
- /**
- * update the is_active flag in the db
- *
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
- *
- * @return Object DAO object on success, null otherwise
- * @static
- */
- static function setIsActive($id, $is_active) {
- if (!$is_active) {
- return self::cancelRecurContribution($id, CRM_Core_DAO::$_nullObject);
- }
- return FALSE;
- }
-
/**
* @param $entityID
* @param string $entity
}
}
}
-
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+/**
+ * Cancel a recurring contribution of existing contribution_recur.id
+ *
+ * @param array $params (reference) array containing id of the recurring contribution
+ *
+ * @return boolean returns true is successfully cancelled
+ */
+
+function civicrm_api3_contribution_recur_cancel($params) {
+ civicrm_api3_verify_one_mandatory($params, NULL, array('id'));
+ return call_user_func_array(array(_civicrm_api3_get_BAO(__FUNCTION__), 'cancelRecurContribution'), array($params['id'], CRM_Core_DAO::$_nullObject));
+}
+
/**
* delete an existing contribution_recur
*
function civicrm_api3_contribution_recur_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
-
el = this[0],
ret = {},
$row = this.first().closest('.crm-entity');
- ret.entity = $row.data('entity') || $row[0].id.split('-')[0];
- ret.id = $row.data('id') || $row[0].id.split('-')[1];
+ ret.entity = $row.data('entity') || $row[0].id.split('-')[0];
+ ret.id = $row.data('id') || $row[0].id.split('-')[1];
+ ret.action = $row.data('entity-action') || $row[0].id.split('-')[2] || 'setvalue';
+
if (!ret.entity || !ret.id) {
return false;
}
{foreach from=$recurRows item=row}
{assign var=id value=$row.id}
- <tr id="contribution_recur-{$row.id}" class="crm-entity {cycle values="even-row,odd-row"}{if NOT $row.is_active} disabled{/if}">
+ <tr id="contribution_recur-{$row.id}-cancel" class="crm-entity {cycle values="even-row,odd-row"}{if NOT $row.is_active} disabled{/if}">
<td>{$row.amount|crmMoney}{if $row.is_test} ({ts}test{/ts}){/if}</td>
<td>{ts}Every{/ts} {$row.frequency_interval} {$row.frequency_unit} </td>
<td>{$row.start_date|crmDate}</td>
function save() {
$row.closest('table').block();
- CRM.api3(info.entity, 'setvalue', {id: info.id, field: 'is_active', value: enabled ? 0 : 1}, {success: successMsg}).done(refresh);
+ CRM.api3(info.entity, info.action, {id: info.id, field: 'is_active', value: enabled ? 0 : 1}, {success: successMsg}).done(refresh);
if (enabled) {
$(this).dialog('close');
}