[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Calendar: add send reminder notifications option for recurring events

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]> Mon, 06 Jul 2026 12:52:41 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a4ba519b0934_3819a97473817@gitlab-sidekiq-low-urgency-cpu-bound-v2-fd48bd9cc-qlvtw.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
3183ad85 by Adrien Mbuya Maloba at 2026-07-06T12:34:29+00:00
[ENH] Calendar: add send reminder notifications option for recurring events
---
* [ENH] Calendar: add send reminder notifications option for recurring events

See merge request tikiwiki/tiki!10651

- - - - -


5 changed files:

- db/tiki.sql
- + installer/schema/20260703_calendar_recurrence_add_reminder_tiki.sql
- lib/calendar/calrecurrence.php
- lib/core/Services/Calendar/Controller.php
- templates/calendar/edit_item.tpl


Changes:

=====================================
db/tiki.sql
=====================================
@@ -414,6 +414,7 @@ CREATE TABLE `tiki_calendar_recurrence` (
   `lang` char(16) NOT NULL default 'en',
   `name` varchar(255) NOT NULL default '',
   `description` blob,
+  `sendReminder` tinyint NOT NULL default '1',
   `daily` tinyint(1) default 0,
   `days` int default NULL,
   `weekly` tinyint(1) default '0',


=====================================
installer/schema/20260703_calendar_recurrence_add_reminder_tiki.sql
=====================================
@@ -0,0 +1 @@
+ALTER TABLE `tiki_calendar_recurrence` ADD COLUMN `sendReminder` tinyint NOT NULL default '1' AFTER `description`;


=====================================
lib/calendar/calrecurrence.php
=====================================
@@ -27,6 +27,7 @@ class CalRecurrence extends TikiLib
     private $lang;
     private $name;
     private $description;
+    private $sendReminder;
     private $daily;
     private $days;
     private $weekly;
@@ -77,7 +78,7 @@ class CalRecurrence extends TikiLib
     {
         $dataExists = false;
         if ($this->getId() > 0) {
-            $query = "SELECT calendarId, start, end, duration, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, daily, days,"
+            $query = "SELECT calendarId, start, end, duration, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, sendReminder, daily, days,"
                      . "weekly, weeks, weekdays, monthly, months, dayOfMonth, monthlyType, monthlyWeekdayValue, monthlyFirstlastWeekdayValue, yearly, years, yearlyType, dateOfYear,"
                      . "yearlyWeekdayValue, yearlyFirstlastWeekdayValue, yearlyWeekMonth, nbRecurrences, startPeriod, endPeriod, user, created, lastModif, uri, uid, recurrenceDstTimezone "
                      . "FROM tiki_calendar_recurrence WHERE recurrenceId = ?";
@@ -98,6 +99,7 @@ class CalRecurrence extends TikiLib
                 $this->setLang($row['lang']);
                 $this->setName($row['name']);
                 $this->setDescription($row['description']);
+                $this->setSendReminder(empty($row['sendReminder']) ? 0 : 1);
                 $this->setDaily($row['daily'] == 1);
                 $this->setDays($row['days']);
                 $this->setWeekly($row['weekly'] == 1);
@@ -142,6 +144,7 @@ class CalRecurrence extends TikiLib
             $this->setLang('');
             $this->setName('');
             $this->setDescription('');
+            $this->setSendReminder(1);
             $this->setDaily(0);
             $this->setDays(1);
             $this->setWeekly(0);
@@ -207,6 +210,9 @@ class CalRecurrence extends TikiLib
         if (isset($data['description'])) {
             $this->setDescription($data['description']);
         }
+        if (isset($data['sendReminder'])) {
+            $this->setSendReminder($data['sendReminder']);
+        }
         if (isset($data['user'])) {
             $this->setUser($data['user']);
         }
@@ -375,10 +381,10 @@ class CalRecurrence extends TikiLib
      */
     private function create()
     {
-        $query = "INSERT INTO tiki_calendar_recurrence (calendarId, start, end, duration, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, "
+        $query = "INSERT INTO tiki_calendar_recurrence (calendarId, start, end, duration, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, sendReminder, "
                  . "daily, days, weekly, weeks, weekdays, monthly, months, dayOfMonth, monthlyType, monthlyWeekdayValue, monthlyFirstlastWeekdayValue, yearly, years, yearlyType, dateOfYear, "
                  . "yearlyWeekdayValue, yearlyFirstlastWeekdayValue, yearlyWeekMonth, nbRecurrences, startPeriod, endPeriod, user, created, lastModif, uri, uid, recurrenceDstTimezone) "
-                 . "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+                 . "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
         $now = $this->now;
         $bindvars = [
                         $this->getCalendarId(),
@@ -395,6 +401,7 @@ class CalRecurrence extends TikiLib
                         $this->getLang(),
                         $this->getName(),
                         $this->getDescription(),
+                        $this->getSendReminder(),
                         $this->isDaily() ? 1 : 0,
                         $this->getDays(),
                         $this->isWeekly() ? 1 : 0,
@@ -442,7 +449,7 @@ class CalRecurrence extends TikiLib
     private function update($updateManuallyChangedEvents = false)
     {
         $query = "UPDATE tiki_calendar_recurrence SET calendarId = ?, start = ?, end = ?, duration = ?, allday = ?, locationId = ?, categoryId = ?, nlId = ?, priority = ?, status = ?, "
-                 . "url = ?, lang = ?, name = ?, description = ?, daily = ?, days = ?, weekly = ?, weeks = ?, weekdays = ?, monthly = ?, months = ?, dayOfMonth = ?, monthlyType = ?, monthlyWeekdayValue = ?, monthlyFirstlastWeekdayValue = ?, yearly = ?, years = ?, yearlyType = ?, dateOfYear = ?, yearlyWeekdayValue = ?, yearlyFirstlastWeekdayValue = ?, yearlyWeekMonth = ?, nbRecurrences = ?, "
+                 . "url = ?, lang = ?, name = ?, description = ?, sendReminder = ?, daily = ?, days = ?, weekly = ?, weeks = ?, weekdays = ?, monthly = ?, months = ?, dayOfMonth = ?, monthlyType = ?, monthlyWeekdayValue = ?, monthlyFirstlastWeekdayValue = ?, yearly = ?, years = ?, yearlyType = ?, dateOfYear = ?, yearlyWeekdayValue = ?, yearlyFirstlastWeekdayValue = ?, yearlyWeekMonth = ?, nbRecurrences = ?, "
                  . "startPeriod = ?, endPeriod = ?, user = ?, lastModif = ?, uri = ?, uid = ?, recurrenceDstTimezone = ? WHERE recurrenceId = ?";
         $now = time();
         $bindvars = [
@@ -460,6 +467,7 @@ class CalRecurrence extends TikiLib
                         $this->getLang(),
                         $this->getName(),
                         $this->getDescription(),
+                        $this->getSendReminder(),
                         $this->isDaily() ? 1 : 0,
                         $this->getDays(),
                         $this->isWeekly() ? 1 : 0,
@@ -529,6 +537,7 @@ class CalRecurrence extends TikiLib
                 'lang'         => $this->getLang(),
                 'name'         => $this->getName(),
                 'description'  => $this->getDescription(),
+                'sendReminder'  => $this->getsendReminder(),
                 'user'         => $this->getUser(),
                 'created'      => $this->getCreated(),
                 'lastmodif'    => $this->getCreated(),
@@ -577,7 +586,7 @@ class CalRecurrence extends TikiLib
 
 
 
-        $query = "SELECT calitemId,calendarId, start, end, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, "
+        $query = "SELECT calitemId,calendarId, start, end, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, sendReminder, "
                  . "user, created, lastModif, changed, recurrenceStart "
                  . "FROM tiki_calendar_items WHERE recurrenceId = ? ORDER BY start";
         $bindvars = [(int)$this->getId()];
@@ -641,6 +650,7 @@ class CalRecurrence extends TikiLib
                     'lang'         => $this->getLang(),
                     'name'         => $this->getName(),
                     'description'  => $this->getDescription(),
+                    'sendReminder'  => $this->getSendReminder(),
                     'user'         => $this->getUser(),
                     'created'      => $this->getCreated(),
                     'lastmodif'    => $this->getCreated(),
@@ -707,7 +717,7 @@ class CalRecurrence extends TikiLib
      */
     public function getOverrides($changed = null)
     {
-        $query = "SELECT calitemId,calendarId, start, end, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, "
+        $query = "SELECT calitemId,calendarId, start, end, allday, locationId, categoryId, nlId, priority, status, url, lang, name, description, sendReminder, "
                  . "user, created, lastModif, changed, recurrenceStart "
                  . "FROM tiki_calendar_items WHERE recurrenceId = ?";
         $bindvars = [(int)$this->getId()];
@@ -765,6 +775,9 @@ class CalRecurrence extends TikiLib
         if ($this->getDescription() != $oldRec->getDescription()) {
             $result[] = "description";
         }
+        if ($this->getSendReminder() != $oldRec->getSendReminder()) {
+            $result[] = "sendReminder";
+        }
         if ($this->isDaily() && ($this->getDays() != $oldRec->getDays())) {
             $result[] = "_days";
         }
@@ -997,6 +1010,11 @@ class CalRecurrence extends TikiLib
         if (! empty($this->getDescription())) {
             $data['DESCRIPTION'] = $this->getDescription();
         }
+        if (! empty($this->getSendReminder())) {
+            $data['X-Tiki-sendReminder'] = $this->getSendReminder();
+        } else {
+            $data['X-Tiki-sendReminder'] = 0;
+        }
         $locations = TikiLib::lib('calendar')->list_locations($this->getCalendarId());
         $locationId = $this->getLocationId();
 
@@ -1349,6 +1367,19 @@ class CalRecurrence extends TikiLib
         $this->description = $value;
     }
 
+    public function getSendReminder()
+    {
+        return $this->sendReminder;
+    }
+
+    /**
+     * @param $value
+     */
+    public function setSendReminder($value)
+    {
+        $this->sendReminder = $value;
+    }
+
     public function isDaily()
     {
         return $this->daily;


=====================================
lib/core/Services/Calendar/Controller.php
=====================================
@@ -279,7 +279,9 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                 $calendarId = $calitem['calendarId'];
                 $calitem['calitemId'] = $calitemId;
                 $calitem['allday'] = empty($calitem['allday']) ? 0 : 1;
-                $calitem['sendReminder'] = empty($calitem['sendReminder']) ? 0 : 1;
+                if (isset($calitem['sendReminder'])) {
+                    $calitem['sendReminder'] = (int) ! empty($calitem['sendReminder']);
+                }
                 $calitem['recurrenceId'] = $input->recurrenceId->int();
                 $calendar = $this->calendarLib->get_calendar($calendarId);
                 $calitem = $this->processParticipants($calitem);
@@ -904,6 +906,7 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                 }
 
                 $client = new \Tiki\SabreDav\CaldavClient();
+
                 $client->saveCalendarObject($calitem);
                 if (! empty($calitem['calitemId'])) {
                     $calitemId = $calitem['calitemId'];
@@ -1006,6 +1009,8 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
         $recurrence->setLang(strLen($calitem['lang']) > 0 ? $calitem['lang'] : 'en');
         $recurrence->setName($calitem['name']);
         $recurrence->setDescription($calitem['description']);
+
+        $recurrence->setSendReminder($calitem['sendReminder']);
         $recurrence->setRecurenceDstTimezone($input->recurrenceDstTimezone->text());
         $recurrence->setUser($calitem['user']);
         $recurrence->setOrganizers($calitem['organizers']);


=====================================
templates/calendar/edit_item.tpl
=====================================
@@ -322,10 +322,12 @@
                 <div class="mb-3 row clearfix">
                     <label class="col-form-label col-sm-3">{tr}Send reminder notifications{/tr}</label>
                     <div class="col-sm-2">
-                        <input type="checkbox" class="form-check-input" name="calitem[sendReminder]" id="sendReminder" value="1" {if $calitem.sendReminder} checked="checked"{/if}>
+                        <input type="checkbox" class="form-check-input" name="calitem[sendReminder]" id="sendReminder" value="1" {if ! isset($calitem.sendReminder) or $calitem.sendReminder}checked{/if}>
                     </div>
                 </div>
                 {* / .mb-3 *}
+            {else}
+                <input type="hidden" name="calitem[sendReminder]" value="{if $calitem.calitemId}{$calitem.sendReminder}{else}1{/if}">
             {/if}
             {if $calendar.customparticipants eq 'y'}
                 <div class="mb-3 row" id="calorg">



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3183ad85e90d86323dfb3f6e32afa8bda7f23201

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3183ad85e90d86323dfb3f6e32afa8bda7f23201
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs