blob: 94b861c4757552d8331a8f8452f9e7ad441e8b36 [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">
<simple-method method-name="FindProducts" short-description="Find products by name/description" login-required="false">
<!-- Search by product name -->
<if-compare field="parameters.searchBy" operator="equals" value="productName">
<entity-condition entity-name="Product" list="products">
<select-field field-name="productId"/>
<select-field field-name="productName"/>
<order-by field-name="productName"/>
</entity-condition>
<iterate list="products" entry="product">
<set field="productName" type="String" value="${product.productName} (${product.productId})"/>
<field-to-list field="productName" list="productsList"/>
<set field="productId" type="String" value="${product.productId}"/>
<field-to-list field="productId" list="productsId"/>
</iterate>
<field-to-result field="productsList" result-name="productsList"/>
<field-to-result field="productsId" result-name="productsId"/>
<else>
<!-- Search by product description -->
<if-compare field="parameters.searchBy" operator="equals" value="productDescription">
<entity-condition entity-name="Product" list="products">
<select-field field-name="productId"/>
<select-field field-name="description"/>
<order-by field-name="description"/>
</entity-condition>
<iterate list="products" entry="product">
<set field="description" type="String" value="${product.description} (${product.productId})"/>
<field-to-list field="description" list="productsList"/>
<set field="productId" type="String" value="${product.productId}"/>
<field-to-list field="productId" list="productsId"/>
</iterate>
<field-to-result field="productsList" result-name="productsList"/>
<field-to-result field="productsId" result-name="productsId"/>
</if-compare>
</else>
</if-compare>
</simple-method>
<simple-method method-name="FindProductsByIdentification" short-description="Find products by good identification" login-required="false">
<!-- Search by good identification -->
<entity-condition entity-name="GoodIdentificationAndProduct" list="products">
<select-field field-name="productId"/>
<select-field field-name="idValue"/>
<order-by field-name="idValue"/>
</entity-condition>
<iterate list="products" entry="product">
<set field="idValue" type="String" value="${product.idValue} ${product.productName} (${product.productId})"/>
<field-to-list field="idValue" list="productsList"/>
<set field="productId" type="String" value="${product.productId}"/>
<field-to-list field="productId" list="productsId"/>
</iterate>
<field-to-result field="productsList" result-name="productsList"/>
<field-to-result field="productsId" result-name="productsId"/>
</simple-method>
</simple-methods>