use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getQuotationsOfUser.
@Override
public List<Filter> getQuotationsOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, SaleOrder.class);
Filter filter = new JPQLFilter("self.clientPartner.id = " + user.getPartner().getId() + " AND self.statusSelect IN (" + SaleOrderRepository.STATUS_DRAFT_QUOTATION + "," + SaleOrderRepository.STATUS_FINALIZED_QUOTATION + ")");
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 getTasksInProgressOfUser.
@Override
public List<Filter> getTasksInProgressOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, ProjectTask.class);
Filter filter = new JPQLFilter("self.status = '" + ProjectTaskRepository.STATUS_IN_PROGRESS + "' 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 getLateTicketsOfUser.
@Override
public List<Filter> getLateTicketsOfUser(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.endDateT != null AND self.endDateT > self.deadlineDateT) " + " OR (self.endDateT = null and self.deadlineDateT < current_date() ) )");
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 getNextDeliveryOfUser.
@Override
public List<Filter> getNextDeliveryOfUser(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 getLastOrderOfUser.
@Override
public List<Filter> getLastOrderOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, SaleOrder.class);
Filter filter = new JPQLFilter("self.clientPartner.id = " + user.getPartner().getId() + " AND self.statusSelect = " + SaleOrderRepository.STATUS_ORDER_COMPLETED);
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
Aggregations