Skip to content
Open
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
6 changes: 5 additions & 1 deletion service/mantle/product/SubscriptionServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,18 @@ along with this software (see the LICENSE.md file). If not, see

<!-- determine fromDate (either last Subscription.thruDate if in future, or nowTimestamp -->
<!-- TODO: for renewals of a particular subscription, get resourceInstanceId from somewhere... (maybe OrderItem?) -->
<set field="nowTimestamp" from="ec.user.nowTimestamp"/>
<entity-find entity-name="mantle.product.subscription.Subscription" list="existingSubscriptionList">
<econdition field-name="subscriptionResourceId" from="subscriptionResourceId"/>
<econdition field-name="subscriberPartyId" from="customerPartyId"/>
<econdition field-name="resourceInstanceId" ignore-if-empty="true"/>
<econdition field-name="fromDate" operator="less-equals" from="nowTimestamp"/>
<econdition field-name="thruDate" operator="greater-equals" from="nowTimestamp"/>
<order-by field-name="-thruDate"/>
</entity-find>
<if condition="fromDate == null">
<set field="fromDate" from="existingSubscriptionList?.first?.thruDate ?: ec.user.nowTimestamp"/></if>
<set field="fromDate" from="existingSubscriptionList?.first?.thruDate ?: nowTimestamp"/></if>
<if condition="fromDate &lt; nowTimestamp"><set field="fromDate" from="nowTimestamp"/></if>
<if condition="!resourceInstanceId &amp;&amp; existingSubscriptionList">
<set field="resourceInstanceId" from="existingSubscriptionList[0].resourceInstanceId"/></if>

Expand Down