BF [1985481] - Processed documents can be edited

- Solve issue reported by Teo on Business Partner window
- Add Messages
This commit is contained in:
Carlos Ruiz 2009-05-08 18:37:19 +00:00
parent 923b8dbd8d
commit 6661ec5618
3 changed files with 69 additions and 3 deletions

View File

@ -877,6 +877,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
if (manualCmd)
setCurrentRow(m_currentRow, false);
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_SAVE));
if (retValue) {
// refresh parent tabs with the same table
refreshParentsSameTable();
}
return retValue;
}
catch (Exception e)
@ -894,11 +900,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Validate that current record has not changed and validate that every parent above has not changed
if (m_mTable.hasChanged(m_currentRow)) {
// return error stating that current record has changed and it cannot be saved
msg = "Current record was changed by another user, please ReQuery";
msg = Msg.getMsg(Env.getCtx(), "CurrentRecordModified");
log.saveError("CurrentRecordModified", msg, false);
return true;
}
if (this.m_vo.AD_Window_ID == 123) return false; // FIXME: arhipac: teo_sarca: workaround - issue when we have same table on parent and child records (BPartner), see tracker description (1985481)
if (isDetail()) {
// get parent tab
// the parent tab is the first tab above with level = this_tab_level-1
@ -909,7 +914,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// this is parent tab
if (parentTab.m_mTable.hasChanged(parentTab.m_currentRow)) {
// return error stating that current record has changed and it cannot be saved
msg = "Record on parent tab " + parentTab.getName() + " was changed by another user, please ReQuery";
msg = Msg.getMsg(Env.getCtx(), "ParentRecordModified") + ": " + parentTab.getName();
log.saveError("ParentRecordModified", msg, false);
return true;
} else {
@ -926,6 +931,27 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return false;
}
private void refreshParentsSameTable() {
if (isDetail()) {
// get parent tab
// the parent tab is the first tab above with level = this_tab_level-1
int level = m_vo.TabLevel;
for (int i = m_window.getTabIndex(this) - 1; i >= 0; i--) {
GridTab parentTab = m_window.getTab(i);
if (parentTab.m_vo.TabLevel == level-1) {
if (parentTab.getAD_Table_ID() == getAD_Table_ID()) {
parentTab.dataRefresh();
}
// search for the next parent
if (parentTab.isDetail()) {
level = parentTab.m_vo.TabLevel;
} else {
break;
}
}
}
}
}
/**
* Do we need to Save?

View File

@ -0,0 +1,20 @@
-- May 8, 2009 1:16:42 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53059,0,TO_DATE('2009-05-08 13:16:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Current record was changed by another user, please ReQuery','E',TO_DATE('2009-05-08 13:16:41','YYYY-MM-DD HH24:MI:SS'),100,'CurrentRecordModified')
;
-- May 8, 2009 1:16:42 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53059 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- May 8, 2009 1:17:20 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53060,0,TO_DATE('2009-05-08 13:17:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Record on parent tab was changed by another user, please navigate to tab and ReQuery','E',TO_DATE('2009-05-08 13:17:20','YYYY-MM-DD HH24:MI:SS'),100,'ParentRecordModified')
;
-- May 8, 2009 1:17:20 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53060 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;

View File

@ -0,0 +1,20 @@
-- May 8, 2009 1:16:42 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53059,0,TO_TIMESTAMP('2009-05-08 13:16:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Current record was changed by another user, please ReQuery','E',TO_TIMESTAMP('2009-05-08 13:16:41','YYYY-MM-DD HH24:MI:SS'),100,'CurrentRecordModified')
;
-- May 8, 2009 1:16:42 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53059 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- May 8, 2009 1:17:20 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53060,0,TO_TIMESTAMP('2009-05-08 13:17:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Record on parent tab was changed by another user, please navigate to tab and ReQuery','E',TO_TIMESTAMP('2009-05-08 13:17:20','YYYY-MM-DD HH24:MI:SS'),100,'ParentRecordModified')
;
-- May 8, 2009 1:17:20 PM COT
-- BF1985481-Processed documents can be edited
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53060 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;