Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
CIVICRM-868: Hiding tax field on edit line item form if no tax collec…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
agilewarealok committed May 22, 2018
1 parent 255c62c commit 9442710
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CRM/Lineitemedit/Form/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ public function preProcess() {

public function assignFormVariables($params = []) {
$this->_lineitemInfo = civicrm_api3('lineItem', 'getsingle', array('id' => $this->_id));
$this->_lineitemInfo['tax_amount'] = CRM_Utils_Array::value('tax_amount', $this->_lineitemInfo, 0.00);
$this->_lineitemInfo['tax_amount'] = CRM_Utils_Array::value('tax_amount', $this->_lineitemInfo, NULL);
foreach (CRM_Lineitemedit_Util::getLineitemFieldNames() as $attribute) {
$this->_values[$attribute] = CRM_Utils_Array::value($attribute, $this->_lineitemInfo, 0);
$lineitemAttributeValue = CRM_Utils_Array::value($attribute, $this->_lineitemInfo, 0);
if ($lineitemAttributeValue !== NULL) {
$this->_values[$attribute] = $lineitemAttributeValue;
}
}

$this->_values['currency'] = CRM_Core_DAO::getFieldValue(
Expand Down Expand Up @@ -155,7 +158,7 @@ public function submit($values, $isTest = FALSE) {
'qty' => $values['qty'],
'unit_price' => CRM_Utils_Rule::cleanMoney($values['unit_price']),
'line_total' => $values['line_total'],
'tax_amount' => CRM_Utils_Array::value('tax_amount', $values, 0.00),
'tax_amount' => CRM_Utils_Array::value('tax_amount', $values, NULL),
);
$lineItem = CRM_Price_BAO_LineItem::create($params);
$lineItem = $lineItem->toArray();
Expand Down

0 comments on commit 9442710

Please sign in to comment.