Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: findParty_Status. (OFBIZ-12677) #531

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion applications/party/servicedef/services_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ under the License.
<service name="performFindParty" engine="java"
location="org.apache.ofbiz.party.party.PartyServices" invoke="performFindParty">
<description>General Party Find Service, duplicated for screen widget purpose, Used in the new findparty page in the Party Manager, etc</description>
<attribute name="roleTypeId" type="String" mode="IN" optional="true"/> <!-- can be null or ANY to include any -->
<attribute name="noConditionFind" type="String" mode="IN" optional="true" default-value="N"/>
<attribute name="extInfo" type="String" mode="IN" optional="true"/>
<attribute name="extCond" type="org.apache.ofbiz.entity.condition.EntityCondition" mode="IN" optional="true">
<description>EntityCondition that can be send to this service to manage complex search case</description>
</attribute>
<attribute name="partyId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
<attribute name="partyTypeId" type="String" mode="IN" optional="true"/>
<attribute name="roleTypeId" type="String" mode="IN" optional="true"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unwanted change. Could you please revert?

Copy link
Contributor

@JacquesLeRoux JacquesLeRoux Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree I see no reason why
<attribute name="roleTypeId" type="String" mode="IN" optional="true"/> <!-- can be null or ANY to include any -->
has been moved. Not a big deal but we lose the comment

<attribute name="statusId" type="String" mode="IN" optional="true"/>
<attribute name="userLoginId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
<attribute name="externalId" type="String" mode="IN" optional="true"/>
<attribute name="groupName" type="String" mode="IN" optional="true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1604,14 +1604,17 @@ public static Map<String, Object> performFindParty(DispatchContext dctx, Map<Str
EntityFunction.upper("%" + partyId + "%")));
}

// now the statusId - send ANY for all statuses; leave null for just enabled; or pass a specific status
// now the statusId - null for all statuses; "PARTY_ENABLED" finds statusId == null entries also, other passed in values are matched exactly
if (UtilValidate.isNotEmpty(statusId)) {
andExprs.add(EntityCondition.makeCondition("statusId", statusId));
} else {
// NOTE: _must_ explicitly allow null as it is not included in a not equal in many databases... odd but true
andExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("statusId", GenericEntity.NULL_FIELD),
EntityOperator.OR, EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")));
if ("PARTY_ENABLED".equals(statusId)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please share use case why this change is needed?

Copy link
Contributor

@JacquesLeRoux JacquesLeRoux Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's OK to be able to select disabled party. That can make sense in some situations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll discuss those changes and will provide an altered pull request.
Will take at least two weeks as georg is not available atm.

// NOTE: _must_ explicitly allow null as it is not included in a not equal in many databases... odd but true
andExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("statusId",
GenericEntity.NULL_FIELD), EntityOperator.OR, EntityCondition.makeCondition("statusId", "PARTY_ENABLED")));
} else {
andExprs.add(EntityCondition.makeCondition("statusId", statusId));
}
}

// check for partyTypeId
if (UtilValidate.isNotEmpty(partyTypeId)) {
andExprs.add(EntityCondition.makeCondition("partyTypeId", partyTypeId));
Expand Down
10 changes: 9 additions & 1 deletion applications/party/widget/partymgr/PartyForms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ under the License.
<set field="states" value="${groovy: org.apache.ofbiz.common.CommonWorkers.getAssociatedStateList(delegator,requestParameters.CUSTOMER_COUNTRY)}"/>
-->
</actions>
<field name="statusId"><hidden value="PARTY_ENABLED"/></field>
<field name="noConditionFind"><hidden value="Y"/></field>
<field name="extInfo" event="onClick" action="javascript:$('#ListParty' + this.value +'_body').toggle(true);collapseFindPartyOptions('ListParty' + this.value +'_body');" title="${uiLabelMap.PartyContactInformation}">
<radio>
Expand Down Expand Up @@ -57,6 +56,14 @@ under the License.
<entity-options entity-name="PartyType"/>
</drop-down>
</field>
<field name="statusId" title="${uiLabelMap.CommonStatus}">
<drop-down allow-empty="true">
<entity-options entity-name="StatusItem">
<entity-constraint name="statusTypeId" value="PARTY_STATUS"/>
<entity-order-by field-name="sequenceId"/>
</entity-options>
</drop-down>
</field>
<field name="idValue"><text size="15"/></field>
<field name="partyIdentificationTypeId">
<drop-down allow-empty="true">
Expand Down Expand Up @@ -99,6 +106,7 @@ under the License.
<sort-field name="groupName"/>
<sort-field name="roleTypeId"/>
<sort-field name="partyTypeId"/>
<sort-field name="statusId"/>
<sort-field name="partyClassificationGroupId"/>
<field-group title="${uiLabelMap.PartyPartyIdentification}" initially-collapsed="true">
<sort-field name="idValue"/>
Expand Down