Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2462

Přidáno uživatelem Ondřej Fibich před více než 9 roky(ů)

Upravy: refs #999: Filtr bankovnich uctu dle vlastnika

Zobrazit rozdíly:

freenetis/branches/1.2/application/controllers/bank_accounts.php
// Create filter form
$filter_form = new Filter_form();
$filter_form->add('name')
$filter_form->add('baname')
->label('Account name')
->table('ba')
->callback('json/bank_account_name');
$filter_form->add('account_nr')
......
->label('Bank code')
->type('number');
$filter_form->add('member_name')
->label('Owner')
->callback('json/member_name');
$filter_form->add('member_id')
->label('Owner ID')
->type('number');
// bank accounts
$total_baccounts = $bank_account_model->count_bank_accounts($filter_form->as_sql());
freenetis/branches/1.2/application/i18n/cs_CZ/texts.php
'out of peak' => 'Mimo špičku',
'outbound' => 'Odchozí',
'owner' => 'Vlastník',
'owner id' => 'ID vlastníka',
'owner of account' => 'Vlastník účtu',
'owners of company telephones' => 'Vlastníci firemnch telefonů',
'page after canceling redirection' => 'Stránka po zrušení přesměrování',
freenetis/branches/1.2/application/models/bank_account.php
// filter
if (!empty($filter_sql))
{
$where = "AND $filter_sql";
$where = "WHERE $filter_sql";
}
// query
return $this->db->query("
SELECT ba.id, ba.name AS baname, ba.account_nr, ba.bank_nr,
m.name AS member_name, ba.member_id, ba.type, ba.settings
FROM bank_accounts ba
LEFT JOIN members m ON m.id = ba.member_id
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL) $where
SELECT ba.* FROM (
SELECT ba.id, ba.name AS baname, ba.account_nr, ba.bank_nr,
m.name AS member_name, ba.member_id, ba.type, ba.settings
FROM bank_accounts ba
LEFT JOIN members m ON m.id = ba.member_id
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL)
) ba
$where
ORDER BY ".$this->db->escape_column($order_by)." $order_by_direction
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
");
......
// filter
if (!empty($filter_sql))
{
$where = "AND $filter_sql";
$where = "WHERE $filter_sql";
}
// query
return $this->db->query("
SELECT COUNT(*) AS total
FROM bank_accounts ba
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL) $where"
SELECT COUNT(ba.id) AS total FROM (
SELECT ba.id, ba.name AS baname, ba.account_nr, ba.bank_nr,
m.name AS member_name, ba.member_id
FROM bank_accounts ba
LEFT JOIN members m ON m.id = ba.member_id
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL)
) ba
$where"
)->current()->total;
}

Také k dispozici: Unified diff