juanferrub/liferay-portal — pull request #298 by matethurzo (2012-09-07 14:21:05+00:00)
Title: LPS-19928 Fixing end date problems in calendar

Hi Juan,

The calendar portlet currently saves an end date to the DB table no matter if the event is repeating or not, or if the user has defined an end date or not. By doing this, if the actual date passes through the saved end date somehow the portal won't send any email notification about it, because the finder won't be able to find it.

Now I think the first solution to this problem is to not save any end date to the DB table if it does not makes any sense, like the event is not repeating or we don't have end date specified there.

The second problem was that the calendar portlet handles the end date at two different locations: in the end date field and in the recurrence as well. If we take a look on the EditEventAction class where the UI parameters are getting processed we use the endDateDay, endDateMonth and endDateYear to set the recurrence object's until date. So I've decided to clean up the methods, because we already have that information in the recurrence object, and use the recurrence.getUntil to determine if we have to save an end date or not.
The validate method in the CalEventLocalService was also inconsistent because it checked the end date in those cases when it wasn't in use as well.
I've also modified the CalendarPortletDataHandlerImpl as well by getting rid of the unnecessary code.

So basically this is what I've done in this PR:
- Calendar portlet won't save any end date if it's not necessary
- Calendar portlet will use the endDate* fields and the recurrence in a more consistent way - we will only use the endDate* fields to assemble the recurrence object's until field.

This saved up some code and the bug is also fixed.

Thanks,

Máté