Update web view with blocked accounts

This commit is contained in:
root 2010-11-02 19:59:49 +01:00
parent c012ab042e
commit 31c7652e83
2 changed files with 25 additions and 5 deletions

View File

@ -45,6 +45,15 @@ class User
return LoadCategory($this, $id);
}
function IsAccountBlocked($id)
{
foreach($this->accounts as $i => $ac)
if ($ac->id == $id)
return $ac["blocked"] == "1";
return false;
}
function GetAccountName($id)
{
foreach($this->accounts as $i => $account)
@ -54,4 +63,5 @@ class User
}
}
?>

View File

@ -97,14 +97,24 @@ $total_incomes = $total_outcomes = $cur_incomes = $cur_outcomes = 0;
while($operation = $operations->fetchArray())
{
if ($operation["transfert"] != "" || $operation["meta"] == "1") continue;
if ($operation["meta"] == "1" ||
($operation["transfert"] != "" && ($operation["amount"] < 0
|| $_SESSION["user"]->IsAccountBlocked($operation["account"]))))
continue;
$date = mktime(0, 0, 0, $operation["month"]+1, $operation["day"]+1, $operation["year"]);
if ($operation["transfert"] == "")
{
$date = mktime(0, 0, 0, $operation["month"]+1, $operation["day"]+1, $operation["year"]);
$accounts[$operation["account"]]["total"] += $operation["amount"];
$accounts[$operation["account"]]["total"] += $operation["amount"];
if ($date <= $cur_date)
$accounts[$operation["account"]]["cur"] += $operation["amount"];
if ($date <= $cur_date)
$accounts[$operation["account"]]["cur"] += $operation["amount"];
}
else
{
$operation["amount"] = -$operation["amount"];
}
if ($operation["amount"] < 0)
{