Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Mon Feb 17, 2020 7:42 am
VoIP Billing solution

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Documentation for adding custom A2Billing modules.
PostPosted: Wed Dec 18, 2013 12:18 am 

Joined: Thu Jun 05, 2008 5:35 pm
Posts: 37
Let's say that, like me, you're a systems administrator with low to passable skill at PHP programming, and you want to add a module to your customer interface to extend its functionality and provide your customers with a localised feature set.

Well, it's not as easy as just adding a link into customer/templates/default/main.tpl and being done with it, especially if you want to create separate features for different user groups. Well, I've figured out most of the details for how to make that happen, and I'm here to share my documentation.

Of course, it's not recommended to make these changes on your live site.

You will need to edit the following files in the /var/www/a2billing/ tree to add the title of your new module to the list in the left-hand menu frame:


For each of these files, you need to add a line similar to this to the end of the list of defines:
define ("ACX_IVR",               1048576);

The number "1048576" is 2^20, and apparently every new item added to this list must be twice was the previous last number in the list was. I'm not exactly sure if this is a strict requirement or not, but I'm going with the convention used in the original code. This same convention also exists elsewhere in the code for other features.

Again, at the bottom of each of these files is another list, defining some more variables used in the code. At the end of this list, add another line like this:

$ACXIVR                 = has_rights (ACX_IVR);

You also need to insert this line of code:
$smarty->assign("ACXIVR", $ACXIVR);

into the similarly-coded list in these files:


The last original A2Billing file to change is admin/Public/form_data/ Near the middle of this file is a list like the others, this time defining what you can see in the card group window within the Admin interface. At the end of the list, add a line like this:

$right_list["21"] = array( gettext("IVR"), "1048576");

Make sure you increment the number in the array definition (in this example, $right_list["21"] and also make sure the number at the end is the same one you used in the define() lines in the previous files.

Once this is completed, go to the Admin site for A2Billing and click Customers → Groups → Edit This Customer Group (the pencil). The name of your module should show up here now.

To enforce this functionality in your PHP script, you need to include this code at the top, before anything else gets executed, to ensure that unauthorized access is denied.

include ("./lib/customer.defines.php");
include ("./lib/customer.module.access.php");
include ("./lib/customer.smarty.php");
include ("./lib/Form/");
include ("./form_data/");

if (!has_rights(ACX_NAME_OF_MODULE)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");

Finally, the HTML for the actual left-hand menu is at 'customer/templates/default/main.tpl'. Add some HTML similar to this, wherever you think it's appropriate to do so in the list:

   {if $ACXIVR > 0 }
   <div class="toggle_menu"><li><a href="ivr.php"><strong>{php} echo gettext("IVR");{/php}</strong></a></li></div>

The Smarty Template Engine should parse this out into HTML properly, so the {if $ACXIVR > 0} is syntactically correct.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 
Voice Broadcast System

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group