fix previous commit :)

git-svn-id: http://www.observium.org/svn/observer/trunk@2759 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-12-06 22:26:47 +00:00
parent a1e96f708f
commit 70f51cef04
5 changed files with 15 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
$datefrom = $day_data['0'];
$dateto = $day_data['1'];
$check = dbFetchRow("SELECT * FROM `bill_hist` WHERE bill_id = ? AND bill_datefrom = ? AND bill_dateto = ? LIMIT 1", array($bill['bill_id'], $datefrom, $dateto));
$check = dbFetchRow("SELECT * FROM `bill_history` WHERE bill_id = ? AND bill_datefrom = ? AND bill_dateto = ? LIMIT 1", array($bill['bill_id'], $datefrom, $dateto));
$period = getPeriod($bill['bill_id'],$datefrom,$dateto);
@@ -90,7 +90,7 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
'bill_percent' => $percent,
'updated' => array('NOW()'));
dbUpdate($update, 'bill_hist', '`bill_hist_id` = ?', array($bill['bill_id']));
dbUpdate($update, 'bill_history', '`bill_hist_id` = ?', array($bill['bill_id']));
echo(" Updated history! ");
} else {
@@ -115,7 +115,7 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
'bill_dateto' => $dateto,
'bill_id' => $bill['bill_id'] );
# print_r($update);
dbInsert($update, 'bill_hist');
dbInsert($update, 'bill_history');
echo(" Generated history! ");
}
echo("\n\n");

View File

@@ -116,7 +116,7 @@ if (file_exists('.svn'))
if ($db_rev+0 < 2758)
{
include('upgrade-scripts/fix-billing-2757.php'); ## Rewrites all sensor RRDs. Nothing will work without this after 1757
include('upgrade-scripts/fix-billing-2758.inc.php'); ## Rewrites all sensor RRDs. Nothing will work without this after 1757
}
if ($dbu_rev+0 > $db_rev)

View File

@@ -68,7 +68,7 @@
if ($imgtype == "historical") {
$i = "0";
foreach (dbFetchRows("SELECT * FROM `bill_hist` WHERE `bill_id` = ? ORDER BY `bill_datefrom` LIMIT 12", array($bill_id)) as $data) {
foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` LIMIT 12", array($bill_id)) as $data) {
$datefrom = strftime("%e %b %Y", strtotime($data['bill_datefrom']));
$dateto = strftime("%e %b %Y", strtotime($data['bill_dateto']));

View File

@@ -54,7 +54,7 @@
<td colspan=\"2\" style=\"text-align: right;\"><a href=\"".generate_url($vars, array('detail' => "all"))."\"><img src=\"images/16/chart_curve.png\" border=\"0\" align=\"absmiddle\" alt=\"Show details\" title=\"Show details\" /> Show all details</a></td>
</tr>");
foreach (dbFetchRows("SELECT * FROM `bill_hist` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 24", array($bill_id)) as $history)
foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 24", array($bill_id)) as $history)
{
if (bill_permitted($history['bill_id']))
{

View File

@@ -475,12 +475,18 @@ function format_si($rate, $round = 2)
return round($rate, $round).$ext;
}
function format_bi($size, $round = '2')
function format_bi($value, $round = '2')
{
if($value < "0")
{
$neg = 1;
$value = $value * -1;
}
$sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E');
$ext = $sizes[0];
for ($i = 1; (($i < count($sizes)) && ($size >= 1024)); $i++) { $size = $size / 1024; $ext = $sizes[$i]; }
return round($size, $round).$ext;
for ($i = 1; (($i < count($sizes)) && ($value >= 1024)); $i++) { $value = $value / 1024; $ext = $sizes[$i]; }
if($neg) { $value = $value * -1; }
return round($value, $round).$ext;
}
function format_number($value, $base = '1000', $round=2)