IDEMPIERE-3906 Make mandatory location on BP quick entry optional on certain tables / integrate contribution from TrekGlobal AP2-580
This commit is contained in:
parent
e0d96ee600
commit
963009b7c7
|
@ -0,0 +1,11 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Sep 19, 2018 3:29:19 PM MYT
|
||||
-- AP2-580 remove mandatory location on BP quick entry on OFX Transaction
|
||||
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Description,AD_SysConfig_UU,IsActive,Name,Created,CreatedBy,UpdatedBy,AD_Client_ID,Value,AD_Org_ID) VALUES (200145,'D','S',TO_DATE('2018-09-19 15:29:13','YYYY-MM-DD HH24:MI:SS'),'Comma separated list of tables where business partner location is optional for quick entry of business partner record','17facb7e-bab8-4c92-a6c6-e7db0ae427a1','Y','BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES',TO_DATE('2018-09-19 15:29:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,'C_Payment',0)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201809191200_Ticket_AP2-580.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Sep 19, 2018 3:29:19 PM MYT
|
||||
-- AP2-580 remove mandatory location on BP quick entry on OFX Transaction
|
||||
UPDATE AD_SysConfig SET ConfigurationLevel='C' WHERE AD_SysConfig_ID=200145
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201902281415_IDEMPIERE-3906.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- Sep 19, 2018 3:29:19 PM MYT
|
||||
-- AP2-580 remove mandatory location on BP quick entry on OFX Transaction
|
||||
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Updated,Description,AD_SysConfig_UU,IsActive,Name,Created,CreatedBy,UpdatedBy,AD_Client_ID,Value,AD_Org_ID) VALUES (200145,'D','S',TO_TIMESTAMP('2018-09-19 15:29:13','YYYY-MM-DD HH24:MI:SS'),'Comma separated list of tables where business partner location is optional for quick entry of business partner record','17facb7e-bab8-4c92-a6c6-e7db0ae427a1','Y','BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES',TO_TIMESTAMP('2018-09-19 15:29:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,'C_Payment',0)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201809191200_Ticket_AP2-580.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- Sep 19, 2018 3:29:19 PM MYT
|
||||
-- AP2-580 remove mandatory location on BP quick entry on OFX Transaction
|
||||
UPDATE AD_SysConfig SET ConfigurationLevel='C' WHERE AD_SysConfig_ID=200145
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201902281415_IDEMPIERE-3906.sql') FROM dual
|
||||
;
|
||||
|
|
@ -23,9 +23,12 @@ import org.compiere.model.GridField;
|
|||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* BPartnerLocation Callouts.
|
||||
|
@ -88,6 +91,31 @@ public class CalloutBPartnerLocation extends CalloutEngine
|
|||
{
|
||||
// this callout is just for quick entry window
|
||||
if ("Y".equals(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_MODE_"))) {
|
||||
|
||||
String optionals = MSysConfig.getValue(MSysConfig.BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES, Env.getAD_Client_ID(ctx));
|
||||
String[] tables = null;
|
||||
if (!Util.isEmpty(optionals, true)) {
|
||||
tables = optionals.split("[,]");
|
||||
}
|
||||
if (tables != null && tables.length > 0) {
|
||||
int parent_windowNo = Integer.parseInt(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_CALLER_WINDOW_"));
|
||||
int parent_tabNo = Integer.parseInt(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_CALLER_TAB_"));
|
||||
//Search the table ID of the first tab
|
||||
int AD_Table_ID = Env.getContextAsInt(ctx, parent_windowNo, parent_tabNo + "|_TabInfo_AD_Table_ID", false);
|
||||
|
||||
//If the new business partner is being created from payment - let the address be null
|
||||
//AP2-413 Remove mandatory flag from location on BP quick entry
|
||||
String tableName = MTable.getTableName(ctx, AD_Table_ID);
|
||||
if (!Util.isEmpty(tableName, true))
|
||||
{
|
||||
for(String table : tables)
|
||||
{
|
||||
if (tableName.equalsIgnoreCase(table.trim()))
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
return Msg.getMsg(ctx, "FillMandatory") + " " + Msg.getElement(ctx, mField.getColumnName());
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1401329788730986024L;
|
||||
private static final long serialVersionUID = 8922763368373540965L;
|
||||
|
||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||
|
@ -73,6 +73,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
public static final String BACKGROUND_JOB_MAX_IN_SYSTEM = "BACKGROUND_JOB_MAX_IN_SYSTEM";
|
||||
public static final String BACKGROUND_JOB_MAX_PER_CLIENT = "BACKGROUND_JOB_MAX_PER_CLIENT";
|
||||
public static final String BACKGROUND_JOB_MAX_PER_USER = "BACKGROUND_JOB_MAX_PER_USER";
|
||||
public static final String BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES = "BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES";
|
||||
public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE";
|
||||
public static final String CASH_AS_PAYMENT = "CASH_AS_PAYMENT";
|
||||
public static final String CHANGE_PASSWORD_MUST_DIFFER = "CHANGE_PASSWORD_MUST_DIFFER";
|
||||
|
|
|
@ -498,7 +498,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
zoomWindowId = gridField != null ? lookup.getZoom(Env.isSOTrx(Env.getCtx(), gridField.getWindowNo())) : lookup.getZoom(Env.isSOTrx(Env.getCtx()));
|
||||
}
|
||||
|
||||
final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), zoomWindowId);
|
||||
int tabNo = gridField != null && gridField.getGridTab() != null ? gridField.getGridTab().getTabNo() : 0;
|
||||
final WQuickEntry vqe = new WQuickEntry(lookup.getWindowNo(), tabNo, zoomWindowId);
|
||||
if (vqe.getQuickFields()<=0)
|
||||
return;
|
||||
vqe.loadRecord (Record_ID);
|
||||
|
|
|
@ -599,7 +599,8 @@ ContextMenuListener, IZoomableEditor
|
|||
if(!getComponent().isEnabled())
|
||||
return;
|
||||
|
||||
final WQuickEntry vqe = new WQuickEntry (lookup.getWindowNo(), lookup.getZoom());
|
||||
int tabNo = gridField != null && gridField.getGridTab() != null ? gridField.getGridTab().getTabNo() : 0;
|
||||
final WQuickEntry vqe = new WQuickEntry(lookup.getWindowNo(), tabNo, lookup.getZoom());
|
||||
int Record_ID = 0;
|
||||
|
||||
Object value = getValue();
|
||||
|
|
|
@ -66,15 +66,17 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1397302187339942732L;
|
||||
private static final long serialVersionUID = -6385383768870354870L;
|
||||
|
||||
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
|
||||
public static final String QUICK_ENTRY_CALLER_WINDOW = "_QUICK_ENTRY_CALLER_WINDOW_";
|
||||
public static final String QUICK_ENTRY_CALLER_TAB = "_QUICK_ENTRY_CALLER_TAB_";
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(WQuickEntry.class);
|
||||
|
||||
protected int m_WindowNo;
|
||||
private int parent_WindowNo;
|
||||
private int parent_TabNo;
|
||||
|
||||
List<GridField> quickFields = new ArrayList<GridField>();
|
||||
protected List<WEditor> quickEditors = new ArrayList<WEditor>();
|
||||
|
@ -94,19 +96,25 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
|||
private boolean isHasField = false;
|
||||
|
||||
private String orientation;
|
||||
|
||||
public WQuickEntry(int WindowNo, int AD_Window_ID)
|
||||
{
|
||||
this(WindowNo, 0, AD_Window_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Requires call loadRecord
|
||||
* @param WindowNo Window No
|
||||
* @param AD_Window_ID
|
||||
*/
|
||||
|
||||
public WQuickEntry(int WindowNo, int AD_Window_ID)
|
||||
public WQuickEntry(int WindowNo, int TabNo, int AD_Window_ID)
|
||||
{
|
||||
super();
|
||||
|
||||
m_AD_Window_ID = AD_Window_ID;
|
||||
parent_WindowNo = WindowNo;
|
||||
parent_TabNo = TabNo;
|
||||
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||
log.info("R/O=" + m_readOnly);
|
||||
|
||||
|
@ -121,6 +129,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
|||
|
||||
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_MODE, "Y");
|
||||
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_WINDOW, parent_WindowNo);
|
||||
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_TAB, parent_TabNo);
|
||||
initPOs();
|
||||
|
||||
} // WQuickEntry
|
||||
|
|
Loading…
Reference in New Issue