bug fix to show sql errors
minor bug fix in sql error reporting
Improved/optimized CDR engine reports (and patient reminders) and added a
generic report result tracking/storing/viewing feature (final revision).

 --Added option to set processing priorities at Administration->Globals->CDR:
     CDR Reports Processing Priority
     Patient Reminder Creation Processing Priority
     This is only functional in linux (and other OS's that support NICE priority
     setting; note Windows does not support this). This is a nice way to allow
     running these reports without hogging up computational processing.

 --Added features to store/track/view reports (and patient reminders). This
   feature is actually rather generic and could support other reports, if
   desired. The following reports are supported:
    -Reports->Clinic->Standard Measures
    -Reports->Clinic->Quality Measures(CQM)
    -Reports->Clinic->Automated Measures(AMC)
    -Administration->Patient Reminders
     (Both 'Process Reminders' and 'Process and Send Reminders')
   To view previous report results and follow status of pending reports, go
   to:
    -Reports->Clinic->Report Results
      This screen lists previous and pending reports:
       -Can see results by clicking on Title
       -Date of reports are listed
       -If report was completed, then time to completion is listed
       -If report is pending, then a status (ie. how many patients are left) is listed
   To support this, a database table report_results was added (in vertical style to
   allow flexibility in supporting reports) with a library of function at
   library/library/report_database.inc and a relatively generic report result
   listing script at interface/reports/report_results.php.

 --Some real examples on using the store/track/view report features include (in order
   of intensity):
   1. Go to Reports->Clinic->Standard Measures and click Submit. Every ten seconds
      you will be updated with the status and when it's done, you'll be shown the
      results and can always go back and view them at Reports->Clinic->Report Results.
   2. Go to Reports->Clinic->Standard Measures and click Submit. Leave the screen
      to do other things or can even log off. Can then see the results (or status
      if still pending) at Reports->Clinic->Report Results.
   3. Go to Administration->Globals->CDR and set both 'CDR Reports Processing Priority'
      and 'Patient Reminder Creation Processing Priority' to 'Lowest Priority'. Now
      go to the following screens, click Submit and then go to the next screen etc.:
       Reports->Clinic->Standard Measures        (click Submit)
       Reports->Clinic->Quality Measures(CQM)    (click Submit)
       Reports->Clinic->Automated Measures(AMC)  (click Submit)
       Administration->Patient Reminders         (click Process Reminders)
      Now can work on other stuff or logout and can see results (or status
      if still pending) at Reports->Clinic->Report Results.

  --A json library was added to support php versions < 5.2, since the report results
    are saved in json format in the database.

  -Modifications for 4.1.1 patch include migrating the upgrade sql instructions to
   the sql patch file.
Turned off a debugging statement in globals.php
Claim submission bug fix

For more details, see following forum thread:
http://sourceforge.net/projects/openemr/forums/forum/202505/topic/5802360
The bugs in the patient portal are rectified.  The code 'require_once("$srcdir/csv_like_join.php");' threw a fatal error.

We have changed the line 51 of the file 'openemr\custom\code_types.inc.php' from 'require_once("$srcdir/csv_like_join.php");' to 'require_once(dirname(__FILE__)."/../library/csv_like_join.php");'.That fixed the bugs.

Signed-off-by: Teny <teny@zhservices.com>
incremented patch version 6