Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 868

Přidáno uživatelem Jiří Sviták před více než 13 roky(ů)

Uprava vysledne statistiky po manualnim prepocitavani zustatku na uctech.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'after you\'ve done that, you can continue' => 'Poté, co tak učiníte, můžete pokračovat.',
'agree' => 'Souhlas',
'all' => 'Všichni',
'all accounts now have correct balances, %d accounts had incorrect balances' => 'Všechny účty teď mají správné zůstatky, %d účtů mělo chybné zůstatky.',
'all accounts now have correct balances, %d accounts had incorrect balances, list of ids of corrected accounts: %s' => 'Všechny účty teď mají správné zůstatky, %d účtů mělo chybné zůstatky, seznam ID opravených účtů: %s',
'all ip addresses of member' => 'všem IP adresám člena',
'all redirected' => 'Všichni přesměrovaní',
'all transfers' => 'Všechny převody',
freenetis/trunk/kohana/application/models/account.php
");
// create update sql query
$sql = "UPDATE accounts SET balance = CASE id ";
// incorrect balances
$incorrect_balances = 0;
// array of ids to change
$ids = array();
foreach ($accounts as $account)
{
if ($account->balance != $account->calculated_balance)
{
$incorrect_balances++;
$sql .= "WHEN $account->id THEN $account->calculated_balance ";
$ids[] = $account->id;
}
}
// are there some accounts with incorrect balances? save correct balances
if ($incorrect_balances > 0)
if (count($ids) > 0)
{
$ids_with_commas = implode(',', $ids);
$sql .= "END WHERE id IN ($ids_with_commas)";
$db = new Database();
$db->query($sql);
}
return $incorrect_balances;
// returns array of ids of corrected accounts
return $ids;
}
/**
freenetis/trunk/kohana/application/controllers/accounts.php
Controller::error(ACCESS);
// get all accounts with their own and calculated balances
$account_model = new Account_Model();
$incorrect_balances = $account_model->recalculate_account_balances();
$this->session->set_flash('message', url_lang::lang('texts.All accounts now have correct balances, %d accounts had incorrect balances.', $incorrect_balances));
// recalculates balances and returns array of ids of incorrect accounts
$incorrect_accounts = $account_model->recalculate_account_balances();
$this->session->set_flash('message', url_lang::lang('texts.All accounts now have correct balances, %d accounts had incorrect balances, list of IDs of corrected accounts: %s', array(0 => count($incorrect_accounts), 1 => implode(", ", $incorrect_accounts))));
url::redirect(url_lang::base().'accounts/show_all');
}
}

Také k dispozici: Unified diff