details: /erp/devel/pi/rev/ccaa923ce17d
changeset: 9445:ccaa923ce17d
user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date: Wed Dec 29 12:31:22 2010 +0100
summary: Fixed issue 15253.Widgets are copied based on the writeable
organizations.
diffstat:
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java
| 3 --
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java
| 11 +++++----
2 files changed, 6 insertions(+), 8 deletions(-)
diffs (50 lines):
diff -r f0a158d9fb17 -r ccaa923ce17d
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java
---
a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java
Wed Dec 29 11:01:00 2010 +0100
+++
b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java
Wed Dec 29 12:31:22 2010 +0100
@@ -181,9 +181,6 @@
obc.setFilterOnReadableClients(false);
obc.add(Expression.eq(WidgetInstance.PROPERTY_CLIENT,
OBDal.getInstance().get(Client.class,
OBContext.getOBContext().getCurrentClient().getId())));
- obc.setFilterOnReadableOrganization(false);
- obc.add(Expression.eq(WidgetInstance.PROPERTY_ORGANIZATION,
OBDal.getInstance().get(
- Organization.class,
OBContext.getOBContext().getCurrentOrganization().getId())));
obc.add(Expression.eq(WidgetInstance.PROPERTY_VISIBLEATROLE,
OBDal.getInstance().get(
Role.class, OBContext.getOBContext().getRole().getId())));
obc.add(Expression.eq(WidgetInstance.PROPERTY_VISIBLEATUSER,
OBDal.getInstance().get(
diff -r f0a158d9fb17 -r ccaa923ce17d
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java
---
a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java
Wed Dec 29 11:01:00 2010 +0100
+++
b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java
Wed Dec 29 12:31:22 2010 +0100
@@ -248,15 +248,15 @@
OBContext.getOBContext().getRole().getId());
final Client client = OBDal.getInstance().get(Client.class,
OBContext.getOBContext().getCurrentClient().getId());
- final Organization organization =
OBDal.getInstance().get(Organization.class,
- OBContext.getOBContext().getCurrentOrganization().getId());
final Set<WidgetInstance> defaultWidgets = new HashSet<WidgetInstance>();
defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("OB", null));
defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("SYSTEM", null));
defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("CLIENT", new
String[] { client
.getId() }));
- defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("ORG", new
String[] { organization
- .getId() }));
+ final Set<String> orgs =
OBContext.getOBContext().getWritableOrganizations();
+ for (String org : orgs) {
+ defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("ORG", new
String[] { org }));
+ }
defaultWidgets.addAll(MyOBUtils
.getDefaultWidgetInstances("ROLE", new String[] { role.getId() }));
log.debug("Copying new widget instances on user: " + user.getId() + "
role: " + role.getId());
@@ -268,11 +268,12 @@
}
}
// now copy all the default widgets that are not defined on the user
+ final Organization orgZero = OBDal.getInstance().get(Organization.class,
"0");
boolean copyDone = false;
for (WidgetInstance widget : defaultWidgets) {
final WidgetInstance copy = (WidgetInstance) DalUtil.copy(widget);
copy.setClient(client);
- copy.setOrganization(organization);
+ copy.setOrganization(orgZero);
copy.setVisibleAtRole(role);
copy.setVisibleAtUser(user);
copy.setCopiedFrom(widget);
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits