Merge with ade8e366cf54154e97af42addf956d38229c553c
This commit is contained in:
commit
17aeb199ef
|
@ -133,3 +133,6 @@ INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarBut
|
||||||
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
|
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_DATE('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201211140148_IDEMPIERE-378.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- IDEMPIERE-457 - hide tab editor for inactive tabs
|
||||||
|
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N & @IsActive@=Y ',Updated=TO_DATE('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201211141558_IDEMPIERE-457.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -133,3 +133,6 @@ INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarB
|
||||||
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
|
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,SeqNo,AD_Process_ID,AD_ToolBarButton_ID,Updated,IsActive,IsCustomization,Name,AD_Client_ID,AD_ToolBarButton_UU,ComponentName,Created,CreatedBy,UpdatedBy,AD_Org_ID) VALUES ('W',692,10,200016,200072,TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),'Y','N','Reverse PO Matching',0,'99e7e98d-a600-4174-9b55-923b790d03ba','ReverseMatchPO',TO_TIMESTAMP('2012-11-12 18:37:49','YYYY-MM-DD HH24:MI:SS'),100,100,0)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201211140148_IDEMPIERE-378.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- IDEMPIERE-457 - hide tab editor for inactive tabs
|
||||||
|
UPDATE AD_ToolBarButton SET DisplayLogic='@IsSortTab@=N & @IsActive@=Y ',Updated=TO_TIMESTAMP('2012-11-07 14:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200068
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201211141558_IDEMPIERE-457.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -122,6 +122,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
Grid form;
|
Grid form;
|
||||||
Vlayout centerVLayout;
|
Vlayout centerVLayout;
|
||||||
Vlayout westVLayout ;
|
Vlayout westVLayout ;
|
||||||
|
|
||||||
|
private static final int POSSEQMULTIPLIER = 10000000;
|
||||||
|
|
||||||
public WTabEditor()
|
public WTabEditor()
|
||||||
{
|
{
|
||||||
|
@ -351,7 +353,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
|
private void setLastCellProps(Cell lastCell, int actualxpos, int seqNo) {
|
||||||
lastCell.setDroppable("true");
|
lastCell.setDroppable("true");
|
||||||
lastCell.addEventListener(Events.ON_DROP, this);
|
lastCell.addEventListener(Events.ON_DROP, this);
|
||||||
int value = (actualxpos+1) * 10000000 + seqNo;
|
int value = (actualxpos+1) * POSSEQMULTIPLIER + seqNo;
|
||||||
mapEmptyCellField.put(lastCell, value);
|
mapEmptyCellField.put(lastCell, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,8 +549,8 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
MField field = getMField(fieldid);
|
MField field = getMField(fieldid);
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
setActiveMField(field);
|
setActiveMField(field);
|
||||||
setBackgroundField(field);
|
|
||||||
setProperties(field);
|
setProperties(field);
|
||||||
|
setBackgroundField(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,13 +562,14 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
MField field = getMField(gridField.getAD_Field_ID());
|
MField field = getMField(gridField.getAD_Field_ID());
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
setActiveMField(field);
|
setActiveMField(field);
|
||||||
setBackgroundField(field);
|
|
||||||
setProperties(field);
|
setProperties(field);
|
||||||
}
|
setBackgroundField(field);
|
||||||
// select the field on the visible list and set focus
|
// select the field on the visible list and set focus
|
||||||
for (Listitem item : visible.getItems()) {
|
for (Listitem item : visible.getItems()) {
|
||||||
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
|
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
|
||||||
visible.setSelectedItem(item);
|
visible.setSelectedItem(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -588,22 +591,17 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
} else {
|
} else {
|
||||||
field.setColumnSpan(field.getColumnSpan()+mult);
|
field.setColumnSpan(field.getColumnSpan()+mult);
|
||||||
}
|
}
|
||||||
setProperties(field);
|
|
||||||
resortArrays();
|
|
||||||
setProperties(field); // seqno could change
|
|
||||||
updateLists(field);
|
|
||||||
repaintGrid();
|
|
||||||
if (field != null) {
|
|
||||||
setActiveMField(field);
|
|
||||||
setBackgroundField(field);
|
|
||||||
setProperties(field);
|
|
||||||
}
|
|
||||||
// select the field on the visible list and set focus
|
// select the field on the visible list and set focus
|
||||||
for (Listitem item : visible.getItems()) {
|
for (Listitem item : visible.getItems()) {
|
||||||
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
|
if (field.getAD_Field_ID() == (Integer) item.getValue()) {
|
||||||
visible.setSelectedItem(item);
|
visible.setSelectedItem(item);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setActiveMField(field);
|
||||||
|
setProperties(field);
|
||||||
|
repaintGrid();
|
||||||
|
setBackgroundField(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,13 +622,12 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
// check empty cells
|
// check empty cells
|
||||||
Integer posseq = mapEmptyCellField.get(me.getTarget());
|
Integer posseq = mapEmptyCellField.get(me.getTarget());
|
||||||
if (posseq != null) {
|
if (posseq != null) {
|
||||||
int actualxpos = posseq / 10000000;
|
int actualxpos = posseq / POSSEQMULTIPLIER;
|
||||||
int seqno = posseq - (actualxpos * 10000000);
|
int seqno = posseq - (actualxpos * POSSEQMULTIPLIER);
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
field.setSeqNo(seqno-5);
|
field.setSeqNo(seqno-5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(actualxpos);
|
field.setXPosition(actualxpos);
|
||||||
setProperties(field);
|
|
||||||
resortArrays();
|
resortArrays();
|
||||||
setProperties(field); // seqno could change
|
setProperties(field); // seqno could change
|
||||||
updateLists(field);
|
updateLists(field);
|
||||||
|
@ -646,17 +643,16 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
// item moved from visible to invisible
|
// item moved from visible to invisible
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
setActiveMField(field);
|
setActiveMField(field);
|
||||||
setBackgroundField(field);
|
|
||||||
field.setSeqNo(0);
|
field.setSeqNo(0);
|
||||||
field.setIsDisplayed(false);
|
field.setIsDisplayed(false);
|
||||||
field.setXPosition(1);
|
field.setXPosition(1);
|
||||||
setProperties(field);
|
|
||||||
resortArrays();
|
resortArrays();
|
||||||
setProperties(field); // seqno could change
|
setProperties(field); // seqno could change
|
||||||
updateLists(field);
|
updateLists(field);
|
||||||
repaintGrid();
|
repaintGrid();
|
||||||
|
setBackgroundField(field);
|
||||||
}
|
}
|
||||||
else if (startItem.getListbox() == invisible && endItem.getListbox() == visible)
|
else if (startItem.getListbox() == invisible && endItem.getListbox() == visible && (Integer) startItem.getValue() != 0)
|
||||||
{
|
{
|
||||||
// item moved from invisible to visible
|
// item moved from invisible to visible
|
||||||
MField field = getMField((Integer) startItem.getValue());
|
MField field = getMField((Integer) startItem.getValue());
|
||||||
|
@ -664,7 +660,6 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
field.setSeqNo(fieldTo.getSeqNo()-5);
|
field.setSeqNo(fieldTo.getSeqNo()-5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(fieldTo.getXPosition());
|
field.setXPosition(fieldTo.getXPosition());
|
||||||
setProperties(field);
|
|
||||||
resortArrays();
|
resortArrays();
|
||||||
setProperties(field); // seqno could change
|
setProperties(field); // seqno could change
|
||||||
updateLists(field);
|
updateLists(field);
|
||||||
|
@ -680,7 +675,6 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
field.setSeqNo(fieldTo.getSeqNo()-5);
|
field.setSeqNo(fieldTo.getSeqNo()-5);
|
||||||
field.setIsDisplayed(true);
|
field.setIsDisplayed(true);
|
||||||
field.setXPosition(fieldTo.getXPosition());
|
field.setXPosition(fieldTo.getXPosition());
|
||||||
setProperties(field);
|
|
||||||
resortArrays();
|
resortArrays();
|
||||||
setProperties(field); // seqno could change
|
setProperties(field); // seqno could change
|
||||||
updateLists(field);
|
updateLists(field);
|
||||||
|
@ -766,9 +760,10 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
visible.removeAllItems();
|
visible.removeAllItems();
|
||||||
invisible.removeAllItems();
|
invisible.removeAllItems();
|
||||||
|
|
||||||
for(MField field : getMFields())
|
for (MField field : getMFields())
|
||||||
{
|
{
|
||||||
if (!field.isActive())
|
GridField gridField = getGridField(field);
|
||||||
|
if (!field.isActive() || gridField.isToolbarButton())
|
||||||
continue;
|
continue;
|
||||||
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
|
KeyNamePair pair = new KeyNamePair(field.getAD_Field_ID(), field.getName());
|
||||||
if (field.isDisplayed()) {
|
if (field.isDisplayed()) {
|
||||||
|
@ -781,6 +776,9 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
||||||
invisible.setSelectedKeyNamePair(pair);
|
invisible.setSelectedKeyNamePair(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (invisible.getItems().isEmpty()){
|
||||||
|
invisible.addItem(new KeyNamePair(0, "..."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -155,29 +155,31 @@ public class WPaymentEditor extends WEditor implements ListDataListener {
|
||||||
@Override
|
@Override
|
||||||
public void setReadWrite(boolean readWrite) {
|
public void setReadWrite(boolean readWrite) {
|
||||||
GridTab m_mTab = gridField.getGridTab();
|
GridTab m_mTab = gridField.getGridTab();
|
||||||
String m_DocStatus = (String) m_mTab.getValue("DocStatus");
|
|
||||||
// DocStatus
|
|
||||||
if (m_DocStatus == null)
|
|
||||||
m_DocStatus = "";
|
|
||||||
// Is the Trx closed? Reversed / Voided / Cloased
|
|
||||||
if (m_DocStatus.equals("RE") || m_DocStatus.equals("VO") || m_DocStatus.equals("CL"))
|
|
||||||
{
|
|
||||||
getComponent().setEnabled(readWrite, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean m_onlyRule = false;
|
boolean m_onlyRule = false;
|
||||||
// Document is not complete - allow to change the Payment Rule only
|
if (m_mTab != null) {
|
||||||
if (m_DocStatus.equals("CO") || m_DocStatus.equals("WP"))
|
String m_DocStatus = (String) m_mTab.getValue("DocStatus");
|
||||||
m_onlyRule = false;
|
// DocStatus
|
||||||
else
|
if (m_DocStatus == null)
|
||||||
m_onlyRule = true;
|
m_DocStatus = "";
|
||||||
|
// Is the Trx closed? Reversed / Voided / Cloased
|
||||||
boolean m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), gridField.getWindowNo(), "IsSOTrx"));
|
if (m_DocStatus.equals("RE") || m_DocStatus.equals("VO") || m_DocStatus.equals("CL"))
|
||||||
// PO only Rule
|
{
|
||||||
if (!m_onlyRule // Only order has Warehouse
|
getComponent().setEnabled(readWrite, false);
|
||||||
&& !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null)
|
return;
|
||||||
m_onlyRule = true;
|
}
|
||||||
|
|
||||||
|
// Document is not complete - allow to change the Payment Rule only
|
||||||
|
if (m_DocStatus.equals("CO") || m_DocStatus.equals("WP"))
|
||||||
|
m_onlyRule = false;
|
||||||
|
else
|
||||||
|
m_onlyRule = true;
|
||||||
|
|
||||||
|
boolean m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), gridField.getWindowNo(), "IsSOTrx"));
|
||||||
|
// PO only Rule
|
||||||
|
if (!m_onlyRule // Only order has Warehouse
|
||||||
|
&& !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null)
|
||||||
|
m_onlyRule = true;
|
||||||
|
}
|
||||||
|
|
||||||
getComponent().setEnabled(readWrite, readWrite && !m_onlyRule);
|
getComponent().setEnabled(readWrite, readWrite && !m_onlyRule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,9 @@ package org.compiere.apps.form;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MField;
|
import org.compiere.model.MField;
|
||||||
|
@ -40,10 +42,14 @@ public class TabEditor
|
||||||
public static CLogger log = CLogger.getCLogger(TabEditor.class);
|
public static CLogger log = CLogger.getCLogger(TabEditor.class);
|
||||||
|
|
||||||
private List<MField> fields = new ArrayList<MField>();
|
private List<MField> fields = new ArrayList<MField>();
|
||||||
|
|
||||||
private MField m_activeField;
|
|
||||||
|
|
||||||
private List<GridField> gridFields = new ArrayList<GridField>();
|
private List<GridField> gridFields = new ArrayList<GridField>();
|
||||||
|
|
||||||
|
private MField m_activeField;
|
||||||
|
|
||||||
|
private Map<Integer, MField> mapField = new HashMap<Integer, MField>();
|
||||||
|
|
||||||
|
private Map<Integer, GridField> mapGridField = new HashMap<Integer, GridField>();
|
||||||
|
|
||||||
public List<GridField> getGridFields() {
|
public List<GridField> getGridFields() {
|
||||||
return gridFields;
|
return gridFields;
|
||||||
|
@ -62,8 +68,10 @@ public class TabEditor
|
||||||
GridField[] l_gridFields = GridField.createFields(Env.getCtx(), windowNo, 0, tabid);
|
GridField[] l_gridFields = GridField.createFields(Env.getCtx(), windowNo, 0, tabid);
|
||||||
for (GridField gridField : l_gridFields) {
|
for (GridField gridField : l_gridFields) {
|
||||||
gridFields.add(gridField);
|
gridFields.add(gridField);
|
||||||
|
mapGridField.put(gridField.getAD_Field_ID(), gridField);
|
||||||
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
|
MField field = new MField(Env.getCtx(), gridField.getAD_Field_ID(), null);
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
|
mapField.put(field.getAD_Field_ID(), field);
|
||||||
gridField.getVO().IsReadOnly = true;
|
gridField.getVO().IsReadOnly = true;
|
||||||
gridField.getVO().IsMandatory = false;
|
gridField.getVO().IsMandatory = false;
|
||||||
gridField.getVO().IsUpdateable = false;
|
gridField.getVO().IsUpdateable = false;
|
||||||
|
@ -81,21 +89,11 @@ public class TabEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MField getMField(int fieldid) {
|
protected MField getMField(int fieldid) {
|
||||||
for (MField field : fields) {
|
return mapField.get(fieldid);
|
||||||
if (field.getAD_Field_ID() == fieldid) {
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected GridField getGridField(MField field) {
|
protected GridField getGridField(MField field) {
|
||||||
for (GridField gridfield : gridFields) {
|
return mapGridField.get( field.getAD_Field_ID());
|
||||||
if (gridfield.getAD_Field_ID() == field.getAD_Field_ID()) {
|
|
||||||
return gridfield;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MField getActiveMField() {
|
public MField getActiveMField() {
|
||||||
|
|
Loading…
Reference in New Issue