Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.3 #1

Open
wants to merge 23 commits into
base: ssa
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f1f9ce5
Exclude test contributions and memberships
johntwyman Jan 9, 2018
9f17a33
Merge pull request #14 from australiangreens/exclude-test-memberships
eileenmcnaughton Jan 9, 2018
1566fa3
Updates from rerunning civix
eileenmcnaughton Jan 10, 2018
54044b9
Increment version, update compatibility
eileenmcnaughton Jan 10, 2018
95d4421
Add setting for enabled tokens, if set only display as set
eileenmcnaughton Jan 11, 2018
c8e9afc
Add angular form to allow setting config
eileenmcnaughton Jan 11, 2018
f905cac
Add token config to menu
eileenmcnaughton Jan 11, 2018
81b97f7
Add screenshots of token list
eileenmcnaughton Jan 11, 2018
b18e0de
Update readme
eileenmcnaughton Jan 12, 2018
1ce9096
Add note about conditional country formatting
eileenmcnaughton Jan 12, 2018
d99fef2
Fixed issue #17: tokens for total amount
jaapjansma Jan 24, 2018
4f3cbac
added tokens for latest completed contribution. See #16
jaapjansma Jan 24, 2018
87cd7d7
Tokens for next pending contribution. See #15
jaapjansma Jan 24, 2018
476a819
Added tokens for deductible amount and fixed query. See #17, #16 and …
jaapjansma Jan 24, 2018
4a20643
Fixed #19: added balance due
jaapjansma Jan 24, 2018
3df3474
Fixed #19: added balance due
jaapjansma Jan 24, 2018
dcb4019
Merge pull request #18 from jaapjansma/maf_norge
eileenmcnaughton Jan 24, 2018
081719e
increment version to 1.2
eileenmcnaughton Jan 24, 2018
57a92ea
#20 more then 25 relationship types did not work.
jaapjansma Mar 22, 2018
e2a6047
Merge pull request #21 from jaapjansma/issue_20
eileenmcnaughton Mar 22, 2018
a17d2b5
increment to 1.3
eileenmcnaughton Mar 23, 2018
b19f14a
add new date format for SSA props @jackrabbitrocks
kcristiano Sep 20, 2017
daa53aa
update info.xml to reflect changes
kcristiano Sep 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
nz.co.fuzion.civitoken
======================

Fuzion Token extension for CiviCRM, that provides its users extra tokens
that can be used on a CiviCRM installation. These include tokens to access
membership data, like membership type, start and end dates, and status. These
are particularly useful to use on your "fees due" automatic notices.
Fuzion Token extension for CiviCRM, that provides its users extra tokens.

These include tokens to access membership data, like membership type, start and end dates, and status. These are particularly useful to use on your "fees due" automatic notices.

By default all tokens are enabled. If you just want some there is a setting page
(screenshot below).

*A note about country-specific address formatting*
CiviCRM has a data structure to support country-specific address formatting but
no inbuilt functionality to support this.

The data format is that the country table has an address_format_id field. That can
be used to link to a row in civicrm_address_format which you create with
a specific format. Currently the only way to create such formats is directly
in the DB. If, however, you do create those formats, this
extension will respect them in the address blocks.

*A note about country in the address block*

Several countries postal codes require that the country be excluded if it is a
domestic posting (if you wish to get bulk postal rates), I am not aware
of any where the country IS required for domestic. This extension does not
include the country in the address block if it matches that configured for
the domain organisation.


![list of tokens](docs/token_listing.png)
![list of tokens2](docs/token_listing_2.png)


Installation
Expand Down
24 changes: 24 additions & 0 deletions ang/civitoken.ang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules

return array (
'js' =>
array (
0 => 'ang/civitoken.js',
1 => 'ang/civitoken/*.js',
2 => 'ang/civitoken/*/*.js',
),
'css' =>
array (
0 => 'ang/civitoken.css',
),
'partials' =>
array (
0 => 'ang/civitoken',
),
'settings' =>
array (
),
);
1 change: 1 addition & 0 deletions ang/civitoken.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Add any CSS rules for Angular module "civitoken" */
6 changes: 6 additions & 0 deletions ang/civitoken.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(function(angular, $, _) {
// Declare a list of dependencies.
angular.module('civitoken', [
'crmUi', 'crmUtil', 'ngRoute'
]);
})(angular, CRM.$, CRM._);
32 changes: 32 additions & 0 deletions ang/civitoken/Setting.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="crm-container">
<h1 crm-page-title>{{ts('Enabled CiviTokens')}}</h1>

<form name="civiTokenForm" crm-ui-id-scope>

<div>
<button class="crm-button" ng-click="save()">{{ts('Save')}}</button>
</div>

<div class="help">
<p>{{ts('Select the tokens you wish to enable on this site.')}}</p>

<p>{{ts('If no tokens are disabled it is considered to be unrestricted (if you really want none uninstall civitoken).')}}</p>
</div>

<div>
<div ng-repeat="(index, setting) in settingOptions">
<input
type="checkbox"
name="selectedTokens"
value="{{setting.name}}"
ng-model="setting.selected"
>
<label >{{setting.title}}</label>
</div>
</div>
<div>
<button class="crm-button" ng-click="save()">{{ts('Save')}}</button>
</div>
</form>

</div>
81 changes: 81 additions & 0 deletions ang/civitoken/Setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
(function(angular, $, _) {

angular.module('civitoken').config(function($routeProvider) {
$routeProvider.when('/civitoken/settings', {
controller: 'CivitokenSetting',
templateUrl: '~/civitoken/Setting.html',

// If you need to look up data when opening the page, list it out
// under "resolve".
resolve: {
existingSettings: function(crmApi) {
return crmApi('Setting', 'get', {
return: ['civitoken_enabled_tokens'],
sequential: true
});
},

settingMetaData: function(crmApi) {
return crmApi('Setting', 'getfields', {
});
},

settingOptions: function(crmApi) {
return crmApi('Setting', 'getoptions', {
'field' : 'civitoken_enabled_tokens',
});
}

}
});
}
);

// The controller uses *injection*. This default injects a few things:
// $scope -- This is the set of variables shared between JS and HTML.
// crmApi, crmStatus, crmUiHelp -- These are services provided by civicrm-core.
// existingSetting -- The current contact, defined above in config().
angular.module('civitoken').controller('CivitokenSetting', function($scope, crmApi, crmStatus, crmUiHelp, existingSettings, settingMetaData, settingOptions) {
// The ts() and hs() functions help load strings for this module.
var ts = $scope.ts = CRM.ts('civitoken');
var hs = $scope.hs = crmUiHelp({file: 'CRM/civitoken/Setting'}); // See: templates/CRM/civitoken/Setting.hlp

// We don't really use the metadata array very fully yet but my intent
// was to make this form fully metadata driven & hence I have not removed the
// bits that would help move that way.
settingMetaData = settingMetaData['values']['civitoken_enabled_tokens'];
settingOptions = settingOptions['values'];
existingSettings = existingSettings['values'][0]['civitoken_enabled_tokens'];
settingMetaData['options'] = {};

var optionValues = Object.keys(settingOptions);
optionValues.forEach(function(keyName) {
settingMetaData['options'][keyName] = {};
settingMetaData['options'][keyName]['name'] = keyName;
settingMetaData['options'][keyName]['title'] = settingOptions[keyName];
settingMetaData['options'][keyName]['selected'] = ($.inArray(keyName, existingSettings) >= 0);
});
settingOptions = settingMetaData.options;

// We have existingSetting available in JS. We also want to reference it in HTML.
$scope.settingOptions = settingOptions;

$scope.save = function save() {
var selected = {'civitoken_enabled_tokens' : []};
optionValues.forEach(function(keyName) {
console.log(keyName + settingOptions[keyName]['selected']);
if (settingOptions[keyName]['selected']) {
selected['civitoken_enabled_tokens'].push(keyName);
}
});
console.log(selected);
return crmStatus(
// Status messages. For defaults, just use "{}"
{start: ts('Saving...'), success: ts('Saved')},
// The save action. Note that crmApi() returns a promise.
crmApi('Setting', 'create', selected)
);
};
});

})(angular, CRM.$, CRM._);
Loading