Merge with 626f88fda0dd1ee86a114a49a4fea4f04f90a09e

This commit is contained in:
Heng Sin Low 2012-09-05 20:20:19 +08:00
commit 44b1b277a7
11 changed files with 352 additions and 13 deletions

View File

@ -0,0 +1,47 @@
CREATE OR REPLACE FUNCTION register_migration_script
(
p_script IN VARCHAR2
)
RETURN VARCHAR2
IS
PRAGMA AUTONOMOUS_TRANSACTION;
v_return VARCHAR2(255);
v_scriptid INTEGER;
BEGIN
v_return := p_script || ' successfully registered';
UPDATE AD_System
SET LastMigrationScriptApplied=p_script
WHERE LastMigrationScriptApplied<p_script
OR LastMigrationScriptApplied IS NULL;
SELECT MAX(AD_MigrationScript_ID)
INTO v_scriptid
FROM AD_MigrationScript
WHERE Name = p_script;
IF (v_scriptid IS NULL)
THEN
INSERT INTO ad_migrationscript
(isapply, scriptroll, ad_migrationscript_uu,
status, projectname, releaseno,
name, filename, ad_client_id,
ad_org_id, created, createdby,
updated, updatedby, isactive,
ad_migrationscript_id)
VALUES
('Y', 'N', generate_uuid(),
'CO', 'iDempiere', (select releaseno from ad_system),
p_script, 'oracle/'||p_script, 0,
0, SYSDATE, 100,
SYSDATE, 100, 'Y',
nextidfunc(53081,'N'));
ELSE
v_return := p_script || ' was already applied';
DBMS_OUTPUT.PUT_LINE(v_return);
UPDATE ad_migrationscript
SET updated=SYSDATE, description = COALESCE(description, ' ') || ' reapplied'
WHERE ad_migrationscript_id = v_scriptid;
END IF;
COMMIT;
RETURN v_return;
END register_migration_script;
/

View File

@ -0,0 +1,53 @@
CREATE OR REPLACE FUNCTION register_migration_script(IN p_script character varying) RETURNS character varying AS
$BODY$
DECLARE
v_return CHARACTER VARYING;
v_scriptid INTEGER;
BEGIN
v_return := p_script || ' successfully registered';
UPDATE AD_System
SET LastMigrationScriptApplied=p_script
WHERE LastMigrationScriptApplied<p_script
OR LastMigrationScriptApplied IS NULL;
SELECT MAX(AD_MigrationScript_ID)
INTO v_scriptid
FROM AD_MigrationScript
WHERE Name = p_script;
IF (v_scriptid IS NULL)
THEN
INSERT INTO ad_migrationscript
(isapply, scriptroll, ad_migrationscript_uu,
status, projectname, releaseno,
name, filename, ad_client_id,
ad_org_id, created, createdby,
updated, updatedby, isactive,
ad_migrationscript_id)
VALUES
('Y', 'N', generate_uuid(),
'CO', 'iDempiere', (select releaseno from ad_system),
p_script, 'postgresql/'||p_script, 0,
0, now(), 100,
now(), 100, 'Y',
nextidfunc(53081,'N'));
ELSE
v_return := p_script || ' was already applied';
RAISE NOTICE '%', v_return;
UPDATE ad_migrationscript
SET updated=now(), description = COALESCE(description, ' ') || ' reapplied'
WHERE ad_migrationscript_id = v_scriptid;
END IF;
RETURN v_return;
END;
$BODY$
LANGUAGE plpgsql;
CREATE TABLE dual ( dummy char );
INSERT INTO dual values ( 'X' );
CREATE OR REPLACE RULE insert_dual AS ON INSERT TO dual DO INSTEAD NOTHING;
CREATE OR REPLACE RULE update_dual AS ON UPDATE TO dual DO INSTEAD NOTHING;
CREATE OR REPLACE RULE delete_dual AS ON DELETE TO dual DO INSTEAD NOTHING;

View File

@ -0,0 +1,46 @@
-- Sep 4, 2012 11:47:10 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=2,Updated=TO_DATE('2012-09-04 11:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405
;
-- Sep 4, 2012 11:47:26 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=3, ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:47:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400
;
-- Sep 4, 2012 11:47:36 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:47:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200403
;
-- Sep 4, 2012 11:47:51 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:47:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200401
;
-- Sep 4, 2012 11:47:58 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4,Updated=TO_DATE('2012-09-04 11:47:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400
;
-- Sep 4, 2012 11:48:09 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=2, ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:48:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200406
;
-- Sep 4, 2012 11:48:19 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:48:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405
;
-- Sep 4, 2012 11:48:30 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_DATE('2012-09-04 11:48:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200402
;
UPDATE AD_System
SET LastMigrationScriptApplied='900_IDEMPIERE-373_User_Locking.sql'
WHERE LastMigrationScriptApplied<'900_IDEMPIERE-373_User_Locking.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,50 @@
CREATE OR REPLACE FUNCTION register_migration_script
(
p_script IN VARCHAR2
)
RETURN VARCHAR2
IS
PRAGMA AUTONOMOUS_TRANSACTION;
v_return VARCHAR2(255);
v_scriptid INTEGER;
BEGIN
v_return := p_script || ' successfully registered';
UPDATE AD_System
SET LastMigrationScriptApplied=p_script
WHERE LastMigrationScriptApplied<p_script
OR LastMigrationScriptApplied IS NULL;
SELECT MAX(AD_MigrationScript_ID)
INTO v_scriptid
FROM AD_MigrationScript
WHERE Name = p_script;
IF (v_scriptid IS NULL)
THEN
INSERT INTO ad_migrationscript
(isapply, scriptroll, ad_migrationscript_uu,
status, projectname, releaseno,
name, filename, ad_client_id,
ad_org_id, created, createdby,
updated, updatedby, isactive,
ad_migrationscript_id)
VALUES
('Y', 'N', generate_uuid(),
'CO', 'iDempiere', (select releaseno from ad_system),
p_script, 'oracle/'||p_script, 0,
0, SYSDATE, 100,
SYSDATE, 100, 'Y',
nextidfunc(53081,'N'));
ELSE
v_return := p_script || ' was already applied';
DBMS_OUTPUT.PUT_LINE(v_return);
UPDATE ad_migrationscript
SET updated=SYSDATE, description = COALESCE(description, ' ') || ' reapplied'
WHERE ad_migrationscript_id = v_scriptid;
END IF;
COMMIT;
RETURN v_return;
END register_migration_script;
/
SELECT register_migration_script('901_IDEMPIERE-420.sql') FROM dual
;

View File

@ -0,0 +1,46 @@
-- Sep 4, 2012 11:47:10 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=2,Updated=TO_TIMESTAMP('2012-09-04 11:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405
;
-- Sep 4, 2012 11:47:26 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=3, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:47:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400
;
-- Sep 4, 2012 11:47:36 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:47:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200403
;
-- Sep 4, 2012 11:47:51 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:47:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200401
;
-- Sep 4, 2012 11:47:58 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4,Updated=TO_TIMESTAMP('2012-09-04 11:47:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200400
;
-- Sep 4, 2012 11:48:09 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=2, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:48:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200406
;
-- Sep 4, 2012 11:48:19 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:48:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200405
;
-- Sep 4, 2012 11:48:30 AM COT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-04 11:48:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200402
;
UPDATE AD_System
SET LastMigrationScriptApplied='900_IDEMPIERE-373_User_Locking.sql'
WHERE LastMigrationScriptApplied<'900_IDEMPIERE-373_User_Locking.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,56 @@
CREATE OR REPLACE FUNCTION register_migration_script(IN p_script character varying) RETURNS character varying AS
$BODY$
DECLARE
v_return CHARACTER VARYING;
v_scriptid INTEGER;
BEGIN
v_return := p_script || ' successfully registered';
UPDATE AD_System
SET LastMigrationScriptApplied=p_script
WHERE LastMigrationScriptApplied<p_script
OR LastMigrationScriptApplied IS NULL;
SELECT MAX(AD_MigrationScript_ID)
INTO v_scriptid
FROM AD_MigrationScript
WHERE Name = p_script;
IF (v_scriptid IS NULL)
THEN
INSERT INTO ad_migrationscript
(isapply, scriptroll, ad_migrationscript_uu,
status, projectname, releaseno,
name, filename, ad_client_id,
ad_org_id, created, createdby,
updated, updatedby, isactive,
ad_migrationscript_id)
VALUES
('Y', 'N', generate_uuid(),
'CO', 'iDempiere', (select releaseno from ad_system),
p_script, 'postgresql/'||p_script, 0,
0, now(), 100,
now(), 100, 'Y',
nextidfunc(53081,'N'));
ELSE
v_return := p_script || ' was already applied';
RAISE NOTICE '%', v_return;
UPDATE ad_migrationscript
SET updated=now(), description = COALESCE(description, ' ') || ' reapplied'
WHERE ad_migrationscript_id = v_scriptid;
END IF;
RETURN v_return;
END;
$BODY$
LANGUAGE plpgsql;
CREATE TABLE dual ( dummy char );
INSERT INTO dual values ( 'X' );
CREATE OR REPLACE RULE insert_dual AS ON INSERT TO dual DO INSTEAD NOTHING;
CREATE OR REPLACE RULE update_dual AS ON UPDATE TO dual DO INSTEAD NOTHING;
CREATE OR REPLACE RULE delete_dual AS ON DELETE TO dual DO INSTEAD NOTHING;
SELECT register_migration_script('901_IDEMPIERE-420.sql') FROM dual
;

View File

@ -16,7 +16,7 @@
<stringAttribute key="location" value="${workspace_loc}/../runtime-install.app"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}/org.adempiere.server-feature"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.activation@default:default,com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.el@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet@default:default"/>

View File

@ -204,7 +204,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
MSession mSession = MSession.get (ctx, currSess.getRemoteAddr(),
currSess.getRemoteHost(), httpSess.getId() );
currSess.getRemoteHost(), httpSess.getId() );
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
//enable full interface, relook into this when doing preference
Env.setContext(ctx, "#ShowTrl", true);

View File

@ -129,7 +129,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
}
else
getComponent().setMultiline(false);
getComponent().setRows(gridField.getNumLines());
getComponent().setRows(gridField.getNumLines() <= 0 ? 1 : gridField.getNumLines());
if (getComponent() instanceof Textbox)
((Textbox)getComponent()).setObscureType(obscureType);

View File

@ -94,6 +94,8 @@ public class RolePanel extends Window implements EventListener, Deferrable
private String m_userName;
/** Password */
private KeyNamePair[] m_clientKNPairs;
private UserPreference m_userpreference=null;
private boolean m_show = true;
@ -104,6 +106,13 @@ public class RolePanel extends Window implements EventListener, Deferrable
login = new Login(ctx);
m_show = show;
m_clientKNPairs = clientsKNPairs;
if( m_clientKNPairs.length == 1 && !m_show ){
Env.setContext(m_ctx, "#AD_Client_ID", (String) m_clientKNPairs[0].getID());
MUser user = MUser.get (m_ctx, m_userName);
m_userpreference=new UserPreference();
m_userpreference.loadPreference(user.get_ID());
}
initComponents();
@ -304,6 +313,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
// initial client - Elaine 2009/02/06
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
String initDefault = userPreference.getProperty(UserPreference.P_CLIENT);
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
{
initDefault=m_userpreference.getProperty( UserPreference.P_CLIENT );
}
if (m_clientKNPairs != null && m_clientKNPairs.length > 0)
{
for(int i = 0; i < m_clientKNPairs.length; i++)
@ -342,6 +355,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
// initial role
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
String initDefault = userPreference.getProperty(UserPreference.P_ROLE);
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
{
initDefault=m_userpreference.getProperty( UserPreference.P_ROLE );
}
KeyNamePair clientKNPair = new KeyNamePair(new Integer((String)lstItemClient.getValue()), lstItemClient.getLabel());
KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair);
if (roleKNPairs != null && roleKNPairs.length > 0)
@ -391,6 +408,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
// initial organisation - Elaine 2009/02/06
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
String initDefault = userPreference.getProperty(UserPreference.P_ORG);
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
{
initDefault=m_userpreference.getProperty( UserPreference.P_ORG );
}
KeyNamePair RoleKNPair = new KeyNamePair(new Integer((String)lstItemRole.getValue()), lstItemRole.getLabel());
KeyNamePair orgKNPairs[] = login.getOrgs(RoleKNPair);
if(orgKNPairs != null && orgKNPairs.length > 0)
@ -423,6 +444,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
// initial warehouse - Elaine 2009/02/06
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
String initDefault = userPreference.getProperty(UserPreference.P_WAREHOUSE);
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
{
initDefault=m_userpreference.getProperty( UserPreference.P_WAREHOUSE );
}
KeyNamePair organisationKNPair = new KeyNamePair(new Integer((String)lstItemOrganisation.getValue()), lstItemOrganisation.getLabel());
KeyNamePair warehouseKNPairs[] = login.getWarehouses(organisationKNPair);
if(warehouseKNPairs != null && warehouseKNPairs.length > 0)

View File

@ -31,6 +31,7 @@ import org.adempiere.install.IDBConfigMonitor;
import org.adempiere.install.IDatabaseConfig;
import org.compiere.db.Database;
import org.compiere.install.ConfigurationData;
import org.compiere.tools.FileUtil;
import org.compiere.util.CLogger;
/**
@ -387,15 +388,28 @@ public class ConfigOracle implements IDatabaseConfig
ospath = "windows";
else
ospath = "unix";
// TNS Name Info via sqlplus
String sqlplus = "sqlplus system/" + systemPassword + "@"
+ "//" + databaseServer.getHostName()
+ ":" + databasePort
+ "/" + databaseName
+ " @utils." + ospath + "/oracle/Test.sql";
log.config(sqlplus);
pass = testSQL(sqlplus);
error = "Error connecting via: " + sqlplus;
String testFile = "utils." + ospath + "/oracle/Test.sql";
if (! new File(testFile).isFile()) {
testFile = "org.adempiere.server-feature/" + testFile;
if (! new File(testFile).isFile()) {
testFile = null;
}
}
if (testFile != null) {
// TNS Name Info via sqlplus
String sqlplus = "sqlplus system/" + systemPassword + "@"
+ "//" + databaseServer.getHostName()
+ ":" + databasePort
+ "/" + databaseName
+ " @" + testFile;
log.config(sqlplus);
pass = testSQL(sqlplus);
error = "Error connecting via: " + sqlplus;
} else {
pass = false;
error = "Test file does not exist";
log.warning(error);
}
if (monitor != null)
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SQL_TEST, "ErrorTNS",
pass, true, error));
@ -411,7 +425,7 @@ public class ConfigOracle implements IDatabaseConfig
log.info("OK: Connection = " + url);
else
log.warning("Cannot connect via Net8: " + url);
}
} else
log.info("OCI Test Skipped");
//