details: /erp/devel/pi/rev/69cd7ff91137
changeset: 11244:69cd7ff91137
user: Martin Taal <martin.taal <at> openbravo.com>
date: Mon Mar 14 23:04:53 2011 +0100
summary: Fixes issue 16165: 3.0RC4: number of completed sales order remains
in <> when create through a quotation
details: /erp/devel/pi/rev/832c6d756398
changeset: 11245:832c6d756398
user: Martin Taal <martin.taal <at> openbravo.com>
date: Mon Mar 14 23:05:16 2011 +0100
summary: Prevent fields set to error after fic call
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java
| 70 +++++----
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 7 +-
2 files changed, 46 insertions(+), 31 deletions(-)
diffs (110 lines):
diff -r 7431922eae64 -r 832c6d756398
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java
Mon Mar 14 22:28:59 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java
Mon Mar 14 23:05:16 2011 +0100
@@ -29,7 +29,9 @@
import org.openbravo.base.model.Property;
import org.openbravo.client.kernel.RequestContext;
import org.openbravo.client.kernel.event.EntityNewEvent;
+import org.openbravo.client.kernel.event.EntityPersistenceEvent;
import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
+import org.openbravo.client.kernel.event.EntityUpdateEvent;
import org.openbravo.dal.service.OBDal;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.model.common.enterprise.DocumentType;
@@ -51,41 +53,49 @@
private static Property[] documentTypeProperties = null;
private static Property[] documentTypeTargetProperties = null;
+ public void onUpdate(@Observes EntityUpdateEvent event) {
+ handleEvent(event);
+ }
+
public void onSave(@Observes EntityNewEvent event) {
+ handleEvent(event);
+ }
- if (isValidEvent(event)) {
- int index = 0;
- for (int i = 0; i < entities.length; i++) {
- if (entities[i] == event.getTargetInstance().getEntity()) {
- index = i;
- break;
- }
+ private void handleEvent(EntityPersistenceEvent event) {
+ if (!isValidEvent(event)) {
+ return;
+ }
+ int index = 0;
+ for (int i = 0; i < entities.length; i++) {
+ if (entities[i] == event.getTargetInstance().getEntity()) {
+ index = i;
+ break;
}
- Entity entity = entities[index];
- Property documentNoProperty = documentNoProperties[index];
- Property documentTypeProperty = documentTypeProperties[index];
- Property docTypeTargetProperty = documentTypeTargetProperties[index];
+ }
+ Entity entity = entities[index];
+ Property documentNoProperty = documentNoProperties[index];
+ Property documentTypeProperty = documentTypeProperties[index];
+ Property docTypeTargetProperty = documentTypeTargetProperties[index];
- String documentNo = (String) event.getCurrentState(documentNoProperty);
- if (documentNo == null || documentNo.startsWith("<")) {
- final DocumentType docTypeTarget = (docTypeTargetProperty == null ?
null
- : (DocumentType) event.getCurrentState(docTypeTargetProperty));
- final DocumentType docType = (documentTypeProperty == null ? null :
(DocumentType) event
- .getCurrentState(documentTypeProperty));
- // use empty strings instead of null
- final String docTypeTargetId = docTypeTarget != null ?
docTypeTarget.getId() : "";
- final String docTypeId = docType != null ? docType.getId() : "";
- String windowId = RequestContext.get().getRequestParameter("windowId");
- if (windowId == null) {
- windowId = "";
- }
+ String documentNo = (String) event.getCurrentState(documentNoProperty);
+ if (documentNo == null || documentNo.startsWith("<")) {
+ final DocumentType docTypeTarget = (docTypeTargetProperty == null ? null
+ : (DocumentType) event.getCurrentState(docTypeTargetProperty));
+ final DocumentType docType = (documentTypeProperty == null ? null :
(DocumentType) event
+ .getCurrentState(documentTypeProperty));
+ // use empty strings instead of null
+ final String docTypeTargetId = docTypeTarget != null ?
docTypeTarget.getId() : "";
+ final String docTypeId = docType != null ? docType.getId() : "";
+ String windowId = RequestContext.get().getRequestParameter("windowId");
+ if (windowId == null) {
+ windowId = "";
+ }
- // recompute it
- documentNo =
Utility.getDocumentNo(OBDal.getInstance().getConnection(false),
- new DalConnectionProvider(false),
RequestContext.get().getVariablesSecureApp(),
- windowId, entity.getTableName(), docTypeTargetId, docTypeId,
false, true);
- event.setCurrentState(documentNoProperty, documentNo);
- }
+ // recompute it
+ documentNo =
Utility.getDocumentNo(OBDal.getInstance().getConnection(false),
+ new DalConnectionProvider(false),
RequestContext.get().getVariablesSecureApp(), windowId,
+ entity.getTableName(), docTypeTargetId, docTypeId, false, true);
+ event.setCurrentState(documentNoProperty, documentNo);
}
}
diff -r 7431922eae64 -r 832c6d756398
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Mon Mar 14 22:28:59 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Mon Mar 14 23:05:16 2011 +0100
@@ -504,7 +504,12 @@
if (this.validateAfterFicReturn) {
delete this.validateAfterFicReturn;
- this.validate();
+ // only validate the fields which have errors
+ for (i = 0; i < this.getFields().length; i++) {
+ if (this.hasFieldErrors(this.getFields()[i].name)) {
+ this.getFields()[i].validate();
+ }
+ }
}
this.markForRedraw();
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits