Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0013281
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajorhave not tried2010-05-11 06:492010-05-18 21:44
ReportermtaalView Statuspublic 
Assigned Tomtaal 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionb27cb4c80a74
ProjectionnoneETAnoneTarget Version2.50MP17
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0013281: [REST] when inserting an object through REST allow setting the organization through xml

DescriptionWhen a new object is passed in through a POST REST request the client/org are always set to the current client/org of the user. This eventhough the xml may contain a valid organization (for the current client of the user and accessible for the user).

For example, for sales orders a user can choose the organization in the sales order entry. The same should be allowed through REST.
Steps To Reproduce1) set the default role to Openbravo Admin but with organization 0 (*)
2) upload through REST (and a POST request) the attached order xml
3) you will get an error:
<ob:error xmlns:ob="http://www.openbravo.com"><message>org.openbravo.service.web.InvalidContentException: [^] Object Order(null) is new but not writable
Caused by: Object Order(null) is new but not writable</message></ob:error>
Proposed SolutionAllow setting the organization through REST if it is a valid/writable organization for the user.

Changes: see the XMLEntityConverter:
1) this has to be moved to after setting all many-to-one properties:


      if (!writable && bob.isNewOBObject()) {
        error("Object " + entityName + "(" + id + ") is new but not writable");
        return bob;
      }
2) This has to be changed to check if the org is a valid/writable org for the user:

          final boolean orgUpdate = bob instanceof OrganizationEnabled
              && p.getName().equals(Client.PROPERTY_ORGANIZATION);
          if (!isOptionClientImport() && currentValue != null && (clientUpdate || orgUpdate)) {
TagsNo tags attached.
Attached Filesxml file icon rest_order.xml [^] (3,282 bytes) 2010-05-11 06:49

- Relationships Relation Graph ] Dependency Graph ]
related to defect 00132832.50MP17 closedmtaal [REST] use organization of the object to retrieved referenced objects 

-  Notes
(0027133)
hgbot (developer)
2010-05-11 13:24

Repository: erp/devel/pi
Changeset: b27cb4c80a74ce23b5d861cfc32f1313fefa2c7d
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue May 11 13:23:41 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/b27cb4c80a74ce23b5d861cfc32f1313fefa2c7d [^]

Fixes issue 13281: [REST] when inserting an object through REST allow setting the organization through xml
Fixes issue 13283: [REST] use organization of the object to retrieved referenced objects

---
M src-test/org/openbravo/test/dal/IssuesTest.java
M src/org/openbravo/dal/xml/XMLEntityConverter.java
A src-test/org/openbravo/test/dal/test_13281.xml
---
(0027322)
iperdomo (developer)
2010-05-14 19:02

Tested on PI @ rev. d58960feb659
(0027512)
hudsonbot (developer)
2010-05-18 21:44

A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/b27cb4c80a74 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/aa11838d5f80 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17380.obx [^]

- Issue History
Date Modified Username Field Change
2010-05-11 06:49 mtaal New Issue
2010-05-11 06:49 mtaal Assigned To => mtaal
2010-05-11 06:49 mtaal File Added: rest_order.xml
2010-05-11 07:47 mtaal Relationship added related to 0013283
2010-05-11 13:24 hgbot Checkin
2010-05-11 13:24 hgbot Note Added: 0027133
2010-05-11 13:24 hgbot Status new => resolved
2010-05-11 13:24 hgbot Resolution open => fixed
2010-05-11 13:24 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/b27cb4c80a74ce23b5d861cfc32f1313fefa2c7d [^]
2010-05-11 18:19 jpabloae Target Version 2.50MP16 => 2.50MP17
2010-05-14 19:02 iperdomo Note Added: 0027322
2010-05-14 19:02 iperdomo Status resolved => closed
2010-05-15 00:01 anonymous sf_bug_id 0 => 3001864
2010-05-18 21:44 hudsonbot Checkin
2010-05-18 21:44 hudsonbot Note Added: 0027512


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker