diff --git a/JasperReports/src/org/compiere/report/ReportStarter.java b/JasperReports/src/org/compiere/report/ReportStarter.java index 21b00d2758..51a1bae82c 100644 --- a/JasperReports/src/org/compiere/report/ReportStarter.java +++ b/JasperReports/src/org/compiere/report/ReportStarter.java @@ -67,6 +67,7 @@ import net.sf.jasperreports.engine.export.JRPrintServiceExporter; import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter; import net.sf.jasperreports.engine.util.JRLoader; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; import org.compiere.db.CConnection; import org.compiere.interfaces.MD5; @@ -873,8 +874,12 @@ public class ReportStarter implements ProcessCall, ClientProcess log.info(" report on server is different that local one, download and replace"); File downloadedFile = new File(downloadedLocalFile); entry.getFile(downloadedFile); - reportFile.delete(); - downloadedFile.renameTo(reportFile); + if (! reportFile.delete()) { + throw new AdempiereException("Cannot delete temporary file " + reportFile.toString()); + } + if (! downloadedFile.renameTo(reportFile)) { + throw new AdempiereException("Cannot rename temporary file " + downloadedFile.toString() + " to " + reportFile.toString()); + } } } else { entry.getFile(reportFile); diff --git a/JasperReports/src/org/compiere/utils/DigestOfFile.java b/JasperReports/src/org/compiere/utils/DigestOfFile.java index 75552d3857..0a6d2b3ad1 100644 --- a/JasperReports/src/org/compiere/utils/DigestOfFile.java +++ b/JasperReports/src/org/compiere/utils/DigestOfFile.java @@ -62,7 +62,7 @@ public class DigestOfFile { byte[] digest = digestAsByteArray(file); Base64 encoder = new Base64(); - String digestAsBase64 = encoder.encode(digest).toString(); + String digestAsBase64 = new String(encoder.encode(digest),"ASCII"); return digestAsBase64; } @@ -75,7 +75,7 @@ public class DigestOfFile { byte[] digest = digestAsByteArray(input); Base64 encoder = new Base64(); - String digestAsBase64 = encoder.encode(digest).toString(); + String digestAsBase64 = new String(encoder.encode(digest),"ASCII"); return digestAsBase64; } diff --git a/base/src/org/compiere/model/CalloutInventory.java b/base/src/org/compiere/model/CalloutInventory.java index 359b41840c..b54c81ea1e 100644 --- a/base/src/org/compiere/model/CalloutInventory.java +++ b/base/src/org/compiere/model/CalloutInventory.java @@ -109,6 +109,7 @@ public class CalloutInventory extends CalloutEngine if (M_AttributeSetInstance_ID != 0) pstmt.setInt(3, M_AttributeSetInstance_ID); rs = pstmt.executeQuery(); + mTab.setValue("QtyBook", Env.ZERO); if (rs.next()) { bd = rs.getBigDecimal(1); diff --git a/base/src/org/compiere/model/MAttachmentEntry.java b/base/src/org/compiere/model/MAttachmentEntry.java index 9965af5af2..3e45c19424 100644 --- a/base/src/org/compiere/model/MAttachmentEntry.java +++ b/base/src/org/compiere/model/MAttachmentEntry.java @@ -250,6 +250,7 @@ public class MAttachmentEntry catch (IOException ioe) { log.log(Level.SEVERE, "getFile", ioe); + throw new RuntimeException(ioe); } return file; } // getFile diff --git a/client/src/org/compiere/apps/search/PAttributeInstance.java b/client/src/org/compiere/apps/search/PAttributeInstance.java index c477dd0462..4e1c05bbe2 100644 --- a/client/src/org/compiere/apps/search/PAttributeInstance.java +++ b/client/src/org/compiere/apps/search/PAttributeInstance.java @@ -173,9 +173,9 @@ public class PAttributeInstance extends CDialog new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "s.QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "s.QtyOrdered", Double.class), // See RV_Storage - new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))-p.GuaranteeDaysMin", Integer.class, true, true, null), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)", Integer.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(daysbetween(asi.GuaranteeDate, SYSDATE))-p.GuaranteeDaysMin", Integer.class, true, true, null), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "daysbetween(asi.GuaranteeDate, SYSDATE)", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), }; /** From Clause */ private static String s_sqlFrom = "M_Storage s" @@ -232,12 +232,12 @@ public class PAttributeInstance extends CDialog } if (ShelfLifeMinPct > 0) { - m_sqlMinLife = " AND COALESCE(TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; + m_sqlMinLife = " AND COALESCE(TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; log.config( "PAttributeInstance.dynInit - ShelfLifeMinPct=" + ShelfLifeMinPct); } if (ShelfLifeMinDays > 0) { - m_sqlMinLife += " AND COALESCE((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)),0)>=" + ShelfLifeMinDays; + m_sqlMinLife += " AND COALESCE((daysbetween(asi.GuaranteeDate, SYSDATE)),0)>=" + ShelfLifeMinDays; log.config( "PAttributeInstance.dynInit - ShelfLifeMinDays=" + ShelfLifeMinDays); } } // BPartner != 0 diff --git a/utils/oracleXE/01_add_missing_Translations.sql b/utils/oracleXE/01_add_missing_Translations.sql new file mode 100644 index 0000000000..2a2f789e92 --- /dev/null +++ b/utils/oracleXE/01_add_missing_Translations.sql @@ -0,0 +1,67 @@ +DECLARE + ins VARCHAR2 (2000); + sel VARCHAR2 (2000); + inssel VARCHAR2 (4001); + table_id NUMBER; +BEGIN + ins := RPAD (' ', 2000, ' '); + sel := RPAD (' ', 2000, ' '); + inssel := RPAD (' ', 4001, ' '); + DBMS_OUTPUT.PUT_LINE ('Start'); + + FOR t IN (SELECT ad_table_id, + SUBSTR (tablename, 1, LENGTH (tablename) - 4) tablename + FROM AD_TABLE + WHERE tablename LIKE '%_Trl' AND isactive = 'Y' + AND isview = 'N') + LOOP + ins := + 'INSERT INTO ' + || t.tablename + || '_TRL (' + || 'ad_language,ad_client_id,ad_org_id,created,createdby,updated,updatedby,isactive,istranslated,' + || t.tablename + || '_id'; + sel := + 'SELECT l.ad_language,t.ad_client_id,t.ad_org_id,t.created,t.createdby,t.updated,t.updatedby,t.isactive,''N'' as istranslated,' + || t.tablename + || '_id'; + + SELECT ad_table_id + INTO table_id + FROM AD_TABLE + WHERE tablename = t.tablename; + + FOR c IN (SELECT col.columnname + FROM AD_COLUMN col INNER JOIN AD_TABLE tab + ON (col.ad_table_id = tab.ad_table_id) + WHERE col.ad_table_id = table_id + AND col.istranslated = 'Y' + AND col.isactive = 'Y' + ORDER BY 1) + LOOP + ins := TRIM (ins) || ',' || TRIM (c.columnname); + sel := TRIM (sel) || ',t.' || TRIM (c.columnname); + END LOOP; + + ins := TRIM (ins) || ')'; + sel := + TRIM (sel) + || ' from ' + || t.tablename + || ' t, ad_language l WHERE l.issystemlanguage=''Y'' AND NOT EXISTS (SELECT 1 FROM ' + || t.tablename + || '_TRL b WHERE b.' + || t.tablename + || '_id=t.' + || t.tablename + || '_id AND b.AD_LANGUAGE=l.AD_LANGUAGE)'; + inssel := TRIM (ins) || ' ' || TRIM (sel); + + DBMS_OUTPUT.PUT_LINE (inssel); + EXECUTE IMMEDIATE inssel; + END LOOP; + + DBMS_OUTPUT.PUT_LINE ('End'); + COMMIT; +END; diff --git a/utils/postgresql/PostMigration.sh b/utils/postgresql/PostMigration.sh index 70690fffb0..6dfdeb0ff5 100644 --- a/utils/postgresql/PostMigration.sh +++ b/utils/postgresql/PostMigration.sh @@ -24,6 +24,6 @@ export PGPASSWORD echo ------------------------------------- echo Add missing translations echo ------------------------------------- -psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/01_add_missing_translations.sql PGPASSWORD= export PGPASSWORD diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java index 1be3efd9ba..61c9092b9e 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java @@ -161,9 +161,9 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "s.QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "s.QtyOrdered", Double.class), // See RV_Storage - new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))-p.GuaranteeDaysMin", Integer.class, true, true, null), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)", Integer.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(daysbetween(asi.GuaranteeDate, SYSDATE))-p.GuaranteeDaysMin", Integer.class, true, true, null), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "daysbetween(asi.GuaranteeDate, SYSDATE)", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), }; /** From Clause */ private static String s_sqlFrom = "M_Storage s" @@ -220,12 +220,12 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener } if (ShelfLifeMinPct > 0) { - m_sqlMinLife = " AND COALESCE(TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; + m_sqlMinLife = " AND COALESCE(TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; log.config( "PAttributeInstance.dynInit - ShelfLifeMinPct=" + ShelfLifeMinPct); } if (ShelfLifeMinDays > 0) { - m_sqlMinLife += " AND COALESCE((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)),0)>=" + ShelfLifeMinDays; + m_sqlMinLife += " AND COALESCE((daysbetween(asi.GuaranteeDate, SYSDATE)),0)>=" + ShelfLifeMinDays; log.config( "PAttributeInstance.dynInit - ShelfLifeMinDays=" + ShelfLifeMinDays); } } // BPartner != 0 diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index bd5ec73800..eccab24bba 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -424,6 +424,16 @@ public class LoginPanel extends Window implements EventListener Clients.response("zkLocaleJavaScript", new AuScript(null, ZkFns.outLocaleJavaScript())); } + // This temporary validation code is added to check the reported bug + // [ adempiere-ZK Web Client-2832968 ] User context lost? + // https://sourceforge.net/tracker/?func=detail&atid=955896&aid=2832968&group_id=176962 + // it's harmless, if there is no bug then this must never fail + Session currSess = Executions.getCurrent().getDesktop().getSession(); + currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); + // End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost? + + Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked()); + /* Check DB version */ String version = DB.getSQLValueString(null, "SELECT Version FROM AD_System"); // Identical DB version @@ -435,15 +445,6 @@ public class LoginPanel extends Window implements EventListener throw new ApplicationException(msg); } - // This temporary validation code is added to check the reported bug - // [ adempiere-ZK Web Client-2832968 ] User context lost? - // https://sourceforge.net/tracker/?func=detail&atid=955896&aid=2832968&group_id=176962 - // it's harmless, if there is no bug then this must never fail - Session currSess = Executions.getCurrent().getDesktop().getSession(); - currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); - // End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost? - - Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked()); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java index 0b56bc79af..a3d3f554f8 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java @@ -169,9 +169,9 @@ public class WPAttributeInstance extends Window implements EventListener new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "s.QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "s.QtyOrdered", Double.class), // See RV_Storage - new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))-p.GuaranteeDaysMin", Integer.class, true, true, null), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)", Integer.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(daysbetween(asi.GuaranteeDate, SYSDATE))-p.GuaranteeDaysMin", Integer.class, true, true, null), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "daysbetween(asi.GuaranteeDate, SYSDATE)", Integer.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeRemainingPct"), "CASE WHEN p.GuaranteeDays > 0 THEN TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100) ELSE 0 END", Integer.class), }; /** From Clause */ private static String s_sqlFrom = "M_Storage s" @@ -228,12 +228,12 @@ public class WPAttributeInstance extends Window implements EventListener } if (ShelfLifeMinPct > 0) { - m_sqlMinLife = " AND COALESCE(TRUNC(((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; + m_sqlMinLife = " AND COALESCE(TRUNC(((daysbetween(asi.GuaranteeDate, SYSDATE))/p.GuaranteeDays)*100),0)>=" + ShelfLifeMinPct; log.config( "PAttributeInstance.dynInit - ShelfLifeMinPct=" + ShelfLifeMinPct); } if (ShelfLifeMinDays > 0) { - m_sqlMinLife += " AND COALESCE((TRUNC(asi.GuaranteeDate)-TRUNC(SysDate)),0)>=" + ShelfLifeMinDays; + m_sqlMinLife += " AND COALESCE((daysbetween(asi.GuaranteeDate, SYSDATE)),0)>=" + ShelfLifeMinDays; log.config( "PAttributeInstance.dynInit - ShelfLifeMinDays=" + ShelfLifeMinDays); } } // BPartner != 0