You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ja...@gmail.com> on 2008/09/05 10:40:21 UTC

Question about recurrence rules and calendar availability

Hi all,

I would like to implement the display of party/facility/fixed asset  
availability in the work effort calendars.
Also based on recent enhancements by Bilgin (OFBIZ-1756, committed in  
the trunk by David in rev. 658108), I would like to use the  
Recurrence* framework.

For example, the data setup for a standard week of work (8 hours per  
day from 9-12 to 13-18, from Monday to Friday) is:

     <RecurrenceRule recurrenceRuleId="SCHED_STD_40HR_WK"  
frequency="DAILY" intervalNumber="1" countNumber="-1"  
byHourList="09,10,11,13,14,15,16,17"
         byDayList="MO,TU,WE,TH,FR"/>
     <RecurrenceInfo recurrenceInfoId="SCHED_STD_40HR_WK"  
startDateTime="2008-01-01 00:00:00.000"  
recurrenceRuleId="SCHED_STD_40HR_WK" recurrenceCount="0"/>
     <WorkEffort workEffortId="SCHED_STD_40HR_WK"  
workEffortTypeId="AVAILABLE" scopeEnumId="WES_PRIVATE"  
workEffortName="Work Schedule Full Time (40 hrs/wk)"
         recurrenceInfoId="SCHED_STD_40HR_WK"/>

I would like to add a visual representation of this special WorkEffort  
in the calendar screen: showing in a different color the time frames  
of AVAILABILITY at work of the party.

So I guess that, if I am rendering a given day in the calendar for a  
party, the flow will be:

1) given the party, get a WorkEffort of type AVAILABLE associated to  
the party (WorkEffortPartyAssign)
2) get the RecurrenceInfo record associated to the WorkEffort
3) create a new RecurrenceInfo object using the above record

and then? what are the methods that I should use (or implement) in the  
RecurrenceInfo class in order to get availability info for the current  
record?

Any hint would be much appreciated because there are still details  
about recurrence rules that are not completely clear to me.

Thanks,

Jacopo
  

Re: Question about recurrence rules and calendar availability

Posted by Adrian Crum <ad...@hlmksw.com>.
Jacopo,

I've been working on exactly the same thing. I have my own recurrence 
rules code here that I've been trying to convert to the OFBiz 
Recurrence* entities.

The recurrence rules entities and code need some work - see the patch I 
posted in Jira - https://issues.apache.org/jira/browse/OFBIZ-1946.

The method I used here was to get the workefforts for the party. Then - 
for each workeffort - check to see if there is a recurrenceInfoId. If 
there is, check to see if the current period being displayed falls 
within the specified recurrence rule(s). If it does, create a "dummy" 
workeffort with the appropriate information, and add it to the list of 
workefforts for that period.

-Adrian

Jacopo Cappellato wrote:
> Hi all,
> 
> I would like to implement the display of party/facility/fixed asset 
> availability in the work effort calendars.
> Also based on recent enhancements by Bilgin (OFBIZ-1756, committed in 
> the trunk by David in rev. 658108), I would like to use the Recurrence* 
> framework.
> 
> For example, the data setup for a standard week of work (8 hours per day 
> from 9-12 to 13-18, from Monday to Friday) is:
> 
>     <RecurrenceRule recurrenceRuleId="SCHED_STD_40HR_WK" 
> frequency="DAILY" intervalNumber="1" countNumber="-1" 
> byHourList="09,10,11,13,14,15,16,17"
>         byDayList="MO,TU,WE,TH,FR"/>
>     <RecurrenceInfo recurrenceInfoId="SCHED_STD_40HR_WK" 
> startDateTime="2008-01-01 00:00:00.000" 
> recurrenceRuleId="SCHED_STD_40HR_WK" recurrenceCount="0"/>
>     <WorkEffort workEffortId="SCHED_STD_40HR_WK" 
> workEffortTypeId="AVAILABLE" scopeEnumId="WES_PRIVATE" 
> workEffortName="Work Schedule Full Time (40 hrs/wk)"
>         recurrenceInfoId="SCHED_STD_40HR_WK"/>
> 
> I would like to add a visual representation of this special WorkEffort 
> in the calendar screen: showing in a different color the time frames of 
> AVAILABILITY at work of the party.
> 
> So I guess that, if I am rendering a given day in the calendar for a 
> party, the flow will be:
> 
> 1) given the party, get a WorkEffort of type AVAILABLE associated to the 
> party (WorkEffortPartyAssign)
> 2) get the RecurrenceInfo record associated to the WorkEffort
> 3) create a new RecurrenceInfo object using the above record
> 
> and then? what are the methods that I should use (or implement) in the 
> RecurrenceInfo class in order to get availability info for the current 
> record?
> 
> Any hint would be much appreciated because there are still details about 
> recurrence rules that are not completely clear to me.
> 
> Thanks,
> 
> Jacopo
>