use of com.axelor.apps.crm.service.LeadService in project axelor-open-suite by axelor.
the class LeadController method checkLeadName.
/**
* Called from lead view on name change and onLoad. Call {@link
* LeadService#isThereDuplicateLead(Lead)}
*
* @param request
* @param response
*/
public void checkLeadName(ActionRequest request, ActionResponse response) {
Lead lead = request.getContext().asType(Lead.class);
response.setAttr("duplicateLeadText", "hidden", !Beans.get(LeadService.class).isThereDuplicateLead(lead));
}
use of com.axelor.apps.crm.service.LeadService in project axelor-open-suite by axelor.
the class EventController method assignToMeLead.
@SuppressWarnings("rawtypes")
public void assignToMeLead(ActionRequest request, ActionResponse response) {
LeadService leadService = Beans.get(LeadService.class);
LeadRepository leadRepo = Beans.get(LeadRepository.class);
if (request.getContext().get("id") != null) {
Lead lead = leadRepo.find((Long) request.getContext().get("id"));
lead.setUser(AuthUtils.getUser());
if (lead.getStatusSelect() == LeadRepository.LEAD_STATUS_NEW)
lead.setStatusSelect(LeadRepository.LEAD_STATUS_ASSIGNED);
leadService.saveLead(lead);
} else if (((List) request.getContext().get("_ids")) != null) {
for (Lead lead : leadRepo.all().filter("id in ?1", request.getContext().get("_ids")).fetch()) {
lead.setUser(AuthUtils.getUser());
if (lead.getStatusSelect() == LeadRepository.LEAD_STATUS_NEW)
lead.setStatusSelect(LeadRepository.LEAD_STATUS_ASSIGNED);
leadService.saveLead(lead);
}
}
response.setReload(true);
}
Aggregations