BLOG

NEXT STEPS

Posts Tagged ‘OFBiz’

OFBiz Tutorial:Use Dependent Selects to Manage Country-State Select Boxes

Wednesday, July 14th, 2010

Javascript components for managing Dependent Selects is starting to find use in ecommerce applications we are developing. It all started with need for updating contents of State field, on change of Country in postal address forms.

More then a year ago we started using Ajax for updating State select box options on change of Country select box value. It was a step forward but I wasn’t satisfied. Recently I had time to build a Dependent Select javascript component that takes the process of managing dependent selects boxes to the next level. Please read my blog post, OFBiz Tutorial – Dependent Selects for Prototype, to know more about it. If you are wondering about a scenario from real world, Here you go.

Below is the piece of code from the Freemarker template for the Checkout page in OFBiz ecommerce application.  It renders Country and State select boxes with their options.

?View Code LANGUAGE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div>
      <label for="shipToCountryGeoId">Country</label>
<select id="shipToCountryGeoId" class="required select dependentSelectMaster" title="shipToCountry" name="shipToCountryGeoId">
        <option title="${country.geoId}" value="${country.geoId}">${country.get("geoName")?default(country.geoId)}</option>
        <!--#list-->
      </select></div>
<div id="shipToStates">
      <label for="shipToStateProvinceGeoId">State</label>
<select id="shipToStateProvinceGeoId" class="required shipToCountry" name="shipToStateProvinceGeoId">
        <option class="${country.geoId}" title="${stateAssoc.geoId}" value="${stateAssoc.geoId}">&lt;#if shippingAddress.stateProvinceGeoId?has_content &amp;&amp; shippingAddress.stateProvinceGeoId?default("") == stateAssoc.geoId&gt; SELECTED <!--#if-->&gt;${stateAssoc.geoName?default(stateAssoc.geoId)}</option>
            <!--#list-->
          <!--#if-->
        <!--#list-->
      </select></div>

Following Javascript code will unobtrusively manage the relationship between Country select box (master) and State select box (slave),

?View Code LANGUAGE
1
2
3
$('checkoutPanel').select('.dependentSelectMaster').reverse().each( function (elt) {
  new Dependent( $$( '.'+elt.title ).first() , elt );
})

Where ‘checkoutPanel’ is Id of wrapper div that encloses checkout html form. Apply ‘dependentSelectMaster’ class to select boxes that have dependent slave elements, making them the master. Slave select box is related to its master using title and class attribute of elements, A select box is slave if it has a class applied to it that is equal to title of master select box.

The javascript code snippet traverses DOM tree looking for master select boxes. Using title attribute of master select it finds all the slaves and creates Dependent select relationship between them. Its all clean and simple.

Needless to say, you’ll need to include Prototype.js and DependentSelect.js in your webpage. I hope you will find this short OFBiz tutorial useful.

- Anil

Anil Patel is Chief Development Officer at HotWax Media as well as an OFBiz project committer, PMC member, and active community contributor. He also studies karate! Anil will join other HotWax Media employees and advisors in periodically posting thoughts here related to OFBiz, eCommerce, ERP, and related topics.

Pricing Enterprise E-commerce Services

Tuesday, July 6th, 2010

Enterprise-e-Commerce

The enterprise e-commerce space is broadly varied, and the boundaries constantly shifting. Features and capabilities only available to huge players just 10 years ago are now more affordable and available to SMBs around the world.

Sometimes just using the term ‘enterprise e-commerce,’ however, can be difficult or misleading. Is enterprise e-commerce the right term to use for a company with 10,000 SKUs, doing a few million dollars a year in online sales? In the event that they manage their suppliers, inventory, warehouse, and fulfillment using an integrated system, for example, I would say yes — this counts as ‘enterprise e-commerce.’ Although clearly no Amazon or Zappos, these companies and their systems take it far beyond the simple eBay auction or basic storefront.

At HotWax Media, we provide enterprise e-commerce consulting services. Our core services are based around Apache OFBiz, but we regularly find ourselves integrating with 3rd party systems like NetSuite, Endicia, and many others. One day it could be SAP with multiple users, and the next day it could be QuickBooks piloted by the business owner herself. The very nature of an enterprise e-commerce system suggests that the consulting services can be quite different from one client to the next, and we have certainly found this to be true. We can find ourselves building systems that are similar in fundamental intent for companies whose revenues are separated by two orders of magnitude.

So the question comes up, what is the right way to go about pricing these services? Constructive Cost Model? (http://en.wikipedia.org/wiki/COCOMO) Probably not. Simple menu of services with some attention to psychology? (http://bit.ly/NLo3V) That’s better because it is more easily understood by the client, but it is not always easy to do on our end.

In fact, when doing unique service projects, you might say that with a fixed price, someone always loses. (http://bit.ly/9E0bbP) Either the vendor pads the cost to cover any surprises, and he wins, or the vendor fails to anticipate (and build in money to cover) the surprises, and he loses. The only thing for certain is that those surprises will come up, and someone will have to pay for them.

The next option is straight hourly work. This should be great for the vendor, but can lead to problems of its own in terms of project and cost management. When vendors are working on a straight hourly arrangement, they have less incentive to plan. While the idea of paying the vendor for his time is fair and honest, hourly projects (that lack planning) can end up costing more than the customer originally planned, and the projects can look expensive in hindsight. When the project is complete, lacking adequate planning, the tendency is to look back and say “All they wanted was X and it cost them Y!?” The problem is that the curvy, flexible path made possible by the hourly arrangement is overlooked in that simple analysis. By the way, this happens all the time with contractors, attorneys, and everyone else who offers services for an hourly rate; it’s not just software developers.

So this brings me to my method of choice for pricing projects: fixed team project planning and pricing. This approach can allow for the best of both worlds. In practice this ends up looking a lot like phased pricing, except that the cost does not vary month to month (except by mutual agreement). Rather, the dedicated team comes at a predictable expense and works off of a well formed project plan. (The creation of the plan is paid work as well, and can be more or less detailed depending on the size of the project and the client’s preference.) Then, the flexibility that real life requires comes in the form of more or less work being completed in each month (or phase).

So we can say, “We have a list of 10 items. We can be very confident that we will complete 5 of them, somewhat confident that we will complete 7 of them, and only slightly confident that we will complete all 10 of them.” At the end of each month, we reassess our plan and make adjustments based team velocity and client priority, leveraging the things we have learned while working on the implementation.

In conclusion: we do a lot of deals each year, and our approach to pricing varies a bit job to job. But whenever possible, we like this fixed team approach. It gives the client and provider both a fair deal, and encourages all parties to plan responsibly. We encourage you to try it out; if you would like us to help you with your enterprise e-commerce project using our fixed team approach, give us a call today!

Mike Bates is CEO at HotWax Media and will join other HotWax Media employees and advisors in periodically posting thoughts here related to OFBiz, eCommerce, ERP, and related topics.
Mike Bates - OFBiz Expert

OFBiz Tutorial- How To Use ECA’s To Extend Service Permission

Wednesday, June 16th, 2010

This OFBiz tutorial is the next part of our earlier tutorial “How to Setup User Permissions”.  See how using ECA’s can extend service permissions.

So far we have seen how to assign security permission to a user which will let the user access a particular application. The level of access to an application will depend on the permission(s) assigned to the user. You may want to allow the user to just view an application or maybe you want to allow them other possible permission options like creating new records, updating the existing records or deleting exiting records in a particular application.

You can also assign an admin permission to a user. This gives the user full access to an application so that the user can View, Create, Update and Delete records in a particular application.

Assigning a permission is not restricted to just one application, you can allow the user to access more then one application by assigning permissions related to other apps.

There are certain cases when a user has admin permission for an application but the user is not allowed to perform certain operation in the application. For example, if you want to view a product lookup screen in the “Asset Maint” application then you would need the permission of the Catalog application. The simplest option is to give the user all the required permissions. The downside of this approach is that this will also allow the user access to the Catalog application.

So in this case if you want the user to have access only to the “Asset Maint” app then you can do this by defining ECA (Event Condition Access) rules which will extend the permission of the other applications while still not allowing the user to access these application(s) other than “Asset Maint.”

The rule can be defined in a file under the sevicedef folder in the component directory tree as following.

OFBiz Tutorial Permissions-2-1a

This also requires the entry of this file in ofbiz-component.xml where secas.xml is the name of the above file.

OFBiz Tutorial Permissions-2-2a

Whenever the user tries to perform any catalog related operation in the “Asset Maint” application, the catalogPermissionCheck service will run first. We know that the user does not have any explicit permission to the Catalog application hence the service will return hasPermission flag as false. Every permission service implements a generic service interface and hasPermission is one of the boolean attibute that is returned by the permission service. If it is false it means that the user does not have sufficient permission.

Since we want to override the permission we define a permission service in the “Asset Maint” component. This service will check whether the user has permission to access the “Asset Maint” component or not instead of checking for Catalog permission. If the service returns a true for the hasPermission flag (which it will if the user has “Asset Maint” permissions) it means the user can access the catalog related screens in “Asset Maint.”

The code for the permission service will look like this: (Click to expand image.)

 OFBiz Tutorial Permissions-2-4a

This way without explicitly assigning the catalog permissions the user will still be able to access the product lookup screen in the “Asset Maint” application.

Similar you can add more rules to the ECA file to override the OFBiz user permissions of other applications in the “Asset Maint” application.

- Vikas

Vikas Mayur is a dynamic OFBiz developer working for HotWax Media as a Director of Software Development in India. He works in web based application and ERP software using OFBiz, which is a top level project of Apache Software Foundation.

HotWax Media’s Solutions to Project Management Challenges

Thursday, June 3rd, 2010
Contegix – Partners: Atlassian
In business, like in life, forging partnerships is never an easy thing to do.  As we’ve discussed in previous posts, our partnership with Contegix has made a profound impact on the companies with which we work and how we provide the greatest impact to our customers.
After working with rudimentary collaboration tools – read: not integrated – we went out and purchased a suite of tools that were supposed to solve many of our project management and company workflow challenges.  After working with this software package (no need to name names) for a year and spending countless hours working with their professional services team and our business team, we were unable to make this software even close to the worth the investment.  We learned from our mistakes and took this one to Contegix!
When we did our original research into the project management space, one of the contenders was the Atlassian suite of tools – but just didn’t measure up to the potential promised from the other tool.  In the time between doing our initial evaluation, and the when the competition failed to live up to it’s promise, the Atlassian tools surged forward – and Contegix backed them as their solution to our problems we were facing.
From protecting access to applications and source code to managing documents and documentation – from showing SVN changesets to performing code review – from project management to development workflows – Atlassian has delivered an extensible set of applications that we can build a solid foundation on for our customers and internal teams alike.  Preparing for our next set of posts, the tools we are using at this moment are:
1. Crowd – centralized single sign on – permissions and access – easily pluggable to a variety of applications
2. Confluence – document management and collaboration
3. FishEye – real time reporting of source code repository changes
4. Crucible – code and document review
5. JIRA – project management and tracking
In this post, I had planned on going into detail about our Atlassian support partner, Customware, but we’ll save that for next post.

Atlassian

In business, like in life, forging partnerships is never an easy thing to do.  As we’ve discussed in previous posts, our partnership with Contegix has made a profound impact on the companies with which we work and how we provide the greatest impact to our customers.  Most of you who follow this blog know by now that HotWax Media specializes in OFBiz development.  However, these project management tools can be used no matter what platform you choose to develop in.

After working with rudimentary collaboration tools – read: not integrated – we went out and purchased a suite of tools that were supposed to solve many of our project management and company workflow challenges.  After working with this software package (no need to name names) for a year and spending countless hours working with their professional services team and our business team, we were unable to make this software even close to the worth the investment.  We learned from our mistakes and took this one to Contegix!

When we did our original research into the project management space, one of the contenders was the Atlassian suite of tools – but just didn’t measure up to the potential promised from the other tool.  In the time between doing our initial evaluation, and the when the competition failed to live up to it’s promise, the Atlassian tools surged forward – and Contegix backed them as their solution to our problems we were facing.

From protecting access to applications and source code to managing documents and documentation – from showing SVN changesets to performing code review – from project management to development workflows – Atlassian has delivered an extensible set of applications that we can build a solid foundation on for our customers and internal teams alike.  Preparing for our next set of posts, the tools we are using at this moment are:

  1. Crowd – centralized single sign on – permissions and access – easily pluggable to a variety of applications
  2. Confluence – document management and collaboration
  3. FishEye – real time reporting of source code repository changes
  4. Crucible – code and document review
  5. JIRA – project management and tracking

In this post, I had planned on going into detail about our Atlassian support partner, Customware, but we’ll save that for next post.

-Tim

Tim Ruppert is Chief Operating Officer at HotWax Media, an OFBiz service provider, as well as an OFBiz project committer and active community member. Tim will join other HotWax Media employees and advisors in periodically posting thoughts here related to OFBiz, eCommerce, ERP, and related topics.

OFBiz Tutorial: How to Setup User Permissions

Thursday, May 20th, 2010

In OFBiz, every application has a base permission (except a few like ecommerce, ofbizwebsite etc.) and users should have at least base OFBiz permission view or base permission admin to login in the application. Sometime base permission may consist of more then one permission and in that case both are required to login/access the application.

The base permission is defined in the ofbiz-component.xml file of each component. If the base permission consists of more then one permission then they are separated by a comma.

Below is a code snippet taken from Asset Maint component ofbiz-component file.

OFBiz Tutorial Permissions 1

We will now learn how to setup permissions for a new user to gain access to a back-end application while using an Asset Maint component as an example throughout the tutorial.

Just a note that we will not focus on the internal details of this component and we will only visit a couple of screens to see whether we have setup correct permission levels for the user or not.

Step by Step Guide

Lets first create a new user in the system. Login to the party manager application with username: admin and password: ofbiz and click on Create New link located at the top of the main screen.

The screen will provide a variety of options to choose from. Click on Create New Person.

OFBiz Tutorial Permissions 2

Enter the required fields and save the form.

OFBiz Tutorial Permissions 3

This will take you to the user profile screen.

Our next step is to create a user login for the new user. Click on Create New link on User Name(s) screen in the right column on the profile page.

OFBiz Tutorial Permissions 4

Enter the details as below and save the form.

User Login Id: joe.will
Current Password: ofbiz
Current Password Verify: ofbiz

Now coming back to the profile screen you will see that the new user login has appeared under the User Name(s) screen in the right column on the profile page.

Now click on the Security Group link. This will present you with a screen where you can add a security group to the user account. Security Group is basically a set of permissions where permissions are classified as VIEW, CREATE, UPDATE and DELETE. An admin security group contains all of these permissions. Select Asset Maint Admin group from the drop-down list. The From Date field is optional and if user does not enter it then the application will use the system’s current timestamp for this field. Thru Date is also optional but if specified then the security group will be valid for the user till the thru date has passed. You can also assign multiple security groups at the same time to the user. Save this form.

Now you have granted sufficient permission to the user to access the Asset Maint application.

OFBiz Tutorial Permissions 5

Note: The admin user is available only if demo data is installed. If only seed data is installed then you have to create the admin user explicitly through the command line with an ant target defined in the build file which is present at the root of the project. Run command create-admin-user-login from the terminal and follow onscreen instructions to complete this wizard.

Testing User’s Permissions

Logout from the party manager application and then you can login to the Asset Maint application with the new user. The user should be able to login in to this application without any issues and this signifies that the user has permission to VIEW this application.

Lets try to check whether the user has permission to perform CREATE operation in the application. Go to the Fixed Assets tab and click on New Fixed Asset link. Fill in the basic details as shown in the screenshot and click on update button. The user should be able to create new fixed asset record. This signifies that user has permission to perform create operation in the application.

OFBiz Tutorial Permissions 6

Similar you can check whether the user has UPDATE or DELETE permissions by updating or removing the fixed asset record.

Lets try to login into any other application (for example catalog) with the same user to check whether the system permits the user to access an application other than Asset Maint. As it would be obvious from the screenshot below that the security permissions assigned to the user is just enough to login and access Asset Maint application and not any other application.

Similar you can try to login into any other application with the same user and you will see the same result.

ofbiz-tutorial-permissions7

So far we have learned the basics of security permission in OFBiz and how we can assign these permissions to the user.

Hope you will enjoy this!

- Vikas

Vikas Mayur is a dynamic OFBiz developer working for HotWax Media as a Director of Software Development in India. He works in web based application and ERP software using OFBiz, which is a top level project of Apache Software Foundation.