use of com.axelor.apps.base.db.AppBase in project axelor-open-suite by axelor.
the class AppBaseServiceImpl method getCustomStyle.
@CallMethod
@Override
public String getCustomStyle() {
AppBase appBase = Beans.get(AppBaseRepository.class).all().fetchOne();
String style = appBase.getCustomAppStyle();
if (StringUtils.isBlank(style)) {
return null;
}
return style;
}
use of com.axelor.apps.base.db.AppBase in project axelor-open-suite by axelor.
the class AppBaseServiceImpl method getTodayDateTime.
public ZonedDateTime getTodayDateTime(Company company) {
ZonedDateTime todayDateTime = ZonedDateTime.now();
if (company != null) {
todayDateTime = DateTool.getTodayDateTime(company.getTimezone());
}
String applicationMode = AppSettings.get().get("application.mode", "prod");
if ("dev".equals(applicationMode)) {
User user = AuthUtils.getUser();
if (user != null && user.getToday() != null) {
todayDateTime = user.getToday();
} else {
AppBase appBase = getAppBase();
if (appBase != null && appBase.getToday() != null) {
return appBase.getToday();
}
}
}
return todayDateTime;
}
use of com.axelor.apps.base.db.AppBase in project axelor-open-suite by axelor.
the class AppBaseServiceImpl method getGeneralDuration.
@Override
public BigDecimal getGeneralDuration(BigDecimal duration) {
if (duration == null) {
return null;
}
AppBase appBase = getAppBase();
if (appBase != null) {
String timePref = appBase.getTimeLoggingPreferenceSelect();
BigDecimal dailyWorkHrs = appBase.getDailyWorkHours();
if (timePref.equals("days") && dailyWorkHrs != null && dailyWorkHrs.compareTo(BigDecimal.ZERO) != 0) {
duration = duration.divide(dailyWorkHrs, 2, RoundingMode.HALF_UP);
} else if (timePref.equals("minutes")) {
duration = duration.multiply(new BigDecimal(60));
}
}
return duration;
}
use of com.axelor.apps.base.db.AppBase in project axelor-open-suite by axelor.
the class ConvertLeadWizardController method setConvertLeadIntoOpportunity.
public void setConvertLeadIntoOpportunity(ActionRequest request, ActionResponse response) throws AxelorException {
Lead lead = findLead(request);
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
response.setAttr("lead", "value", lead);
response.setAttr("amount", "value", lead.getEstimatedBudget());
response.setAttr("customerDescription", "value", lead.getDescription());
response.setAttr("source", "value", lead.getSource());
response.setAttr("partner", "value", lead.getPartner());
response.setAttr("user", "value", lead.getUser());
response.setAttr("team", "value", lead.getTeam());
response.setAttr("webSite", "value", lead.getWebSite());
response.setAttr("source", "value", lead.getSource());
response.setAttr("department", "value", lead.getDepartment());
response.setAttr("isCustomer", "value", true);
response.setAttr("partnerTypeSelect", "value", "1");
response.setAttr("language", "value", appBase.getDefaultPartnerLanguage());
Company company = null;
CompanyRepository companyRepo = Beans.get(CompanyRepository.class);
if (lead.getUser() != null && lead.getUser().getActiveCompany() != null) {
company = lead.getUser().getActiveCompany();
} else if (companyRepo.all().count() == 1) {
company = companyRepo.all().fetchOne();
}
if (company != null) {
response.setAttr("company", "value", company);
response.setAttr("currency", "value", company.getCurrency());
}
}
use of com.axelor.apps.base.db.AppBase in project axelor-open-suite by axelor.
the class ConvertLeadWizardController method setPartnerDefaults.
public void setPartnerDefaults(ActionRequest request, ActionResponse response) throws AxelorException {
Lead lead = findLead(request);
AppBase appBase = Beans.get(AppBaseService.class).getAppBase();
response.setAttr("name", "value", lead.getEnterpriseName());
response.setAttr("industrySector", "value", lead.getIndustrySector());
response.setAttr("titleSelect", "value", lead.getTitleSelect());
response.setAttr("emailAddress", "value", lead.getEmailAddress());
response.setAttr("mobilePhone", "value", lead.getMobilePhone());
response.setAttr("fixedPhone", "value", lead.getFixedPhone());
response.setAttr("webSite", "value", lead.getWebSite());
response.setAttr("source", "value", lead.getSource());
response.setAttr("department", "value", lead.getDepartment());
response.setAttr("team", "value", lead.getTeam());
response.setAttr("user", "value", lead.getUser());
if (lead.getUser() != null) {
if (lead.getUser().getActiveCompany().getDefaultPartnerCategorySelect() == CompanyRepository.CATEGORY_CUSTOMER) {
response.setAttr("isCustomer", "value", true);
} else if (lead.getUser().getActiveCompany().getDefaultPartnerCategorySelect() == CompanyRepository.CATEGORY_SUPPLIER) {
response.setAttr("isSupplier", "value", true);
} else {
response.setAttr("isProspect", "value", true);
}
} else {
response.setAttr("isProspect", "value", true);
}
response.setAttr("partnerTypeSelect", "value", "1");
response.setAttr("language", "value", appBase.getDefaultPartnerLanguage());
response.setAttr("nbrEmployees", "value", 0);
}
Aggregations