陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Quintiq file version 2.0
#parent: #root
StaticMethod ValidDate (
  output String feedback_o,
  MacroPlan owner,
  DateTime startdate,
  DateTime endtime
) declarative remote as Boolean
{
  TextBody:
  [*
    // 甄兰鸽 Jul-26-2024 (created)
    feedback_o := '';
    if( startdate.IsFinite() and endtime.IsFinite() ){
      if( startdate > endtime ){
        feedback_o := Translations::MP_LibCal_Event_ValidDatePeriod();
      }
      mindate      := owner.StartOfPlanning().Date();
      maxdate      := maxobject( owner, Period_MP, period, not period.IsHistorical(), period.StartDate() );
    
      if( startdate.Date() < mindate or endtime.Date() > maxdate.StartDate() ){
        feedback_o := Translations::MP_LibCal_Event_ValidDate();
      }
    
      if( ( endtime - startdate ).Days() > 1 ){
        feedback_o := Translations::MP_LibCal_Event_ValidDateInterval();
      }
    
    }else{
      feedback_o := "日期非法";
    }
    return feedback_o = '';
  *]
}