Pages

Tuesday, March 15, 2011

Pharos UniPrint - "Not enough money to print job"

On our new Pharos UniPrint 8.1 system a new error appeared today. "Not enough money to print job". I first figured this was a message I had written in the Pharos billing Plug-in. But looking closer I found that this message wasn't one I had written. and it appeared before my Plug-In "PrintJob -Accept Costs" was called. 

Pharos Not enough Money to print job
The issue only happened when a user had some money in internal balances and then the rest on the gateway balance. I narrowed it down to a feature that when Pharos Billing Plug-In was called the PlugIn.Balance was returned. If the balance wasn't enough the Pharos Popup not enough money to print job appeared. This all makes since but i'd been using the same Billing script in Pharos UniPrint 8.0.

The problem was actually how Pharos UniPrint 8.1 parsed the same billing Plug-in script differently that 8.0 did. 

For example if given the following scripts in Pharos UniPrint 8.0.

PlugIn.Balance = 0.02;
new sBalance = "0.07";
PlugIn.Balance +=  sBalance;

PlugIn.Balance will equal "0.09"

The same Script in Pharos UniPrint 8.1 
PlugIn.Balance = 0.02;
new sBalance = "0.07";
PlugIn.Balance +=  sBalance;

PlugIn.Balance will equal "0.020.07"

Instead of doing the math its joining them as strings. The fix is easy enough.

For Pharos UniPrint 8.1 and Pharos UniPrint 8.0 use the following. 

PlugIn.Balance = 0.02;
new sBalance = "0.07";
PlugIn.Balance = 0.0 + PlugIn.Balance + sBalance;
PlugIn.Balance will equal "0.09"

No comments:

Post a Comment

Please leave a comment; someone, anyone!