IDEMPIERE-1437 Do not allow changing Table in Tab when there are Fields (#1927)
This commit is contained in:
parent
71a49baf00
commit
34a33ba06f
|
@ -0,0 +1,10 @@
|
||||||
|
-- IDEMPIERE-1437
|
||||||
|
SELECT register_migration_script('202307061451_IDEMPIERE-1437.sql') FROM dual;
|
||||||
|
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Jul 6, 2023, 2:51:25 PM CEST
|
||||||
|
UPDATE AD_Field SET ReadOnlyLogic='@SQL=SELECT 1 FROM AD_Field WHERE AD_Tab_ID=@AD_Tab_ID@',Updated=TO_TIMESTAMP('2023-07-06 14:51:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=131
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- IDEMPIERE-1437
|
||||||
|
SELECT register_migration_script('202307061451_IDEMPIERE-1437.sql') FROM dual;
|
||||||
|
|
||||||
|
-- Jul 6, 2023, 2:51:25 PM CEST
|
||||||
|
UPDATE AD_Field SET ReadOnlyLogic='@SQL=SELECT 1 FROM AD_Field WHERE AD_Tab_ID=@AD_Tab_ID@',Updated=TO_TIMESTAMP('2023-07-06 14:51:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=131
|
||||||
|
;
|
||||||
|
|
|
@ -232,6 +232,11 @@ public class MTab extends X_AD_Tab implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (! newRecord && is_ValueChanged(COLUMNNAME_AD_Table_ID) && getFields(false, get_TrxName()).length > 0) {
|
||||||
|
log.saveError("Error", "Cannot change table if there are related fields");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isReadOnly() && isInsertRecord())
|
if (isReadOnly() && isInsertRecord())
|
||||||
setIsInsertRecord(false);
|
setIsInsertRecord(false);
|
||||||
if (is_new() || is_ValueChanged(COLUMNNAME_AD_TabType))
|
if (is_new() || is_ValueChanged(COLUMNNAME_AD_TabType))
|
||||||
|
|
Loading…
Reference in New Issue