LP1335668 Modifications to ACQ Year End and Transfer Fund
authorLiam Whalen <liam.whalen@bc.libraries.coop>
Tue, 5 Aug 2014 19:17:43 +0000 (12:17 -0700)
committerLiam Whalen <liam.whalen@bc.libraries.coop>
Tue, 5 Aug 2014 19:23:47 +0000 (12:23 -0700)
commit5ef37d6bb5d17b06ac5b00f8a11973c0db423e38
tree2082d99ba81814194f055a31934ddccb19773f12
parent9bb060092ea3b358366e229a6cbd102af09ac8b5
LP1335668 Modifications to ACQ Year End and Transfer Fund

These files modify how ACQ Year End opeartes, as well as the functioning
of the transfer_fund stored procedure.  The major changes rely upon a
change to acq.fund_allocation.  The change adds two new columns:
fund_amount and conversion_ratio.  fund_amount is the amount of money
allocated to the fund in the currency of the fund, and converson ratio
was the ratio used to make the conversion.  These columns are populated
by a new trigger on the acq.fund_allocation table.

The addition of the fund_amount column allows the exchange rates to be
modified without changing the values stored in each fund.  Currently, if
you modify exchange rates, the values already allocated to funds change.

The transfer_fund stored procedure has had some of its logic modified,
and a new stored procedure return_funds_to_source is added to simplify
the login in transfer_fund.  return_funds_to_source is used in cases
where the money is not being transferred to another fund, but, instead,
is being returned to the funding source.

As well, a small fix now allows funds with no money allocated to them to
be displayed as $0.00.

Finally, a number of PgTap tests are included to check these changes.

Signed-off-by: Liam Whalen <liam.whalen@bc.libraries.coop>
15 files changed:
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/t/acq_fund_amount_test.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_fund_transfer.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_insert_fund_allocation_fund_amount.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_return_funds_to_source_test.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_rollover.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_rollover_distribution_formula.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_rollover_encumbrance_only.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/acq_rollover_encumbrance_only_and_distribution_formula.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.add_fund_amount_and_conversion_ratio_to_fund_allocation.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.empty_fund_totals_now_0.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.insert_fund_allocation_fund_amount.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.return_funds_to_source.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.rollover_with_return_funds_to_source.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq.transfer_fund.sql [new file with mode: 0644]