Fixes and tests for indirect transfers. Extended balance.
TrsrDB:
fixed Id -> credId
autobalance -> make_transfers
TrsrDB::Account:
added history accessor
TrsrDB::Balance:
added fieds earned spent and even_until, renamed credit to available
TrsrDB::CurrentArrears:
fixed account -> debtor in relation declaration
schema.sql:
fixed triggers
deactivated trigger enforceFixedCredit
extended Balance with some more fields
t/schema.{sql,out}
trivial fixes
t/schema.t added tests:
Get balances after transfers
partial use of credit,
indirect transfers
This commit is contained in:
@@ -30,5 +30,9 @@ __PACKAGE__->has_many(
|
||||
__PACKAGE__->has_one(
|
||||
balance => 'TrsrDB::Balance', 'ID'
|
||||
);
|
||||
__PACKAGE__->has_many(
|
||||
history => 'TrsrDB::History',
|
||||
{ 'foreign.account' => 'self.ID' }
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
@@ -4,7 +4,7 @@ package TrsrDB::Balance;
|
||||
use base qw/DBIx::Class::Core/;
|
||||
|
||||
__PACKAGE__->table("Balance");
|
||||
__PACKAGE__->add_columns(qw/ID credit promised arrears/);
|
||||
__PACKAGE__->add_columns(qw/ ID available earned promised spent arrears even_until /);
|
||||
__PACKAGE__->set_primary_key("ID");
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
|
||||
@@ -8,12 +8,12 @@ __PACKAGE__->add_columns(qw/billId debtor targetCredit date purpose difference/)
|
||||
__PACKAGE__->set_primary_key("billId");
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
account => 'TrsrDB::Account',
|
||||
{ 'foreign.ID' => 'self.account' }
|
||||
debtor => 'TrsrDB::Account',
|
||||
{ 'foreign.ID' => 'self.debtor' }
|
||||
);
|
||||
|
||||
__PACKAGE__->many_to_many(
|
||||
payable_with => account => 'available_credits'
|
||||
payable_with => debtor => 'available_credits'
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user