-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to accept/reject multiple drawdowns at once
- Loading branch information
Dominic Tubach
committed
Feb 4, 2025
1 parent
4899ebb
commit d3277a7
Showing
12 changed files
with
612 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
Civi/Funding/Api4/Action/FundingDrawdown/AcceptMultipleAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2025 SYSTOPIA GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation in version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Civi\Funding\Api4\Action\FundingDrawdown; | ||
|
||
use Civi\Api4\FundingDrawdown; | ||
use Civi\Api4\Generic\AbstractAction; | ||
use Civi\Api4\Generic\Result; | ||
use Civi\Funding\Api4\Action\Traits\IdsParameterTrait; | ||
|
||
class AcceptMultipleAction extends AbstractAction { | ||
|
||
use IdsParameterTrait; | ||
|
||
public function __construct() { | ||
parent::__construct(FundingDrawdown::getEntityName(), 'acceptMultiple'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
public function _run(Result $result): void { | ||
foreach ($this->getIds() as $id) { | ||
$result[$id] = FundingDrawdown::accept() | ||
->setId($id) | ||
->execute() | ||
->single(); | ||
} | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
Civi/Funding/Api4/Action/FundingDrawdown/RejectMultipleAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2025 SYSTOPIA GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation in version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Civi\Funding\Api4\Action\FundingDrawdown; | ||
|
||
use Civi\Api4\FundingDrawdown; | ||
use Civi\Api4\Generic\AbstractAction; | ||
use Civi\Api4\Generic\Result; | ||
use Civi\Funding\Api4\Action\Traits\IdsParameterTrait; | ||
|
||
class RejectMultipleAction extends AbstractAction { | ||
|
||
use IdsParameterTrait; | ||
|
||
public function __construct() { | ||
parent::__construct(FundingDrawdown::getEntityName(), 'rejectMultiple'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
public function _run(Result $result): void { | ||
foreach ($this->getIds() as $id) { | ||
$result[$id] = FundingDrawdown::reject() | ||
->setId($id) | ||
->execute() | ||
->single(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div af-fieldset=""> | ||
<div class="af-container af-layout-inline"> | ||
<af-field name="FundingDrawdown_FundingPayoutProcess_payout_process_id_01_FundingPayoutProcess_FundingCase_funding_case_id_01.identifier" defn="{required: false, input_attrs: {}}" /> | ||
<af-field name="status" defn="{input_attrs: {multiple: true}, required: false}" /> | ||
<af-field name="FundingDrawdown_FundingPayoutProcess_payout_process_id_01_FundingPayoutProcess_FundingCase_funding_case_id_01.recipient_contact_id" defn="{required: false, input_attrs: {}}" /> | ||
<af-field name="FundingDrawdown_FundingPayoutProcess_payout_process_id_01_FundingPayoutProcess_FundingCase_funding_case_id_01.funding_program_id" defn="{input_type: 'Select', input_attrs: {multiple: true}, required: false}" /> | ||
</div> | ||
<crm-search-display-table search-name="FundingDrawdownsAll" display-name="Table"></crm-search-display-table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
use CRM_Funding_ExtensionUtil as E; | ||
|
||
return [ | ||
'type' => 'search', | ||
'requires' => ['crmFunding'], | ||
'title' => E::ts('Drawdowns'), | ||
'icon' => 'fa-list-alt', | ||
'server_route' => 'civicrm/funding/drawdown/list', | ||
'permission' => [ | ||
'access Funding', | ||
'administer Funding', | ||
], | ||
'permission_operator' => 'OR', | ||
'search_displays' => [ | ||
'FundingDrawdownsAll.Table', | ||
], | ||
]; |
Oops, something went wrong.