A2Billing – invalid rate card expiry date 0000-00-00

Recently I’ve had a few calls about rate cards in A2Billing not working as expected. Everything looked good except the expiry date on the rate card was showing as 0000-00-00 00:00. This caused the rates in that rate card not to be evaluated as part of the call plan.

It looks like this is caused by a limitation in 32 bit Linux with the last date able to be represented as 19 January 2038. See here for more information about this – http://en.wikipedia.org/wiki/Year_2038_problem

When you create a new rate card, A2Billing tries to add 25 years to the current date to generate the expiry date for the rate card. Since 19 January 2013 this would have taken it past the last valid date in 32 bit Linux – causing the 0000-00-00 00:00

Unfortunately the 25 year addition is not a variable you can set, but requires a code change to modify. In A2Billing v2.0.1 (maybe slightly different in other versions) the file to edit is –

admin/Public/form_data/FG_var_tariffplan.inc

with the line of code to change being line 94 –

92         if ($form_action=="ask-add"){
93         $begin_date = date("Y");
94         $begin_date_plus = date("Y")+25;
95         $end_date = date("-m-d H:i:s");
96         $comp_date = "value='".$begin_date.$end_date."'";
97         $comp_date_plus = "value='".$begin_date_plus.$end_date."'";
98         }

Just reduce the number of years being added to the expiry date being generated.

If you are a SysAdminMan customer and experiencing this error just open a support ticket to have the change applied.