blob: 4ca0009ebe2e5083623e94353e3712ca6ca9263b [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.xsd">
<!-- MarketingCampaign methods -->
<simple-method method-name="createMarketingCampaign" short-description="Create an MarketingCampaign">
<check-permission permission="MARKETING" action="_CREATE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingCreatePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaign" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<!-- MarketingCampaign uses a sequenced id, so get the next one now and set it... -->
<sequenced-id sequence-name="MarketingCampaign" field="newEntity.marketingCampaignId"/>
<create-value value-field="newEntity"/>
<field-to-result field="newEntity.marketingCampaignId" result-name="marketingCampaignId"/>
</simple-method>
<simple-method method-name="updateMarketingCampaign" short-description="Update an MarketingCampaign">
<check-permission permission="MARKETING" action="_UPDATE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingUpdatePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaign" value-field="lookupPKMap"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="MarketingCampaign" map="lookupPKMap" value-field="lookedUpValue"/>
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteMarketingCampaign" short-description="Delete an MarketingCampaign">
<check-permission permission="MARKETING" action="_DELETE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingDeletePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaign" value-field="lookupPKMap"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="MarketingCampaign" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- MarketingCampaignPrice methods -->
<simple-method method-name="addPriceRuleToMarketingCampaign" short-description="Add PriceRule To MarketingCampaign">
<check-permission permission="MARKETING" action="_CREATE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingCreatePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignPrice" value-field="newEntity"/>
<!-- no non-pk fields in this entity, but there may be later... <set-nonpk-fields map="parameters" value-field="newEntity"/> -->
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="removePriceRuleFromMarketingCampaign" short-description="Remove PriceRule from MarketingCampaign">
<check-permission permission="MARKETING" action="_DELETE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingDeletePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignPrice" value-field="lookupPKMap"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="MarketingCampaignPrice" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- MarketingCampaignPromo methods -->
<simple-method method-name="addPromoToMarketingCampaign" short-description="Add Promo To MarketingCampaign">
<check-permission permission="MARKETING" action="_CREATE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingCreatePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignPromo" value-field="newEntity"/>
<!-- no non-pk fields in this entity, but there may be later... <set-nonpk-fields map="parameters" value-field="newEntity"/> -->
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="removePromoFromMarketingCampaign" short-description="Remove Promo from MarketingCampaign">
<check-permission permission="MARKETING" action="_DELETE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingDeletePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignPromo" value-field="lookupPKMap"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="MarketingCampaignPromo" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<!-- MarketingCampaignRole methods -->
<simple-method method-name="addRoleToMarketingCampaign" short-description="Add Role To MarketingCampaign">
<check-permission permission="MARKETING" action="_CREATE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingCreatePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignRole" value-field="newEntity"/>
<!-- no non-pk fields in this entity, but there may be later... <set-nonpk-fields map="parameters" value-field="newEntity"/> -->
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="removeRoleFromMarketingCampaign" short-description="Remove Role from MarketingCampaign">
<check-permission permission="MARKETING" action="_DELETE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingDeletePermissionError"/>
</check-permission>
<check-errors/>
<make-value entity-name="MarketingCampaignRole" value-field="lookupPKMap"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="MarketingCampaignRole" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="createMarketingCampaignRole" short-description="Add Role To MarketingCampaign">
<!-- allow if userLogin.partyId = parameters.partyId or has permission -->
<if>
<condition>
<and>
<if-compare-field field="userLogin.partyId" to-field="parameters.partyId" operator="not-equals"/>
<not><if-has-permission permission="MARKETING" action="_CREATE"/></not>
</and>
</condition>
<then>
<add-error>
<fail-property resource="MarketingUiLabels.xml" property="MarketingCreatePermissionError"/>
</add-error>
</then>
</if>
<entity-one entity-name="MarketingCampaign" value-field="marketingCampaign"/>
<!-- okay, now check for all errors -->
<check-errors/>
<make-value entity-name="MarketingCampaignRole" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>
<simple-method method-name="updateMarketingCampaignRole" short-description="Update Add Role To MarketingCampaign">
<!-- allow if userLogin.partyId = parameters.partyId or has permission -->
<if>
<condition>
<and>
<if-compare-field field="userLogin.partyId" to-field="parameters.partyId" operator="not-equals"/>
<not><if-has-permission permission="MARKETING" action="_UPDATE"/></not>
</and>
</condition>
<then>
<add-error>
<fail-property resource="MarketingUiLabels.xml" property="MarketingUpdatePermissionError"/>
</add-error>
</then>
</if>
<check-errors/>
<entity-one entity-name="MarketingCampaign" value-field="marketingCampaign"/>
<entity-one entity-name="MarketingCampaignRole" value-field="lookedUpValue"/>
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteMarketingCampaignRole" short-description="Remove Role from MarketingCampaign">
<check-permission permission="MARKETING" action="_DELETE">
<fail-property resource="MarketingUiLabels.xml" property="MarketingDeletePermissionError"/>
</check-permission>
<check-errors/>
<entity-one entity-name="MarketingCampaignRole" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
</simple-methods>