ilscipio/scipio-erp

View on GitHub
applications/shop/widget/OrderPrintScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<!-- These forms are for generating printed documents, such as invoices, bills, statements, etc. -->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">

    <!-- SCIPIO: Original: component://order/widget/ordermgr/OrderPrintScreens.xml#OrderPDF -->
    <!-- generate a PDF for the order, sharing the same BSH file as the HTML page for viewing the order -->
    <screen name="OrderPDF">
        <section>
            <actions>
                <!-- SCIPIO: FIXME!!!: This screen does not properly do permission checks!!!
                    It must allow anonymous user (userLoginId "anonymous" with partyId set to temporary value)
                    and not allow viewing other people's orders!!!
                    See component://order/widget/ordermgr/OrderPrintScreens.xml -->
               <set field="permChecksSetGlobal" type="Boolean" value="true" />
               <script location="component://shop/webapp/shop/WEB-INF/actions/common/CommonUserChecks.groovy"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <if-true field="userIsKnown" />
                    </condition>
                    <widgets>
                        <include-screen name="OrderPDF" location="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
                    </widgets>
                    <fail-widgets>
                        <label text="${uiLabelMap.ShopViewPermissionError}"/>
                    </fail-widgets>
                </section>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Original: component://accounting/widget/AccountingPrintScreens.xml#InvoicePDF -->
    <!-- generate a PDF for the invoice.  sharing the same BSH file as the HTML page for viewing invoice -->
    <screen name="InvoicePDF">
        <section>
            <actions>
                <!-- SCIPIO: FIXME!!!: This screen MAY not properly do permission checks!!!
                    It must allow anonymous user (userLoginId "anonymous" with partyId set to temporary value)
                    and not allow viewing other people's orders!!!
                    See component://accounting/widget/AccountingPrintScreens.xml -->
               <set field="permChecksSetGlobal" type="Boolean" value="true" />
               <script location="component://shop/webapp/shop/WEB-INF/actions/common/CommonUserChecks.groovy"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <if-true field="userIsKnown" />
                    </condition>
                    <widgets>
                        <include-screen name="InvoicePDF" location="component://accounting/widget/AccountingPrintScreens.xml"/>
                    </widgets>
                    <fail-widgets>
                        <label text="${uiLabelMap.ShopViewPermissionError}"/>
                    </fail-widgets>
                </section>
            </widgets>
        </section>
    </screen>

</screens>