Skip to content
Snippets Groups Projects
Commit 7b24f1b2 authored by srosse's avatar srosse
Browse files

OO-1254: add a "not dummy" template, ensure temporary directory is created for...

OO-1254: add a "not dummy" template, ensure temporary directory is created for the preview, a date to date handler and not a string
parent 96663d26
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,10 @@ public class CertificatePDFFormWorker { ...@@ -116,6 +116,10 @@ public class CertificatePDFFormWorker {
fillCertificationInfos(acroForm); fillCertificationInfos(acroForm);
fillAssessmentInfos(acroForm); fillAssessmentInfos(acroForm);
} }
if(!destinationDir.exists()) {
destinationDir.mkdirs();
}
File certificateFile = new File(destinationDir, templateName); File certificateFile = new File(destinationDir, templateName);
OutputStream out = new FileOutputStream(certificateFile); OutputStream out = new FileOutputStream(certificateFile);
document.save(out); document.save(out);
......
...@@ -66,6 +66,7 @@ import org.olat.core.id.Roles; ...@@ -66,6 +66,7 @@ import org.olat.core.id.Roles;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.core.util.FileUtils; import org.olat.core.util.FileUtils;
import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
...@@ -111,6 +112,7 @@ import org.olat.repository.RepositoryService; ...@@ -111,6 +112,7 @@ import org.olat.repository.RepositoryService;
import org.olat.repository.model.RepositoryEntrySecurity; import org.olat.repository.model.RepositoryEntrySecurity;
import org.olat.resource.OLATResource; import org.olat.resource.OLATResource;
import org.olat.user.UserManager; import org.olat.user.UserManager;
import org.olat.user.propertyhandlers.DatePropertyHandler;
import org.olat.user.propertyhandlers.UserPropertyHandler; import org.olat.user.propertyhandlers.UserPropertyHandler;
import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -679,7 +681,11 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList ...@@ -679,7 +681,11 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList
identity.setName("username"); identity.setName("username");
List<UserPropertyHandler> userPropertyHandlers = userManager.getAllUserPropertyHandlers(); List<UserPropertyHandler> userPropertyHandlers = userManager.getAllUserPropertyHandlers();
for(UserPropertyHandler handler:userPropertyHandlers) { for(UserPropertyHandler handler:userPropertyHandlers) {
identity.getUser().setProperty(handler.getName(), handler.getName()); if(handler instanceof DatePropertyHandler) {
identity.getUser().setProperty(handler.getName(), Formatter.formatDatetime(new Date()));
} else {
identity.getUser().setProperty(handler.getName(), handler.getName());
}
} }
return identity; return identity;
} }
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment