Commit aec26029 authored by jaapjansma's avatar jaapjansma
Browse files

Added setting to enable or disable activity creation upon expense submission.

parent 2ac00ac7
Version 1.1.0
--------------
* Added setting to enable or disable activity creation upon expense submission.
Version 1.0.11
--------------
......
......@@ -26,8 +26,8 @@ class CRM_Expenses_BAO_Expense extends CRM_Expenses_DAO_Expense {
CRM_Core_BAO_CustomValueTable::store($params['custom'], self::$_tableName, $instance->id);
}
if (empty($params['id'])) {
$createActivityParams = [
if (empty($params['id']) && \Civi::settings()->get('expenses_create_activities')) {
$createActivityParams = [
'activity_type_id' => 'ExpenseSubmitted',
'status_id' => 'Completed',
];
......
......@@ -33,6 +33,9 @@ You can add custom fields to an expense by going to **Administer > Customize Dat
add **Set of Custom Fields** and set **Used for** to either Expense or Expense Line. In the following screens you can then
add the custom fields in the usual way.
You can further configure expenses by going to **Administer > CiviContribute > Expense Settings**.
You can enable whether an activity should be created when a new expense is added. Which is enabled by default.
## Background of this extension
I developed the expense extension for Sozio Kultur. An organization which gives out grants to cultural organizations in Germany.
......
......@@ -221,5 +221,13 @@ function expenses_civicrm_navigationMenu(&$menu) {
'operator' => 'OR',
'separator' => 0,
));
_expenses_civix_insert_navigation_menu($menu, 'Administer/CiviContribute', array(
'label' => E::ts('Expense Settings'),
'name' => 'settings_expenses',
'url' => 'civicrm/admin/setting/preferences/expenses',
'permission' => 'administer CiviCRM',
'operator' => 'OR',
'separator' => 0,
));
_expenses_civix_navigationMenu($menu);
}
......@@ -13,8 +13,8 @@
<url desc="Documentation">https://lab.civicrm.org/extensions/expenses/blob/master/README.md</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-11-27</releaseDate>
<version>1.0.11</version>
<releaseDate>2021-02-09</releaseDate>
<version>1.1.0</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.0</ver>
......
<?php
use CRM_Expenses_ExtensionUtil as E;
/**
* @author Jaap Jansma <jaap.jansma@civicoop.org>
* @license AGPL-3.0
*/
return array(
'expenses_create_activities' => array(
'name' => 'expenses_create_activities',
'type' => 'Boolean',
'default' => '1',
'html_type' => 'checkbox',
'title' => E::ts('Create activity'),
'is_domain' => 1,
'is_contact' => 0,
'description' => E::ts('If enabled, an activity will be created when a new expenses is added.'),
'settings_pages' => ['expenses' => ['weight' => 10]],
),
);
......@@ -30,4 +30,9 @@
<title>Expense</title>
<access_arguments>manage expenses;access my cases and activities;access all cases and activities</access_arguments>
</item>
<item>
<path>civicrm/admin/setting/preferences/expenses</path>
<title>Expense Settings</title>
<page_callback>CRM_Admin_Form_Generic</page_callback>
</item>
</menu>
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