use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getTotalProjectsOfUser.
/* Project Query */
@Override
public List<Filter> getTotalProjectsOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Project.class);
Filter filter = new JPQLFilter("self.isProject = true AND self.clientPartner.id = " + user.getPartner().getId() + " AND self.statusSelect != " + ProjectRepository.STATE_CANCELED);
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getNewTasksOfUser.
@Override
public List<Filter> getNewTasksOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, ProjectTask.class);
Filter filter = new JPQLFilter("self.status = '" + ProjectTaskRepository.STATUS_NEW + "' AND self.typeSelect = '" + ProjectTaskRepository.TYPE_TASK + "' AND self.project.clientPartner.id = " + user.getPartner().getId());
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.project.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getResolvedTicketsOfUser.
@Override
public List<Filter> getResolvedTicketsOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Ticket.class);
Filter filter = new JPQLFilter("self.customer.id = " + user.getPartner().getId() + " AND self.assignedToUser.id = " + user.getId() + " AND self.statusSelect IN (" + TicketRepository.STATUS_RESOLVED + ", " + TicketRepository.STATUS_CLOSED + ")");
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getPlannedDeliveriesOfUser.
@Override
public List<Filter> getPlannedDeliveriesOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, StockMove.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.typeSelect = " + StockMoveRepository.TYPE_OUTGOING + " AND self.statusSelect = " + StockMoveRepository.STATUS_PLANNED + " AND self.isReversion != true");
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getTicketsOfUser.
/* Helpdesk Query */
@Override
public List<Filter> getTicketsOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Ticket.class);
Filter filter = new JPQLFilter("self.customer.id = " + user.getPartner().getId() + " AND self.assignedToUser.id = " + user.getId());
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
Aggregations