diff --git a/CRM/FormProcessor/BAO/FormProcessor.php b/CRM/FormProcessor/BAO/FormProcessor.php index 0c1efbfe4f9fe849aaac7c34793bb4ab711e710c..1d365edf1987e1532b51c08f6bd87bfcc40a5490 100644 --- a/CRM/FormProcessor/BAO/FormProcessor.php +++ b/CRM/FormProcessor/BAO/FormProcessor.php @@ -80,6 +80,30 @@ return $result; } + /** + * Function to delete a FormProcessor with id + * + * @param int $id + * @throws Exception when $id is empty + * @access public + * @static + */ + public static function deleteWithId($id) { + if (empty($id)) { + throw new Exception('id can not be empty when attempting to delete a form processor'); + } + + CRM_Utils_Hook::pre('delete', 'FormProcessor', $id, CRM_Core_DAO::$_nullArray); + + $rule = new FormProcessor(); + $rule->id = $id; + $rule->delete(); + + CRM_Utils_Hook::post('delete', 'FormProcessor', $id, CRM_Core_DAO::$_nullArray); + + return; + } + /** * Public function to generate name from label * diff --git a/api/v3/FormProcessor/Delete.php b/api/v3/FormProcessor/Delete.php index 0ad80a23660952a46bb78b3761e33d4bb0ccf8de..0bfeb6d4d69537b54668858ad75bf42e90d8348c 100644 --- a/api/v3/FormProcessor/Delete.php +++ b/api/v3/FormProcessor/Delete.php @@ -8,8 +8,12 @@ * @return void * @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards */ -function _civicrm_api3_civi_rule_rule_Delete_spec(&$spec) { - $spec['id']['api_required'] = 1; +function _civicrm_api3_form_processor_Delete_spec(&$spec) { + $spec['id'] = array( + 'title' => E::ts('ID'), + 'type' => CRM_Utils_Type::T_INT, + 'api_required' => true + ); } /** @@ -21,7 +25,7 @@ function _civicrm_api3_civi_rule_rule_Delete_spec(&$spec) { * @see civicrm_api3_create_error * @throws API_Exception */ -function civicrm_api3_civi_rule_rule_Delete($params) { +function civicrm_api3_form_processor_Delete($params) { if (!array_key_exists('id', $params) || empty($params['id'])) { throw new API_Exception('Parameter id is mandatory and can not be empty in ' . __METHOD__, 0010); } else {