blob: 39e30f4d8c0748539d4a95e74bdc76c094975621 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods-v2.xsd">
<!-- TaxAuthority methods -->
<simple-method method-name="createTaxAuthority" short-description="create a TaxAuthority">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="TaxAuthority" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateTaxAuthority" short-description="update a TaxAuthority">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthority" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteTaxAuthority" short-description="delete a TaxAuthority">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthority" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- TaxAuthorityAssoc methods -->
<simple-method method-name="createTaxAuthorityAssoc" short-description="create a TaxAuthorityAssoc">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="TaxAuthorityAssoc" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<if-empty field="newEntity.fromDate"><now-timestamp field="newEntity.fromDate"/></if-empty>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateTaxAuthorityAssoc" short-description="update a TaxAuthorityAssoc">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityAssoc" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteTaxAuthorityAssoc" short-description="delete a TaxAuthorityAssoc">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityAssoc" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- TaxAuthorityCategory methods -->
<simple-method method-name="createTaxAuthorityCategory" short-description="create a TaxAuthorityCategory">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="TaxAuthorityCategory" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateTaxAuthorityCategory" short-description="update a TaxAuthorityCategory">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityCategory" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteTaxAuthorityCategory" short-description="delete a TaxAuthorityCategory">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<set field="taxAuthorityRateProductMap.taxAuthGeoId" from-field="parameters.taxAuthGeoId"/>
<set field="taxAuthorityRateProductMap.taxAuthPartyId" from-field="parameters.taxAuthPartyId"/>
<set field="taxAuthorityRateProductMap.productCategoryId" from-field="parameters.productCategoryId"/>
<find-by-and entity-name="TaxAuthorityRateProduct" map="taxAuthorityRateProductMap" list="taxAuthorityRateProductList"/>
<if-empty field="taxAuthorityRateProductList">
<entity-one entity-name="TaxAuthorityCategory" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
<else>
<add-error>
<fail-property resource="AccountingUiLabels" property="AccountingTaxAuthorityRateProductUseThisProductCategory"/>
</add-error>
</else>
</if-empty>
<check-errors/>
</simple-method>
<!-- TaxAuthorityGlAccount methods -->
<simple-method method-name="createTaxAuthorityGlAccount" short-description="create a TaxAuthorityGlAccount">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="TaxAuthorityGlAccount" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateTaxAuthorityGlAccount" short-description="update a TaxAuthorityGlAccount">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityGlAccount" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteTaxAuthorityGlAccount" short-description="delete a TaxAuthorityGlAccount">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityGlAccount" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- TaxAuthorityRateProduct methods -->
<simple-method method-name="createTaxAuthorityRateProduct" short-description="create a TaxAuthorityRateProduct">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="TaxAuthorityRateProduct" value-field="newEntity"/>
<sequenced-id sequence-name="TaxAuthorityRateProduct" field="newEntity.taxAuthorityRateSeqId"/>
<field-to-result field="newEntity.taxAuthorityRateSeqId" result-name="taxAuthorityRateSeqId"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<if-empty field="newEntity.fromDate">
<now-timestamp field="newEntity.fromDate"/>
</if-empty>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateTaxAuthorityRateProduct" short-description="update a TaxAuthorityRateProduct">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityRateProduct" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteTaxAuthorityRateProduct" short-description="delete a TaxAuthorityRateProduct">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="TaxAuthorityRateProduct" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- PartyTaxAuthInfo methods -->
<simple-method method-name="createPartyTaxAuthInfo" short-description="create a PartyTaxAuthInfo">
<set value="_CREATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<call-simple-method method-name="validatePartyTaxIdInline"/>
<!-- done checking preliminary constraints, see if there are any errors -->
<check-errors/>
<make-value entity-name="PartyTaxAuthInfo" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<if-empty field="newEntity.fromDate"><now-timestamp field="newEntity.fromDate"/></if-empty>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updatePartyTaxAuthInfo" short-description="update a PartyTaxAuthInfo">
<set value="_UPDATE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<call-simple-method method-name="validatePartyTaxIdInline"/>
<!-- done checking preliminary constraints, see if there are any errors -->
<check-errors/>
<entity-one entity-name="PartyTaxAuthInfo" value-field="lookedUpValue"/>
<set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="validatePartyTaxIdInline" short-description="validatePartyTaxIdInline">
<!-- validate the partyTaxId based on TaxAuthority.taxIdFormatPattern if not empty -->
<!-- If the party validated is in the UE, we could to a better job using the SOAP service from http://ec.europa.eu/taxation_customs/vies/faqvies.do#item16 -->
<entity-one entity-name="TaxAuthority" value-field="taxAuthority"/>
<if>
<condition>
<and>
<not><if-empty field="taxAuthority.taxIdFormatPattern"/></not>
<not><if-empty field="parameters.partyTaxId"/></not>
<not><if-regexp field="parameters.partyTaxId" expr="${taxAuthority.taxIdFormatPattern}"/></not>
</and>
</condition>
<then>
<add-error>
<fail-property resource="AccountingErrorUiLabels" property="AccountingTaxIdInvalidFormat"/>
</add-error>
</then>
</if>
</simple-method>
<simple-method method-name="deletePartyTaxAuthInfo" short-description="delete a PartyTaxAuthInfo">
<set value="_DELETE" field="securityAction"/>
<check-permission permission="ACCOUNTING" action="${securityAction}">
<fail-property resource="AccountingUiLabels" property="AccountingPermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="PartyTaxAuthInfo" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="createCustomerTaxAuthInfo" short-description="Create a Customer PartyTaxAuthInfo">
<call-bsh><![CDATA[
taxAuthPartyGeoIds = parameters.get("taxAuthPartyGeoIds");
parameters.put("taxAuthPartyId", taxAuthPartyGeoIds.substring(0, taxAuthPartyGeoIds.indexOf("::")));
parameters.put("taxAuthGeoId", taxAuthPartyGeoIds.substring(taxAuthPartyGeoIds.indexOf("::") + 2));
]]></call-bsh>
<set-service-fields service-name="createPartyTaxAuthInfo" map="parameters" to-map="createPartyTaxAuthInfoMap"/>
<call-service service-name="createPartyTaxAuthInfo" in-map-name="createPartyTaxAuthInfoMap" include-user-login="true"/>
</simple-method>
</simple-methods>