From bd12cc49b5fd9a9a6f18ce90d204cec2176996f4 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 25 七月 2024 16:48:42 +0800
Subject: [PATCH] 批量不可用事件新建bug

---
 _Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
index 5660545..df18866 100644
--- a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
+++ b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
@@ -47,22 +47,30 @@
     
     //鍙湁閫氳繃鎵归噺鍒涘缓鐣岄潰涓斿凡鏈夊悓鍚嶄簨浠惰繘鍏ヤ笅闈㈡搷浣�
     if( ismultiple and not isnull( event ) ){
+      event.IsMultiple( true );
       lp        := event.LeadingParticipation();
       timezone  := lp.Calendar().GetTimeZone();
       starttime := startDate_i.DateTime( timezone ).AddAsPeriod( timezone, startTimeOfDay_i );
       endtime   := endDate_i.DateTime( timezone ).AddAsPeriod( timezone, endTimeOfDay_i );
+      etis      := selectset( lp, Subscription.ExplicitTimeInterval, eti, true );
     //  startDate := starttime.Date( timezone );
     //  endDate   := endtime.Date( timezone ) - ifexpr( endtime = endtime.StartOfDay( timezone ), 1, 0 );
-      lp.AddSubscribers( subscribers_i, true );;
       leadingETI := selectobject( lp, ExplicitTimeInterval, eti, eti.Start() = starttime and eti.End() = endtime );
+    
       if( isnull( leadingETI ) ){
         leadingETI := lp.CreateTimeInterval( starttime, endtime, event.Capacity() );
       }
-    //  info( '-----------------------2-----------------', lp.ExplicitTimeInterval( relsize ) );
+      lp.AddSubscribers( subscribers_i, true );
+    
       if( not isnull( leadingETI ) ){
         traverse( lp, Subscription, subscription, subscribers_i.Find( subscription.Calendar() ) >= 0 ){
-          traverse( subscription, ExplicitTimeInterval, eti, not ( eti.Start() = starttime and eti.End() = endtime ) ){
+    
+          traverse( subscription, ExplicitTimeInterval, eti, etis.Find( eti ) < 0 ){
             eti.Delete();
+          }
+          subscribingETI := subscription.CreateTimeInterval( starttime, endtime, event.Capacity() );
+          if( not isnull( subscribingETI ) ){
+            subscribingETI.LeadingETI( relset, leadingETI );
           }
         }
       }
@@ -73,14 +81,13 @@
                                       patternType_i, patternDaily_IsEveryWeekday_i, patternWeekly_Weekdays_i, 
                                       patternMonthly_IsDay_i, patternMonthly_Day_i, patternMonthly_WeekOfMonth_i, patternMonthly_DayOfWeek_i,
                                       patternYearly_IsDate_i, patternYearly_Month_i, patternYearly_Day_i, patternYearly_WeekOfMonth_i, patternYearly_DayOfWeek_i,
-                                      periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i );
+                                      periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i, ismultiple );
     }
+    
     if( not isnull( event ) ){
       event.EventType( relset, eventtype_i );
     }
-    if( ismultiple ){
-      event.IsMultiple( ismultiple );
-    }
+    
     return event;
   *]
 }

--
Gitblit v1.9.3