Skip to content

Commit

Permalink
Afform - Use apiBatch for process action
Browse files Browse the repository at this point in the history
Before: Processing form submissions glitchy in the UI

After: Uses standard batch runner
  • Loading branch information
colemanw committed Jan 28, 2025
1 parent bec03a7 commit 4c05e0e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 84 deletions.
19 changes: 17 additions & 2 deletions ext/afform/core/afform.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,24 @@ function afform_shortcode_content($content, $atts, $args, $context) {
*/
function afform_civicrm_searchKitTasks(array &$tasks, bool $checkPermissions, ?int $userID) {
$tasks['AfformSubmission']['process'] = [
'module' => 'afSearchTasks',
'title' => E::ts('Process Submissions'),
'icon' => 'fa-check-square-o',
'uiDialog' => ['templateUrl' => '~/afSearchTasks/afformSubmissionProcessTask.html'],
'apiBatch' => [
'action' => 'get',
'params' => [
'select' => ['id', 'afform_name'],
'where' => [['status_id:name', '=', 'Pending']],
'chain' => [
['Afform', 'process', ['submissionId' => '$id', 'name' => '$afform_name']],
],
],
'conditions' => [
['check user permission', '=', ['administer afform']],
],
'confirmMsg' => E::ts('Confirm processing %1 %2.'),
'runMsg' => E::ts('Processing %1 %2...'),
'successMsg' => E::ts('Successfully processed %1 %2.'),
'errorMsg' => E::ts('An error occurred while attempting to process %1 %2.'),
],
];
}
14 changes: 0 additions & 14 deletions ext/afform/core/ang/afSearchTasks.ang.php

This file was deleted.

7 changes: 0 additions & 7 deletions ext/afform/core/ang/afSearchTasks.module.js

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ private function checkLinkAccess(array $link, array $data): bool {
if (empty($link['path']) && empty($link['task'])) {
return FALSE;
}
if (!empty($link['entity']) && !empty($link['action']) && !in_array($link['action'], ['view', 'preview'], TRUE) && $this->getCheckPermissions()) {
if (!empty($link['entity']) && !empty($link['action']) && !in_array($link['action'], ['view', 'preview', 'get'], TRUE) && $this->getCheckPermissions()) {
$actionName = $this->getPermittedLinkAction($link['entity'], $link['action']);
if (!$actionName) {
return FALSE;
Expand Down

0 comments on commit 4c05e0e

Please sign in to comment.