diff --git a/migration/i1.0c-release/oracle/201309301915_IDEMPIERE-1083.sql b/migration/i1.0c-release/oracle/201309301915_IDEMPIERE-1083.sql new file mode 100644 index 0000000000..fdb5694ad7 --- /dev/null +++ b/migration/i1.0c-release/oracle/201309301915_IDEMPIERE-1083.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 30, 2013 7:12:21 PM SGT +-- IDEMPIERE-1083 Print shipping label applet is not working +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200036,'S',' ','3d792b55-0ca5-467c-b666-c642103efb28',TO_DATE('2013-09-30 19:12:20','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-09-30 19:12:20','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER',0,'D') +; + +SELECT register_migration_script('201309301915_IDEMPIERE-1083.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0c-release/postgresql/201309301915_IDEMPIERE-1083.sql b/migration/i1.0c-release/postgresql/201309301915_IDEMPIERE-1083.sql new file mode 100644 index 0000000000..403d4f1fad --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309301915_IDEMPIERE-1083.sql @@ -0,0 +1,7 @@ +-- Sep 30, 2013 7:12:21 PM SGT +-- IDEMPIERE-1083 Print shipping label applet is not working +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200036,'S',' ','3d792b55-0ca5-467c-b666-c642103efb28',TO_TIMESTAMP('2013-09-30 19:12:20','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-09-30 19:12:20','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER',0,'D') +; + +SELECT register_migration_script('201309301915_IDEMPIERE-1083.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index f52cb31bb4..590171fbc4 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -118,6 +118,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_MAX_UPLOAD_SIZE = "ZK_MAX_UPLOAD_SIZE"; public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE"; public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE"; + public static final String ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER = "ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER"; /** * Standard Constructor diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LabelAppletWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LabelAppletWindow.java index 0983da88e5..9fba9147a4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LabelAppletWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LabelAppletWindow.java @@ -19,6 +19,8 @@ import java.util.List; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; +import org.compiere.model.MSysConfig; +import org.compiere.util.CLogger; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -31,11 +33,12 @@ import org.zkoss.zul.Div; * */ public class LabelAppletWindow extends Window implements EventListener -{ +{ /** * */ - private static final long serialVersionUID = -8980224912104404397L; + private static final long serialVersionUID = -592770994381511142L; + private final static CLogger log = CLogger.getCLogger(LabelAppletWindow.class); public LabelAppletWindow(List list) { @@ -57,7 +60,23 @@ public class LabelAppletWindow extends Window implements EventListener { try { - tempFile = File.createTempFile("lblapp", Long.toString(System.nanoTime())); + File directory = null; + String tempFolder = MSysConfig.getValue(MSysConfig.ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER, null); + if (tempFolder != null && tempFolder.trim().length() > 0) + { + directory = new File(tempFolder.trim()); + if (!directory.exists()) + { + log.severe("Directory doesn't exists " + tempFolder); + directory = null; + } + else if (!directory.canWrite()) + { + log.severe("Directory cannot write " + tempFolder); + directory = null; + } + } + tempFile = File.createTempFile("lblapp", Long.toString(System.nanoTime()), directory); fos = new FileOutputStream(tempFile); applet.setParam("file_" + i, tempFile.getAbsolutePath()); fos.write(list.get(i));