mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
enable deletion of bill
git-svn-id: http://www.observium.org/svn/observer/trunk@1713 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
40
html/pages/bill/actions.inc.php
Normal file
40
html/pages/bill/actions.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
if($_POST['action'] == "delete_bill" && $_POST['confirm'] == "confirm") {
|
||||
|
||||
$port_query = mysql_query("SELECT * FROM `bill_ports` WHERE `bill_id` = '$bill_id'");
|
||||
while($port_data = mysql_fetch_array($port_query)) {
|
||||
mysql_query("DELETE FROM `port_in_measurements` WHERE `port_id` = '".mres($port_data['bill_id'])."'");
|
||||
mysql_query("DELETE FROM `port_out_measurements` WHERE `port_id` = '".mres($port_data['bill_id'])."'");
|
||||
}
|
||||
|
||||
mysql_query("DELETE FROM `bill_ports` WHERE `bill_id` = '".mres($bill_id)."'");
|
||||
mysql_query("DELETE FROM `bill_data` WHERE `bill_id` = '".mres($bill_id)."'");
|
||||
mysql_query("DELETE FROM `bill_perms` WHERE `bill_id` = '".mres($bill_id)."'");
|
||||
mysql_query("DELETE FROM `bills` WHERE `bill_id` = '".mres($bill_id)."'");
|
||||
|
||||
echo("<div class=infobox>Bill Deleted. Redirecting to Bills list.</div>");
|
||||
|
||||
echo("<meta http-equiv='Refresh' content=\"2; url='bills/'\">");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($_POST['action'] == "add_bill_port") { mysql_query("INSERT INTO `bill_ports` (`bill_id`, `port_id`) VALUES ('".mres($_POST['bill_id'])."','".mres($_POST['interface_id'])."')"); }
|
||||
if($_POST['action'] == "delete_bill_port") { mysql_query("DELETE FROM `bill_ports` WHERE `bill_id` = '".mres($bill_id)."' AND `port_id` = '".mres($_POST['interface_id'])."'"); }
|
||||
if($_POST['action'] == "update_bill") {
|
||||
mysql_query("UPDATE `bills` SET `bill_name` = '".mres($_POST['bill_name'])."',
|
||||
`bill_day` = '".mres($_POST['bill_day'])."',
|
||||
`bill_gb` = '".mres($_POST['bill_gb'])."',
|
||||
`bill_cdr` = '".mres($_POST['bill_cdr'])."',
|
||||
`bill_type` = '".mres($_POST['bill_type'])."'
|
||||
WHERE `bill_id` = '".mres($bill_id)."'");
|
||||
|
||||
if(mysql_affected_rows())
|
||||
{
|
||||
echo("<div class=infobox>Bill Properties Updated</div>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
23
html/pages/bill/delete.inc.php
Normal file
23
html/pages/bill/delete.inc.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
echo("
|
||||
|
||||
<h3>Delete Bill</h3>
|
||||
|
||||
<p>Are you sure you want to delete his bill?</p>
|
||||
|
||||
<br \>
|
||||
|
||||
<form action='' method='post'><input type='hidden' name='action' value='delete_bill'>
|
||||
|
||||
Confirm: <input type='checkbox' name='confirm' value='confirm'>
|
||||
|
||||
<br />
|
||||
|
||||
<input type=submit value=' Yes, please delete this bill! ' name='Delete'></form>
|
||||
|
||||
|
||||
|
||||
");
|
||||
|
||||
?>
|
Reference in New Issue
Block a user