use of com.axelor.rpc.filter.Filter 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;
}
use of com.axelor.rpc.filter.Filter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getCompanyTicketsOfUser.
@Override
public List<Filter> getCompanyTicketsOfUser(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.getActiveCompany().getId());
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.Filter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getRefundOfUser.
@Override
public List<Filter> getRefundOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Invoice.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.operationTypeSelect = " + InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND);
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.Filter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getTasksDueOfUser.
@Override
public List<Filter> getTasksDueOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, ProjectTask.class);
Filter filter = new JPQLFilter("self.status IN ('" + ProjectTaskRepository.STATUS_NEW + "','" + ProjectTaskRepository.STATUS_IN_PROGRESS + "') AND self.project.clientPartner.id = " + user.getPartner().getId() + " AND self.typeSelect = '" + ProjectTaskRepository.TYPE_TASK + "' AND self.taskEndDate < current_date() ");
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.Filter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getOverdueInvoicesOfUser.
/* Invoice Query */
@Override
public List<Filter> getOverdueInvoicesOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Invoice.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.dueDate < current_date() " + " AND self.amountRemaining != 0 AND self.statusSelect != " + InvoiceRepository.STATUS_DRAFT + " AND self.statusSelect != " + InvoiceRepository.STATUS_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;
}
Aggregations