blob: 84346afa31ac22085bedd6bc03c852b7b94da3d6 [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">
<simple-method method-name="createSystemInfoNote" short-description="Create a system to to a specific party">
<set field="parameters.partyId" from-field="parameters.partyId" default-value="userLogin.partyId"/>
<make-value value-field="noteData" entity-name="NoteData"/>
<set-nonpk-fields value-field="noteData" map="parameters"/>
<now-timestamp field="noteData.noteDateTime"/>
<sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
<set field="noteData.noteName" value="SYSTEMNOTE"/>
<create-value value-field="noteData"/>
</simple-method>
<simple-method method-name="getPortletAttributeMap" short-description="get the attributes of the SystemInfoNotes portlet for a userlogin">
<!-- get the portlet settings: works only if portlet is used only one time and the user only has a single userLogin -->
<entity-and entity-name="UserLogin" list="ulList">
<field-map field-name="partyId" from-field="partyId"/>
</entity-and>
<if-not-empty field="ulList">
<set field="haveUserLogin" value="true"/>
<first-from-list entry="userLogin" list="ulList"/>
<set field="paMap.ownerUserLoginId" from-field="userLogin.userLoginId"/>
<set field="paMap.portalPortletId" value="SystemInfoNotes"/>
<call-service service-name="getPortletAttributes" in-map-name="paMap">
<result-to-field result-name="attributeMap" field="attributeMap"/>
</call-service>
</if-not-empty>
</simple-method>
<simple-method method-name="deleteSystemInfoNote" short-description="Delete SystemInfo Note">
<entity-one value-field="noteData" entity-name="NoteData"/>
<remove-related relation-name="CustRequestItemNote" value-field="noteData"/>
<remove-related relation-name="CustRequestNote" value-field="noteData"/>
<remove-related relation-name="MarketingCampaignNote" value-field="noteData"/>
<remove-related relation-name="OrderHeaderNote" value-field="noteData"/>
<remove-related relation-name="PartyNote" value-field="noteData"/>
<remove-related relation-name="QuoteNote" value-field="noteData"/>
<remove-related relation-name="WorkEffortNote" value-field="noteData"/>
<remove-value value-field="noteData"/>
</simple-method>
<simple-method method-name="deleteAllSystemNotes" short-description="delete all system notes from a particular user">
<set field="removeData.noteParty" from-field="parameters.userLogin.partyId"/>
<set field="removeData.noteName" value="SYSTEMNOTE"/>
<remove-by-and entity-name="NoteData" map="removeData"/>
</simple-method>
<simple-method method-name="getSystemInfoStatus" short-description="">
<!-- communication events -->
<entity-count entity-name="CommunicationEventRole" count-field="comCount">
<condition-list combine="and">
<condition-expr field-name="partyId" from-field="userLogin.partyId"/>
<condition-expr field-name="statusId" operator="not-equals" value="COM_ROLE_COMPLETED"/>
</condition-list>
</entity-count>
<entity-condition entity-name="CommunicationEventAndRole" list="comms">
<condition-list combine="and">
<condition-expr field-name="partyId" from-field="userLogin.partyId"/>
<condition-expr field-name="statusId" operator="not-equals" value="COM_ROLE_COMPLETED"/>
</condition-list>
<order-by field-name="-entryDate"/>
</entity-condition>
<if-compare field="comCount" value="0" operator="greater">
<set field="status.noteInfo" value="Open communication events: ${comCount}"/>
<first-from-list entry="comm" list="comms"/>
<set field="status.noteDateTime" from-field="comm.entryDate"/>
<field-to-list field="status" list="systemInfoStatus"/>
<clear-field field="status"/>
</if-compare>
<!-- assigned tasks -->
<entity-and entity-name="WorkEffortAndPartyAssign" list="assigns" filter-by-date="true">
<field-map field-name="partyId" from-field="parameters.userLogin.partyId"/>
<field-map field-name="statusId" value="PAS_ASSIGNED"/>
<field-map field-name="workEffortTypeId" value="TASK"/>
<order-by field-name="-fromDate"/>
</entity-and>
<entity-count entity-name="WorkEffortAndPartyAssign" count-field="assignCount">
<condition-list combine="and">
<condition-expr field-name="partyId" operator="equals" from-field="parameters.userLogin.partyId"/>
<condition-expr field-name="statusId" operator="equals" value="PAS_ASSIGNED"/>
<condition-expr field-name="workEffortTypeId" operator="equals" value="TASK"/>
</condition-list>
</entity-count>
<if-compare field="assignCount" value="0" operator="greater">
<set field="status.noteInfo" value="Assigned and not completed tasks: ${assignCount}"/>
<first-from-list entry="assign" list="assigns"/>
<set field="status.noteDateTime" from-field="assign.fromDate"/>
<field-to-list field="status" list="systemInfoStatus"/>
</if-compare>
<!-- return result -->
<if-not-empty field="systemInfoStatus">
<field-to-result field="systemInfoStatus"/>
</if-not-empty>
</simple-method>
<simple-method method-name="getSystemInfoNotes" short-description="">
<entity-and entity-name="NoteData" list="systemInfoNotes">
<field-map field-name="noteParty" from-field="parameters.userLogin.partyId"/>
<field-map field-name="noteName" value="SYSTEMNOTE"/>
<order-by field-name="-noteDateTime"/>
</entity-and>
<if-not-empty field="systemInfoNotes">
<field-to-result field="systemInfoNotes"/>
</if-not-empty>
</simple-method>
<simple-method method-name="getLastSystemInfoNote"
short-description="Get the last 3 system info notes"
login-required="false">
<if-not-empty field="parameters.userLogin">
<entity-and entity-name="NoteData" list="systemInfoNotes">
<field-map field-name="noteParty"
from-field="parameters.userLogin.partyId"/>
<field-map field-name="noteName" value="SYSTEMNOTE"/>
<order-by field-name="-noteDateTime"/>
</entity-and>
<else>
<entity-and entity-name="NoteData" list="systemInfoNotes">
<field-map field-name="noteParty" value="_NA_"/>
<field-map field-name="noteName" value="SYSTEMNOTE"/>
<order-by field-name="-noteDateTime"/>
</entity-and>
</else>
</if-not-empty>
<if-not-empty field="systemInfoNotes">
<set field="lastSystemInfoNote1" from-field="systemInfoNotes[0]"/>
<field-to-result field="lastSystemInfoNote1"/>
<if-not-empty field="systemInfoNotes[2]">
<set field="lastSystemInfoNote2" from-field="systemInfoNotes[1]"/>
<field-to-result field="lastSystemInfoNote2"/>
</if-not-empty>
<if-not-empty field="systemInfoNotes[3]">
<set field="lastSystemInfoNote3" from-field="systemInfoNotes[2]"/>
<field-to-result field="lastSystemInfoNote3"/>
</if-not-empty>
</if-not-empty>
</simple-method>
</simple-methods>