Undefined function onsetdate() error

malik8515 wrote on Friday, March 16, 2012:

after updating to patch 8 I am getting this error when I try to generate X12
Call to undefined function onsetdate() in /home/public_html/emr/openemr-4.1.0/library/Claim.class.php on line 999

tmccormi wrote on Friday, March 16, 2012:

Odd that was working fine in 4.1.1 dev.    I’ll check the patch 8 directly, in the mean time this will fix it… last line of the example.

Here is lines 993 to 1001 from Claim.class.php

  function onsetDate() {
    return cleanDate($this->encounter);
  }
 
  function onsetDateValid()
  {
      // return onsetDate()!==’’;
      return cleanDate($this->encounter) !== ‘’;
  }

tmccormi wrote on Friday, March 16, 2012:

Kevin,
  Can you take a look at this…  I’m going to traveling friday-monday and I will not have developer level internet access.
-Tony

yehster wrote on Friday, March 16, 2012:

Branch with a fix:
https://github.com/yehster/openemr/commit/c851310473e986a2e70b27fd2d07a7849f04645f
https://github.com/yehster/openemr/tree/onsetDateFix
My branch here is based off of the patch

I’ve pushed the change to the official 4.1.1 dev tip, but haven’t done anything with patch.

bradymiller wrote on Friday, March 16, 2012:

Hi,

Can I get some clarification on this. Was this bug specific to the patch (rel-410 branch) or was this bug also in the development branch (master)? This will help me figure out how to incorporate this into the next patch, which sounds like may need to be released soon too squash this bug.

thanks,
-brady
OpenEMR

yehster wrote on Friday, March 16, 2012:

I verified that the bug was present in both the development branch and rel-410 when investigating this
This is the commit in the official repository which addresses the problem for master. 
https://github.com/openemr/openemr/commit/fb33dd24b2d85df99667170fdb597768d5ab55e9

It’s possible that a different php version/configuration/setting masked the bug for Tony. 

malik8515 wrote on Friday, March 16, 2012:

Now I am getting this error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/public_html/emr/openemr-4.1.0/library/Claim.class.php on line 1083

yehster wrote on Friday, March 16, 2012:

What did you change? Did you try to change the code as Tony suggested? (and possibly made an error with single quotes versus double quotes?) or did you pull the code from git?

malik8515 wrote on Friday, March 16, 2012:

Thanks a lot guys its working now.
I tried exactly as above suggested by tony and got the above error.  Then I used your suggestion from git and its working.  Thanks again.

kevmccor wrote on Saturday, March 17, 2012:

I used the fix in Tony’s post and it works fine.  Just one missing/extra brace or character and there will be errors, so one should be very careful that they are editing the correct lines and all the braces are where/what they are supposed to be.  Use a text editor, not a word processor!

yehster wrote on Saturday, March 17, 2012:

Better of course would be to use a Code Editor/IDE with syntax checking :slight_smile: NetBeans is my current favorite.

-The Other Kevin :wink: