Sfoglia il codice sorgente

align

feature/allineamento-sorgenti
E-A B 2 anni fa
parent
commit
49f693edb5
  1. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/audit/service/persistence/AuditEventPersistenceImpl.java
  2. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/details_column.jsp
  3. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/relations_column.jsp
  4. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/detail.jsp
  5. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view.jsp
  6. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view_list.jsp
  7. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/edit.jsp
  8. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/view.jsp
  9. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-hook.xml
  10. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java
  11. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java
  12. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java
  13. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java
  14. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java
  15. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java
  16. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java
  17. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java
  18. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/DisponibilitaImpl.java
  19. 8
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/FunzionarioImpl.java
  20. 17
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/PrenotazioneImpl.java
  21. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/ProfessionistaImpl.java
  22. 29
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaLocalServiceImpl.java
  23. 52
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaServiceImpl.java
  24. 22
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
  25. 112
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
  26. 211
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneLocalServiceImpl.java
  27. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneServiceImpl.java
  28. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
  29. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
  30. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp
  31. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita_action.jsp
  32. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/view.jsp
  33. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/init.jsp
  34. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/view.jsp
  35. 1
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/audit/service/persistence/AuditEventPersistenceImpl.java

@ -43,6 +43,7 @@ import it.tref.liferay.portos.audit.NoSuchAuditEventException;
import it.tref.liferay.portos.audit.model.AuditEvent; import it.tref.liferay.portos.audit.model.AuditEvent;
import it.tref.liferay.portos.audit.model.impl.AuditEventImpl; import it.tref.liferay.portos.audit.model.impl.AuditEventImpl;
import it.tref.liferay.portos.audit.model.impl.AuditEventModelImpl; import it.tref.liferay.portos.audit.model.impl.AuditEventModelImpl;
import it.tref.liferay.portos.audit.service.persistence.AuditEventPersistence;
import java.io.Serializable; import java.io.Serializable;

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/details_column.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.util.TextFormatter"%> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%>
<%@page import="com.liferay.portal.kernel.json.JSONArray"%> <%@page import="com.liferay.portal.kernel.json.JSONArray"%>
<%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%> <%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/relations_column.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.util.TextFormatter"%> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%>
<%@page import="com.liferay.portal.kernel.json.JSONArray"%> <%@page import="com.liferay.portal.kernel.json.JSONArray"%>
<%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%> <%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/detail.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view_list.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/edit.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/html/init.jsp" %> <%@ include file="/html/init.jsp" %>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/view.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/html/init.jsp" %> <%@ include file="/html/init.jsp" %>

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-hook.xml

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd"> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook> <hook>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java

@ -13,6 +13,7 @@ import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class DuplicateFunzionarioException extends PortalException { public class DuplicateFunzionarioException extends PortalException {
public DuplicateFunzionarioException() { public DuplicateFunzionarioException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java

@ -13,6 +13,7 @@ import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class DuplicatePrenotazioneException extends PortalException { public class DuplicatePrenotazioneException extends PortalException {
public DuplicatePrenotazioneException() { public DuplicatePrenotazioneException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java

@ -13,6 +13,7 @@ import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class DuplicateProfessionistaException extends PortalException { public class DuplicateProfessionistaException extends PortalException {
public DuplicateProfessionistaException() { public DuplicateProfessionistaException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java

@ -13,6 +13,7 @@ import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class NoSuchDisponibilitaException extends NoSuchModelException { public class NoSuchDisponibilitaException extends NoSuchModelException {
public NoSuchDisponibilitaException() { public NoSuchDisponibilitaException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java

@ -13,6 +13,7 @@ import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class NoSuchFunzionarioException extends NoSuchModelException { public class NoSuchFunzionarioException extends NoSuchModelException {
public NoSuchFunzionarioException() { public NoSuchFunzionarioException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java

@ -13,6 +13,7 @@ import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class NoSuchPrenotazioneException extends NoSuchModelException { public class NoSuchPrenotazioneException extends NoSuchModelException {
public NoSuchPrenotazioneException() { public NoSuchPrenotazioneException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java

@ -13,6 +13,7 @@ import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class NoSuchProfessionistaException extends NoSuchModelException { public class NoSuchProfessionistaException extends NoSuchModelException {
public NoSuchProfessionistaException() { public NoSuchProfessionistaException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java

@ -13,6 +13,7 @@ import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class SlotNotAvailableException extends PortalException { public class SlotNotAvailableException extends PortalException {
public SlotNotAvailableException() { public SlotNotAvailableException() {

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/DisponibilitaImpl.java

@ -20,6 +20,7 @@ package it.tref.portos.calendar.appointments.model.impl;
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class DisponibilitaImpl extends DisponibilitaBaseImpl { public class DisponibilitaImpl extends DisponibilitaBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a disponibilita model instance * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a disponibilita model instance

8
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/FunzionarioImpl.java

@ -22,6 +22,7 @@ import com.liferay.portal.kernel.util.StringPool;
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class FunzionarioImpl extends FunzionarioBaseImpl { public class FunzionarioImpl extends FunzionarioBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a funzionario model instance * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a funzionario model instance
@ -29,7 +30,8 @@ public class FunzionarioImpl extends FunzionarioBaseImpl {
*/ */
public FunzionarioImpl() {} public FunzionarioImpl() {}
public String getFullDescription() { @Override
return getNome() + StringPool.SPACE + getCognome(); public String getFullDescription() {
} return getNome() + StringPool.SPACE + getCognome();
}
} }

17
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/PrenotazioneImpl.java

@ -24,6 +24,7 @@ import org.apache.commons.lang.time.DateUtils;
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class PrenotazioneImpl extends PrenotazioneBaseImpl { public class PrenotazioneImpl extends PrenotazioneBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a prenotazione model instance * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a prenotazione model instance
@ -31,17 +32,9 @@ public class PrenotazioneImpl extends PrenotazioneBaseImpl {
*/ */
public PrenotazioneImpl() {} public PrenotazioneImpl() {}
public boolean isExpired(Date now) { @Override
public boolean isExpired(Date now) {
if (now.after(getStartDate())) { return now.after(getStartDate()) || DateUtils.isSameDay(now, getStartDate());
return true; }
}
if (DateUtils.isSameDay(now, getStartDate())) {
return true;
}
return false;
}
} }

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/ProfessionistaImpl.java

@ -20,6 +20,7 @@ package it.tref.portos.calendar.appointments.model.impl;
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting + Manifattura Web Group s.r.l.
*/ */
@SuppressWarnings("serial")
public class ProfessionistaImpl extends ProfessionistaBaseImpl { public class ProfessionistaImpl extends ProfessionistaBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a professionista model instance * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a professionista model instance

29
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaLocalServiceImpl.java

@ -286,9 +286,10 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
Calendar cal2 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1); cal1.setTime(date1);
cal2.setTime(date2); cal2.setTime(date2);
boolean sameDay =
cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) boolean sameDay = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
&& cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR); cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);
return sameDay; return sameDay;
} }
@ -315,10 +316,10 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
return results; return results;
}
} }
public List<Disponibilita> findByFunzionario_StartDate(long funzionarioId, Date date, long presidio) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22); Date end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
@ -369,11 +370,11 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if (organization.getParentOrganization() != null) {
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
@ -424,11 +425,11 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if (organization.getParentOrganization() != null) {
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());

52
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaServiceImpl.java

@ -11,7 +11,6 @@ package it.tref.portos.calendar.appointments.service.impl;
import it.tref.portos.calendar.appointments.model.Disponibilita; import it.tref.portos.calendar.appointments.model.Disponibilita;
import it.tref.portos.calendar.appointments.model.Funzionario; import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.model.Prenotazione; import it.tref.portos.calendar.appointments.model.Prenotazione;
import it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil;
import it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl;
import java.text.ParseException; import java.text.ParseException;
@ -38,7 +37,6 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the disponibilita remote service. * The implementation of the disponibilita remote service.
@ -63,6 +61,7 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class);
@Override
public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio, public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
@ -70,6 +69,7 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
serviceContext); serviceContext);
} }
@Override
public List<Disponibilita> addDisponibilitaGenerale(long presidio, long userId, Date dataInizioDisponibilita, public List<Disponibilita> addDisponibilitaGenerale(long presidio, long userId, Date dataInizioDisponibilita,
Date dataFineDisponibilita, String giornoSettimana, String oraInizioDisponibilita, Date dataFineDisponibilita, String giornoSettimana, String oraInizioDisponibilita,
String oraFineDisponibilita, ServiceContext serviceContext) throws SystemException, PortalException { String oraFineDisponibilita, ServiceContext serviceContext) throws SystemException, PortalException {
@ -87,7 +87,9 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
return listDisponibilita; return listDisponibilita;
} }
public String verifyDisponibilitaByDateHour(String presidio, String date,String[] oreInizio, String idFunzionario) throws SystemException, ParseException { @Override
public String verifyDisponibilitaByDateHour(String presidio, String date, String[] oreInizio, String idFunzionario)
throws SystemException, ParseException {
JSONObject json = JSONFactoryUtil.createJSONObject(); JSONObject json = JSONFactoryUtil.createJSONObject();
JSONArray array = JSONFactoryUtil.createJSONArray(); JSONArray array = JSONFactoryUtil.createJSONArray();
@ -99,18 +101,9 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
String oraInizio = oreInizio[i]; String oraInizio = oreInizio[i];
jsonFiglio.put("ora", oraInizio); jsonFiglio.put("ora", oraInizio);
Date dateVerify = formatDateTime(oraInizio, dateVerifyTemp); Date dateVerify = formatDateTime(oraInizio, dateVerifyTemp);
List<Prenotazione> lista = prenotazioneLocalService.findByDateHourFunzionario(dateVerify,
Long.parseLong(idFunzionario), org.getGroupId());
List<Prenotazione> lista = jsonFiglio.put("disponibile", lista.isEmpty());
PrenotazioneLocalServiceUtil.findByDateHourFunzionario(
dateVerify, Long.parseLong(idFunzionario), org.getGroupId());
if(lista.isEmpty()){
jsonFiglio.put("disponibile", true);
} else {
jsonFiglio.put("disponibile", false);
}
array.put(jsonFiglio); array.put(jsonFiglio);
} }
json.put("slot", array); json.put("slot", array);
@ -124,32 +117,23 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio)); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
List<User> userDefinitivo = new ArrayList<User>(); List<User> userDefinitivo = new ArrayList<User>();
try { try {
if (organization != null) {
if(organization != null){ List<User> users = userLocalService.getOrganizationUsers(Long.valueOf(presidio));
List<User> users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
for (User user : users) { for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario"); "portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){ boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosIstruttore.getRoleId());
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole( if (isIstruttore) {
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
userDefinitivo.add(user); userDefinitivo.add(user);
} }
} }
} }
} }
} catch (NumberFormatException | PortalException | SystemException e) {
} catch (NumberFormatException | SystemException e) { _log.error(e, e);
_log.error(e,e);
} catch (PortalException e) {
_log.error(e,e);
} }
Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date); Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date);

22
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; 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.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl;
import java.util.Date; import java.util.Date;
import java.util.List; 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. * The implementation of the funzionario local service.
* <p> * <p>
@ -40,8 +40,9 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
* service. * service.
*/ */
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia, @Override
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); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); Date now = new Date();
@ -74,8 +75,9 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
return this.deleteFunzionario(funzionario); return this.deleteFunzionario(funzionario);
} }
public List<Funzionario> findByPresidio(String presidio) throws SystemException { @Override
return funzionarioPersistence.findByPresidio(presidio); public List<Funzionario> findByPresidio(String presidio) throws SystemException {
}
return funzionarioPersistence.findByPresidio(presidio);
}
} }

112
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java

@ -8,6 +8,7 @@
package it.tref.portos.calendar.appointments.service.impl; 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.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl;
@ -22,6 +23,7 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; 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.kernel.util.Validator;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Role; import com.liferay.portal.model.Role;
@ -30,8 +32,6 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; 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. * The implementation of the funzionario remote service.
@ -55,81 +55,59 @@ public class FunzionarioServiceImpl extends FunzionarioServiceBaseImpl {
private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class);
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia, @Override
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); return funzionarioLocalService.addFunzionario(userId, nome, cognome, presidio, tipologia, serviceContext);
} }
public String getFunzionariByPresidio(String presidio) { @Override
public String getFunzionariByPresidio(String presidio) {
JSONArray json = JSONFactoryUtil.createJSONArray();
JSONArray json = JSONFactoryUtil.createJSONArray();
try { try {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio)); if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(Long.valueOf(presidio));
if(organization != null){ Collections.sort(users, new UserComparator());
for (User user : users) {
List<User> users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio)); Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
//Bug 32935 Constants.ROLE_NAME_GEOLOGO);
Collections.sort(users, new UserComparator()); Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
"portos_calendario");
for (User user : users) { Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
Constants.ROLE_NAME_ISTRUTTORE);
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_GEOLOGO); organization.getGroupId(), portosCalendario.getRoleId());
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario"); organization.getGroupId(), portosIstruttore.getRoleId());
boolean isGeologo = userLocalService.hasRoleUser(portosGeologo.getRoleId(),
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_ISTRUTTORE); user.getUserId());
if (isCalendario) {
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){ JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
jsonFunzionario.put("id", user.getUserId());
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole( jsonFunzionario.put("nome", user.getFirstName());
user.getUserId(), organization.getGroupId(), portosCalendario.getRoleId()); jsonFunzionario.put("cognome", user.getLastName());
if (isIstruttore) {
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole( jsonFunzionario.put("tipologia", "Istruttore");
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId()); } else if (isGeologo) {
jsonFunzionario.put("tipologia", "Geologo");
boolean isGeologo = UserLocalServiceUtil.hasRoleUser(portosGeologo.getRoleId(), user.getUserId()); } else {
jsonFunzionario.put("tipologia", StringPool.BLANK);
}
if(isCalendario){ json.put(jsonFunzionario);
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<User> { class UserComparator implements Comparator<User> {

211
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneLocalServiceImpl.java

@ -33,6 +33,7 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the prenotazione local service. * The implementation of the prenotazione local service.
@ -55,45 +56,56 @@ public class PrenotazioneLocalServiceImpl extends PrenotazioneLocalServiceBaseIm
* service. * service.
*/ */
@Override //Product Backlog Item 32934
public Prenotazione addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate, public Prenotazione addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate,
Date endDate, String descrizione, String telefono, String email, long presidio, Date endDate, String descrizione, String telefono, String email, long presidio, ServiceContext serviceContext) throws SystemException, PortalException {
ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione =
prenotazionePersistence.create(counterLocalService.increment(Prenotazione.class.getName()));
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
prenotazione.setCompanyId(serviceContext.getCompanyId());
prenotazione.setUserId(user.getUserId());
prenotazione.setUserName(user.getFullName());
prenotazione.setCreateDate(serviceContext.getCreateDate(now));
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setGroupId(presidio);
prenotazione.setFunzionarioId(funzionarioId);
prenotazione.setProfessionistaId(professionistaId);
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
prenotazione.setTelefono(telefono);
prenotazione.setEmail(email);
prenotazione = updatePrenotazione(prenotazione);
return prenotazione;
}
@Override Prenotazione prenotazione =
public Prenotazione updatePrenotazione(long prenotazioneId, Date startDate, Date endDate, String descrizione, prenotazionePersistence.create(counterLocalService.increment(Prenotazione.class.getName()));
ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now)); Date now = new Date();
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate); prenotazione.setCompanyId(serviceContext.getCompanyId());
prenotazione.setDescLong(descrizione); prenotazione.setUserId(user.getUserId());
prenotazione = updatePrenotazione(prenotazione); prenotazione.setUserName(user.getFullName());
return prenotazione; prenotazione.setCreateDate(serviceContext.getCreateDate(now));
} prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setGroupId(presidio);
prenotazione.setFunzionarioId(funzionarioId);
prenotazione.setProfessionistaId(professionistaId);
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
//Product Backlog Item 32934
prenotazione.setTelefono(telefono);
prenotazione.setEmail(email);
prenotazione = prenotazioneLocalService.updatePrenotazione(prenotazione);
return prenotazione;
}
public Prenotazione updatePrenotazione(long prenotazioneId, Date startDate, Date endDate, String descrizione,
ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId);
Date now = new Date();
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
prenotazione = prenotazioneLocalService.updatePrenotazione(prenotazione);
return prenotazione;
}
@Override @Override
public Prenotazione deletePrenotazione(Prenotazione prenotazione) throws SystemException { public Prenotazione deletePrenotazione(Prenotazione prenotazione) throws SystemException {
@ -108,33 +120,31 @@ public class PrenotazioneLocalServiceImpl extends PrenotazioneLocalServiceBaseIm
return this.deletePrenotazione(prenotazione); return this.deletePrenotazione(prenotazione);
} }
@SuppressWarnings("unchecked") public List<Prenotazione> findByStartDate(Date date) throws SystemException {
@Override Date start = DateUtils.truncate(date, java.util.Calendar.DAY_OF_MONTH);
public List<Prenotazione> findByStartDate(Date date) throws SystemException { Date end = DateUtils.addDays(start, 1);
Date start = DateUtils.truncate(date, java.util.Calendar.DAY_OF_MONTH); DynamicQuery dynamicQuery = dynamicQuery();
Date end = DateUtils.addDays(start, 1); dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end));
DynamicQuery dynamicQuery = dynamicQuery(); dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId"));
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end)); return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId"));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
@SuppressWarnings("unchecked") }
@Override
public List<Prenotazione> findByDateHourFunzionario(Date date, long funzionarioId, long groupId) public List<Prenotazione> findByDateHourFunzionario(Date date, long funzionarioId, long groupId) throws SystemException {
throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", date));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", date));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
} }
@Override public int getAvailableSlotByStartDate_EndDate(long funzionarioId, Date startDate, Date endDate)
public int getAvailableSlotByStartDate_EndDate(long funzionarioId, Date startDate, Date endDate) throws SystemException {
throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
@ -151,45 +161,54 @@ public class PrenotazioneLocalServiceImpl extends PrenotazioneLocalServiceBaseIm
return (int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery); return (int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery);
} }
@SuppressWarnings("unchecked") }
@Override
public List<Prenotazione> findByFunzionario_StartDate(long funzionarioId, Date date, long groupId)
throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); public List<Prenotazione> findByFunzionario_StartDate(long funzionarioId, Date date, long groupId) throws SystemException {
Date end = DateUtils.addHours(start, 22); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); Date end = DateUtils.addHours(start, 22);
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId)); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
} dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
public int countPrenotazioniPresidioPeriodo(long presidioId, String fromString, String toString) throws SystemException, PortalException, ParseException{
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date from = sdf.parse(fromString);
Date to = sdf.parse(toString);
Calendar fromCal = Calendar.getInstance();
fromCal.setTime(from);
fromCal.set(Calendar.HOUR_OF_DAY, 2);
Calendar toCal = Calendar.getInstance();
toCal.setTime(to);
toCal.set(Calendar.HOUR_OF_DAY, 22);
Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
Role portosCalendario = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_calendario");
if (org != null) {
List<User> users = UserLocalServiceUtil.getOrganizationUsers(presidioId);
for (User user : users) {
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), org.getGroupId(), portosCalendario.getRoleId());
if(isCalendario){
DynamicQuery dynamicQuery = dynamicQuery();
@Override
public int countPrenotazioniPresidioPeriodo(long presidioId, String fromString, String toString)
throws SystemException, PortalException, ParseException {
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date from = sdf.parse(fromString);
Date to = sdf.parse(toString);
Calendar fromCal = Calendar.getInstance();
fromCal.setTime(from);
fromCal.set(Calendar.HOUR_OF_DAY, 2);
Calendar toCal = Calendar.getInstance();
toCal.setTime(to);
toCal.set(Calendar.HOUR_OF_DAY, 22);
Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
Role portosCalendario = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_calendario");
if (org != null) {
List<User> users = userLocalService.getOrganizationUsers(presidioId);
for (User user : users) {
boolean isCalendario =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), org.getGroupId(),
portosCalendario.getRoleId());
if (isCalendario) {
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", fromCal.getTime(), toCal.getTime())); dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", fromCal.getTime(), toCal.getTime()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId()));

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneServiceImpl.java

@ -113,6 +113,7 @@ public class PrenotazioneServiceImpl extends PrenotazioneServiceBaseImpl {
} catch (NumberFormatException | PortalException | SystemException e) { } catch (NumberFormatException | PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
} }
Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date); Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
JSONArray json = JSONFactoryUtil.createJSONArray(); JSONArray json = JSONFactoryUtil.createJSONArray();

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%> <%@page import="java.util.ArrayList"%>
<%@page import="com.liferay.portal.model.Role"%> <%@page import="com.liferay.portal.model.Role"%>
<%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%> <%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%> <%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%> <%@page import="com.liferay.portal.model.Organization"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%> <%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%> <%@page import="com.liferay.portal.model.Organization"%>
<%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita_action.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.portos.calendar.appointments.model.Disponibilita"%> <%@page import="it.tref.portos.calendar.appointments.model.Disponibilita"%>
<%@ include file="/html/calendar_appointments/init.jsp" %> <%@ include file="/html/calendar_appointments/init.jsp" %>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/view.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%> <%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%>
<%@ include file="/html/calendar_appointments/init.jsp" %> <%@ include file="/html/calendar_appointments/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/init.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.text.Format"%> <%@page import="java.text.Format"%>
<%@page import="com.liferay.portal.kernel.util.FastDateFormatFactoryUtil"%> <%@page import="com.liferay.portal.kernel.util.FastDateFormatFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringUtil"%> <%@page import="com.liferay.portal.kernel.util.StringUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/view.jsp

@ -1,3 +1,4 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% <%
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.

1
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

Caricamento…
Annulla
Salva