IDEMPIERE-5573 - Enable Showing Inactive Records through Reference (#1674)

* IDEMPIERE-5573 - Enable Showing Inactive Records through Reference

* IDEMPIERE-5573 - fixes
This commit is contained in:
Peter Takács 2023-02-17 03:47:39 +01:00 committed by GitHub
parent 59ded47edf
commit e7b9b72582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 363 additions and 75 deletions

View File

@ -0,0 +1,86 @@
-- IDEMPIERE-5573
SELECT register_migration_script('202302131520_IDEMPIERE-5573.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 13, 2023, 3:20:01 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203787,0,0,'Y',TO_TIMESTAMP('2023-02-13 15:20:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:20:01','YYYY-MM-DD HH24:MI:SS'),100,'ShowInactive','Show Inactive','Show Inactive Records','Show Inactive','D','c95fa8c2-91eb-4c57-8a93-5867af55151d')
;
-- Feb 13, 2023, 3:20:44 PM CET
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200230,'AD_Reference Show Inactive','L',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:20:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:20:44','YYYY-MM-DD HH24:MI:SS'),100,'D','N','998ea62f-47e7-433e-9293-d49324d16c10')
;
-- Feb 13, 2023, 3:21:46 PM CET
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200626,'No','No Inactive Records',200230,'N',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:21:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:21:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f99597a3-8f11-4547-8b62-ab918dad0f8b')
;
-- Feb 13, 2023, 3:22:20 PM CET
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200627,'Yes','Show all records (active/inactive)',200230,'Y',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:22:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:22:19','YYYY-MM-DD HH24:MI:SS'),100,'D','4116b567-0f8f-492d-a1f7-4ac3d5a53aaf')
;
-- Feb 13, 2023, 3:23:16 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215772,0,'Show Inactive','Show Inactive Records',102,'ShowInactive','N',4,'N','N','Y','N','N',0,'N',17,200230,0,0,'Y',TO_TIMESTAMP('2023-02-13 15:23:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:23:15','YYYY-MM-DD HH24:MI:SS'),100,203787,'Y','N','D','N','N','N','Y','3215b375-ef7a-422b-af73-42ca0562bce9','N',0,'N','N','N','N')
;
-- Feb 13, 2023, 3:23:19 PM CET
ALTER TABLE AD_Reference ADD ShowInactive VARCHAR2(4 CHAR) DEFAULT 'N' NOT NULL
;
-- Feb 13, 2023, 3:57:23 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207567,'Show Inactive','Show Inactive Records',102,215772,'Y',4,130,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:57:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:57:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f3f4797e-be33-47a5-8d7e-b765723c8ee6','Y',130,2)
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=10,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=258
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=20,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1985
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=30,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=107
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=40,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=108
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=50,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=109
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=257
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5123
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=178
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206184
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=314
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207567
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204575
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=106
;

View File

@ -0,0 +1,83 @@
-- IDEMPIERE-5573
SELECT register_migration_script('202302131520_IDEMPIERE-5573.sql') FROM dual;
-- Feb 13, 2023, 3:20:01 PM CET
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203787,0,0,'Y',TO_TIMESTAMP('2023-02-13 15:20:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:20:01','YYYY-MM-DD HH24:MI:SS'),100,'ShowInactive','Show Inactive','Show Inactive Records','Show Inactive','D','c95fa8c2-91eb-4c57-8a93-5867af55151d')
;
-- Feb 13, 2023, 3:20:44 PM CET
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200230,'AD_Reference Show Inactive','L',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:20:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:20:44','YYYY-MM-DD HH24:MI:SS'),100,'D','N','998ea62f-47e7-433e-9293-d49324d16c10')
;
-- Feb 13, 2023, 3:21:46 PM CET
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200626,'No','No Inactive Records',200230,'N',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:21:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:21:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f99597a3-8f11-4547-8b62-ab918dad0f8b')
;
-- Feb 13, 2023, 3:22:20 PM CET
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200627,'Yes','Show all records (active/inactive)',200230,'Y',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:22:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:22:19','YYYY-MM-DD HH24:MI:SS'),100,'D','4116b567-0f8f-492d-a1f7-4ac3d5a53aaf')
;
-- Feb 13, 2023, 3:23:16 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215772,0,'Show Inactive','Show Inactive Records',102,'ShowInactive','N',4,'N','N','Y','N','N',0,'N',17,200230,0,0,'Y',TO_TIMESTAMP('2023-02-13 15:23:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:23:15','YYYY-MM-DD HH24:MI:SS'),100,203787,'Y','N','D','N','N','N','Y','3215b375-ef7a-422b-af73-42ca0562bce9','N',0,'N','N','N','N')
;
-- Feb 13, 2023, 3:23:19 PM CET
ALTER TABLE AD_Reference ADD COLUMN ShowInactive VARCHAR(4) DEFAULT 'N' NOT NULL
;
-- Feb 13, 2023, 3:57:23 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207567,'Show Inactive','Show Inactive Records',102,215772,'Y',4,130,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-13 15:57:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-13 15:57:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f3f4797e-be33-47a5-8d7e-b765723c8ee6','Y',130,2)
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=10,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=258
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=20,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1985
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=30,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=107
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=40,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=108
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=50,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=109
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=257
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5123
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=178
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206184
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=314
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, XPosition=4,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207567
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204575
;
-- Feb 13, 2023, 3:57:39 PM CET
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-02-13 15:57:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=106
;

View File

@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_Reference
* @author iDempiere (generated)
* @version Release 10
* @version Release 11
*/
public interface I_AD_Reference
{
@ -195,6 +195,19 @@ public interface I_AD_Reference
*/
public String getName();
/** Column name ShowInactive */
public static final String COLUMNNAME_ShowInactive = "ShowInactive";
/** Set Show Inactive.
* Show Inactive Records
*/
public void setShowInactive (String ShowInactive);
/** Get Show Inactive.
* Show Inactive Records
*/
public String getShowInactive();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
@ -211,19 +224,6 @@ public interface I_AD_Reference
*/
public int getUpdatedBy();
/** Column name ValidationType */
public static final String COLUMNNAME_ValidationType = "ValidationType";
/** Set Validation type.
* Different method of validating data
*/
public void setValidationType (String ValidationType);
/** Get Validation type.
* Different method of validating data
*/
public String getValidationType();
/** Column name VFormat */
public static final String COLUMNNAME_VFormat = "VFormat";
@ -242,4 +242,17 @@ _lLoOaAcCa09"
*/
public String getVFormat();
/** Column name ValidationType */
public static final String COLUMNNAME_ValidationType = "ValidationType";
/** Set Validation type.
* Different method of validating data
*/
public void setValidationType (String ValidationType);
/** Get Validation type.
* Different method of validating data
*/
public String getValidationType();
}

View File

@ -844,7 +844,9 @@ public final class MLookup extends Lookup implements Serializable
{
//force refresh
m_lookup.clear();
fillComboBox(isMandatory(), true, true, false, isShortList()); // idempiere 90
MReference ref = m_info.AD_Reference_Value_ID > 0 ? MReference.get(Env.getCtx(),m_info.AD_Reference_Value_ID) : null;
boolean onlyActive = ref == null || !ref.isShowInactiveRecords();
fillComboBox(isMandatory(), true, onlyActive, false, isShortList()); // idempiere 90
return m_lookup.size();
}
finally

View File

@ -28,6 +28,7 @@ import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.Env;
import org.compiere.util.Util;
import org.idempiere.cache.ImmutableIntPOCache;
import org.idempiere.cache.ImmutablePOSupport;
@ -144,4 +145,12 @@ public class MReference extends X_AD_Reference implements ImmutablePOSupport {
return this;
}
/**
* Show inactive records
* @return
*/
public boolean isShowInactiveRecords() {
return !Util.isEmpty(getShowInactive()) && MReference.SHOWINACTIVE_Yes.equalsIgnoreCase(getShowInactive());
}
} // MReference

View File

@ -23,7 +23,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Model for AD_Reference
* @author iDempiere (generated)
* @version Release 10 - $Id$ */
* @version Release 11 - $Id$ */
@org.adempiere.base.Model(table="AD_Reference")
public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
{
@ -31,7 +31,7 @@ public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20221224L;
private static final long serialVersionUID = 20230213L;
/** Standard Constructor */
public X_AD_Reference (Properties ctx, int AD_Reference_ID, String trxName)
@ -43,6 +43,8 @@ public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setName (null);
setShowInactive (null);
// N
setValidationType (null);
} */
}
@ -57,6 +59,8 @@ public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
setEntityType (null);
// @SQL=SELECT CASE WHEN '@P|AdempiereSys:N@'='Y' THEN 'D' ELSE get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) END FROM Dual
setName (null);
setShowInactive (null);
// N
setValidationType (null);
} */
}
@ -252,6 +256,45 @@ public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
return new KeyNamePair(get_ID(), getName());
}
/** ShowInactive AD_Reference_ID=200230 */
public static final int SHOWINACTIVE_AD_Reference_ID=200230;
/** No = N */
public static final String SHOWINACTIVE_No = "N";
/** Yes = Y */
public static final String SHOWINACTIVE_Yes = "Y";
/** Set Show Inactive.
@param ShowInactive Show Inactive Records
*/
public void setShowInactive (String ShowInactive)
{
set_Value (COLUMNNAME_ShowInactive, ShowInactive);
}
/** Get Show Inactive.
@return Show Inactive Records
*/
public String getShowInactive()
{
return (String)get_Value(COLUMNNAME_ShowInactive);
}
/** Set Value Format.
@param VFormat Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public void setVFormat (String VFormat)
{
set_Value (COLUMNNAME_VFormat, VFormat);
}
/** Get Value Format.
@return Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public String getVFormat()
{
return (String)get_Value(COLUMNNAME_VFormat);
}
/** ValidationType AD_Reference_ID=2 */
public static final int VALIDATIONTYPE_AD_Reference_ID=2;
/** DataType = D */
@ -276,20 +319,4 @@ public class X_AD_Reference extends PO implements I_AD_Reference, I_Persistent
{
return (String)get_Value(COLUMNNAME_ValidationType);
}
/** Set Value Format.
@param VFormat Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public void setVFormat (String VFormat)
{
set_Value (COLUMNNAME_VFormat, VFormat);
}
/** Get Value Format.
@return Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public String getVFormat()
{
return (String)get_Value(COLUMNNAME_VFormat);
}
}

View File

@ -47,27 +47,34 @@ import org.compiere.util.Env;
@SuppressWarnings("deprecation")
public class DefaultInfoFactory implements IInfoFactory {
@Override
public InfoPanel create(int WindowNo, String tableName, String keyColumn, String value, boolean multiSelection,
String whereClause, int AD_InfoWindow_ID, boolean lookup) {
return create(WindowNo, tableName, keyColumn,
value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, null);
}
@Override
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup) {
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field) {
return create(WindowNo, tableName, keyColumn,
value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null);
value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, field);
}
public InfoPanel create(int WindowNo, String tableName, String keyColumn,
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field) {
InfoPanel info = null;
setSOTrxBasedOnDocType(WindowNo);
if (tableName.equals("C_BPartner")) {
info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoBPartnerWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx").equals("N"),
multiSelection, whereClause, lookup);
}
} else if (tableName.equals("M_Product")) {
info = new InfoProductWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoProductWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoProductPanel ( WindowNo,
Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"),
@ -75,31 +82,31 @@ public class DefaultInfoFactory implements IInfoFactory {
multiSelection, value,whereClause, lookup);
}
} else if (tableName.equals("C_Invoice")) {
info = new InfoInvoiceWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoInvoiceWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoInvoicePanel ( WindowNo, value,
multiSelection, whereClause, lookup);
}
} else if (tableName.equals("A_Asset")) {
info = new InfoAssetWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoAssetWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoAssetPanel (WindowNo, 0, value,
multiSelection, whereClause, lookup);
}
} else if (tableName.equals("C_Order")) {
info = new InfoOrderWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoOrderWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoOrderPanel ( WindowNo, value,
multiSelection, whereClause, lookup);
}
} else if (tableName.equals("M_InOut")) {
info = new InfoInOutWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoInOutWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoInOutPanel (WindowNo, value,
multiSelection, whereClause, lookup);
}
} else if (tableName.equals("C_Payment")) {
info = new InfoPaymentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoPaymentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoPaymentPanel (WindowNo, value, multiSelection, whereClause, lookup);
}
@ -107,17 +114,17 @@ public class DefaultInfoFactory implements IInfoFactory {
info = new InfoCashLinePanel (WindowNo, value,
multiSelection, whereClause, lookup);
} else if (tableName.equals("S_ResourceAssignment")) {
info = new InfoAssignmentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, predefinedContextVariables);
info = new InfoAssignmentWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoAssignmentPanel (WindowNo, value,
multiSelection, whereClause, lookup);
}
} else {
info = new InfoWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
info = new InfoWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
if (!info.loadedOK()) {
info = new InfoGeneralPanel (value, WindowNo,
tableName, keyColumn,
multiSelection, whereClause, lookup);
multiSelection, whereClause, lookup, field);
if (!info.loadedOK()) {
info.dispose(false);
info = null;
@ -142,7 +149,7 @@ public class DefaultInfoFactory implements IInfoFactory {
if (col.equals("M_Product_ID"))
{
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, true, whereClause, AD_InfoWindow_ID);
InfoWindow infoWindow = new InfoProductWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, true, whereClause, AD_InfoWindow_ID, true, field);
if (infoWindow.loadedOK())
return infoWindow;
@ -162,7 +169,7 @@ public class DefaultInfoFactory implements IInfoFactory {
}
else if (col.equals("C_BPartner_ID"))
{
InfoWindow infoWindow = new InfoBPartnerWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID);
InfoWindow infoWindow = new InfoBPartnerWindow(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
if (infoWindow.loadedOK())
return infoWindow;
@ -176,7 +183,7 @@ public class DefaultInfoFactory implements IInfoFactory {
}
else // General Info
{
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true);
info = create(lookup.getWindowNo(), tableName, keyColumn, queryValue, multiSelection, whereClause, AD_InfoWindow_ID, true, field);
}
return info;
}
@ -197,7 +204,7 @@ public class DefaultInfoFactory implements IInfoFactory {
MInfoWindow infoWindow = MInfoWindow.getInfoWindow(AD_InfoWindow_ID);
String tableName = infoWindow.getAD_Table().getTableName();
String keyColumn = tableName + "_ID";
InfoPanel info = create(windowNo, tableName, keyColumn, null, false, null, AD_InfoWindow_ID, false, predefinedContextVariables);
InfoPanel info = create(windowNo, tableName, keyColumn, null, false, null, AD_InfoWindow_ID, false, predefinedContextVariables, null);
if (info instanceof InfoWindow)
return (InfoWindow) info;
else

View File

@ -83,4 +83,20 @@ public interface IInfoFactory {
public default InfoWindow create (int AD_InfoWindow_ID, String predefinedContextVariables) {
return create (AD_InfoWindow_ID, predefinedContextVariables);
}
/**
*
* @param WindowNo
* @param tableName
* @param keyColumn
* @param value
* @param multiSelection
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @return {@link InfoPanel}
*/
public InfoPanel create(int WindowNo, String tableName, String keyColumn, String value, boolean multiSelection,
String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field);
}

View File

@ -3,6 +3,7 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
import org.compiere.util.Env;
/**
@ -63,9 +64,9 @@ public class InfoAssetWindow extends InfoWindow {
*/
public InfoAssetWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
@Override

View File

@ -3,6 +3,8 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
/**
* @author hengsin
*
@ -60,8 +62,8 @@ public class InfoAssignmentWindow extends InfoWindow {
*/
public InfoAssignmentWindow(int WindowNo, String tableName,
String keyColumn, String queryValue, boolean multipleSelection,
String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
String whereClause, int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
}

View File

@ -4,6 +4,7 @@
package org.adempiere.webui.info;
import org.adempiere.webui.panel.InvoiceHistory;
import org.compiere.model.GridField;
import org.compiere.util.Env;
/**
@ -44,9 +45,9 @@ public class InfoBPartnerWindow extends InfoWindow {
*/
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup) {
int AD_InfoWindow_ID, boolean lookup, GridField field) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup);
whereClause, AD_InfoWindow_ID, lookup, field);
}
/**
@ -62,9 +63,9 @@ public class InfoBPartnerWindow extends InfoWindow {
*/
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
/**

View File

@ -3,6 +3,8 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
/**
* @author hengsin
*
@ -59,8 +61,8 @@ public class InfoInOutWindow extends InfoWindow {
*/
public InfoInOutWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
}

View File

@ -3,6 +3,7 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
import org.compiere.util.Env;
/**
@ -61,9 +62,9 @@ public class InfoInvoiceWindow extends InfoWindow {
*/
public InfoInvoiceWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
@Override

View File

@ -3,6 +3,8 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
/**
* @author hengsin
*
@ -59,9 +61,9 @@ public class InfoOrderWindow extends InfoWindow {
*/
public InfoOrderWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
}

View File

@ -3,6 +3,8 @@
*/
package org.adempiere.webui.info;
import org.compiere.model.GridField;
/**
* @author hengsin
*
@ -59,9 +61,9 @@ public class InfoPaymentWindow extends InfoWindow {
*/
public InfoPaymentWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
}

View File

@ -53,6 +53,7 @@ import org.adempiere.webui.panel.InvoiceHistory;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.model.GridField;
import org.compiere.model.MDocType;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
@ -137,6 +138,24 @@ public class InfoProductWindow extends InfoWindow {
whereClause, AD_InfoWindow_ID, lookup);
}
/**
* @param WindowNo
* @param tableName
* @param keyColumn
* @param queryValue
* @param multipleSelection
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
*/
public InfoProductWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, GridField field) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, field);
}
/**
* @param WindowNo
* @param tableName
@ -150,9 +169,9 @@ public class InfoProductWindow extends InfoWindow {
*/
public InfoProductWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables) {
int AD_InfoWindow_ID, boolean lookup, GridField field, String predefinedContextVariables) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup, null, predefinedContextVariables);
whereClause, AD_InfoWindow_ID, lookup, field, predefinedContextVariables);
}
@Override

View File

@ -103,6 +103,7 @@ import org.compiere.model.MInfoWindow;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MLookupInfo;
import org.compiere.model.MProcess;
import org.compiere.model.MReference;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
@ -1066,7 +1067,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
StringBuilder builder = new StringBuilder();
MTable table = MTable.get(Env.getCtx(), infoWindow.getAD_Table_ID());
if (!hasIsActiveEditor() && table.get_ColumnIndex("IsActive") >=0 ) {
MReference ref = m_gridfield != null && m_gridfield.getAD_Reference_Value_ID() > 0 ? MReference.get(Env.getCtx(), m_gridfield.getAD_Reference_Value_ID()) : null;
boolean onlyActive = ref == null || !ref.isShowInactiveRecords();
if (!hasIsActiveEditor() && table.get_ColumnIndex("IsActive") >= 0 && onlyActive) {
if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND ");
}

View File

@ -37,9 +37,11 @@ import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.Dialog;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.GridField;
import org.compiere.model.I_C_ElementValue;
import org.compiere.model.MColumn;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MReference;
import org.compiere.model.MTable;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@ -96,13 +98,14 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean multipleSelection, String whereClause)
{
this(queryValue, windowNo, tableName, keyColumn, multipleSelection, whereClause, true);
this(queryValue, windowNo, tableName, keyColumn, multipleSelection, whereClause, true, null);
}
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean multipleSelection, String whereClause, boolean lookup)
public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean multipleSelection, String whereClause, boolean lookup, GridField field)
{
super(windowNo, tableName, keyColumn, multipleSelection, whereClause, lookup, 0, queryValue);
setGridfield(field);
setTitle(Msg.getMsg(Env.getCtx(), "Info"));
try
@ -314,11 +317,20 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
return false;
// Prepare table
StringBuilder where = new StringBuilder();
if(m_gridfield != null) {
MReference ref = m_gridfield.getAD_Reference_Value_ID() > 0 ? MReference.get(Env.getCtx(), m_gridfield.getAD_Reference_Value_ID()) : null;
if(ref == null || !ref.isShowInactiveRecords()) {
where = new StringBuilder(p_tableName).append(".").append("IsActive='Y'");
}
}
StringBuilder where = new StringBuilder(p_tableName).append(".").append("IsActive='Y'");
if (p_whereClause.length() > 0)
where.append(" AND (").append(p_whereClause).append(")");
if (p_whereClause.length() > 0) {
if(where.length() > 0)
where.append(" AND ");
where.append(" (").append(p_whereClause).append(")");
}
prepareTable(m_generalLayout, p_tableName, where.toString(), "2");
contentPanel.repaint();