V globálním nastavení umožněn upload loga školy.
Upraveny tiskových sestav vloženo logo a název organizace. closes #199
This commit is contained in:
@@ -22,6 +22,7 @@ public class SettingsData {
|
||||
private List<Vehicle> vehicles;
|
||||
private Map<Integer, BigDecimal[]> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user