details: /erp/devel/pi/rev/2bae90f9419d
changeset: 11433:2bae90f9419d
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Fri Apr 01 15:41:35 2011 +0200
summary: Fixed issue 16546. If a callout has an EXECUTE command, the window
will be shown in classic mode.
The FIC will verify that no EXECUTE elements are present in the callout
responses. If there is one, and it's different from 'displayLogic()' (which is
automatically done in OB 3 windows), then it will return a message to the user,
and create a new preference so that after next login, the affected window will
be shown in classic mode.
diffstat:
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
| 11 ++
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
| 40 ++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
diffs (92 lines):
diff -r 2629628e292f -r 2bae90f9419d
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
---
a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
Fri Apr 01 14:50:47 2011 +0200
+++
b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
Fri Apr 01 15:41:35 2011 +0200
@@ -849,6 +849,17 @@
<!--FF8080812EDE8228012EE38E0C69007E-->
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
<!--FF8080812EDE8228012EE38E0C69007E--></AD_MESSAGE>
+<!--FF8080812F10C577012F1138306C0027--><AD_MESSAGE>
+<!--FF8080812F10C577012F1138306C0027-->
<AD_MESSAGE_ID><![CDATA[FF8080812F10C577012F1138306C0027]]></AD_MESSAGE_ID>
+<!--FF8080812F10C577012F1138306C0027-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812F10C577012F1138306C0027--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812F10C577012F1138306C0027--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812F10C577012F1138306C0027-->
<VALUE><![CDATA[OBUIAPP_ExecuteInCallout]]></VALUE>
+<!--FF8080812F10C577012F1138306C0027--> <MSGTEXT><![CDATA[This window is
using some functionality (an EXECUTE command in a callout response) which needs
to be updated to work in Openbravo 3. Therefore, it's likely that this window
will not work correctly in Openbravo 3 mode. A preference has been added so
that this window is opened in classic mode until this problem is fixed. Contact
with your System Administrator, or with the developer of the module to fix
this. You now need to log out of the application, and login again, so that this
window is shown in classic mode.]]></MSGTEXT>
+<!--FF8080812F10C577012F1138306C0027--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--FF8080812F10C577012F1138306C0027-->
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8080812F10C577012F1138306C0027--></AD_MESSAGE>
+
<!--FF8081812D6761CF012D676DF2A70045--><AD_MESSAGE>
<!--FF8081812D6761CF012D676DF2A70045-->
<AD_MESSAGE_ID><![CDATA[FF8081812D6761CF012D676DF2A70045]]></AD_MESSAGE_ID>
<!--FF8081812D6761CF012D676DF2A70045-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 2629628e292f -r 2bae90f9419d
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Fri Apr 01 14:50:47 2011 +0200
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Fri Apr 01 15:41:35 2011 +0200
@@ -58,13 +58,16 @@
import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBCriteria;
import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBDao;
import org.openbravo.data.Sqlc;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.model.ad.datamodel.Column;
+import org.openbravo.model.ad.domain.Preference;
import org.openbravo.model.ad.domain.ReferencedTable;
import org.openbravo.model.ad.ui.AuxiliaryInput;
import org.openbravo.model.ad.ui.Field;
import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.model.ad.ui.Window;
import org.openbravo.service.db.DalConnectionProvider;
import org.openbravo.service.json.JsonConstants;
import org.openbravo.service.json.JsonToDataConverter;
@@ -909,6 +912,18 @@
if (name.equals("MESSAGE")) {
log.debug("Callout message: " + element.get(1, null));
messages.add(element.get(1, null).toString());
+ } else if (name.equals("EXECUTE")) {
+ String js = element.get(1, null) == null ? null :
element.get(1, null).toString();
+ if (js != null && !js.equals("")) {
+ if (js.equals("displayLogic();")) {
+ // We don't do anything, this is a harmless js response
+ } else {
+ messages.add(Utility.messageBD(new
DalConnectionProvider(false),
+ "OBUIAPP_ExecuteInCallout",
RequestContext.get().getVariablesSecureApp()
+ .getLanguage()));
+ createNewPreferenceForWindow(tab.getWindow());
+ }
+ }
} else {
if (name.startsWith("inp")) {
boolean changed = false;
@@ -1022,6 +1037,31 @@
}
+ /**
+ * This method will create a new preference to show the given window in
classic mode, if there is
+ * a preference doesn't already exist
+ *
+ * @param window
+ */
+ private void createNewPreferenceForWindow(Window window) {
+
+ OBCriteria<Preference> prefCriteria =
OBDao.getFilteredCriteria(Preference.class, Expression
+ .eq(Preference.PROPERTY_PROPERTY, "OBUIAPP_UseClassicMode"),
Expression.eq(
+ Preference.PROPERTY_WINDOW, window));
+ if (prefCriteria.count() > 0) {
+ // Preference already exists. We don't create a new one.
+ return;
+ }
+ Preference newPref = OBProvider.getInstance().get(Preference.class);
+ newPref.setWindow(window);
+ newPref.setProperty("OBUIAPP_UseClassicMode");
+ newPref.setSearchKey("Y");
+ newPref.setPropertyList(true);
+ OBDal.getInstance().save(newPref);
+ OBDal.getInstance().flush();
+
+ }
+
private void addCalloutToList(Column col, List<String> listOfCallouts,
List<String> lastFieldChangedList) {
if (col.getCallout().getADModelImplementationList() == null
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits