Skip to content

Commit

Permalink
Improved: User with only 'VIEW' permissions and invoice payments (OFB…
Browse files Browse the repository at this point in the history
…IZ-12384) (#386)

Currently, a user with only 'VIEW' permissions, as demonstrated in trunk demo with userId = auditor, accessing the payments screen on an invoice sees fields editable and triggers to requests reserved for users with 'CREATE' or 'UPDATE' permissions.
To see (test): https://demo-trunk.ofbiz.apache.org/accounting/control/editInvoiceApplications?invoiceId=demo10001

Modifiied: InvoiceScreens.xml
restructured EditInvoiceApplications screen to work with user's permissions, additional clean-up
  • Loading branch information
PierreSmits committed Dec 6, 2021
1 parent 033ab16 commit 878495a
Showing 1 changed file with 74 additions and 51 deletions.
125 changes: 74 additions & 51 deletions applications/accounting/widget/InvoiceScreens.xml
Expand Up @@ -352,7 +352,6 @@ under the License.
<set field="titleProperty" value="PageTitleListEditInvoiceApplications"/>
<set field="tabButtonItem" value="editInvoiceApplications"/>
<set field="helpAnchor" value="_help_for_edit_invoice_applications"/>

<set field="invoiceId" from-field="parameters.invoiceId"/>
<entity-one entity-name="Invoice" value-field="invoice"/>
<script location="component://accounting/groovyScripts/invoice/CreateApplicationList.groovy"/>
Expand All @@ -366,72 +365,96 @@ under the License.
<decorator-section name="body">
<section>
<condition>
<if-compare field="notAppliedAmount" operator="greater" value="0"/>
<and>
<or>
<if-has-permission permission="ACCOUNTING" action="_CREATE"/>
<if-has-permission permission="ACCOUNTING" action="_UPDATE"/>
</or>
</and>
</condition>
<widgets>
<screenlet title="${uiLabelMap.AccountingPaymentsApplied} ${appliedAmount?currency(${invoice.currencyUomId})} ${uiLabelMap.AccountingOpenPayments} ${notAppliedAmount?currency(${invoice.currencyUomId})}">
<include-form name="EditInvoiceApplications" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<section>
<condition>
<if-empty field="invoiceApplications"/>
</condition>
<widgets>
<container><label style="h3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
</widgets>
</section>
<section>
<condition>
<or>
<not><if-empty field="payments"/></not>
<not><if-empty field="paymentsActualCurrency"/></not>
</or>
<if-compare field="notAppliedAmount" operator="greater" value="0"/>
</condition>
<widgets>
<screenlet title="${uiLabelMap.AccountingListPaymentsNotYetApplied} [${invoice.partyIdFrom}] ${uiLabelMap.AccountingPaymentSentForm} [${invoice.partyId}]">
<section>
<condition>
<not><if-empty field="payments"/></not>
</condition>
<widgets>
<include-form name="ListPaymentsNotApplied" location="component://accounting/widget/InvoiceForms.xml"/>
</widgets>
</section>
<section>
<condition>
<not><if-empty field="paymentsActualCurrency"/></not>
</condition>
<widgets>
<include-form name="ListPaymentsNotAppliedForeignCurrency" location="component://accounting/widget/InvoiceForms.xml"/>
</widgets>
</section>
</screenlet>
</widgets>
<widgets>
<screenlet title="${uiLabelMap.AccountingPaymentsApplied} ${appliedAmount?currency(${invoice.currencyUomId})}
${uiLabelMap.AccountingOpenPayments} ${notAppliedAmount?currency(${invoice.currencyUomId})}">
<include-form name="EditInvoiceApplications" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<section>
<condition>
<if-empty field="invoiceApplications"/>
</condition>
<widgets>
<container><label style="h3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
</widgets>
</section>
<section>
<condition>
<or>
<not><if-empty field="payments"/></not>
<not><if-empty field="paymentsActualCurrency"/></not>
</or>
</condition>
<widgets>
<screenlet title="${uiLabelMap.AccountingListPaymentsNotYetApplied} [${invoice.partyIdFrom}]
${uiLabelMap.AccountingPaymentSentForm} [${invoice.partyId}]">
<section>
<condition>
<not><if-empty field="payments"/></not>
</condition>
<widgets>
<include-form name="ListPaymentsNotApplied" location="component://accounting/widget/InvoiceForms.xml"/>
</widgets>
</section>
<section>
<condition>
<not><if-empty field="paymentsActualCurrency"/></not>
</condition>
<widgets>
<include-form name="ListPaymentsNotAppliedForeignCurrency" location="component://accounting/widget/InvoiceForms.xml"/>
</widgets>
</section>
</screenlet>
</widgets>
</section>
<screenlet title="${uiLabelMap.AccountingAssignPaymentToInvoice}">
<include-form name="AddPayment" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
</widgets>
<fail-widgets>
<screenlet title="${uiLabelMap.AccountingPaymentsApplied} ${appliedAmount?currency(${invoice.currencyUomId})}
${uiLabelMap.AccountingOpenPayments} ${notAppliedAmount?currency(${invoice.currencyUomId})}">
<include-form name="EditInvoiceApplications" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<section>
<condition>
<if-empty field="invoiceApplications"/>
</condition>
<widgets>
<container>
<label style="h3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label>
</container>
</widgets>
</section>
</fail-widgets>
</section>
<screenlet title="${uiLabelMap.AccountingAssignPaymentToInvoice}">
<include-form name="AddPayment" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
</widgets>
<fail-widgets>
<screenlet title="${uiLabelMap.AccountingPaymentsApplied} ${appliedAmount?currency(${invoice.currencyUomId})} ${uiLabelMap.AccountingOpenPayments} ${notAppliedAmount?currency(${invoice.currencyUomId})}">
<include-form name="EditInvoiceApplications" location="component://accounting/widget/InvoiceForms.xml"/>
<screenlet
title="${uiLabelMap.AccountingAppliedPayments} ${appliedAmount?currency(${invoice.currencyUomId})}
${uiLabelMap.AccountingOpenPayments} ${notAppliedAmount?currency(${invoice.currencyUomId})}"
navigation-form-name="ListInvoiceApplications">
<include-form name="ListInvoiceApplications" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<section>
<condition>
<if-empty field="invoiceApplications"/>
</condition>
<widgets>
<container><label style="h3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
</widgets>
</section>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>

<screen name="EditInvoiceItems">
<section>
<actions>
Expand Down

0 comments on commit 878495a

Please sign in to comment.