diff --git a/CRM/Batch/BAO/EntityBatch.php b/CRM/Batch/BAO/EntityBatch.php index b37fbb85c400cc322bbf4c82c7ecf53411d0bd7d..025a877b8ec3965e28524984c45c5001335fedfd 100644 --- a/CRM/Batch/BAO/EntityBatch.php +++ b/CRM/Batch/BAO/EntityBatch.php @@ -29,19 +29,14 @@ class CRM_Batch_BAO_EntityBatch extends CRM_Batch_DAO_EntityBatch { /** * Remove entries from entity batch. * @param array|int $params + * @deprecated * @return CRM_Batch_DAO_EntityBatch */ public static function del($params) { if (!is_array($params)) { $params = ['id' => $params]; } - $entityBatch = new CRM_Batch_DAO_EntityBatch(); - $entityId = $params['id'] ?? NULL; - CRM_Utils_Hook::pre('delete', 'EntityBatch', $entityId, $params); - $entityBatch->copyValues($params); - $entityBatch->delete(); - CRM_Utils_Hook::post('delete', 'EntityBatch', $entityBatch->id, $entityBatch); - return $entityBatch; + return self::deleteRecord($params); } } diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index b14792abce53a73e67a5b5f62a8007efe5357119..33e891cb2a5768f3dd2c0f148c1be1b46641f2a3 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -479,7 +479,11 @@ class CRM_Financial_Page_AJAX { $updated = CRM_Batch_BAO_EntityBatch::create($params); } else { - $updated = CRM_Batch_BAO_EntityBatch::del($params); + $delete = \Civi\Api4\EntityBatch::delete(FALSE); + foreach ($params as $field => $val) { + $delete->addWhere($field, '=', $val); + } + $updated = $delete->execute()->count(); } } }