*/
public $isShowTax;
+ /**
+ * Is it a good idea to show the line item subtotal.
+ *
+ * This would be true if at least one line has a quantity > 1.
+ * Otherwise it is very repetitive.
+ *
+ * @var bool
+ *
+ * @scope tplParams
+ */
+ public $isShowLineSubtotal;
+
/**
* Line items associated with the contribution.
*
return FALSE;
}
return !$this->order->getPriceSetMetadata()['is_quick_config'];
+ return $this->isShowLineItems;
+ }
+
+ /**
+ * Is it a good idea to show the line item subtotal.
+ *
+ * This would be true if at least one line has a quantity > 1.
+ * Otherwise it is very repetitive.
+ *
+ * @return bool
+ * @throws \CRM_Core_Exception
+ */
+ public function getIsShowLineSubtotal(): bool {
+ foreach ($this->getLineItems() as $lineItem) {
+ if ((int) $lineItem['qty'] > 1) {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
/**
*/
public $isPrimary;
+ /**
+ * Should a participant count column be shown.
+ *
+ * This would be true if there is a line item on the receipt
+ * with more than one participant in it. Otherwise it's confusing to
+ * show.
+ *
+ * @var bool
+ *
+ * @scope tplParams as isShowParticipantCount
+ */
+ public $isShowParticipantCount;
+
/**
* @var int
*
}
/**
- * Set contribution object.
+ * It is a good idea to show the participant count column.
+ *
+ * This would be true if there is a line item on the receipt
+ * with more than one participant in it. Otherwise it's confusing to
+ * show.
+ *
+ * @return bool
+ * @throws \CRM_Core_Exception
+ */
+ public function getIsShowParticipantCount(): bool {
+ foreach ($this->getLineItems() as $lineItem) {
+ if ((int) $lineItem['participant_count'] > 1) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+
+ /**
+ * Set participant object.
*
* @param array $participant
*
{if {event.is_monetary|boolean}}
-
<tr>
<th {$headerStyle}>
{event.fee_label}
<th>{ts}Tax Amount{/ts}</th>
{/if}
<th>{ts}Total{/ts}</th>
- {if !empty($pricesetFieldsCount)}
+ {if $iShowParticipantCount}
<th>{ts}Total Participants{/ts}</th>
{/if}
</tr>
<td {$tdStyle}>
{$line.line_total+$line.tax_amount|crmMoney:$currency}
</td>
- {if !empty($pricesetFieldsCount)}
+ {if $isShowParticipantCount}
<td {$tdStyle}>{$line.participant_count}</td>
{/if}
</tr>
{contribution.total_amount} {if !empty($hookDiscount.message)}({$hookDiscount.message}){/if}
</td>
</tr>
- {if !empty($pricesetFieldsCount)}
+ {if $isShowParticipantCount}
<tr>
- <td {$labelStyle}>
- {ts}Total Participants{/ts}</td>
- <td {$valueStyle}>
- {assign var="count" value= 0}
- {foreach from=$lineItem item=pcount}
- {assign var="lineItemCount" value=0}
- {if $pcount neq 'skip'}
- {foreach from=$pcount item=p_count}
- {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
- {/foreach}
- {if $lineItemCount < 1}{assign var="lineItemCount" value=1}
- {/if}
- {assign var="count" value=$count+$lineItemCount}
- {/if}
- {/foreach}
- {$count}
- </td>
+ <td {$labelStyle}>{ts}Total Participants{/ts}</td>
+ <td {$valueStyle}>{$line.participant_count}</td>
</tr>
{/if}
{if {contribution.is_pay_later|boolean} && {contribution.balance_amount|boolean}}