Index: html/pages/bill/actions.inc.php =================================================================== --- html/pages/bill/actions.inc.php (revision 6107) +++ html/pages/bill/actions.inc.php (working copy) @@ -11,7 +11,7 @@ * */ -if ($_POST['action'] == "delete_bill" && $_POST['confirm'] == "confirm") +if ($vars['action'] == "delete_bill" && $vars['confirm'] == "confirm") { foreach (dbFetchRows("SELECT * FROM `bill_ports` WHERE `bill_id` = ?", array($bill_id)) as $port_data) { @@ -29,9 +29,10 @@ echo(""); } -if ($_POST['action'] == "reset_bill" && ($_POST['confirm'] == "rrd" || $_POST['confirm'] == "mysql")) +if ($vars['action'] == "reset_bill" && ($vars['confirm'] == "rrd" || $vars['confirm'] == "mysql")) { - if ($_POST['confirm'] == "mysql") { + if ($vars['confirm'] == "mysql") + { foreach (dbFetchRows("SELECT * FROM `bill_ports` WHERE `bill_id` = ?", array($bill_id)) as $port_data) { dbDelete('port_in_measurements', '`port_id` = ?', array($port_data['bill_id'])); @@ -40,7 +41,8 @@ dbDelete('bill_hist', '`bill_id` = ?', array($bill_id)); dbDelete('bill_data', '`bill_id` = ?', array($bill_id)); } - if ($_POST['confirm'] == "rrd") { + if ($vars['confirm'] == "rrd") + { // TODO: First need to add new rrd with poller/discover, so the default rrd isn't wipped } @@ -48,55 +50,59 @@ echo(""); } -if ($_POST['action'] == "add_bill_port") +if ($vars['action'] == "add_bill_port") { - $check = dbFetchRows("SELECT port_id FROM `bill_ports` WHERE `bill_id` = ? LIMIT 1", array($_POST['bill_id'])); - if ($check[0]['port_id'] != $_POST['port_id']) { - dbInsert(array('bill_id' => $_POST['bill_id'], 'port_id' => $_POST['port_id']), 'bill_ports'); + foreach ($vars['port_id'] as $entry) + { + $check = dbFetchRows("SELECT port_id FROM `bill_ports` WHERE `bill_id` = ? LIMIT 1", array($entry)); + if ($check[0]['port_id'] != $entry) + { + dbInsert(array('bill_id' => $vars['bill_id'], 'port_id' => $entry), 'bill_ports'); + } } } -if ($_GET['action'] == "delete_bill_port") +if ($vars['action'] == "delete_bill_port") { - dbDelete('bill_ports', "`bill_id` = ? AND `port_id` = ?", array($bill_id, $_GET['port_id'])); + dbDelete('bill_ports', "`bill_id` = ? AND `port_id` = ?", array($bill_id, $vars['port_id'])); } -if ($_POST['action'] == "update_bill") +if ($vars['action'] == "update_bill") { - if (isset($_POST['bill_quota']) or isset($_POST['bill_cdr'])) + if (isset($vars['bill_quota']) or isset($vars['bill_cdr'])) { - if ($_POST['bill_type'] == "quota") + if ($vars['bill_type'] == "quota") { - if (isset($_POST['bill_quota_type'])) + if (isset($vars['bill_quota_type'])) { - if ($_POST['bill_quota_type'] == "MB") { $multiplier = 1 * $config['billing']['base']; } - if ($_POST['bill_quota_type'] == "GB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } - if ($_POST['bill_quota_type'] == "TB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } - $bill_quota = (is_numeric($_POST['bill_quota']) ? $_POST['bill_quota'] * $config['billing']['base'] * $multiplier : 0); + if ($vars['bill_quota_type'] == "MB") { $multiplier = 1 * $config['billing']['base']; } + if ($vars['bill_quota_type'] == "GB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } + if ($vars['bill_quota_type'] == "TB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } + $bill_quota = (is_numeric($vars['bill_quota']) ? $vars['bill_quota'] * $config['billing']['base'] * $multiplier : 0); $bill_cdr = 0; } } - if ($_POST['bill_type'] == "cdr") + if ($vars['bill_type'] == "cdr") { - if (isset($_POST['bill_cdr_type'])) + if (isset($vars['bill_cdr_type'])) { - if ($_POST['bill_cdr_type'] == "Kbps") { $multiplier = 1 * $config['billing']['base']; } - if ($_POST['bill_cdr_type'] == "Mbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } - if ($_POST['bill_cdr_type'] == "Gbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } - $bill_cdr = (is_numeric($_POST['bill_cdr']) ? $_POST['bill_cdr'] * $multiplier : 0); + if ($vars['bill_cdr_type'] == "Kbps") { $multiplier = 1 * $config['billing']['base']; } + if ($vars['bill_cdr_type'] == "Mbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } + if ($vars['bill_cdr_type'] == "Gbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } + $bill_cdr = (is_numeric($vars['bill_cdr']) ? $vars['bill_cdr'] * $multiplier : 0); $bill_quota = 0; } } } - $bill_notify = ($_POST['bill_notify'] == 'on' ? 1 : 0); - $bill_contact = (strlen($_POST['bill_contact']) ? $_POST['bill_contact'] : array('NULL')); + $bill_notify = ($vars['bill_notify'] == 'on' ? 1 : 0); + $bill_contact = (strlen($vars['bill_contact']) ? $vars['bill_contact'] : array('NULL')); - if (dbUpdate(array('bill_name' => $_POST['bill_name'], 'bill_day' => $_POST['bill_day'], 'bill_quota' => $bill_quota, 'bill_cdr' => $bill_cdr, - 'bill_type' => $_POST['bill_type'], 'bill_custid' => $_POST['bill_custid'], 'bill_ref' => $_POST['bill_ref'], - 'bill_notes' => $_POST['bill_notes'], 'bill_contact' => $bill_contact, 'bill_notify' => $bill_notify), 'bills', '`bill_id` = ?', array($bill_id))) + if (dbUpdate(array('bill_name' => $vars['bill_name'], 'bill_day' => $vars['bill_day'], 'bill_quota' => $bill_quota, 'bill_cdr' => $bill_cdr, + 'bill_type' => $vars['bill_type'], 'bill_custid' => $vars['bill_custid'], 'bill_ref' => $vars['bill_ref'], + 'bill_notes' => $vars['bill_notes'], 'bill_contact' => $bill_contact, 'bill_notify' => $bill_notify), 'bills', '`bill_id` = ?', array($bill_id))) { print_message("Bill Properties Updated"); } } -?> +// EOF Index: html/pages/bill/edit.inc.php =================================================================== --- html/pages/bill/edit.inc.php (revision 6107) +++ html/pages/bill/edit.inc.php (working copy) @@ -179,12 +179,13 @@ if (is_array($ports)) { - foreach ($port_ids AS $port_entry) { + foreach ($port_ids AS $port_entry) + { - $emptyCheck = true; + $emptyCheck = true; - $port = get_port_by_id($port_entry['port_id']); - $device = device_by_id_cache($port['device_id']); + $port = get_port_by_id($port_entry['port_id']); + $device = device_by_id_cache($port['device_id']); $devicebtn = ''; if (empty($port['ifAlias'])) { $portalias = ""; } else { $portalias = " - ".$port['ifAlias'].""; } @@ -204,7 +205,8 @@ echo(' ' . PHP_EOL); echo(' ' . PHP_EOL); } - if (!$emptyCheck) { + if (!$emptyCheck) + { echo('
' . PHP_EOL); echo(' There are no ports assigned to this bill' . PHP_EOL); echo('
' . PHP_EOL); @@ -227,7 +229,7 @@
- " . $device['hostname'] . ""); } + if (device_permitted($device['device_id'])) + { + echo(" "); + } } ?> @@ -246,7 +249,7 @@
- +
Index: html/pages/bill/navbar.inc.php =================================================================== --- html/pages/bill/navbar.inc.php (revision 6107) +++ html/pages/bill/navbar.inc.php (working copy) @@ -16,60 +16,51 @@ $isAdd = (($vars['view'] == "add") ? true : false); $disabledAdmin = ($isAdmin ? "" : 'disabled="disabled"'); $disabledUser = ($isUser ? "" : 'disabled="disabled"'); -$links['quick'] = ($isUser ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'quick')) : 'javascript:;'); -$links['accurate'] = ($isUser ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'accurate')) : 'javascript:;'); -$links['transfer'] = ($isUser ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'transfer')) : 'javascript:;'); -$links['history'] = ($isUser ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'history')) : 'javascript:;'); -$links['api'] = ($isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'api')) : 'javascript:;'); -$links['edit'] = ($isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'edit')) : 'javascript:;'); -$links['delete'] = ($isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'delete')) : 'javascript:;'); -$links['reset'] = ($isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'reset')) : 'javascript:;'); -$links['bills'] = generate_url(array('page' => 'bills')); -$active['quick'] = (($vars['view'] == "quick") ? "active " : ""); -$active['accurate']= (($vars['view'] == "accurate") ? "active " : ""); -$active['transfer']= (($vars['view'] == "transfer") ? "active " : ""); -$active['history'] = (($vars['view'] == "history") ? "active " : ""); -$active['api'] = (($vars['view'] == "api") ? "active " : ""); -$active['edit'] = (($vars['view'] == "edit") ? "active " : ""); -$active['reset'] = (($vars['view'] == "reset") ? "active " : ""); -$active['delete'] = (($vars['view'] == "delete") ? "active " : ""); -$brand = 'Bill'; -if (!$isAdd) { - $brand .= ':'.$bill_data['bill_name']; +$navbar['class'] = 'navbar-narrow'; +$navbar['brand'] = 'Bill'; + +if (!$isAdd) +{ + $navbar['brand'] .= ': '.$bill_data['bill_name']; } -echo(''); -?> +$navbar['options_right']['back']['url'] = generate_url(array('page' => 'bills')); +$navbar['options_right']['back']['text'] = 'Back'; +$navbar['options_right']['back']['icon'] = 'icon-chevron-left'; + +print_navbar($navbar); +unset($navbar); + +// EOF