Rewrite of transfer fund
My comments are verbose at the moment to help me figure out what is
going on.
I have also added a second function acq.current_fund_allocation, which
returns the total amount of money allocated to the current fund.
This allows the acq.transfer_fund to determine if it is trying to
transfer more money than is currently available.
A few more sanity checks have also been added. And, the currency
conversion is done strictly from the database now. It seems
inconsistent to me to convert between old_fund and new_fund according to
a rate defined outside of this funciton but to convert between the funds
and the funding sources with values from acq.exchange_rate
LP#800478 Fixing asq.transfer_fund function
The function has to be broken up into parts. One for transfering funds
and one for returning funds to funding sources. This work so far has
created the code for transfering between funds. The acq.fund_allocation
table needs to be updated to have fund_amount and conversion_ratio
fields added. fund_amount will allow the funds to display their total
without fluctuating depending on the worth of the funding source
currency and conversion ratio is good to have for accounting purposes.
This adds the fuction acq.return_funds_to_source. This is
used when funds are returned to a funding source without then
transferring them to another fund. This can happen when rolling over
acqusitions at year end depending on the options chosen.
Added updates for the acq.rollover_funds_by_org_unit and
acq.rollover_funds_by_org_tree functions, so they use the new
acq.return_funds_to_source function when appropriate.
As well, aded a commented out DROP line to remove the old version of the
acq.transfer_fund function.
LP#800478 Tracked down all old transfer_fund references
As well, it modifies all old versions of transfer
fund because the new version has new parameters.