treasuredb/TrsrDB/Account.pm
Florian "flowdy" Heß 3985b46224 Added TrsrDB::autobalance(). Renamings and fixes.
Renamed "debts" to "arrears", because of psychologically slightly more positive
connotations. Renamed field "Id" of table Credit to "credId" in analogy to
field "billId" of table Debit.
2016-07-03 22:26:58 +02:00

35 lines
806 B
Perl

use strict;
package TrsrDB::Account;
use base qw/DBIx::Class::Core/;
__PACKAGE__->table('Account');
__PACKAGE__->add_columns(qw/ID type altId IBAN/);
__PACKAGE__->set_primary_key('ID');
__PACKAGE__->has_many(
statement_rows => 'TrsrDB::ReconstructedBankStatement',
{ 'foreign.account' => 'self.ID' }
);
__PACKAGE__->has_many(
debits => 'TrsrDB::Debit',
{ 'foreign.debtor' => 'self.ID' }
);
__PACKAGE__->has_many(
current_arrears => 'TrsrDB::CurrentArrears',
{ 'foreign.debtor' => 'self.ID' }
);
__PACKAGE__->has_many(
credits => 'TrsrDB::Credit',
{ 'foreign.account' => 'self.ID' }
);
__PACKAGE__->has_many(
available_credits => 'TrsrDB::AvailableCredits',
{ 'foreign.account' => 'self.ID' }
);
__PACKAGE__->has_one(
balance => 'TrsrDB::Balance', 'ID'
);
1;