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

ActionField045

Beschrijving: Close week in hourregistration for Employee (EmployeeLabour/EmployeeLabourLines). Custom: Nee

Propertiesbewerken

Property Type Accessor
EmployeeLabour EmployeeLabour Root
DisplayCount Int64 Optional

XMLbewerken

<Workflow Name="ActionField045" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Close week in hourregistration for Employee (EmployeeLabour/EmployeeLabourLines).</Description>
	<Properties>
		<Property	Name="EmployeeLabour"		Type="EmployeeLabour"	Accessor="Root"		Direction="In" />

		<Property	Name="DisplayCount"			Type="Int64"			Accessor="Optional"	Direction="In"		Default="4"		Comment="Number of jobs to be shown in message 0436 - there are JobWeekLabour records that do not have status closed." />

		<Property	Name="JobWeekLabourJobs"	Type="QueryResult"		Accessor="Internal" />
		<Property	Name="MessageString"		Type="String"			Accessor="Internal"						Default="Empty" />
		<Property	Name="RowCount"				Type="Int64"			Accessor="Internal"						Default="0" />
		<Property	Name="Validated"			Type="Boolean"			Accessor="Internal"						Default="True" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Validation Name="ValidateEmployeeLabourStatus" Condition="${EmployeeLabour.Status} != EmployeeLabourStatus.Closed" MessageCode="0435">
			<Parameter	Name="EmployeeLabour"	Direction="In"		Value="${EmployeeLabour}" />
		</Validation>

		<Transaction>
			<Query Name="Get JobWeekLabours" Type="JobWeekLabour" OutputProperty="${JobWeekLabourJobs}" Comment="Because of group property, order by won't work with Oracle">
				<Joins>
					<Join	Name="Id.JobWeek"		Alias="jobWeek"	Type="InnerJoin" />
					<Join	Name="jobWeek.Id.Job"	Alias="job"		Type="InnerJoin" />
				</Joins>
				<Filters>
					<CombinedFilter FilterOperator="And">
						<PropertyFilter	PropertyName="jobWeek.Id.Week"	Operator="="		PropertyValue="${EmployeeLabour.Id.Week}" />
						<NotFilter>
							<PropertyFilter	PropertyName="jobWeek.Status"	Operator="="		PropertyValue="EmployeeLabourStatus.Closed" />
						</NotFilter>
						<PropertyFilter	PropertyName="Employee"			Operator="="		PropertyValue="${EmployeeLabour.Id.Employee}" />
					</CombinedFilter>
				</Filters>
				<Properties>
					<Property Name="job.Id" Alias="jobId" Type="GroupProperty" />
					<Property Name="job.Description" Alias="jobDescription" Type="GroupProperty" />
				</Properties>
			</Query>

			<When Name="Check count" Condition="${JobWeekLabourJobs.Count} &gt; 0">
				<Assign Name="Toggle validated" Property="${Validated}" Value="False" />

				<ForEach Name="LoopJobWeekLabours" In="${JobWeekLabourJobs}" As="Job">
					<When Name="DisplayCount" Condition="${RowCount} &lt;= ${DisplayCount}">
						<When Name="Add separator" Condition="${MessageString} != Empty">
							<Assign Name="Add separator" Property="${MessageString}" Value="=#concat(${MessageString}, ', ')" />
						</When>

						<Assign Name="Add Id" Property="${MessageString}" Value="=#concat(${MessageString}, ${Job.jobId},' ', ${Job.jobDescription})" />
						<Assign Name="RowCount" Property="${RowCount}" Value="=${RowCount} + 1" />
					</When>
				</ForEach>

				<Validation Name="Has JobWeekLabours" Condition="${Validated} == True" MessageCode="0436">
					<Parameter	Name="Count"			Direction="In"		Value="${JobWeekLabourJobs.Count}" />
					<Parameter	Name="EmployeeLabour"	Direction="In"		Value="${EmployeeLabour}" />
					<Parameter	Name="Jobs"				Direction="In"		Value="=#trim(${MessageString})" />
					<Parameter	Name="RowCount"			Direction="In"		Value="${RowCount}" />
				</Validation>
			</When>

			<ForEach Name="ForEach EmployeeLabourLine" In="${EmployeeLabour.Lines}" As="EmployeeLabourLine">
				<ChangeStatus Name="Close EmployeeLabourLine" DomainObject="${EmployeeLabourLine}" NewStatus="EmployeeLabourLineStatus.Closed" />
			</ForEach>

			<ChangeStatus Name="Close EmployeeLabour" DomainObject="${EmployeeLabour}" NewStatus="EmployeeLabourStatus.Closed" />
		</Transaction>

		<UserContent Name="Post" />

		<Message Name="EmployeeLabourIsClosed" MessageCode="0501">
			<Parameter	Name="EmployeeLabour"	Direction="In"		Value="${EmployeeLabour}" />
		</Message>
	</Execution>
</Workflow>