diff --git a/pdf-archival-repo/src/main/java/org/alfresco/extension/pdfarchival/repo/action/executer/PDFConvertToArchivableActionExecuter.java b/pdf-archival-repo/src/main/java/org/alfresco/extension/pdfarchival/repo/action/executer/PDFConvertToArchivableActionExecuter.java
index fcbbf96..0b8d1f2 100644
--- a/pdf-archival-repo/src/main/java/org/alfresco/extension/pdfarchival/repo/action/executer/PDFConvertToArchivableActionExecuter.java
+++ b/pdf-archival-repo/src/main/java/org/alfresco/extension/pdfarchival/repo/action/executer/PDFConvertToArchivableActionExecuter.java
@@ -99,6 +99,7 @@ protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
Boolean inplace = Boolean.valueOf(String.valueOf(action.getParameterValue(PARAM_INPLACE)));
Integer archiveLevel = Integer.valueOf(String.valueOf(action.getParameterValue(PARAM_ARCHIVE_LEVEL)));
+ String providedName = String.valueOf(action.getParameterValue(PARAM_DESTINATION_NAME));
// get an output file for the new PDF (temp file)
File out = getTempFile(actionedUponNodeRef);
@@ -122,7 +123,7 @@ protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
ex.printStackTrace();
}
- NodeRef destinationNode = createDestinationNode(String.valueOf(ns.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME)),
+ NodeRef destinationNode = createDestinationNode(getFilename(providedName, actionedUponNodeRef),
(NodeRef)action.getParameterValue(PARAM_DESTINATION_FOLDER), actionedUponNodeRef, inplace);
ContentWriter writer = serviceRegistry.getContentService().getWriter(destinationNode, ContentModel.PROP_CONTENT, true);
writer.setEncoding(cs.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT).getEncoding());
@@ -157,6 +158,26 @@ private DocumentFormat getDocumentFormat(int level) {
return format;
}
+ private String getFilename(String providedName, NodeRef targetNodeRef)
+ {
+ NodeService ns = serviceRegistry.getNodeService();
+
+ String fileName = null;
+ if(providedName != null)
+ {
+ fileName = String.valueOf(providedName);
+ if(!fileName.endsWith(FILE_EXTENSION))
+ {
+ fileName = fileName + FILE_EXTENSION;
+ }
+ }
+ else
+ {
+ fileName = String.valueOf(ns.getProperty(targetNodeRef, ContentModel.PROP_NAME));
+ }
+ return fileName;
+ }
+
/**
* @param actionedUponNodeRef
* @return
diff --git a/pdf-archival-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/pdfarchival/components/form/controls/hidingCheckbox.ftl b/pdf-archival-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/pdfarchival/components/form/controls/hidingCheckbox.ftl
index 0c7c243..0506686 100644
--- a/pdf-archival-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/pdfarchival/components/form/controls/hidingCheckbox.ftl
+++ b/pdf-archival-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/pdfarchival/components/form/controls/hidingCheckbox.ftl
@@ -8,7 +8,7 @@ control parameters in the form config by hiding the div {field.name}-control
<#if form.mode == "view">
<#else>
-
+
- assoc_destination-folder,prop_destination-name
+ assoc_destination-folder-cntrl,prop_destination-name