use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerBaseRepository method populate.
@Override
public Map<String, Object> populate(Map<String, Object> json, Map<String, Object> context) {
if (!context.containsKey("json-enhance")) {
return json;
}
try {
Long id = (Long) json.get("id");
Partner partner = find(id);
json.put("address", Beans.get(PartnerService.class).getDefaultAddress(partner));
} catch (Exception e) {
e.printStackTrace();
}
return json;
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerBaseRepository method copy.
@Override
public Partner copy(Partner partner, boolean deep) {
Partner copy = super.copy(partner, deep);
copy.setPartnerSeq(null);
copy.setEmailAddress(null);
PartnerAddressRepository partnerAddressRepository = Beans.get(PartnerAddressRepository.class);
List<PartnerAddress> partnerAddressList = Lists.newArrayList();
if (deep && copy.getPartnerAddressList() != null) {
for (PartnerAddress partnerAddress : copy.getPartnerAddressList()) {
partnerAddressList.add(partnerAddressRepository.copy(partnerAddress, deep));
}
}
copy.setPartnerAddressList(partnerAddressList);
copy.setBlockingList(null);
copy.setBankDetailsList(null);
return copy;
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class UserBaseRepository method remove.
@Override
public void remove(User user) {
if (user.getPartner() != null) {
PartnerBaseRepository partnerRepo = Beans.get(PartnerBaseRepository.class);
Partner partner = partnerRepo.find(user.getPartner().getId());
if (partner != null) {
partner.setLinkedUser(null);
partnerRepo.save(partner);
}
}
super.remove(user);
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class EmployeeController method setContactSocialNetworkUrl.
public void setContactSocialNetworkUrl(ActionRequest request, ActionResponse response) {
Partner partnerContact = request.getContext().asType(Partner.class);
Map<String, String> urlMap = Beans.get(EmployeeService.class).getSocialNetworkUrl(partnerContact.getName(), partnerContact.getFirstName());
response.setAttr("facebookLabel", "title", urlMap.get("facebook"));
response.setAttr("twitterLabel", "title", urlMap.get("twitter"));
response.setAttr("linkedinLabel", "title", urlMap.get("linkedin"));
response.setAttr("youtubeLabel", "title", urlMap.get("youtube"));
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class CampaignServiceImpl method generateEvents.
@Transactional
public void generateEvents(Campaign campaign) {
LocalDateTime eventStartDateTime = campaign.getEventStartDateTime();
LocalDateTime eventEndDateTime = campaign.getEventEndDateTime();
Long duration = campaign.getDuration();
for (Partner partner : campaign.getPartnerSet()) {
Event event = new Event();
if (partner.getIsContact()) {
event.setContactPartner(partner);
} else {
event.setPartner(partner);
}
event.setUser(campaign.getGenerateEventPerPartnerOrLead() ? partner.getUser() : campaign.getEventUser());
event.setSubject(campaign.getSubject());
event.setTypeSelect(campaign.getEventTypeSelect());
event.setStartDateTime(eventStartDateTime);
event.setEndDateTime(eventEndDateTime);
event.setDuration(duration);
event.setTeam(campaign.getGenerateEventPerPartnerOrLead() ? partner.getTeam() : campaign.getTeam());
event.setCampaign(campaign);
event.setStatusSelect(1);
eventRepo.save(event);
}
for (Lead lead : campaign.getLeadSet()) {
Event event = new Event();
event.setLead(lead);
event.setUser(campaign.getGenerateEventPerPartnerOrLead() ? lead.getUser() : campaign.getEventUser());
event.setSubject(campaign.getSubject());
event.setTypeSelect(campaign.getEventTypeSelect());
event.setStartDateTime(eventStartDateTime);
event.setEndDateTime(eventEndDateTime);
event.setDuration(duration);
event.setTeam(campaign.getGenerateEventPerPartnerOrLead() ? lead.getTeam() : campaign.getTeam());
event.setCampaign(campaign);
event.setStatusSelect(1);
eventRepo.save(event);
}
}
Aggregations