blob: d199a7ec8d3631213c586f4305371d6fe75f21a8 [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"
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.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 entity-name="NoteData" value-field="noteData"/>
<set-nonpk-fields map="parameters" value-field="noteData"/>
<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 list="ulList" entry="userLogin"/>
<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 entity-name="NoteData" value-field="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 list="comms" entry="comm"/>
<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 list="assigns" entry="assign"/>
<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>