use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerController method showPartnerOnMap.
public void showPartnerOnMap(ActionRequest request, ActionResponse response) {
try {
Partner partner = request.getContext().asType(Partner.class);
response.setView(ActionView.define(partner.getFullName()).add("html", Beans.get(AppBaseService.class).getAppBase().getMapApiSelect() == AppBaseRepository.MAP_API_GOOGLE ? Beans.get(MapService.class).getMapURI("partner", partner.getId()) : Beans.get(MapService.class).getOsmMapURI("partner", partner.getId())).map());
} catch (Exception e) {
TraceBackService.trace(e);
}
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerController method modifyRegistrationCode.
public void modifyRegistrationCode(ActionRequest request, ActionResponse response) {
try {
Partner partner = request.getContext().asType(Partner.class);
String taxNbr = Beans.get(PartnerService.class).getTaxNbrFromRegistrationCode(partner);
String nic = Beans.get(PartnerService.class).getNicFromRegistrationCode(partner);
String siren = Beans.get(PartnerService.class).getSirenFromRegistrationCode(partner);
response.setValue("taxNbr", taxNbr);
response.setValue("nic", nic);
response.setValue("siren", siren);
} catch (Exception e) {
TraceBackService.trace(e);
}
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerController method checkPartnerName.
/**
* Called from partner view on name change and onLoad. Call {@link
* PartnerService#isThereDuplicatePartner(Partner)}
*
* @param request
* @param response
*/
public void checkPartnerName(ActionRequest request, ActionResponse response) {
try {
Partner partner = request.getContext().asType(Partner.class);
response.setAttr("duplicatePartnerText", "hidden", !Beans.get(PartnerService.class).isThereDuplicatePartner(partner));
} catch (Exception e) {
TraceBackService.trace(e);
}
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerController method setPartnerSequence.
public void setPartnerSequence(ActionRequest request, ActionResponse response) throws AxelorException {
Partner partner = request.getContext().asType(Partner.class);
partner = Beans.get(PartnerRepository.class).find(partner.getId());
if (partner.getPartnerSeq() == null) {
String seq = Beans.get(SequenceService.class).getSequenceNumber(SequenceRepository.PARTNER);
if (seq == null)
throw new AxelorException(partner, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.PARTNER_1));
else
response.setValue("partnerSeq", seq);
}
}
use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.
the class PartnerController method printClientSituation.
/* Fonction appeler par le bouton imprimer
*
* @param request
* @param response
* @return
*/
public void printClientSituation(ActionRequest request, ActionResponse response) throws AxelorException {
Partner partner = request.getContext().asType(Partner.class);
User user = AuthUtils.getUser();
String name = I18n.get("Customer Situation");
String fileLink = ReportFactory.createReport(IReport.CLIENT_SITUATION, name + "-${date}").addParam("Locale", ReportSettings.getPrintingLocale(partner)).addParam("Timezone", getTimezone(user)).addParam("UserId", user.getId()).addParam("PartnerId", partner.getId()).addParam("PartnerPic", partner.getPicture() != null ? MetaFiles.getPath(partner.getPicture()).toString() : "").generate().getFileLink();
LOG.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
}
Aggregations