Categorie: reference
Bijgewerkt: 2026-04-08
actionfield workflow actionfield168
ActionField168
Beschrijving: Batch close EmployeeLabours from one week (DomainGlobals.LastClosedWeek + 1). Custom: Nee
XMLbewerken
<Workflow Name="ActionField168" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
<Description>Batch close EmployeeLabours from one week (DomainGlobals.LastClosedWeek + 1).</Description>
<Properties>
<Property Name="CanCloseJob" Type="Boolean" Accessor="Internal" />
<Property Name="CompletedJobs" Type="List[Job]" Accessor="Internal" />
<Property Name="DomainGlobals" Type="DomainGlobals" Accessor="Internal" Default="#{UltimoSettings.Id}" />
<Property Name="EmployeeLabours" Type="List[EmployeeLabour]" Accessor="Internal" />
<Property Name="WeekToClose" Type="WeekOfYear" Accessor="Internal" />
</Properties>
<Execution>
<UserContent Name="Pre" />
<Assign Name="Determine WeekToClose" Property="${WeekToClose}" Value="=#addweeks(${DomainGlobals.LastClosedWeek}, 1)" />
<ContinuationQuestion Name="Close week?" MessageCode="0398">
<Parameter Name="LastClosedWeek" Direction="In" Value="${DomainGlobals.LastClosedWeek}" />
<Parameter Name="WeekToClose" Direction="In" Value="${WeekToClose}" />
</ContinuationQuestion>
<Transaction>
<Command Name="Can close week?" CommandName="EmployeeLabour_CloseWeeksCheck" Comment="throws CommandException when close isn't allowed" />
<GetList Name="Get completed jobs" Type="Job" OutputProperty="${CompletedJobs}" OrderBy="Id" OrderDirection="Ascending">
<Filters>
<PropertyFilter PropertyName="Status" Operator="=" PropertyValue="JobStatus.Completed" />
</Filters>
</GetList>
<ForEach Name="Close completed jobs" In="${CompletedJobs}" As="Job">
<Command Name="Can close job?" CommandName="Job_CloseCompletedCheck">
<Parameter Name="Job" Direction="In" Value="${Job}" />
<Parameter Name="CanClose" Direction="Out" OutputProperty="${CanCloseJob}" />
</Command>
<When Name="Can close job » Yes" Condition="${CanCloseJob} == True">
<ChangeStatus Name="Close job" DomainObject="${Job}" NewStatus="JobStatus.Closed" />
</When>
</ForEach>
<GetList Name="Get employee labour weeks" Type="EmployeeLabour" OutputProperty="${EmployeeLabours}" OrderBy="Id" OrderDirection="Ascending">
<Filters>
<PropertyFilter PropertyName="Id.Week" Operator="=" PropertyValue="${WeekToClose}" />
</Filters>
</GetList>
<ForEach Name="Close employee labour weeks" In="${EmployeeLabours}" As="EmployeeLabour">
<ChangeStatus Name="Close employee labour week" DomainObject="${EmployeeLabour}" NewStatus="EmployeeLabourStatus.Closed" />
<ForEach Name="Close employee labour week lines" In="${EmployeeLabour.Lines}" As="EmployeeLabourLine">
<ChangeStatus Name="Close employee labour week line" DomainObject="${EmployeeLabourLine}" NewStatus="EmployeeLabourLineStatus.Closed" />
</ForEach>
</ForEach>
<Assign Name="Update last closed week" Property="${DomainGlobals.LastClosedWeek}" Value="${WeekToClose}" />
</Transaction>
<UserContent Name="Post" />
<Message Name="ummWEEKCLOSED" MessageCode="0400">
<Parameter Name="WeekToClose" Direction="In" Value="${WeekToClose}" />
</Message>
</Execution>
</Workflow>