allow filtering of holiday dates
authorAlan <alan@roojs.com>
Tue, 9 Apr 2024 06:47:04 +0000 (14:47 +0800)
committerAlan <alan@roojs.com>
Tue, 9 Apr 2024 06:47:04 +0000 (14:47 +0800)
DataObjects/Core_holiday.php

index 76e0b8b..9867e50 100644 (file)
@@ -24,6 +24,22 @@ class Pman_Core_DataObjects_Core_holiday extends DB_DataObject
         'cny' => 'https://raw.githubusercontent.com/andrewlkho/cny.ics/master/cny.ics', // CNY
     );
     
+    
+    function apply_filters($q, $au, $roo)
+    {
+        if (isset($q['date_from'])) {
+            $dt = date("Y-m-d",strtotime($q['date_from']));
+            $this->whereAdd("holiday_date > '$dt'");
+        }
+        if (isset($q['date_to'])) {
+            $dt = date("Y-m-d",strtotime($q['date_to']));
+            $this->whereAdd("holiday_date < '$dt'");
+        }
+        
+        
+    }
+    
+    
      
     function updateHolidays($country)
     {