Merge bug fixes from release to trunk

merge 11707, 11708, 11816, 11817

11707 -> Fix [2971934] DigestOfFile incosistent Base64 conversion - thanks to Silvano (freepath)
Adding raise of exceptions when the file cannot be written
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2971934

11708 -> Fix [2127565] - LOT Control Error
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2127565

11816 -> Fixing some errors found when building testadempiere
Link to /release commit: http://adempiere.svn.sourceforge.net/adempiere/?rev=11816&view=rev

11817 -> [2846601] - DB.isDatabaseOK() is not called / moving the validation some lines down - it breaks completely the usage of Adempiere
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2846601

Regards,
Tony
This commit is contained in:
tspc 2010-03-26 23:10:30 +00:00
parent 21212ed383
commit 704877109d
10 changed files with 104 additions and 29 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -250,6 +250,7 @@ public class MAttachmentEntry
catch (IOException ioe)
{
log.log(Level.SEVERE, "getFile", ioe);
throw new RuntimeException(ioe);
}
return file;
} // getFile

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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());
}
}

View File

@ -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