Quintiq file version 2.0
|
#parent: #root
|
StaticMethod GetInfo (
|
Number recurrenceInterval_i,
|
Boolean onMonday_i,
|
Boolean onTuesday_i,
|
Boolean onWednesday_i,
|
Boolean onThursday_i,
|
Boolean onFriday_i,
|
Boolean onSaturday_i,
|
Boolean onSunday_i
|
) const declarative remote as String
|
{
|
Description:
|
[*
|
Get information about the RecurrencePattern in textual format.
|
Is implemented as a static method so it can also be called from the UI when there is no instance available yet.
|
*]
|
TextBody:
|
[*
|
value := "";
|
days := Translations::Pattern_Days().Tokenize( ';' );
|
|
if( days.Size() = 7 )
|
{
|
value := "every ";
|
|
if( recurrenceInterval_i > 1 )
|
{
|
value := value + [String]recurrenceInterval_i + " weeks on ";
|
}
|
|
selectedDays := construct( Strings );
|
|
if( onMonday_i ) { selectedDays.Add( days.Element( monday - 1 ) ); }
|
if( onTuesday_i ) { selectedDays.Add( days.Element( tuesday - 1 ) ); }
|
if( onWednesday_i ) { selectedDays.Add( days.Element( wednesday - 1 ) ); }
|
if( onThursday_i ) { selectedDays.Add( days.Element( thursday - 1 ) ); }
|
if( onFriday_i ) { selectedDays.Add( days.Element( friday - 1 ) ); }
|
if( onSaturday_i ) { selectedDays.Add( days.Element( saturday - 1 ) ); }
|
if( onSunday_i ) { selectedDays.Add( days.Element( sunday - 1 ) ); }
|
|
if( selectedDays.Size() = 7 )
|
{
|
// If the value only contains 'every ' it must be reset first.
|
value := ifexpr( value = "every ", "", value ) + "every day of the week";
|
}
|
else
|
{
|
// If there are multiple days, then replace then use 'and' instead of the last comma.
|
lastDay := "";
|
nrOfSelectedDays := selectedDays.Size();
|
|
if( nrOfSelectedDays > 1 )
|
{
|
lastDay := selectedDays.Element( nrOfSelectedDays - 1 );
|
selectedDays.Delete( nrOfSelectedDays - 1 );
|
}
|
|
daysValue := selectedDays.ToString( ', ' );
|
|
if( nrOfSelectedDays > 1 )
|
{
|
daysValue := daysValue + " and " + lastDay;
|
}
|
|
value := value + daysValue;
|
}
|
}
|
else
|
{
|
value := [String]days.Size() + " days defined in Translations::Pattern_Days(), should be 7";
|
}
|
|
return value;
|
*]
|
}
|