users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
+
for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
- Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
- "portos_calendario");
- if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
- boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
- organization.getGroupId(), portosIstruttore.getRoleId());
- if (isIstruttore) {
+
+ Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
+
+ if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
+
+ boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
+ user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
+
+
+ if(isIstruttore){
userDefinitivo.add(user);
}
}
}
}
- } catch (NumberFormatException | PortalException | SystemException e) {
- _log.error(e, e);
+
+ } catch (NumberFormatException | SystemException e) {
+ _log.error(e,e);
+ } catch (PortalException e) {
+ _log.error(e,e);
}
+
Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
JSONArray json = JSONFactoryUtil.createJSONArray();
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
index 21ca8470..835ca8de 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
+++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
@@ -8,17 +8,17 @@
package it.tref.portos.calendar.appointments.service.impl;
+import com.liferay.portal.kernel.exception.PortalException;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.model.User;
+import com.liferay.portal.service.ServiceContext;
+
import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl;
import java.util.Date;
import java.util.List;
-import com.liferay.portal.kernel.exception.PortalException;
-import com.liferay.portal.kernel.exception.SystemException;
-import com.liferay.portal.model.User;
-import com.liferay.portal.service.ServiceContext;
-
/**
* The implementation of the funzionario local service.
*
@@ -40,9 +40,8 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
* service.
*/
- @Override
- public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
- ServiceContext serviceContext) throws PortalException, SystemException {
+ public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
+ ServiceContext serviceContext) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
@@ -75,9 +74,8 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
return this.deleteFunzionario(funzionario);
}
- @Override
- public List findByPresidio(String presidio) throws SystemException {
+ public List findByPresidio(String presidio) throws SystemException {
+ return funzionarioPersistence.findByPresidio(presidio);
+ }
- return funzionarioPersistence.findByPresidio(presidio);
- }
}
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
index 447943fe..46611410 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
+++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
@@ -8,7 +8,6 @@
package it.tref.portos.calendar.appointments.service.impl;
-import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl;
@@ -23,7 +22,6 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
-import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Role;
@@ -32,6 +30,8 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
+import com.liferay.portal.service.UserLocalServiceUtil;
+import it.tref.liferay.portos.bo.shared.util.Constants;
/**
* The implementation of the funzionario remote service.
@@ -55,59 +55,81 @@ public class FunzionarioServiceImpl extends FunzionarioServiceBaseImpl {
private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class);
- @Override
- public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
- ServiceContext serviceContext) throws PortalException, SystemException {
+ public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
+ ServiceContext serviceContext) throws PortalException, SystemException {
return funzionarioLocalService.addFunzionario(userId, nome, cognome, presidio, tipologia, serviceContext);
}
- @Override
- public String getFunzionariByPresidio(String presidio) {
-
- JSONArray json = JSONFactoryUtil.createJSONArray();
- try {
- Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
- if (organization != null) {
- List users = userLocalService.getOrganizationUsers(Long.valueOf(presidio));
- Collections.sort(users, new UserComparator());
- for (User user : users) {
- Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
- Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
- Constants.ROLE_NAME_GEOLOGO);
- Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
- "portos_calendario");
- Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
- Constants.ROLE_NAME_ISTRUTTORE);
- if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
- boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
- organization.getGroupId(), portosCalendario.getRoleId());
- boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
- organization.getGroupId(), portosIstruttore.getRoleId());
- boolean isGeologo = userLocalService.hasRoleUser(portosGeologo.getRoleId(),
- user.getUserId());
- if (isCalendario) {
- JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
- jsonFunzionario.put("id", user.getUserId());
- jsonFunzionario.put("nome", user.getFirstName());
- jsonFunzionario.put("cognome", user.getLastName());
- if (isIstruttore) {
- jsonFunzionario.put("tipologia", "Istruttore");
- } else if (isGeologo) {
- jsonFunzionario.put("tipologia", "Geologo");
- } else {
- jsonFunzionario.put("tipologia", StringPool.BLANK);
- }
- json.put(jsonFunzionario);
+ public String getFunzionariByPresidio(String presidio) {
+
+ JSONArray json = JSONFactoryUtil.createJSONArray();
+
+ try {
+
+ Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
+
+ if(organization != null){
+
+ List users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
+
+ //Bug 32935
+ Collections.sort(users, new UserComparator());
+
+ for (User user : users) {
+
+ Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
+
+ Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_GEOLOGO);
+
+ Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
+
+ Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_ISTRUTTORE);
+
+ if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
+
+ boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
+ user.getUserId(), organization.getGroupId(), portosCalendario.getRoleId());
+
+ boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
+ user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
+
+ boolean isGeologo = UserLocalServiceUtil.hasRoleUser(portosGeologo.getRoleId(), user.getUserId());
+
+
+ if(isCalendario){
+ JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
+ jsonFunzionario.put("id", user.getUserId());
+ jsonFunzionario.put("nome", user.getFirstName());
+ jsonFunzionario.put("cognome", user.getLastName());
+
+ if(isIstruttore){
+ jsonFunzionario.put("tipologia", "Istruttore");
+ } else if(isGeologo){
+ jsonFunzionario.put("tipologia", "Geologo");
+ } else {
+ jsonFunzionario.put("tipologia", "");
}
+
+
+
+
+ json.put(jsonFunzionario);
}
}
}
- } catch (NumberFormatException | PortalException | SystemException e) {
- _log.error(e, e);
}
- return json.toString();
+
+ } catch (NumberFormatException | SystemException e) {
+ _log.error(e,e);
+ } catch (PortalException e) {
+ _log.error(e,e);
}
+
+ return json.toString();
+ }
+
+
}
class UserComparator implements Comparator {
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
index 8e7e7acd..d654039d 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
+++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
@@ -1,4 +1,3 @@
-<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.liferay.portal.model.Role"%>
<%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%>
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
index 4b1c0905..6a89a46b 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
+++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
@@ -1,4 +1,3 @@
-<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%>
@@ -245,11 +244,11 @@ String dataFine = ParamUtil.getString(request, "dataFineRicerca","");