Commit 9033c3d2 authored by jaapjansma's avatar jaapjansma
Browse files

* Made Expense Type and Status either configurable through the configuration...

* Made Expense Type and Status either configurable through the configuration or parameters in the Create Expense action.
parent 4f690674
Version 1.0.7
--------------
* Made Expense Type and Status either configurable through the configuration or parameters in the Create Expense action.
Version 1.0.6
--------------
* Fixed issue in action Get Expense by Type.
Version 1.0.5
-------------
......
......@@ -29,8 +29,16 @@ class CreateUpdateExpense extends AbstractAction {
* @return void
*/
protected function doAction(ParameterBagInterface $parameters, ParameterBagInterface $output) {
$api_params['type_id'] = $this->configuration->getParameter('type_id');
$api_params['status_id'] = $this->configuration->getParameter('status_id');
if ($parameters->doesParameterExists('type_id')) {
$api_params['type_id'] = $parameters->getParameter('type_id');
} else {
$api_params['type_id'] = $this->configuration->getParameter('type_id');
}
if ($parameters->doesParameterExists('status_id')) {
$api_params['status_id'] = $parameters->getParameter('status_id');
} else {
$api_params['status_id'] = $this->configuration->getParameter('status_id');
}
if ($parameters->doesParameterExists('id')) {
$api_params['id'] = $parameters->getParameter('id');
}
......@@ -68,9 +76,13 @@ class CreateUpdateExpense extends AbstractAction {
* @return SpecificationBag
*/
public function getConfigurationSpecification() {
$typeSpec = new OptionGroupByNameSpecification('type_id', 'expense_type', E::ts('Expense Type'), false);
$typeSpec->setDescription(E::ts('Set the expense type either in the configuration or in the parameters'));
$statusSpec = new OptionGroupByNameSpecification('status_id', 'expense_status', E::ts('Expense Status'), false);
$statusSpec->setDescription(E::ts('Set the status either in the configuration or in the parameters'));
return new SpecificationBag([
new OptionGroupByNameSpecification('type_id', 'expense_type', E::ts('Expense Type'), true),
new OptionGroupByNameSpecification('status_id', 'expense_status', E::ts('Expense Status'), true),
$typeSpec,
$statusSpec,
]);
}
......@@ -80,6 +92,11 @@ class CreateUpdateExpense extends AbstractAction {
* @return SpecificationBag
*/
public function getParameterSpecification() {
$typeSpec = new OptionGroupByNameSpecification('type_id', 'expense_type', E::ts('Expense Type'), false);
$typeSpec->setDescription(E::ts('Set the expense type either in the configuration or in the parameters'));
$statusSpec = new OptionGroupByNameSpecification('status_id', 'expense_status', E::ts('Expense Status'), false);
$statusSpec->setDescription(E::ts('Set the status either in the configuration or in the parameters'));
$specs = new SpecificationBag([
new Specification('id', 'Integer', E::ts("Expense ID"), false),
new Specification('contact_id', 'Integer', E::ts("Contact ID"), true),
......@@ -88,6 +105,8 @@ class CreateUpdateExpense extends AbstractAction {
new Specification('assignee_contact_id', 'Integer', E::ts("Assignee Contact ID"), false),
new Specification('case_id', 'Integer', E::ts("Case ID"), false),
new OptionGroupSpecification('currency', 'currencies_enabled', E::ts('Currency'), FALSE),
$typeSpec,
$statusSpec,
]);
$customGroups = civicrm_api3('CustomGroup', 'get', [
......
......@@ -14,7 +14,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-10-20</releaseDate>
<version>1.0.6</version>
<version>1.0.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.0</ver>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment