contributionId) { $this->order = new CRM_Financial_BAO_Order(); $this->order->setTemplateContributionID($this->contributionId); } return $this->order; } /** * Should line items be displayed for the contribution. * * This determination is based on whether the price set is quick config. * * @var bool * * @scope tplParams */ public $isShowLineItems; /** * Get bool for whether a line item breakdown be displayed. * * @return bool */ public function getIsShowLineItems(): bool { $order = $this->getOrder(); if (!$order) { // This would only be the case transitionally. // Since this is a trait it is used by templates which don't (yet) // always have the contribution ID available as well as migrated ones. return FALSE; } return $this->order->getPriceSetMetadata()['is_quick_config']; } /** * Set contribution object. * * @param array $contribution * * @return $this */ public function setContribution(array $contribution): self { $this->contribution = $contribution; if (!empty($contribution['id'])) { $this->contributionId = $contribution['id']; } return $this; } /** * Extra variables to be exported to smarty based on being calculated. * * We export isShowTax to denote whether invoicing is enabled but * hopefully at some point we will separate the assumption that invoicing * and tax are a package. * * @param array $export */ protected function exportExtraTplParams(array &$export): void { $export['isShowTax'] = (bool) Civi::settings()->get('invoicing'); } }