Categorie: reference Bijgewerkt: 2026-04-08 actionfield workflow actionfield936

ActionField936

Beschrijving: Create a new ContractPeriod for a RentableRealEstateContract. Custom: Nee

Propertiesbewerken

Property Type Accessor
RentableRealEstateContract ServiceContract Root
LettableUnitIsRequired Boolean Optional

XMLbewerken

<Workflow Name="ActionField936" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create a new ContractPeriod for a RentableRealEstateContract.</Description>
	<Properties>
		<Property	Name="RentableRealEstateContract"				Type="ServiceContract"		Accessor="Root"		Direction="In" />

		<Property	Name="LettableUnitIsRequired"					Type="Boolean"				Accessor="Optional"	Direction="In"		Default="True"	Comment="Caution: do not use False if you use ActionField936 in the rental administration." />

		<Property	Name="AddContractPeriod"						Type="Boolean"				Accessor="Internal"						Default="True"	Comment="This flag is used to format validation messages, where False means ContractPeriod is changed" />
		<Property	Name="ContractLines"							Type="List[ContractLine]"	Accessor="Internal" />
		<Property	Name="ContractPeriod"							Type="ContractPeriod"		Accessor="Internal" />
		<Property	Name="NewRentedPeriod"							Type="StateTimeslot"		Accessor="Internal" />
		<Property	Name="SelectedDateFrom"							Type="Date"					Accessor="Internal" />
		<Property	Name="SelectedDateTill"							Type="Date?"				Accessor="Internal" />
		<Property	Name="SelectedOtherPartyMaximumTerminationDate"	Type="Date?"				Accessor="Internal" />
		<Property	Name="SelectedOurPartyMaximumTerminationDate"	Type="Date?"				Accessor="Internal" />
		<Property	Name="SelectedText"								Type="UltimoString"			Accessor="Internal" />
		<Property	Name="StateAgenda"								Type="StateAgenda"			Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<When Name="When Lettable Unit is required #1" Condition="${LettableUnitIsRequired} == True">
			<Validation Name="RentableObjectIsNotRentable" Condition="${RentableRealEstateContract.Space.Rentable} == True" MessageCode="1749">
				<Parameter	Name="AddContractPeriod"	Direction="In"		Value="${AddContractPeriod}" />
				<Parameter	Name="Space"				Direction="In"		Value="${RentableRealEstateContract.Space}" />
			</Validation>
			<Validation Name="RentableRealEstateContractHasEndDate" Condition="${RentableRealEstateContract.EndDate} == Empty" MessageCode="1785">
				<Parameter	Name="AddContractPeriod"	Direction="In"		Value="${AddContractPeriod}" />
				<Parameter	Name="ServiceContract"		Direction="In"		Value="${RentableRealEstateContract}" />
			</Validation>
		</When>

		<WorkflowCall Name="Change a ContractPeriod" WorkflowName="Dialog_ContractPeriod_CreateOrChangePeriod">
			<Parameter	Name="ContractPeriodContext"			Direction="In"		Value="ContractPeriodContext.None" />
			<Parameter	Name="IsNew"							Direction="In"		Value="True" />
			<Parameter	Name="DateFrom"							Direction="InOut"	Value="Empty"						OutputProperty="${SelectedDateFrom}" />
			<Parameter	Name="DateTill"							Direction="InOut"	Value="Empty"						OutputProperty="${SelectedDateTill}" />
			<Parameter	Name="OtherPartyMaximumTerminationDate"	Direction="InOut"	Value="Empty"						OutputProperty="${SelectedOtherPartyMaximumTerminationDate}" />
			<Parameter	Name="OurPartyMaximumTerminationDate"	Direction="InOut"	Value="Empty"						OutputProperty="${SelectedOurPartyMaximumTerminationDate}" />
			<Parameter	Name="Text"								Direction="InOut"	Value="Empty"						OutputProperty="${SelectedText}" />
		</WorkflowCall>

		<WorkflowCall Name="Validate ContractPeriod" WorkflowName="ServiceContract_ValidateContractPeriod">
			<Parameter	Name="AddContractPeriod"					Direction="In"		Value="${AddContractPeriod}" />
			<Parameter	Name="LettableUnitIsRequired"				Direction="In"		Value="${LettableUnitIsRequired}" />
			<Parameter	Name="NewDateFrom"							Direction="In"		Value="${SelectedDateFrom}" />
			<Parameter	Name="NewDateTill"							Direction="In"		Value="${SelectedDateTill}" />
			<Parameter	Name="NewOtherPartyMaximumTerminationDate"	Direction="In"		Value="${SelectedOtherPartyMaximumTerminationDate}" />
			<Parameter	Name="NewOurPartyMaximumTerminationDate"	Direction="In"		Value="${SelectedOurPartyMaximumTerminationDate}" />
			<Parameter	Name="RentableRealEstateContract"			Direction="In"		Value="${RentableRealEstateContract}" />
		</WorkflowCall>

		<Transaction>
			<Insert Name="ContractPeriod" ObjectType="ContractPeriod" OutputProperty="${ContractPeriod}">
				<Parameter	Name="Context"							Direction="In"		Value="ContractPeriodContext.None" />
				<Parameter	Name="Status"							Direction="In"		Value="ContractPeriodStatus.None" />
				<Parameter	Name="DateFrom"							Direction="In"		Value="${SelectedDateFrom}" />
				<Parameter	Name="DateTill"							Direction="In"		Value="${SelectedDateTill}" />
				<Parameter	Name="OtherPartyMaximumTerminationDate"	Direction="In"		Value="${SelectedOtherPartyMaximumTerminationDate}" />
				<Parameter	Name="OurPartyMaximumTerminationDate"	Direction="In"		Value="${SelectedOurPartyMaximumTerminationDate}" />
				<Parameter	Name="ServiceContract"					Direction="In"		Value="${RentableRealEstateContract}" />
				<Parameter	Name="ServiceContract"					Direction="In"		Value="${RentableRealEstateContract}" />
				<Parameter	Name="Text"								Direction="In"		Value="${SelectedText}" />
			</Insert>

			<When Name="ContractIsActive" Condition="${RentableRealEstateContract.Status} == ServiceContractStatus.Active || ${LettableUnitIsRequired} == False">
				<When Name="StateAgenda does not exist" Condition="${LettableUnitIsRequired} == True &amp;&amp; ${RentableRealEstateContract.Space.StateAgenda} == Empty">
					<Insert Name="Create StateAgenda" ObjectType="StateAgenda" OutputProperty="${StateAgenda}" />

					<Assign Name="Assign StateAgenda to Space" Property="${RentableRealEstateContract.Space.StateAgenda}" Value="${StateAgenda}" />
				</When>

				<Insert Name="Create new stateTimeslot" ObjectType="StateTimeslot" OutputProperty="${NewRentedPeriod}">
					<Parameter	Name="Status"		Direction="In"		Value="StateTimeslotStatus.Rented" />
					<Parameter	Name="Employee"		Direction="In"		Value="#{User.EmployeeId}" />
					<Parameter	Name="EndDate"		Direction="In"		Value="${ContractPeriod.DateTill}" />
					<Parameter	Name="StartDate"	Direction="In"		Value="${ContractPeriod.DateFrom}" />
					<Parameter	Name="StateAgenda"	Direction="In"		Value="=${LettableUnitIsRequired} == True ? ${RentableRealEstateContract.Space.StateAgenda} : EMPTY" />
				</Insert>

				<Assign Name="Also associate StateTimeslot with ContractPeriod" Property="${ContractPeriod.StateTimeslot}" Value="${NewRentedPeriod}" />
			</When>

			<GetList Name="Get list of ContractLines" Type="ContractLine" OutputProperty="${ContractLines}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="InvoiceOnce"			Operator="="		PropertyValue="False" />
					<PropertyFilter	PropertyName="ServiceContract.Id"	Operator="="		PropertyValue="${ContractPeriod.ServiceContract.Id}" />
					<PropertyFilter	PropertyName="Status"				Operator="!="		PropertyValue="ContractLineStatus.Concept"				Comment="This is to prevent the 'empty' lines added through canceled dialog" />
				</Filters>
			</GetList>

			<ForEach Name="Loop through the list of ContractLines" In="${ContractLines}" As="ContractLine">
				<When Name="See comment below" Condition="${ContractLine.StartDateChargePeriod} == Empty || ${ContractPeriod.DateFrom} &lt;= ${ContractLine.StartDateChargePeriod}">
					<Comment><![CDATA[
						StartDateChargePeriod can be in some previous period, and then the new period doesn't affect the contractline's StartDateChargePeriod; it can be in some later
						period: we won't arrive here: it's not allowed; and it can be at the end of the contractPeriod, in which case it will be set to the start of the new period
					]]></Comment>

					<Assign Name="Assign StartDateChargePeriod" Property="${ContractLine.StartDateChargePeriod}" Value="${ContractPeriod.DateFrom}" />

					<Command Name="ContractLine_CalculateDatesRelevantToCharging" CommandName="ContractLine_CalculateDatesRelevantToCharging">
						<Parameter	Name="ContractLine"						Direction="In"		Value="${ContractLine}" />
						<Parameter	Name="RecalculateStartDateChargePeriod"	Direction="In"		Value="False" />
					</Command>
				</When>
			</ForEach>
		</Transaction>

		<UserContent Name="Post" />
	</Execution>
</Workflow>