'Save and Dispense' not working properly

I use an instance of xampp-openemr-5.0.1.4 on windows 10.
Initially ‘Save and Dispense’ button of Prescriptions worked as expected. (Inventory changed with popping up of the drug label.) But now I cannot see a pop up of the drug label and deductions of the inventory after dispensing the drug. No popping up of any messages either with clicking the ‘Save and Dispense’ button. However the dispensed drug is saved in the patients prescription list.
Drug templates and NDC numbers too were added in the inventory as it was mentioned in wiki for proper functioning of this button.
Browser settings were updated with unblocking popups and demo version works correctly.
The following is the relevant apache error log.
error.log (295.7 KB)

I saw this issue was discussed in several places. But non of them helped to overcome the problem. Hope some one can help me sorting out the issue.
Thank you in advance.

Pretty sure this function is not available in v5.0.1: Call to undefined function collectCsrfToken from your error log.

Thank you, Jerry for your prompt attention to this issue. BTW will there be a simple way to correct this at code level since the feature has been there in previous versions?

@Sugath If indeed the log you attached is from a v5.0.1 instance then, the function collectCsrfToken, is not available in version 5.0.1. This is a new security feature introduced in current development branch v5.0.2.
So somehow it appears your C_Prescription.class.php is from v5.0.2-dev. The function in question resides in sanitize.inc.php in version 5.0.2-dev but not version 5.0.1.
Have you made changes recently to your 5.0.1 branch.

Of course Jerry, I did some changes to the C_Prescription.class.php to customize the print out put of the prescription. I commented out some ‘Echo’ and changed the order of lines. I have attached what I have changed. I am not sure (not a programmer myself) those changes have made this behavior. What will b e possible to revert the function back to normal?

I think the reason for the error log is that I checked the function of the button with the latest C_Prescription.class.php. Even with the original file, output remains the same.

Best I can tell you is try clearing smarty template cache at Administration->Other->Calendar or bring up browser console and then recreate your error to see if you get any errors in console.

Hi Sugath
Sounds like you are distributing medications from your clinic
I am from SL and using 5.0.1 (?The current version available)
I have not seen this ‘Save & Dispense’ button
Is it because its in 5.0.1.4 ? is this a new version ? Can I also install this (we are using linux)
Thanks in advance
Kumara

Hi Jerry!
It was a long pause since I met you. The problem was not solved. Drug label doesn’t come out.
I have attached some screenshots of the browser console. Will you be able to figure out the issue?