From c474ce0c845e5395adae8dc35d5737ca512945b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 1 Jun 2020 15:37:44 +0200 Subject: [PATCH] Don't cherry-pick: - renderReceipt() does now require a second parameter showReceiptPaymentType which can be used to include or exclude the payment type in views. For all selection boxes, this feature has been disabled (in views) or else the selection box becomes very wide MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../FinancialsWebViewReceiptHelperBean.java | 19 +++++++++++++------ .../admin_form_financial_receipt_item.tpl | 2 +- .../admin_receipt_item_list.xhtml | 14 +++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/beans/helper/receipt/FinancialsWebViewReceiptHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/receipt/FinancialsWebViewReceiptHelperBean.java index 8f6e1228..fa5d4084 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/receipt/FinancialsWebViewReceiptHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/receipt/FinancialsWebViewReceiptHelperBean.java @@ -45,13 +45,15 @@ public class FinancialsWebViewReceiptHelperBean extends BaseFinancialsBean imple } /** - * Returns the receipt number and more. If null is provided, an empty string is returned. + * Returns the receipt number and more. If null is provided, an empty string + * is returned. *

- * @param receipt Receipt instance + * @param receipt Receipt instance + * @param showReceiptPaymentType Whether the payment type should be shown *

* @return Receipt number and more */ - public String renderReceipt (final BillableReceipt receipt) { + public String renderReceipt (final BillableReceipt receipt, final Boolean showReceiptPaymentType) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(50); @@ -59,9 +61,14 @@ public class FinancialsWebViewReceiptHelperBean extends BaseFinancialsBean imple if (receipt instanceof BillableReceipt) { // Add relevant data sb.append(this.getMessageFromBundle("RECEIPT_ISSUED")).append(" "); //NOI18N - sb.append(DateFormat.getInstance().format(receipt.getReceiptIssued())).append(", "); //NOI18N - sb.append(this.getMessageFromBundle("PAYMENT_TYPE")).append(" "); //NOI18N - sb.append(this.getMessageFromBundle(receipt.getReceiptPaymentType().getMessageKey())); + sb.append(DateFormat.getInstance().format(receipt.getReceiptIssued())); + + // Is payment type to be shown? + if (showReceiptPaymentType) { + // Add payment type + sb.append(", ").append(this.getMessageFromBundle("PAYMENT_TYPE")).append(" "); //NOI18N + sb.append(this.getMessageFromBundle(receipt.getReceiptPaymentType().getMessageKey())); + } // Is receipt number included? if (receipt.getReceiptNumber() != null) { diff --git a/web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl b/web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl index 2f4e8eec..e2905d42 100644 --- a/web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl +++ b/web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl @@ -153,7 +153,7 @@ value="#{receiptListController.allReceipts}" var="receipt" itemValue="#{receipt}" - itemLabel="#{receiptBeanHelper.renderReceipt(receipt)}" + itemLabel="#{receiptBeanHelper.renderReceipt(receipt, false)}" /> diff --git a/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml b/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml index 546c4669..9e32401e 100644 --- a/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml +++ b/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml @@ -122,14 +122,14 @@ value="#{receiptListController.allReceipts}" var="receipt" itemValue="#{receipt}" - itemLabel="#{receiptBeanHelper.renderReceipt(receipt)}" + itemLabel="#{receiptBeanHelper.renderReceipt(receipt, false)}" /> @@ -301,7 +301,7 @@ @@ -313,11 +313,7 @@ title="#{msg.ADMIN_LINK_SHOW_BASIC_DATA_TITLE}" rendered="#{not empty receiptItemListController.selectedReceiptItem.itemManufacturer}" > - - - - - + @@ -348,7 +344,7 @@ -- 2.39.5