Commit 82f771f0 authored by Monish Deb's avatar Monish Deb

make class, project, location and department fields optional

parent d62716cc
......@@ -92,10 +92,9 @@ class CRM_Syncintacct_API {
$journalLineEntry->setTransactionCurrency($entry['CURRENCY']);
$journalLineEntry->setTransactionAmount($entry['AMOUNT']);
// @TODO this is a dummy active location id passed
$journalLineEntry->setLocationId($entry['LOCATION']);
$journalLineEntry->setDepartmentId($entry['DEPARTMENT']);
$journalLineEntry->setProjectId($entry['PROJECTID']);
$journalLineEntry->setClassId($entry['CLASSID']);
$journalLineEntry->setLocationId(CRM_Utils_Array::value('LOCATION', $entry, 'Elim'));
//$journalLineEntry->setLocationId($entry['LOCATION']);
$this->_setMetaData($journalLineEntry, $entry);
$journalLineEntry->setMemo($entry['DESCRIPTION']);
$customFields = new CustomAllocationSplit($entry['customfields']);
$journalLineEntry->setCustomAllocationSplits($customFields);
......@@ -129,16 +128,28 @@ class CRM_Syncintacct_API {
$billLineEntry = new BillLineCreate();
$billLineEntry->setGlAccountNumber($entry['ACCOUNTNO']);
$billLineEntry->setTransactionAmount($entry['AMOUNT']);
$billLineEntry->setLocationId($entry['LOCATION']);
$billLineEntry->setDepartmentId($entry['DEPARTMENT']);
$billLineEntry->setProjectId($entry['PROJECTID']);
$billLineEntry->setClassId($entry['CLASSID']);
//$billLineEntry->setLocationId($entry['LOCATION']);
$billLineEntry->setLocationId(CRM_Utils_Array::value('LOCATION', $entry, 'Elim'));
$this->_setMetaData($billLineEntry, $entry);
// TODO: BillLineCreate does not support adding custom fields yet
// $customFields = new CustomAllocationSplit($entry['customfields']);
// $billLineEntry->setCustomAllocationSplits($customFields);
return $billLineEntry;
}
public function _setMetaData(&$entry, $params) {
$attributes = [
'DEPARTMENT' => 'setDepartmentId',
'PROJECTID' => 'setProjectId',
'CLASSID' => 'setClassId',
];
foreach ($attributes as $attribute => $func) {
if (!empty($params[$attribute])) {
$entry->$func($params[$attribute]);
}
}
}
/**
* Function to fetch vendors
*/
......
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