Fixed/Modified the earlier patch for CRM-12695 wrt comment on PR - 1135

Modified the earlier patch (as per comments suggested on PR -1135 https://github.com/civicrm/civicrm-core/pull/1135#issuecomment-20604599) to fix CRM-12695.
Also has a Web Test to test the fix.