示例#1
0
function fbilling_configpageload()
{
    global $currentcomponent;
    global $astman;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null;
    $tech_hardware = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null;
    $fbilling_alias = $astman->database_get("AMPUSER", $extdisplay . "/cidname");
    $sql = "SELECT billing_extensions.credit AS extension_credit,billing_extensions.refill,";
    $sql .= "billing_extensions.refill_value,billing_extensions.use_limit,";
    $sql .= "billing_extensions.tenant_id,billing_extensions.permission_id,";
    $sql .= "billing_extensions.is_active,billing_extensions.personal_credit,";
    $sql .= "billing_tenants.credit AS tenant_credit ";
    $sql .= "FROM billing_extensions,billing_tenants WHERE  ";
    $sql .= "billing_extensions.sip_num = '{$extdisplay}' AND billing_extensions.tenant_id = billing_tenants.id";
    $extension_data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC);
    $extension_is_active = !$extension_data['is_active'] ? '0' : $extension_data['is_active'];
    $extension_credit = !$extension_data['extension_credit'] ? '0' : $extension_data['extension_credit'];
    $extension_tenant_credit = !$extension_data['tenant_credit'] ? '0' : $extension_data['tenant_credit'];
    $extension_personal_credit = !$extension_data['personal_credit'] ? '0' : $extension_data['personal_credit'];
    $extension_tenant = !$extension_data['tenant_id'] ? '0' : $extension_data['tenant_id'];
    $extension_permission = !$extension_data['permission_id'] ? '0' : $extension_data['permission_id'];
    $extension_use_limit = !$extension_data['use_limit'] ? '0' : $extension_data['use_limit'];
    $extension_refill = !$extension_data['refill'] ? '0' : $extension_data['refill'];
    $extension_refill_value = !$extension_data['refill_value'] ? '0' : $extension_data['refill_value'];
    $extension_address = $astman->database_get("SIP", "Registry" . "/{$extdisplay}");
    $extension_activity_url = $dst_url = fbilling_build_url("display=fbilling_reports&cat=detailed_search&action=search&day_start=01&", "src={$extdisplay}&src_match=true");
    $extension_gen_invoice_url = fbilling_build_url("display=fbilling_reports&cat=generate_invoice&", "src={$extdisplay}");
    if ($ext === '') {
        $extdisplay = $extn;
    } else {
        $extdisplay = $ext;
    }
    $extension_address = explode(":", $extension_address);
    //echo $extension_address['0'];
    if ($action != 'del') {
        $section = _("FBilling Settings");
        //echo $extension_data['personal_credit'];
        $currentcomponent->addguielem($section, new gui_textbox('fbilling_credit', $extension_credit, _('Credit'), _("Current credit for this extension, to increase or decrease credit, just change the value here."), "frm_extensions_validateTenantPermission()", _("Please make sure you selected permission and tenant for this extension"), false, 0, ''));
        $currentcomponent->addguielem($section, new gui_textbox('fbilling_tenant_credit', $extension_tenant_credit, _('Tenant Credit'), _("Current credit for tenant this extension belongs to<br/>Tenant credit can be changed from Tenants section in FBilling Administration"), "", "", false, 0, true));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_extension_use_personal_credit', $currentcomponent->getoptlist('fbilling_extension_use_personal_credit'), $extension_personal_credit, _('Use Personal Credit'), _("Whether or not extension should use personal credit<br/>If set to yes, calls will be charged against credit specified above<br/>If set to no, calls will be charged against tenant credit"), false, ""));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_extension_is_active', $currentcomponent->getoptlist('fbilling_extension_is_active'), $extension_is_active, _('Active'), _("Whether or not extension is active.<br />If set to No, calls made by this extension will not go through irregardless of permission, tenants, credit..."), false, ""));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_tenant', $currentcomponent->getoptlist('fbilling_tenant'), $extension_tenant, _('Tenant'), _("Tenant to which this extension will belong"), false, ""));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_permission', $currentcomponent->getoptlist('fbilling_permission'), $extension_permission, _('Permission'), _("Calling permissions this extension"), false, ""));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_limit', $currentcomponent->getoptlist('fbilling_limit'), $extension_use_limit, _('Use Limit'), _("If set to No, this extension will be able to make unlimited number of calls, and credit will not be changed"), false, ""));
        $currentcomponent->addguielem($section, new gui_selectbox('fbilling_refill', $currentcomponent->getoptlist('fbilling_refill'), $extension_refill, _('Refill'), _("If set to Yes, every time refill script is executed, extensions credit will be topped up to value set in Refill Value field"), false, ""));
        $currentcomponent->addguielem($section, new gui_textbox('fbilling_refill_value', $extension_refill_value, _('Refill Value'), _("If Refill set to Yes, every time refill script is executed, extensions credit will be set to this value"), "", "", false, 0, ''));
        $currentcomponent->addguielem($section, new gui_textbox('fbilling_alias', "{$fbilling_alias}", _('Alias'), _("Name shown in FBilling Reports"), "", "", false, 0, ''));
        $currentcomponent->addguielem($section, new gui_link_new_tab('fbilling_account_phone', 'Go to phone web inetrface', "http://{$extension_address['0']}"));
        $currentcomponent->addguielem($section, new gui_link_new_tab('fbilling_account_activity', 'Extension activity', $extension_activity_url));
        $currentcomponent->addguielem($section, new gui_link_new_tab('fbilling_gen_invoice', 'Generate invoice', $extension_gen_invoice_url));
    }
}
    <th><?php 
    echo _("Tenant");
    ?>
</th>
    <th><?php 
    echo _("Cause");
    ?>
</th>
    <th colspan=2><?php 
    echo _("Action");
    ?>
</th>
    <?php 
    foreach ($search_results as $cdr) {
        $dst_url = fbilling_build_url("test", "dst={$cdr['dst']}&dst_match=true");
        $src_url = fbilling_build_url("test", "src={$cdr['src']}&src_match=true");
        echo "<tr>";
        echo "<td><a href=/admin/config.php?display=extensions&extdisplay={$cdr['src']}>{$cdr['src']}<a/></td>";
        echo "<td>{$cdr['alias']}</td>";
        echo "<td>{$cdr['dst']}</td>";
        echo "<td>{$cdr['calldate']}</td>";
        echo "<td>{$cdr['billsec']}</td>";
        echo "<td>{$cdr['tariff_cost']}</td>";
        echo "<td>{$cdr['total_cost']}</td>";
        echo "<td>{$cdr['tenant']}</td>";
        echo "<td>{$cdr['cause']}</td>";
        echo "<td><a href={$dst_url}>Calls to this number</a></td>";
        echo "<td><a href={$src_url}>Calls by this number</a></td>";
        echo "<tr>";
    }
    ?>