diff --git a/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql b/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql new file mode 100644 index 0000000000..14e1c01780 --- /dev/null +++ b/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql @@ -0,0 +1,22 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 26, 2018 12:53:01 PM CEST +-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry +UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614 +; + +-- Mar 26, 2018 12:53:05 PM CEST +UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623 +; + +-- Mar 26, 2018 12:53:10 PM CEST +UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614 +; + +-- Mar 26, 2018 12:53:13 PM CEST +UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623 +; + +SELECT register_migration_script('201803261255_IDEMPIERE-3705.sql') FROM dual +; diff --git a/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql b/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql new file mode 100644 index 0000000000..8585eaeab0 --- /dev/null +++ b/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql @@ -0,0 +1,14 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Apr 16, 2018 8:50:16 PM CEST +-- AP2-15 Define customer or vendor by context when creating new BPs via QuickEntry +UPDATE AD_Menu SET IsSOTrx='Y',Updated=TO_DATE('2018-04-16 20:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=328 +; + +-- Apr 16, 2018 8:50:44 PM CEST +UPDATE AD_Menu SET IsSOTrx='N',Updated=TO_DATE('2018-04-16 20:50:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=335 +; + +SELECT register_migration_script('201804162050_IDEMPIERE-3705.sql') FROM dual +; diff --git a/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql b/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql new file mode 100644 index 0000000000..5969e5cc75 --- /dev/null +++ b/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql @@ -0,0 +1,19 @@ +-- Mar 26, 2018 12:53:01 PM CEST +-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry +UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614 +; + +-- Mar 26, 2018 12:53:05 PM CEST +UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623 +; + +-- Mar 26, 2018 12:53:10 PM CEST +UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614 +; + +-- Mar 26, 2018 12:53:13 PM CEST +UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623 +; + +SELECT register_migration_script('201803261255_IDEMPIERE-3705.sql') FROM dual +; diff --git a/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql b/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql new file mode 100644 index 0000000000..93eb709698 --- /dev/null +++ b/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql @@ -0,0 +1,11 @@ +-- Apr 16, 2018 8:50:16 PM CEST +-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry +UPDATE AD_Menu SET IsSOTrx='Y',Updated=TO_TIMESTAMP('2018-04-16 20:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=328 +; + +-- Apr 16, 2018 8:50:44 PM CEST +UPDATE AD_Menu SET IsSOTrx='N',Updated=TO_TIMESTAMP('2018-04-16 20:50:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=335 +; + +SELECT register_migration_script('201804162050_IDEMPIERE-3705.sql') FROM dual +; diff --git a/org.adempiere.base.callout/META-INF/MANIFEST.MF b/org.adempiere.base.callout/META-INF/MANIFEST.MF index 0b46c1dfb7..3fec665a66 100644 --- a/org.adempiere.base.callout/META-INF/MANIFEST.MF +++ b/org.adempiere.base.callout/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 5.1.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.adempiere.base;bundle-version="0.0.0" Eclipse-RegisterBuddy: org.adempiere.base -Service-Component: OSGI-INF/costadjustmentcalloutfactory.xml +Service-Component: OSGI-INF/costadjustmentcalloutfactory.xml, OSGI-INF/bpartnerquickentrycalloutFactory.xml Bundle-ActivationPolicy: lazy Export-Package: org.compiere.model Bundle-ClassPath: . diff --git a/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml b/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml new file mode 100644 index 0000000000..91c9d02b1b --- /dev/null +++ b/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java b/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java new file mode 100644 index 0000000000..e49e88f217 --- /dev/null +++ b/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java @@ -0,0 +1,30 @@ +/****************************************************************************** + * Copyright (C) 2013 Diego Ruiz * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base.callout; + +import org.adempiere.base.IColumnCallout; +import org.adempiere.base.IColumnCalloutFactory; +import org.adempiere.model.CalloutBPartnerQuickEntry; +import org.compiere.model.MBPartner; + +public class BPartnerCalloutFactory implements IColumnCalloutFactory { + + @Override + public IColumnCallout[] getColumnCallouts(String tableName, String columnName) { + if (tableName.equalsIgnoreCase(MBPartner.Table_Name)) { + return new IColumnCallout[]{new CalloutBPartnerQuickEntry()}; + } + return null; + } +} diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java new file mode 100644 index 0000000000..7e990cb629 --- /dev/null +++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2013 Diego Ruiz * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.model; + +import java.util.Properties; + +import org.adempiere.base.IColumnCallout; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.MBPartner; +import org.compiere.util.Env; +import org.compiere.util.Util; + +public class CalloutBPartnerQuickEntry implements IColumnCallout { + + @Override + public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) { + // this callout is just for quick entry window + if ("Y".equals(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_MODE_"))) { + int parent_windowNo = Integer.parseInt(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_CALLER_WINDOW_")); + + String docSOTrx = Env.getContext(ctx, parent_windowNo, "IsSOTrx", false); + + if (!Util.isEmpty(docSOTrx)) { + boolean isSOTrx = "Y".equals(docSOTrx); + mTab.setValue(MBPartner.COLUMNNAME_IsCustomer, isSOTrx); + mTab.setValue(MBPartner.COLUMNNAME_IsVendor, !isSOTrx); + } + } + return null; + } + +}