Merging IDEMPIERE-377

This commit is contained in:
Deepak Pansheriya 2012-08-30 10:50:41 +05:30
commit b61a7c374b
11 changed files with 265 additions and 115 deletions

View File

@ -0,0 +1,15 @@
-- Aug 27, 2012 9:48:50 PM IST
-- Add search sequence support for search dialog
UPDATE AD_Message SET MsgText='History records',Updated=TO_DATE('2012-08-27 21:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=292
;
-- Aug 27, 2012 9:48:50 PM IST
-- Add search sequence support for search dialog
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=292
;
UPDATE AD_System
SET LastMigrationScriptApplied='895_IDEMPIERE-377_History_Trl.sql'
WHERE LastMigrationScriptApplied<'895_IDEMPIERE-377_History_Trl.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,15 @@
-- Aug 29, 2012 9:03:37 AM COT
-- IDEMPIERE-29 Improvement on full location
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Show Location',200024,'D','9ddf0097-1eb7-4e6f-88a0-1dfdd6334097','ShowLocation','Y',TO_DATE('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'))
;
-- Aug 29, 2012 9:03:37 AM COT
-- IDEMPIERE-29 Improvement on full location
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200024 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
UPDATE AD_System
SET LastMigrationScriptApplied='896_IDEMPIERE-29.sql'
WHERE LastMigrationScriptApplied<'896_IDEMPIERE-29.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,15 @@
-- Aug 27, 2012 9:48:50 PM IST
-- Add search sequence support for search dialog
UPDATE AD_Message SET MsgText='History records',Updated=TO_TIMESTAMP('2012-08-27 21:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=292
;
-- Aug 27, 2012 9:48:50 PM IST
-- Add search sequence support for search dialog
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=292
;
UPDATE AD_System
SET LastMigrationScriptApplied='895_IDEMPIERE-377_History_Trl.sql'
WHERE LastMigrationScriptApplied<'895_IDEMPIERE-377_History_Trl.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,15 @@
-- Aug 29, 2012 9:03:37 AM COT
-- IDEMPIERE-29 Improvement on full location
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Show Location',200024,'D','9ddf0097-1eb7-4e6f-88a0-1dfdd6334097','ShowLocation','Y',TO_TIMESTAMP('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-08-29 09:03:36','YYYY-MM-DD HH24:MI:SS'))
;
-- Aug 29, 2012 9:03:37 AM COT
-- IDEMPIERE-29 Improvement on full location
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200024 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
UPDATE AD_System
SET LastMigrationScriptApplied='896_IDEMPIERE-29.sql'
WHERE LastMigrationScriptApplied<'896_IDEMPIERE-29.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -16,6 +16,10 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.grid.ed; package org.compiere.grid.ed;
import static org.compiere.model.SystemIDs.COLUMN_AD_WF_ACTIVITY_AD_USER_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICELINE_M_PRODUCT_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -54,11 +58,12 @@ import org.compiere.apps.FieldRecordInfo;
import org.compiere.apps.search.Info; import org.compiere.apps.search.Info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MLocation;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import static org.compiere.model.SystemIDs.*;
import org.compiere.swing.CButton; import org.compiere.swing.CButton;
import org.compiere.swing.CMenuItem; import org.compiere.swing.CMenuItem;
import org.compiere.swing.CTextField; import org.compiere.swing.CTextField;
@ -101,7 +106,7 @@ public class VLookup extends JComponent
/** /**
* *
*/ */
private static final long serialVersionUID = 1307112072890929329L; private static final long serialVersionUID = -8609913311212365705L;
/***************************************************************************** /*****************************************************************************
* Mouse Listener for Popup Menu * Mouse Listener for Popup Menu
@ -315,6 +320,14 @@ public class VLookup extends JComponent
mBPartnerUpd.addActionListener(this); mBPartnerUpd.addActionListener(this);
popupMenu.add(mBPartnerUpd); popupMenu.add(mBPartnerUpd);
} }
if ((columnName.toUpperCase().equals("C_BPARTNER_LOCATION_ID"))
|| (columnName.toUpperCase().equals("BILL_LOCATION_ID"))
|| (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID")))
{
m_location = new CMenuItem (Msg.getMsg(Env.getCtx(), "ShowLocation"), Env.getImageIcon("InfoBPartner16.gif"));
m_location.addActionListener(this);
popupMenu.add(m_location);
}
// //
if (m_lookup != null && m_lookup.getZoom() == 0) if (m_lookup != null && m_lookup.getZoom() == 0)
mZoom.setEnabled(false); mZoom.setEnabled(false);
@ -377,6 +390,7 @@ public class VLookup extends JComponent
private CMenuItem mRefresh; private CMenuItem mRefresh;
private CMenuItem mBPartnerNew; private CMenuItem mBPartnerNew;
private CMenuItem mBPartnerUpd; private CMenuItem mBPartnerUpd;
private CMenuItem m_location;
// Mouse Listener // Mouse Listener
private VLookup_mouseAdapter mouseAdapter; private VLookup_mouseAdapter mouseAdapter;
@ -745,6 +759,8 @@ public class VLookup extends JComponent
actionBPartner(true); actionBPartner(true);
else if (e.getSource() == mBPartnerUpd) else if (e.getSource() == mBPartnerUpd)
actionBPartner(false); actionBPartner(false);
else if (e.getSource() == m_location)
actionLocation();
} // actionPerformed } // actionPerformed
/** /**
@ -1279,6 +1295,24 @@ public class VLookup extends JComponent
actionCombo (new Integer(result)); // data binding actionCombo (new Integer(result)); // data binding
} // actionBPartner } // actionBPartner
private void actionLocation ()
{
int BPLocation_ID = 0;
if (m_value instanceof Integer)
BPLocation_ID = ((Integer)m_value).intValue();
else if (m_value != null)
BPLocation_ID = Integer.parseInt(m_value.toString());
if (BPLocation_ID>0)
{
MBPartnerLocation bpl = new MBPartnerLocation(Env.getCtx(), BPLocation_ID, null);
MLocation location= new MLocation(Env.getCtx(), bpl.getC_Location_ID(), null);
VLocationDialog ld = new VLocationDialog(AEnv.getFrame(this), Msg.getMsg(Env.getCtx(), "C_Location_ID"), location);
ld.setVisible(true);
}
} // actionBPartner
/** /**
* Action - Zoom * Action - Zoom
* @param selectedItem item * @param selectedItem item

View File

@ -57,7 +57,7 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
/** /**
* *
*/ */
private static final long serialVersionUID = -8640626174604214333L; private static final long serialVersionUID = 904447827065380369L;
private static final String BTNPREFIX = "Btn"; private static final String BTNPREFIX = "Btn";
@ -75,7 +75,7 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
private ToolBarButton btnGridToggle; private ToolBarButton btnGridToggle;
private ToolBarButton btnHistoryRecords, btnParentRecord, btnDetailRecord; private ToolBarButton btnParentRecord, btnDetailRecord;
private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast; private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast;
@ -154,7 +154,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
btnAttachment = createButton("Attachment", "Attachment", "Attachment"); btnAttachment = createButton("Attachment", "Attachment", "Attachment");
btnChat = createButton("Chat", "Chat", "Chat"); btnChat = createButton("Chat", "Chat", "Chat");
btnGridToggle = createButton("Toggle", "Multi", "Multi"); btnGridToggle = createButton("Toggle", "Multi", "Multi");
btnHistoryRecords = createButton("HistoryRecords", "HistoryX", "History");
addSeparator(); addSeparator();
btnParentRecord = createButton("ParentRecord", "Parent", "Parent"); btnParentRecord = createButton("ParentRecord", "Parent", "Parent");
btnDetailRecord = createButton("DetailRecord", "Detail", "Detail"); btnDetailRecord = createButton("DetailRecord", "Detail", "Detail");
@ -203,7 +202,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
btnParentRecord.setVisible(false); btnParentRecord.setVisible(false);
btnDetailRecord.setVisible(false); btnDetailRecord.setVisible(false);
btnActiveWorkflows.setVisible(false); btnActiveWorkflows.setVisible(false);
btnHistoryRecords.setVisible(false);
btnProductInfo.setVisible(false); btnProductInfo.setVisible(false);
setAlign("end"); setAlign("end");
setWidth("100%"); setWidth("100%");
@ -288,7 +286,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
keyMap.put(KeyEvent.F6, btnFind); keyMap.put(KeyEvent.F6, btnFind);
keyMap.put(KeyEvent.F7, btnAttachment); keyMap.put(KeyEvent.F7, btnAttachment);
keyMap.put(KeyEvent.F8, btnGridToggle); keyMap.put(KeyEvent.F8, btnGridToggle);
keyMap.put(KeyEvent.F9, btnHistoryRecords);
keyMap.put(KeyEvent.F11, btnReport); keyMap.put(KeyEvent.F11, btnReport);
keyMap.put(KeyEvent.F12, btnPrint); keyMap.put(KeyEvent.F12, btnPrint);
@ -401,11 +398,6 @@ public class CWindowToolbar extends FToolbar implements EventListener<Event>
this.event = null; this.event = null;
} }
public void enableHistoryRecords(boolean enabled)
{
this.btnHistoryRecords.setDisabled(!enabled);
}
public void enableNavigation(boolean enabled) public void enableNavigation(boolean enabled)
{ {
this.btnFirst.setDisabled(!enabled); this.btnFirst.setDisabled(!enabled);

View File

@ -41,13 +41,14 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
/** /**
* *
*/ */
private static final long serialVersionUID = 8172397145177408454L; private static final long serialVersionUID = 5813878069049398656L;
public static final String EVENT_ATTRIBUTE = "EVENT"; public static final String EVENT_ATTRIBUTE = "EVENT";
public static final String ZOOM_EVENT = "ZOOM"; public static final String ZOOM_EVENT = "ZOOM";
public static final String REQUERY_EVENT = "REQUERY"; public static final String REQUERY_EVENT = "REQUERY";
public static final String PREFERENCE_EVENT = "VALUE_PREFERENCE"; public static final String PREFERENCE_EVENT = "VALUE_PREFERENCE";
public static final String NEW_EVENT = "NEW_RECORD"; public static final String NEW_EVENT = "NEW_RECORD";
public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record
public static final String SHOWLOCATION_EVENT = "SHOW_LOCATION";
public static final String CHANGE_LOG_EVENT = "CHANGE_LOG"; public static final String CHANGE_LOG_EVENT = "CHANGE_LOG";
public static final String EDITOR_EVENT = "EDITOR"; public static final String EDITOR_EVENT = "EDITOR";
@ -56,26 +57,33 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
private boolean zoomEnabled = true; private boolean zoomEnabled = true;
private boolean requeryEnabled = true; private boolean requeryEnabled = true;
private boolean preferencesEnabled = true; private boolean preferencesEnabled = true;
private boolean showLocation = true;
private Menuitem zoomItem; private Menuitem zoomItem;
private Menuitem requeryItem; private Menuitem requeryItem;
private Menuitem prefItem; private Menuitem prefItem;
private Menuitem newItem; private Menuitem newItem;
private Menuitem updateItem; // Elaine 2009/02/16 - update record private Menuitem updateItem; // Elaine 2009/02/16 - update record
private Menuitem showLocationItem;
private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>(); private ArrayList<ContextMenuListener> menuListeners = new ArrayList<ContextMenuListener>();
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences) public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences)
{ {
this(zoom, requery, preferences, false, false); this(zoom, requery, preferences, false, false, false);
} }
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord) public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord)
{ {
this(zoom, requery, preferences, newRecord, false); this(zoom, requery, preferences, newRecord, false, false);
} }
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord) public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord)
{
this(zoom, requery, preferences, newRecord, updateRecord, false);
}
public WEditorPopupMenu(boolean zoom, boolean requery, boolean preferences, boolean newRecord, boolean updateRecord, boolean showLocation)
{ {
super(); super();
this.zoomEnabled = zoom; this.zoomEnabled = zoom;
@ -83,6 +91,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
this.preferencesEnabled = preferences; this.preferencesEnabled = preferences;
this.newEnabled = newRecord; this.newEnabled = newRecord;
this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record this.updateEnabled = updateRecord; // Elaine 2009/02/16 - update record
this.showLocation = showLocation;
init(); init();
} }
@ -144,6 +153,15 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
this.appendChild(updateItem); this.appendChild(updateItem);
} }
// //
if (showLocation)
{
showLocationItem = new Menuitem();
showLocationItem.setAttribute(EVENT_ATTRIBUTE, SHOWLOCATION_EVENT);
showLocationItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ShowLocation")));
showLocationItem.setImage("/images/InfoBPartner16.png");
showLocationItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(showLocationItem);
}
} }

View File

@ -29,12 +29,16 @@ import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.window.WFieldRecordInfo; import org.adempiere.webui.window.WFieldRecordInfo;
import org.adempiere.webui.window.WLocationDialog;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MLocation;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
@ -142,7 +146,15 @@ ContextMenuListener, IZoomableEditor
if (gridField != null) if (gridField != null)
{ {
String columnName = getColumnName();
if ((columnName.toUpperCase().equals("C_BPARTNER_LOCATION_ID"))
|| (columnName.toUpperCase().equals("BILL_LOCATION_ID"))
|| (columnName.toUpperCase().equals("DROPSHIP_LOCATION_ID")))
{
popupMenu = new WEditorPopupMenu(true, true, isShowPreference(), false, false, true);
} else {
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference()); popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference());
}
addChangeLogMenu(popupMenu); addChangeLogMenu(popupMenu);
} }
} }
@ -377,6 +389,26 @@ ContextMenuListener, IZoomableEditor
AEnv.actionZoom(lookup, getValue()); AEnv.actionZoom(lookup, getValue());
} }
private void actionLocation() {
int BPLocation_ID = 0;
Object value = getValue();
if (value instanceof Integer)
BPLocation_ID = ((Integer)value).intValue();
else if (value != null)
BPLocation_ID = Integer.parseInt(value.toString());
if (BPLocation_ID>0)
{
MBPartnerLocation bpl = new MBPartnerLocation(Env.getCtx(), BPLocation_ID, null);
MLocation location= new MLocation(Env.getCtx(), bpl.getC_Location_ID(), null);
final WLocationDialog vbp = new WLocationDialog(Msg.getMsg(Env.getCtx(), "Location"), location);
vbp.setVisible(true);
AEnv.showWindow(vbp);
}
} // actionLocation
public void onMenu(ContextMenuEvent evt) public void onMenu(ContextMenuEvent evt)
{ {
if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent())) if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent()))
@ -397,6 +429,10 @@ ContextMenuListener, IZoomableEditor
{ {
WFieldRecordInfo.start(gridField); WFieldRecordInfo.start(gridField);
} }
else if (WEditorPopupMenu.SHOWLOCATION_EVENT.equals(evt.getContextEvent()))
{
actionLocation();
}
} }
public void propertyChange(PropertyChangeEvent evt) public void propertyChange(PropertyChangeEvent evt)

View File

@ -115,11 +115,6 @@ public interface ToolbarListener
*/ */
public void onAttachment(); public void onAttachment();
/**
* Open the history dialog
*/
public void onHistoryRecords();
/** /**
* Open the archive dialog * Open the archive dialog
*/ */

View File

@ -160,8 +160,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private boolean boolChanges = false; private boolean boolChanges = false;
private int m_onlyCurrentDays = 0;
private Component parent; private Component parent;
private boolean m_findCancelled; private boolean m_findCancelled;
@ -364,11 +362,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.enableFind(true); toolbar.enableFind(true);
adTab.evaluate(null); adTab.evaluate(null);
if (gridWindow.isTransaction())
{
toolbar.enableHistoryRecords(true);
}
if (detailQuery != null && zoomToDetailTab(detailQuery)) if (detailQuery != null && zoomToDetailTab(detailQuery))
{ {
return true; return true;
@ -379,7 +372,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
curTabIndex = embeddedTabindex; curTabIndex = embeddedTabindex;
toolbar.enableTabNavigation(false); toolbar.enableTabNavigation(false);
toolbar.enableFind(true); toolbar.enableFind(true);
toolbar.enableHistoryRecords(false);
} }
updateToolbar(); updateToolbar();
@ -648,7 +640,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
private void initFirstTabpanel() { private void initFirstTabpanel() {
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); curTabpanel.query(m_onlyCurrentRows, 0, MRole.getDefault().getMaxQueryRecords());
curTabpanel.activate(true); curTabpanel.activate(true);
} }
@ -919,57 +911,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} // lock } // lock
// //
/**
* @see ToolbarListener#onHistoryRecords()
*/
public void onHistoryRecords()
{
logger.info("");
if (gridWindow.isTransaction())
{
Callback<Boolean> callback = new Callback<Boolean>() {
@Override
public void onCallback(Boolean result) {
if (result) {
final WOnlyCurrentDays ocd = new WOnlyCurrentDays();
ocd.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
m_onlyCurrentDays = ocd.getCurrentDays();
history(m_onlyCurrentDays);
focusToActivePanel();
}
});
AEnv.showWindow(ocd);
}
}
};
saveAndNavigate(callback);
}
}
private void history(int onlyCurrentDays)
{
if (onlyCurrentDays == 1) // Day
{
m_onlyCurrentRows = true;
onlyCurrentDays = 0; // no Created restriction
}
else
m_onlyCurrentRows = false;
curTab.setQuery(null); // reset previous queries
MRole role = MRole.getDefault();
int maxRows = role.getMaxQueryRecords();
logger.config("OnlyCurrent=" + m_onlyCurrentRows
+ ", Days=" + m_onlyCurrentDays
+ ", MaxRows=" + maxRows);
curTab.query(m_onlyCurrentRows, onlyCurrentDays, maxRows);
}
/** /**
* @see ToolbarListener#onAttachment() * @see ToolbarListener#onAttachment()
@ -1253,10 +1194,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.getButton("Attachment").setPressed(curTab.hasAttachment()); toolbar.getButton("Attachment").setPressed(curTab.hasAttachment());
toolbar.getButton("Chat").setPressed(curTab.hasChat()); toolbar.getButton("Chat").setPressed(curTab.hasChat());
if (isFirstTab())
{
toolbar.getButton("HistoryRecords").setPressed(!curTab.isOnlyCurrentRows());
}
toolbar.getButton("Find").setPressed(curTab.isQueryActive()); toolbar.getButton("Find").setPressed(curTab.isQueryActive());
if (toolbar.isPersonalLock) if (toolbar.isPersonalLock)
@ -1266,14 +1203,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.enablePrint(curTab.isPrinted()); toolbar.enablePrint(curTab.isPrinted());
if (gridWindow.isTransaction() && isFirstTab())
{
toolbar.enableHistoryRecords(true);
}
else
{
toolbar.enableHistoryRecords(false);
}
//Deepak-Enabling customize button IDEMPIERE-364 //Deepak-Enabling customize button IDEMPIERE-364
if(!(curTabpanel instanceof ADSortTab)) if(!(curTabpanel instanceof ADSortTab))
toolbar.enableCustomize(((ADTabpanel)curTabpanel).isGridView()); toolbar.enableCustomize(((ADTabpanel)curTabpanel).isGridView());
@ -1404,12 +1333,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.enableDelete(false); toolbar.enableDelete(false);
} }
// History (on first Tab only)
if (isFirstTab())
{
toolbar.getButton("HistoryRecords").setPressed(!curTab.isOnlyCurrentRows());
}
// Transaction info // Transaction info
String trxInfo = curTab.getTrxInfo(); String trxInfo = curTab.getTrxInfo();
if (trxInfo != null) if (trxInfo != null)
@ -1664,7 +1587,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
m_onlyCurrentRows = false; // search history too m_onlyCurrentRows = false; // search history too
curTab.setQuery(query); curTab.setQuery(query);
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize curTabpanel.query(m_onlyCurrentRows, 0, MRole.getDefault().getMaxQueryRecords()); // autoSize
} }
if (findWindow.isCreateNew()) if (findWindow.isCreateNew())

View File

@ -34,6 +34,8 @@ import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import jxl.biff.drawing.ComboBox;
import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
@ -110,7 +112,15 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
/** /**
* *
*/ */
private static final long serialVersionUID = 4937678675702382252L; private static final long serialVersionUID = -5352467965724233821L;
// values and label for history combo
private static final String HISTORY_DAY_ALL = "All";
private static final String HISTORY_DAY_YEAR = "Year";
private static final String HISTORY_DAY_MONTH = "Month";
private static final String HISTORY_DAY_WEEK = "Week";
private static final String HISTORY_DAY_DAY = "Day";
private static final String HISTORY_LABEL= "History";
/** Main Window for the Lookup Panel */ /** Main Window for the Lookup Panel */
private MultiTabPart winMain; private MultiTabPart winMain;
/** Simple Window Tab */ /** Simple Window Tab */
@ -176,6 +186,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
private static final String FIELD_SEPARATOR = "<^>"; private static final String FIELD_SEPARATOR = "<^>";
private static final String SEGMENT_SEPARATOR = "<~>"; private static final String SEGMENT_SEPARATOR = "<~>";
Combobox historyCombo = new Combobox();
/** /**
* FindPanel Constructor * FindPanel Constructor
* @param targetWindowNo targetWindowNo * @param targetWindowNo targetWindowNo
@ -469,15 +482,23 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
fQueryName.setValue(""); fQueryName.setValue("");
fQueryName.addEventListener(Events.ON_SELECT, this); fQueryName.addEventListener(Events.ON_SELECT, this);
// adding history combo
prepareHistoryCombo();
Label labelHistory = new Label(Msg.getMsg(Env.getCtx(), HISTORY_LABEL));
div.appendChild(labelHistory);
div.appendChild(historyCombo);
historyCombo.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
Label label = new Label(Msg.getMsg(Env.getCtx(), "SavedQuery")); Label label = new Label(Msg.getMsg(Env.getCtx(), "SavedQuery"));
div.appendChild(label); div.appendChild(label);
div.appendChild(fQueryName); div.appendChild(fQueryName);
div.appendChild(btnSave); div.appendChild(btnSave);
// div.appendChild(new Separator());
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
msgLabel = new Label(""); msgLabel = new Label("");
msgLabel.setStyle("margin-left: 10px"); msgLabel.setStyle("margin-left: 10px");
div.appendChild(msgLabel); div.appendChild(msgLabel);
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
winMain = new MultiTabPart(); winMain = new MultiTabPart();
winMain.createPart(layout); winMain.createPart(layout);
@ -499,6 +520,23 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
} // initPanel } // initPanel
/**
* preparing combo of history
*/
private void prepareHistoryCombo()
{
historyCombo.setAutodrop(true);
historyCombo.setAutocomplete(false);
historyCombo.setButtonVisible(true);
historyCombo.setReadonly(true);
historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_ALL)),HISTORY_DAY_ALL);
historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_YEAR)), HISTORY_DAY_YEAR);
historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_MONTH)), HISTORY_DAY_MONTH);
historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_WEEK)), HISTORY_DAY_WEEK);
historyCombo.appendItem((Msg.getMsg(Env.getCtx(), HISTORY_DAY_DAY)), HISTORY_DAY_DAY);
}
/** /**
* Dynamic Init.6 * Dynamic Init.6
* Set up GridController * Set up GridController
@ -664,6 +702,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
for (int c = 0; c < m_findFields.length; c++) for (int c = 0; c < m_findFields.length; c++)
{ {
GridField field = m_findFields[c]; GridField field = m_findFields[c];
String columnName = field.getColumnName(); String columnName = field.getColumnName();
String header = field.getHeader(); String header = field.getHeader();
if (header == null || header.length() == 0) if (header == null || header.length() == 0)
@ -1441,6 +1480,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_query.addRestriction(getSubCategoryWhereClause(((Integer) value).intValue())); m_query.addRestriction(getSubCategoryWhereClause(((Integer) value).intValue()));
else else
m_query.addRestriction(ColumnSQL, MQuery.EQUAL, value, ColumnName, wed.getDisplay()); m_query.addRestriction(ColumnSQL, MQuery.EQUAL, value, ColumnName, wed.getDisplay());
/* /*
if (value.toString().indexOf('%') != -1) if (value.toString().indexOf('%') != -1)
m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay()); m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay());
@ -1451,9 +1491,55 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
} }
} // editors } // editors
if(historyCombo.getSelectedItem()!=null)
{
addHistoryRestriction(historyCombo.getSelectedItem());
}
m_isCancel = false; // teo_sarca [ 1708717 ] m_isCancel = false; // teo_sarca [ 1708717 ]
} // cmd_ok_Simple } // cmd_ok_Simple
/**
* Get days from selected values of history combo
* @param selectedItem
* @return
*/
private int getHistoryDays(String selectedItem)
{
int retDays = 0;
if (selectedItem.equals(HISTORY_DAY_DAY))
retDays = 1;
else if (selectedItem.equals(HISTORY_DAY_WEEK))
retDays = 7;
else if (selectedItem.equals(HISTORY_DAY_MONTH))
retDays = 31;
else if (selectedItem.equals(HISTORY_DAY_YEAR))
retDays = 365;
return retDays;
}
/**
* Adding where clause from history data
* @param selectedHistoryItem
*/
private void addHistoryRestriction(Comboitem selectedHistoryItem)
{
String selectedHistoryValue = historyCombo.getSelectedItem().getValue();
log.info("History combo selected value =" +selectedHistoryValue);
if (null!=selectedHistoryItem && selectedHistoryItem.toString().length() > 0 && getHistoryDays(selectedHistoryValue) > 0)
{
StringBuffer where = new StringBuffer();
where.append("Created >= ");
where.append("SysDate-").append(getHistoryDays(selectedHistoryValue));
m_query.addRestriction(where.toString());
}
}
public void dispose() public void dispose()
{ {
log.config(""); log.config("");
@ -1569,8 +1655,14 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_query.addRestriction(ColumnSQL, Operator, parsedValue, m_query.addRestriction(ColumnSQL, Operator, parsedValue,
infoName, infoDisplay); infoName, infoDisplay);
} }
if(historyCombo.getSelectedItem()!=null)
{
addHistoryRestriction(historyCombo.getSelectedItem());
}
} // cmd_save } // cmd_save
/** /**
* Get the number of records of target tab * Get the number of records of target tab
* @param query where clause for target tab * @param query where clause for target tab