diff --git a/src/main/java/info/bukova/isspst/data/SettingsData.java b/src/main/java/info/bukova/isspst/data/SettingsData.java index acbb9fdd..ae1674dd 100644 --- a/src/main/java/info/bukova/isspst/data/SettingsData.java +++ b/src/main/java/info/bukova/isspst/data/SettingsData.java @@ -22,6 +22,7 @@ public class SettingsData { private List vehicles; private Map refunds; private String stampFile; + private String logoFile; public SettingsData() { newReqTemplate = new MailMessage(); @@ -140,4 +141,13 @@ public class SettingsData { this.stampFile = stampFile; } + public String getLogoFile() + { + return logoFile; + } + + public void setLogoFile(String logoFile) + { + this.logoFile = logoFile; + } } diff --git a/src/main/java/info/bukova/isspst/reporting/ParamFiller.java b/src/main/java/info/bukova/isspst/reporting/ParamFiller.java index 4cb8e873..b1bbddda 100644 --- a/src/main/java/info/bukova/isspst/reporting/ParamFiller.java +++ b/src/main/java/info/bukova/isspst/reporting/ParamFiller.java @@ -1,8 +1,6 @@ package info.bukova.isspst.reporting; -import java.util.HashMap; -import java.util.Map; - +import info.bukova.isspst.data.Address; import info.bukova.isspst.data.AuthItem; import info.bukova.isspst.data.Order; import info.bukova.isspst.data.TripBill; @@ -13,8 +11,13 @@ import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.storage.FileStorage; +import java.util.HashMap; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; +import com.mysql.jdbc.StringUtils; + public class ParamFiller { @Autowired @@ -74,6 +77,15 @@ public class ParamFiller { definition.setParam("P_STAMP", storage.serverPath(settingService.getSettings().getStampFile())); } } + + definition.setParam("P_LOGO", storage.serverPath(settingService.getSettings().getLogoFile())); + + Address mainAddress = settingService.getSettings().getMainAddress(); + + if (mainAddress != null) { + String addr = (StringUtils.isNullOrEmpty(mainAddress.getCompany()) ? "" : mainAddress.getCompany()); + definition.setParam("P_MAIN_ADDRESS", addr); + } } } diff --git a/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java index fdeda412..3577e450 100644 --- a/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java +++ b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java @@ -1,6 +1,7 @@ package info.bukova.isspst.ui.settings; import info.bukova.isspst.Constants; +import info.bukova.isspst.StringUtils; import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.SettingsData; @@ -77,7 +78,24 @@ public class GlobalSettingsVM extends DocumentViewModel storage.removeFile(settings.getStampFile()); settings.setStampFile(null); } - + + @Command + @NotifyChange({ "settings", "logoImg" }) + public void uploadLogo(@ContextParam(ContextType.TRIGGER_EVENT) UploadEvent upEvent) { + int i = upEvent.getMedia().getName().lastIndexOf("."); + String fileName = "LogoImageFile" + upEvent.getMedia().getName().substring(i); + storage.saveFile(upEvent.getMedia().getByteData(), fileName); + settings.setLogoFile(fileName); + } + + @Command + @NotifyChange("logoImg") + public void removeLogo() + { + storage.removeFile(settings.getLogoFile()); + settings.setLogoFile(null); + } + public List getRequirementFields() { return ReflectionTools.getEntityFields(Requirement.class); } @@ -144,7 +162,7 @@ public class GlobalSettingsVM extends DocumentViewModel } public RenderedImage getStampImg() { - if (settings.getStampFile() == null || settings.getStampFile().isEmpty()) { + if (StringUtils.isNullOrEmpty(settings.getStampFile())) { return null; } @@ -155,4 +173,16 @@ public class GlobalSettingsVM extends DocumentViewModel } } + public RenderedImage getLogoImg() { + if (StringUtils.isNullOrEmpty(settings.getLogoFile())) { + return null; + } + + try { + return ImageIO.read(storage.file(settings.getLogoFile())); + } + catch (IOException e) { + return null; + } + } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index b83c18bb..a800620e 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -182,6 +182,8 @@ GlobalSettingsFreeMealsCount=Počet jídel zdarma GlobalSettingsHours=Hodin GlobalSettingsUploadStamp=Nahrát obrázek razítka GlobalSettingsStamp=Razítko +GlobalSettingsUploadOrganizationLogo=Nahrát logo +GlobalSettingsOrganizationLogo=Logo GlobalSettingsReqEnable=Povolení požadavků GlobalSettingsInsertUrl=Vložit URL záznamu diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jasper b/src/main/webapp/WEB-INF/reports/tripBill.jasper index a2febae2..c0abfc27 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBill.jasper and b/src/main/webapp/WEB-INF/reports/tripBill.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jrxml b/src/main/webapp/WEB-INF/reports/tripBill.jrxml index 2a937252..b4c83281 100644 --- a/src/main/webapp/WEB-INF/reports/tripBill.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripBill.jrxml @@ -1,12 +1,14 @@ - - - - + + + + - + + + @@ -50,159 +52,159 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -210,6 +212,19 @@ tuzemské pracovní cesty]]> + + + + + + + + + + + + + @@ -329,7 +344,7 @@ tuzemské pracovní cesty]]> - + diff --git a/src/main/webapp/WEB-INF/reports/tripBillFreeMeals.jasper b/src/main/webapp/WEB-INF/reports/tripBillFreeMeals.jasper index 2683be74..096bd0e6 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBillFreeMeals.jasper and b/src/main/webapp/WEB-INF/reports/tripBillFreeMeals.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripBillItems.jasper b/src/main/webapp/WEB-INF/reports/tripBillItems.jasper index a5f52472..3b13ab43 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBillItems.jasper and b/src/main/webapp/WEB-INF/reports/tripBillItems.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper index eff4bf30..7625b9fc 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper and b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml index e1bbf087..4d234455 100644 --- a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml @@ -2,7 +2,7 @@ - +