CMS MADE SIMPLE FORGE

CGCalendar

 

[#11342] Calendar events that start before current period and end after it aren't shown in calendars

avatar
Created By: Rimas Kudelis (rimas)
Date Submitted: Tue Mar 28 15:03:22 -0400 2017

Assigned To:
Version: 2.2
CMSMS Version: None
Severity: Minor
Resolution: None
State: Open
Summary:
Calendar events that start before current period and end after it aren't shown in calendars
Detailed Description:
If I create an event that starts on e.g. January 1st and ends on March 31st,
that event will not be visible in the admin area when I navigate to February,
even though I believe it should.

The problem can be fixed by editing action.admin_ajax_fetchevents.php and
replacing the following block:

if( $start && $end ) {
$where[] = '((E.event_date_start BETWEEN ? AND ?) OR (E.event_date_end
BETWEEN ? AND ?))';
    $parms[] = trim($db->DbTimeStamp($start),"'");
    $parms[] = trim($db->DbTimeStamp($end),"'");
    $parms[] = trim($db->DbTimeStamp($start),"'");
    $parms[] = trim($db->DbTimeStamp($end),"'");
}

with the following:

if( $start && $end ) {
    $where[] = '((E.event_date_start < ?) AND (E.event_date_end > ?))';
    $parms[] = trim($db->DbTimeStamp($end),"'");
    $parms[] = trim($db->DbTimeStamp($start),"'");
}

Note that this would skip zero-length events that occur on event_date_start  or
event_date_end. I haven't tested if it's possible to create such events, but if
it is, the comparison operators above should probably be changed to their "or
equals" siblings.


It seems that this issue is also relevant to front-end (I haven't tested
properly yet). To fix it, same change should be made to the file named
action.ajax_fetchevents.php .


History

Comments
avatar
Date: 2017-03-29 01:23
Posted By: Rimas Kudelis (rimas)

Update: I checked and indeed this is the case with the front-end calendar as
well, and my change fixes it.
      
Updates

Updated: 2017-03-29 01:23
resolution_id: => 5