Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Apr 19, 2024 11:21 am
Hosted Voice Broadcast


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 
Offline

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:

admin/lib/customer.module.access.php
agent/lib/customer.module.access.php
common/lib/customer.module.access.php
customer/lib/customer.module.access.php


For each of these files, you need to add a line similar to this to the end of the list of defines:
Code:
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:

Code:
$ACXIVR                 = has_rights (ACX_IVR);


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

into the similarly-coded list in these files:

agent/lib/customer.smarty.php
common/lib/customer.smarty.php
admin/lib/customer.smarty.php
customer/lib/customer.smarty.php

The last original A2Billing file to change is admin/Public/form_data/FG_var_card_group.inc 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:

Code:
$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.

Code:
include ("./lib/customer.defines.php");
include ("./lib/customer.module.access.php");
include ("./lib/customer.smarty.php");
include ("./lib/Form/Class.FormHandler.inc.php");
include ("./form_data/FG_var_did.inc");


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


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:

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


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


Top
 Profile  
 
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 12 guests


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group