Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml?rev=1128865&r1=1128864&r2=1128865&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml (original) +++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml Sun May 29 11:02:09 2011 @@ -19,243 +19,252 @@ under the License. --> <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> <simple-method method-name="openTerminal" short-description="Open Terminal" login-required="true"> - <if-not-empty field="parameters.confirm"> - <set field="posTerminalId" value="null"/> - <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> - <field field="request" type="javax.servlet.http.HttpServletRequest"/> - <field field="posTerminalId" type="String"/> - </call-class-method> - <if-not-empty field="webPosSession"> - <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> - <if-compare field="mgrLoggedIn" operator="equals" value="true" type="String"> - <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <clear-field field="posTerminalId"/> + <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + <field field="posTerminalId" type="String"/> + </call-class-method> + <if-not-empty field="webPosSession"> + <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> + <if-compare field="mgrLoggedIn" operator="equals" value="true" type="String"> + <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <check-errors/> + <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/> + <if-compare field="isOpen" operator="equals" value="false"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="startingDrawerAmount"> + <convert type="BigDecimal" to-field="startingDrawerAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerOpenTerminalDrawingAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> <check-errors/> - <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/> - <if-compare field="isOpen" operator="equals" value="false"> - <set field="startingDrawerAmount" from-field="parameters.startingDrawerAmount" type="String"/> - <set field="allowNegative" value="false" type="Boolean"/> - <set field="allowPositive" value="true" type="Boolean"/> - <set field="minDecimal" value="0" type="Integer"/> - <set field="maxDecimal" value="3" type="Integer"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="startingDrawerAmount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="true"> - <make-value value-field="terminalState" entity-name="PosTerminalState"/> - <call-object-method obj-field="webPosSession" method-name="getId" ret-field="terminalState.posTerminalId"/> - <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="nowTimestamp" ret-field="terminalState.openedDate"/> - <call-object-method obj-field="webPosSession" method-name="getUserLoginId" ret-field="terminalState.openedByUserLoginId"/> - <call-object-method obj-field="webPosTransaction" method-name="getTransactionId" ret-field="terminalState.startingTxId"/> - <set from-field="parameters.startingDrawerAmount" field="terminalState.startingDrawerAmount"/> - <create-value value-field="terminalState"/> - <check-errors/> - <log level="info" message="Created PosTerminalState ${terminalState.startingTxId}"/> - <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerOpenTerminalDrawingAmountNotValid"/></add-error> - <check-errors/> - </else> - </if-compare> + <if-empty field="context.startingDrawerAmount"> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerOpenTerminalDrawingAmountNotValid"/></add-error> + <check-errors/> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerTerminalAlreadyOpened"/></add-error> + <make-value value-field="terminalState" entity-name="PosTerminalState"/> + <call-object-method obj-field="webPosSession" method-name="getId" ret-field="terminalState.posTerminalId"/> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="nowTimestamp" ret-field="terminalState.openedDate"/> + <call-object-method obj-field="webPosSession" method-name="getUserLoginId" ret-field="terminalState.openedByUserLoginId"/> + <call-object-method obj-field="webPosTransaction" method-name="getTransactionId" ret-field="terminalState.startingTxId"/> + <set from-field="context.startingDrawerAmount" field="terminalState.startingDrawerAmount" type="BigDecimal"/> + <create-value value-field="terminalState"/> <check-errors/> + <log level="info" message="Created PosTerminalState ${terminalState.startingTxId}"/> </else> - </if-compare> + </if-empty> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerTerminalAlreadyOpened"/></add-error> <check-errors/> </else> </if-compare> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> <check-errors/> </else> - </if-not-empty> + </if-compare> + <else> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <check-errors/> + </else> </if-not-empty> </simple-method> - + <simple-method method-name="closeTerminal" short-description="Close Terminal" login-required="true"> - <if-not-empty field="parameters.confirm"> - <set field="posTerminalId" value="null"/> - <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> - <field field="request" type="javax.servlet.http.HttpServletRequest"/> - <field field="posTerminalId" type="String"/> - </call-class-method> - <if-not-empty field="webPosSession"> - <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> - <if-compare field="mgrLoggedIn" operator="equals" value="true"> - <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> - <check-errors/> - <call-object-method obj-field="webPosTransaction" method-name="getTerminalState" ret-field="terminalState"/> - <if-not-empty field="terminalState"> - <set field="amount" from-field="parameters.endingDrawerCashAmount" type="String"/> - <set field="allowNegative" value="false" type="Boolean"/> - <set field="allowPositive" value="true" type="Boolean"/> - <set field="minDecimal" value="0" type="Integer"/> - <set field="maxDecimal" value="3" type="Integer"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="false"> + <clear-field field="posTerminalId"/> + <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + <field field="posTerminalId" type="String"/> + </call-class-method> + <if-not-empty field="webPosSession"> + <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> + <if-compare field="mgrLoggedIn" operator="equals" value="true"> + <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <check-errors/> + <call-object-method obj-field="webPosTransaction" method-name="getTerminalState" ret-field="terminalState"/> + <if-not-empty field="terminalState"> + <if-not-empty field="parameters.endingDrawerCashAmount"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="endingDrawerCashAmount"> + <convert type="BigDecimal" to-field="endingDrawerCashAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerOpenTerminalDrawingAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <check-errors/> + <if-empty field="context.endingDrawerCashAmount"> <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalCashAmountNotValid"/></add-error> <check-errors/> - </if-compare> - <set field="amount" from-field="parameters.endingDrawerCheckAmount" type="String"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="false"> + </if-empty> + </if-not-empty> + <if-not-empty field="parameters.endingDrawerCheckAmount"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="endingDrawerCheckAmount"> + <convert type="BigDecimal" to-field="endingDrawerCheckAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalCheckAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <check-errors/> + <if-empty field="context.endingDrawerCheckAmount"> <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalCheckAmountNotValid"/></add-error> <check-errors/> - </if-compare> - <set field="amount" from-field="parameters.endingDrawerCcAmount" type="String"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="false"> + </if-empty> + </if-not-empty> + <if-not-empty field="parameters.endingDrawerCcAmount"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="endingDrawerCcAmount"> + <convert type="BigDecimal" to-field="endingDrawerCcAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalCcAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <check-errors/> + <if-empty field="context.endingDrawerCcAmount"> <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalCcAmountNotValid"/></add-error> <check-errors/> - </if-compare> - <set field="amount" from-field="parameters.endingDrawerGcAmount" type="String"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="false"> + </if-empty> + </if-not-empty> + <if-not-empty field="parameters.endingDrawerGcAmount"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="endingDrawerGcAmount"> + <convert type="BigDecimal" to-field="endingDrawerGcAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalGcAmounNotValidt"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <check-errors/> + <if-empty field="context.endingDrawerGcAmount"> <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalGcAmounNotValidt"/></add-error> <check-errors/> - </if-compare> - <set field="amount" from-field="parameters.endingDrawerOtherAmount" type="String"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="false"> + </if-empty> + </if-not-empty> + <if-not-empty field="parameters.endingDrawerOtherAmount"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="endingDrawerOtherAmount"> + <convert type="BigDecimal" to-field="endingDrawerOtherAmount" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalOtherAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <check-errors/> + <if-empty field="context.endingDrawerOtherAmount"> <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerCloseTerminalOtherAmountNotValid"/></add-error> <check-errors/> - </if-compare> - <call-object-method obj-field="webPosSession" method-name="getUserLoginId" ret-field="terminalState.closedByUserLoginId"/> - <set from-field="parameters.endingDrawerCashAmount" field="terminalState.actualEndingCash"/> - <set from-field="parameters.endingDrawerCheckAmount" field="terminalState.actualEndingCheck"/> - <set from-field="parameters.endingDrawerCcAmount" field="terminalState.actualEndingCc"/> - <set from-field="parameters.endingDrawerGcAmount" field="terminalState.actualEndingGc"/> - <set from-field="parameters.endingDrawerOtherAmount" field="terminalState.actualEndingOther"/> - <call-object-method obj-field="webPosTransaction" method-name="getTransactionId" ret-field="terminalState.endingTxId"/> - <store-value value-field="terminalState"/> - <check-errors/> - <log level="info" message="Close PosTerminalState ${terminalState.endingTxId}"/> - <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerTerminalAlreadyClosed"/></add-error> - <check-errors/> - </else> + </if-empty> </if-not-empty> + <call-object-method obj-field="webPosSession" method-name="getUserLoginId" ret-field="terminalState.closedByUserLoginId"/> + <set field="terminalState.actualEndingCash" from-field="context.endingDrawerCashAmount" type="BigDecimal"/> + <set field="terminalState.actualEndingCheck" from-field="context.endingDrawerCheckAmount" type="BigDecimal"/> + <set field="terminalState.actualEndingCc" from-field="context.endingDrawerCcAmount" type="BigDecimal"/> + <set field="terminalState.actualEndingGc" from-field="context.endingDrawerGcAmount" type="BigDecimal"/> + <set field="terminalState.actualEndingOther" from-field="context.endingDrawerOtherAmount" type="BigDecimal"/> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="nowTimestamp" ret-field="terminalState.closedDate"/> + <call-object-method obj-field="webPosTransaction" method-name="getTransactionId" ret-field="terminalState.endingTxId"/> + <store-value value-field="terminalState"/> + <check-errors/> + <log level="info" message="Close PosTerminalState ${terminalState.endingTxId}"/> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerTerminalAlreadyClosed"/></add-error> <check-errors/> </else> - </if-compare> + </if-not-empty> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> <check-errors/> </else> - </if-not-empty> - <!-- // TODO: missing to call the printTotals and SyncCallbackAdaptor and SecurityEvents.logout(pos) --> + </if-compare> + <else> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <check-errors/> + </else> </if-not-empty> + <!-- // TODO: missing to call the printTotals and SyncCallbackAdaptor and SecurityEvents.logout(pos) --> </simple-method> - + <simple-method method-name="voidOrder" short-description="Void Order" login-required="true"> - <if-not-empty field="parameters.confirm"> - <set field="posTerminalId" value="null"/> - <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> - <field field="request" type="javax.servlet.http.HttpServletRequest"/> - <field field="posTerminalId" type="String"/> - </call-class-method> - <if-not-empty field="webPosSession"> - <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> - <if-compare field="mgrLoggedIn" operator="equals" value="true"> - <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> - <check-errors/> - <call-object-method obj-field="webPosTransaction" method-name="getTerminalState" ret-field="terminalState"/> - <if-not-empty field="terminalState"> - <set field="fieldName" value="openedDate" type="String"/> - <call-object-method obj-field="terminalState" method-name="getTimestamp" ret-field="openDate"> + <clear-field field="posTerminalId"/> + <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + <field field="posTerminalId" type="String"/> + </call-class-method> + <if-not-empty field="webPosSession"> + <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> + <if-compare field="mgrLoggedIn" operator="equals" value="true"> + <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <check-errors/> + <call-object-method obj-field="webPosTransaction" method-name="getTerminalState" ret-field="terminalState"/> + <if-not-empty field="terminalState"> + <set field="fieldName" value="openedDate" type="String"/> + <call-object-method obj-field="terminalState" method-name="getTimestamp" ret-field="openDate"> + <field field="fieldName" type="String"/> + </call-object-method> + <entity-one entity-name="OrderHeader" value-field="orderHeader"> + <field-map field-name="orderId" from-field="parameters.orderId"/> + </entity-one> + <if-not-empty field="orderHeader"> + <set field="fieldName" value="orderDate" type="String"/> + <call-object-method obj-field="orderHeader" method-name="getTimestamp" ret-field="orderDate"> <field field="fieldName" type="String"/> </call-object-method> - <entity-one entity-name="OrderHeader" value-field="orderHeader"> - <field-map field-name="orderId" from-field="parameters.orderId"/> - </entity-one> - <if-not-empty field="orderHeader"> - <set field="fieldName" value="orderDate" type="String"/> - <call-object-method obj-field="orderHeader" method-name="getTimestamp" ret-field="orderDate"> - <field field="fieldName" type="String"/> - </call-object-method> - <call-object-method obj-field="orderDate" method-name="after" ret-field="isAfter"> - <field field="openDate" type="Timestamp"/> + <call-object-method obj-field="orderDate" method-name="after" ret-field="isAfter"> + <field field="openDate" type="Timestamp"/> + </call-object-method> + <if-compare field="isAfter" operator="equals" value="true"> + <call-object-method obj-field="webPosSession" method-name="getDispatcher" ret-field="dispatcher"/> + <set field="returnOrder.orderId" from-field="parameters.orderId"/> + <set field="returnOrder.returnHeaderTypeId" value="CUSTOMER_RETURN"/> + <call-object-method obj-field="webPosSession" method-name="getUserLogin" ret-field="returnOrder.userLogin"/> + <set field="serviceName" value="quickReturnOrder"/> + <call-object-method obj-field="dispatcher" method-name="runSync" ret-field="returnResp"> + <field field="serviceName" type="String"/> + <field field="returnOrder" type="java.util.Map"/> </call-object-method> - <if-compare field="isAfter" operator="equals" value="true"> - <call-object-method obj-field="webPosSession" method-name="getDispatcher" ret-field="dispatcher"/> - <set field="returnOrder.orderId" from-field="parameters.orderId"/> - <set field="returnOrder.returnHeaderTypeId" value="CUSTOMER_RETURN"/> - <call-object-method obj-field="webPosSession" method-name="getUserLogin" ret-field="returnOrder.userLogin"/> - <set field="serviceName" value="quickReturnOrder"/> - <call-object-method obj-field="dispatcher" method-name="runSync" ret-field="returnResp"> - <field field="serviceName" type="String"/> - <field field="returnOrder" type="java.util.Map"/> - </call-object-method> - <check-errors/> - <log level="info" message="Void order ${returnResp}"/> - <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderNotValidDate"/></add-error> - <check-errors/> - </else> - </if-compare> + <check-errors/> + <log level="info" message="Void order ${returnResp}"/> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderNotValidOrderId"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderNotValidDate"/></add-error> <check-errors/> </else> - </if-not-empty> + </if-compare> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderTerminalNotOpened"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderNotValidOrderId"/></add-error> <check-errors/> </else> </if-not-empty> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerVoidOrderTerminalNotOpened"/></add-error> <check-errors/> </else> - </if-compare> + </if-not-empty> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> <check-errors/> </else> - </if-not-empty> - <!-- // TODO: print void receipt --> + </if-compare> + <else> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <check-errors/> + </else> </if-not-empty> + <!-- // TODO: print void receipt --> </simple-method> - + <simple-method method-name="shutdown" short-description="Shutdown" login-required="true"> - <set field="posTerminalId" value="null"/> + <clear-field field="posTerminalId"/> <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> <field field="request" type="javax.servlet.http.HttpServletRequest"/> <field field="posTerminalId" type="String"/> @@ -276,110 +285,104 @@ under the License. </else> </if-not-empty> </simple-method> - + <simple-method method-name="paidOutAndIn" short-description="Paid Out and In" login-required="true"> - <if-not-empty field="parameters.confirm"> - <set field="posTerminalId" value="null"/> - <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> - <field field="request" type="javax.servlet.http.HttpServletRequest"/> - <field field="posTerminalId" type="String"/> - </call-class-method> - <if-not-empty field="webPosSession"> - <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> - <if-compare field="mgrLoggedIn" operator="equals" value="true"> - <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> - <check-errors/> - <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/> - <check-errors/> - <if-compare field="isOpen" operator="equals" value="true"> - <set field="amount" from-field="parameters.amountInOut" type="String"/> - <set field="allowNegative" value="false" type="Boolean"/> - <set field="allowPositive" value="true" type="Boolean"/> - <set field="minDecimal" value="0" type="Integer"/> - <set field="maxDecimal" value="3" type="Integer"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="true"> - <make-value value-field="internTx" entity-name="PosTerminalInternTx"/> - <call-object-method obj-field="webPosTransaction" method-name="getTerminalLogId" ret-field="internTx.posTerminalLogId"/> - <set field="internTx.paidAmount" from-field="parameters.amountInOut"/> - <set field="internTx.reasonComment" from-field="parameters.reasonCommentInOut"/> - <set field="internTx.reasonEnumId" from-field="parameters.reasonInOut"/> - <create-value value-field="internTx"/> - <set from-field="parameters.type" field="paidInOut"/> - <call-object-method obj-field="webPosTransaction" method-name="paidInOut"> - <field field="paidInOut" type="String"/> - </call-object-method> + <clear-field field="posTerminalId"/> + <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + <field field="posTerminalId" type="String"/> + </call-class-method> + <if-not-empty field="webPosSession"> + <call-object-method obj-field="webPosSession" method-name="isManagerLoggedIn" ret-field="mgrLoggedIn"/> + <if-compare field="mgrLoggedIn" operator="equals" value="true"> + <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <check-errors/> + <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/> + <check-errors/> + <if-compare field="isOpen" operator="equals" value="true"> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="amountInOut"> + <convert type="BigDecimal" to-field="amountInOut" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerPaidOutAndIndAmountNotValid"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <if-not-empty field="context.amountInOut"> + <make-value value-field="internTx" entity-name="PosTerminalInternTx"/> + <call-object-method obj-field="webPosTransaction" method-name="getTerminalLogId" ret-field="internTx.posTerminalLogId"/> + <set field="internTx.paidAmount" from-field="context.amountInOut" type="BigDecimal"/> + <set field="internTx.reasonComment" from-field="parameters.reasonCommentInOut"/> + <if-compare field="parameters.type" operator="equals" value="IN"> + <set field="internTx.reasonEnumId" from-field="parameters.reasonIn"/> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerPaidOutAndIndAmountNotValid"/></add-error> - <check-errors/> + <set field="internTx.reasonEnumId" from-field="parameters.reasonOut"/> </else> </if-compare> + <create-value value-field="internTx"/> + <set from-field="parameters.type" field="paidInOut"/> + <call-object-method obj-field="webPosTransaction" method-name="paidInOut"> + <field field="paidInOut" type="String"/> + </call-object-method> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerPaidOutAndInWithoutOpenedTransaction"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerPaidOutAndIndAmountNotValid"/></add-error> <check-errors/> </else> - </if-compare> + </if-not-empty> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerPaidOutAndInWithoutOpenedTransaction"/></add-error> <check-errors/> </else> </if-compare> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotManagerLoggedIn"/></add-error> <check-errors/> </else> - </if-not-empty> + </if-compare> + <else> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <check-errors/> + </else> </if-not-empty> </simple-method> - + <simple-method method-name="modifyPrice" short-description="Modify Price" login-required="true"> - <if-not-empty field="parameters.confirm"> - <set field="posTerminalId" value="null"/> - <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> - <field field="request" type="javax.servlet.http.HttpServletRequest"/> - <field field="posTerminalId" type="String"/> - </call-class-method> - <if-not-empty field="webPosSession"> - <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <clear-field field="posTerminalId"/> + <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + <field field="posTerminalId" type="String"/> + </call-class-method> + <if-not-empty field="webPosSession"> + <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/> + <check-errors/> + <call-map-processor in-map-name="parameters" out-map-name="context"> + <simple-map-processor name="inputValidate"> + <process field="price"> + <convert type="BigDecimal" to-field="price" replace="true" set-if-null="false"> + <fail-property resource="WebPosUiLabels" property="WebPosManagerModifyPriceNotValidPrice"/> + </convert> + </process> + </simple-map-processor> + </call-map-processor> + <if-not-empty field="context.price"> + <set field="cartLineIdx" from-field="parameters.cartLineIdx" type="Integer"/> + <call-object-method obj-field="webPosTransaction" method-name="modifyPrice"> + <field field="cartLineIdx" type="int"/> + <field field="context.price" type="BigDecimal"/> + </call-object-method> + <check-errors/> + <call-object-method obj-field="webPosTransaction" method-name="calcTax"/> <check-errors/> - <set field="amount" from-field="parameters.price" type="String"/> - <set field="allowNegative" value="false" type="Boolean"/> - <set field="allowPositive" value="true" type="Boolean"/> - <set field="minDecimal" value="0" type="Integer"/> - <set field="maxDecimal" value="3" type="Integer"/> - <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble"> - <field field="amount" type="String"/> - <field field="allowNegative" type="boolean"/> - <field field="allowPositive" type="boolean"/> - <field field="minDecimal" type="int"/> - <field field="maxDecimal" type="int"/> - </call-class-method> - <if-compare field="isDouble" operator="equals" value="true"> - <set from-field="parameters.sku" field="sku" type="String"/> - <set from-field="parameters.price" field="price" type="BigDecimal"/> - <call-object-method obj-field="webPosTransaction" method-name="modifyPrice"> - <field field="sku" type="String"/> - <field field="price" type="BigDecimal"/> - </call-object-method> - <check-errors/> - <call-object-method obj-field="webPosTransaction" method-name="calcTax"/> - <check-errors/> - <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerModifyPriceNotValidPrice"/></add-error> - <check-errors/> - </else> - </if-compare> <else> - <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosManagerModifyPriceNotValidPrice"/></add-error> <check-errors/> </else> </if-not-empty> + <else> + <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error> + <check-errors/> + </else> </if-not-empty> </simple-method> </simple-methods> \ No newline at end of file |
Free forum by Nabble | Edit this page |