details: https://code.openbravo.com/erp/devel/pi/rev/5d23d46f8bdc changeset: 28022:5d23d46f8bdc user: Miguel de Juana <miguel.dejuana <at> openbravo.com> date: Mon Nov 23 13:40:58 2015 +0100 summary: Fixed issue 31417: Add some methods to LoginUtils to be accessible from other clasess
- Add getDefaultWarehouse for a given org to LoginUtils diffstat: src/org/openbravo/base/secureApp/LoginUtils.java | 28 ++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diffs (36 lines): diff -r 8a03fc30c8e3 -r 5d23d46f8bdc src/org/openbravo/base/secureApp/LoginUtils.java --- a/src/org/openbravo/base/secureApp/LoginUtils.java Thu Nov 12 14:52:08 2015 +0100 +++ b/src/org/openbravo/base/secureApp/LoginUtils.java Mon Nov 23 13:40:58 2015 +0100 @@ -567,4 +567,32 @@ return null; } + + /** + * Returns default warehouse for a given organization + * + * @throws ServletException + * + */ + public static String getDefaultWarehouse(ConnectionProvider connectionProvider, String strClient, + String strOrg, String strRole) throws ServletException { + + String strWarehouse; + if (!strRole.equals("0")) { + // Pick the warehouse using the given organization + strWarehouse = DefaultOptionsData.getDefaultWarehouse(connectionProvider, strClient, "'" + + strOrg + "'"); + if (strWarehouse == null || strWarehouse.isEmpty()) { + // If no warehouse for the default organization is available, pick using using the + // accessible tree + strWarehouse = DefaultOptionsData.getDefaultWarehouse( + connectionProvider, + strClient, + new OrgTree(connectionProvider, strClient).getAccessibleTree(connectionProvider, + strRole).toString()); + } + } else + strWarehouse = ""; + return strWarehouse; + } } ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits