Skip to content

Commit bd89933

Browse files
carolmariaabbbrianchandotcom
authored andcommitted
LPD-51804 Generate new URL to view calendar booking
1 parent 9a88f7f commit bd89933

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

modules/apps/calendar/calendar-service/src/main/java/com/liferay/calendar/internal/notification/NotificationTemplateContextFactory.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import com.liferay.portal.kernel.service.GroupLocalService;
2929
import com.liferay.portal.kernel.service.LayoutLocalService;
3030
import com.liferay.portal.kernel.service.ServiceContext;
31+
import com.liferay.portal.kernel.service.ServiceContextThreadLocal;
32+
import com.liferay.portal.kernel.theme.ThemeDisplay;
3133
import com.liferay.portal.kernel.util.CalendarUtil;
3234
import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil;
3335
import com.liferay.portal.kernel.util.FileUtil;
@@ -217,6 +219,21 @@ private static String _getCalendarBookingURL(
217219
User user)
218220
throws Exception {
219221

222+
ServiceContext serviceContext =
223+
ServiceContextThreadLocal.getServiceContext();
224+
225+
if (serviceContext != null) {
226+
ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();
227+
228+
if (themeDisplay != null) {
229+
return StringBundler.concat(
230+
themeDisplay.getPortalURL(),
231+
themeDisplay.getPathFriendlyURLPublic(),
232+
"/calendar/shared/-/calendar/",
233+
calendarBooking.getCalendarBookingId());
234+
}
235+
}
236+
220237
String url = layoutURL;
221238

222239
if (layoutURL == null) {

modules/apps/calendar/calendar-web/src/main/java/com/liferay/calendar/web/internal/info/item/provider/CalendarBookingInfoItemFieldValuesProvider.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.liferay.info.item.provider.InfoItemFieldValuesProvider;
1919
import com.liferay.info.localized.InfoLocalizedValue;
2020
import com.liferay.layout.page.template.info.item.provider.DisplayPageInfoItemFieldSetProvider;
21+
import com.liferay.petra.string.StringBundler;
2122
import com.liferay.petra.string.StringPool;
2223
import com.liferay.portal.kernel.exception.PortalException;
2324
import com.liferay.portal.kernel.language.Language;
@@ -92,6 +93,16 @@ calendarBooking, _getThemeDisplay())
9293
* User, long)}
9394
*/
9495
protected String getCalendarBookingURL(CalendarBooking calendarBooking) {
96+
ThemeDisplay themeDisplay = _getThemeDisplay();
97+
98+
if (themeDisplay != null) {
99+
return StringBundler.concat(
100+
themeDisplay.getPortalURL(),
101+
themeDisplay.getPathFriendlyURLPublic(),
102+
"/calendar/shared/-/calendar/",
103+
calendarBooking.getCalendarBookingId());
104+
}
105+
95106
try {
96107
Company company = _companyLocalService.getCompany(
97108
calendarBooking.getCompanyId());

0 commit comments

Comments
 (0)