Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Eventlist: Month view shows events from past months from multi-day event #8792

Closed
arno1979 opened this issue Sep 28, 2017 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@arno1979
Copy link

arno1979 commented Sep 28, 2017

An error similar to the one described in #8782 and fixed in 03d2a8b appears when using an eventlist where cal_format is set to month (applies to the setting day as well.)
But as far as I can tell the source of the error lies somewhere completely different therefore I opened this new issue.

Steps to reproduce:

  • create a multi-day event stretching from 2017-08-15 to 2017-11-22
  • create a list module with cal_format set to month and the option shortened_view set to disabled
  • include the list module on a page and load that page with the get parameter ?month=201709

Expected result:

  • show all dates from the month of September (2017-09-01 to 2017-09-30)

Actual result:

  • all dates from the start of the event (2017-08-15) until the end of September are shown (see also screenshot)

bildschirmfoto 2017-09-28 um 09 31 52

I think I also found the source of the error:
In the function addEvent in Events.php events are added by using the $intStart variable on lines 213 - 218.
In a multi-day event this always seems to be the date of the first day of the event.
I experimented with using $intBegin instead by adding $intStart = $intBegin; above line 213 and got the desired result:
Only dates from September are shown.

I am not sure if you can simply replace $intStart with $intBegin because I have not checked the implications if the list module is configured differently than in the case described here.

@leofeyer leofeyer added this to the 3.5.30 milestone Sep 28, 2017
@leofeyer
Copy link
Member

leofeyer commented Oct 5, 2017

We have changed the behavior because of #8194. Can you please test the following code:

protected function addEvent($objEvents, $intStart, $intEnd, $strUrl, $intBegin, $intLimit, $intCalendar)
{
	/** @var \PageModel $objPage */
	global $objPage;

	$span = \Calendar::calculateSpan($intStart, $intEnd);

	// Adjust the start time of a multi-day event (see #8792)
	if (!$this->cal_noSpan && $span > 0)
	{
		$intStart = $intBegin;
	}

	$intDate = $intStart;
	// …

@arno1979
Copy link
Author

arno1979 commented Oct 5, 2017

I made a quick test and your code seems to work!

@leofeyer
Copy link
Member

leofeyer commented Oct 5, 2017

Fixed in c962d5c. Did you also make sure that the code does not alter any of the other modes?

@leofeyer
Copy link
Member

leofeyer commented Oct 5, 2017

I did some extensive testing and came to the conclusion that the code did not work. I have now fixed the issue in b509bba.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants