...
 
Commits (3)
......@@ -92,14 +92,14 @@ class CRM_Syncintacct_API {
$journalLineEntry->setTransactionAmount($entry['AMOUNT']);
$this->_setMetaData($journalLineEntry, $entry);
$journalLineEntry->setMemo($entry['DESCRIPTION']);
$customFields = new CustomAllocationSplit($entry['customfields']);
$journalLineEntry->setCustomAllocationSplits($customFields);
$journalLineEntry->setCustomFields($entry['customfields']);
return $journalLineEntry;
}
public function createGLBatch($GLBatch) {
$journalEntry = new JournalEntryCreate();
$journalEntry->setJournalSymbol('GJ');
$journalEntry->setJournalSymbol('CIVI');
$journalEntry->setReferenceNumber($GLBatch['REFERENCENO']);
$journalEntry->setPostingDate($GLBatch['BATCH_DATE']);
$journalEntry->setDescription($GLBatch['BATCH_TITLE']);
$journalEntry->setAction('Draft');
......
......@@ -96,9 +96,11 @@ class CRM_Syncintacct_Util {
public static function formatGLBatchParams($dao, $batchID) {
$batch = civicrm_api3('Batch', 'getsingle', ['id' => $batchID]);
$GLBatch = [
'JOURNAL' => 'CIVIBATCH' . $batchID,
'JOURNAL' => 'TEST',
'BATCH_DATE' => new DateTime($batch['created_date']),
'BATCH_TITLE' => $batch['title'],
// REFERENCENO should be "October 2018" if running in November 2018.
'REFERENCENO' => "CiviCRM - " . (new DateTime('first day of last month'))->format('F Y'),
'ENTRIES' => [],
];
$queryResults = [];
......@@ -107,7 +109,9 @@ class CRM_Syncintacct_Util {
$accountName = $dao->credit_account ? $dao->credit_account_name : $dao->from_credit_account_name;
$accountID = $dao->credit_account ? $dao->credit_account_id : $dao->from_credit_account_id;
$values = self::getAccountDataByCode($accountID);
// Items in lowercase are for bundling purposes, they aren't part of the Intacct spec.
$GLBatch['ENTRIES'][] = [
'account_name' => $accountName,
'ACCOUNTNO' => $dao->credit_account ?: $dao->from_credit_account,
'ACCOUNTID' => $accountID,
'CURRENCY' => $dao->currency,
......@@ -119,14 +123,15 @@ class CRM_Syncintacct_Util {
'LOCATION' => $values['location'],
'PROJECTID' => $values['project_id'],
'customfields' => [
'batch_id' => $batchID,
'financial_trxn_id' => $dao->financial_trxn_id,
'financial_item_id' => $dao->financial_item_id,
'url' => CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
'CIVICRM_BATCH_ID' => $batchID,
'FINANCIAL_TRXN_ID' => $dao->financial_trxn_id,
'FINANCIAL_ITEM_ID' => $dao->financial_item_id,
'CIVICRM_URL' => CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
]
];
$values = self::getAccountDataByCode($dao->to_account_id);
$GLBatch['ENTRIES'][] = [
'account_name' => $accountName,
'ACCOUNTNO' => $dao->to_account_code,
'ACCOUNTID' => $dao->to_account_id,
'CURRENCY' => $dao->currency,
......@@ -138,10 +143,10 @@ class CRM_Syncintacct_Util {
'PROJECTID' => $values['project_id'],
'CONTRIBUTION_AMOUNT' => $dao->contribution_amount,
'customfields' => [
'batch_id' => $batchID,
'financial_trxn_id' => $dao->financial_trxn_id,
'financial_item_id' => $dao->financial_item_id,
'url' => CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
'CIVICRM_BATCH_ID' => $batchID,
'FINANCIAL_TRXN_ID' => $dao->financial_trxn_id,
'FINANCIAL_ITEM_ID' => $dao->financial_item_id,
'CIVICRM_URL' => CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
],
];
$queryResults[] = get_object_vars($dao);
......@@ -175,10 +180,10 @@ class CRM_Syncintacct_Util {
'LOCATION' => $values['location'],
'PROJECTID' => $values['project_id'],
'customfields' => [
'batch_id' => $batchID,
'financial_trxn_id' => $dao->financial_trxn_id,
'financial_item_id' => $dao->financial_item_id,
'url' => CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
'CIVICRM_BATCH_ID' => $batchID,
'FINANCIAL_TRXN_ID' => $dao->financial_trxn_id,
'FINANCIAL_ITEM_ID' => $dao->financial_item_id,
'CIVICRM_URL' => CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&id={$dao->entity_id}&cid={$dao->contact_id}&action=view", TRUE),
]
];
}
......
......@@ -34,6 +34,20 @@ cv en syncintacct
## Configuration
### Intacct Configuration
#### CiviCRM Journal
This extension posts to a journal called "CiviCRM Journal" with a symbol of "CIVI". To create the journal, go to Intacct's **General Ledger menu » Journal Entry**. Press the **Add** button at the bottom. On the next screen, select the **Journal** drop-down and press the **Add** button there. Fill in the Symbol ("CIVI") and the title ("CiviCRM Journal") and save.
#### Custom fields
If you create custom fields to hold them, this extension will populate them with the CiviCRM batch ID, financial item ID, financial transaction ID, and a link back to the contribution. Go to Intacct's **Platform Services menu » Custom Fields** and create the following fields:
* CIVICRM_URL - Object is "GL Entry", type is "URL", label is "URL", Field ID is "CIVICRM_URL".
* CIVICRM_BATCH_ID - Object is "GL Entry", type is "Text", label is "Batch ID", Length is "10", Field ID is "CIVICRM_BATCH_ID".
* FINANCIAL_ITEM_ID - Object is "GL Entry", type is "Text", label is "Financial Item ID", Field ID is "FINANCIAL_ITEM_ID".
* FINANCIAL_TRXN_ID - Object is "GL Entry", type is "Text", label is "Financial Trxn ID", Field ID is "FINANCIAL_TRXN_ID".
Minimal configuration support has been added to the extension for synchronizing with not just the GL Account in Intacct but also Location, Class, Department and Project. In order to add these four new fields, which are later added as parameters of General Ledger and Accounts Payable bill entries, staff users will be expected to manually fill them in for all used combinations of them.
Normally initial configuration of CiviCRM involves setting up Financial Types and Financial Accounts so that they match the accounts in your accounting package using the documentation at https://docs.civicrm.org/user/en/latest/contributions/key-concepts-and-configurations/. This results in a one-to-one correspondence between Financial Accounts in CiviCRM and the accounts in your Chart of Accounts that are used by CiviCRM.
......