Exchange Configuration Bug Fixes: (1) Gnats 4629: Something strange is happening with Exchange deletion. OR: "Removing an Exchange Supply Role from a Supply corrupts the Supply" (2) Gnats 4631: Exchange configuration can clobber supply role OR: "A Supply assigned as an Exchange Borrow can never be assigned to a different Exchange or Supply Role." (3) Exchange Configuration Dialog Box updating was not complete. ------------------------------- Accounting/AccountingCBData.hpp Accounting/Supply.hpp Accounting/Supply.cpp ------------------------------- Added AccountingCBData CallbackSubType: supply_role_changed New callbacks generated from the following methods, using this call: callSupplyChangedCallbacks (AccountingCBData::supply_role_changed, ..); (1) void Supply::setStandaloneRole(); <<< NEW METHOD [Gnats 4629] (2) void Supply::setStandaloneRole(SupplyDemandType_t) throw (cwException); (3) void Supply::setExchangeInputRole (Exchange*) throw (cwException); (4) void Supply::setExchangeBorrowRole (Exchange*) throw (cwException); (5) void Supply::setExchangeDestRole (Exchange*) throw (cwException); (6) void Supply::setExchangePaybackRole (Payback*) throw (cwException); ----------------------- Accounting/Exchange.hpp Accounting/Exchange.cpp ----------------------- bool _hasBorrowSupply; // borrow supply flag <<< *** REMOVED *** Supply *_borrowSupply; // borrow supply Supply *_inputBorrow; // input borrow supply (OWNERSHIP) An unused _borrowSupply value is no longer maintained within the Exchange object or in the RiverWare model file (or other Exchange serializations). The _hasBorrowSupply boolean field was removed from the Exchange class -- [but no change was made to the serialization format -- that still contains the redundancy]. The _inputBorrow Supply is active if and only if the _borrowSupply reference pointer is NULL (instead of depending on the removed flag). ALSO [Gnats 4629]: When removing the _borrowSupply or _destSupply references from the Exchange, those Supplies' Roles are now set back to "Stand Alone" by the Supply method which doesn't effect the Supplies' Types. Changes in: void Exchange::setBorrowSupply (Supply*, bool origDeleted) void Exchange::setDestSupply (Supply*, bool origDeleted) ------------------------------- QtAccounting/ExchangeCfgDlg.cpp QtAccounting/ExchangeCfgDlg.hpp ------------------------------- New field: QString _borrowNameCache; This temporarily retains (during the ExchangeCfgDlg session) the previously set Borrow Supply name when the user switches to, and then back from the Input Borrowed Amounts (local Supply) radio button. This is needed here because the Exchange class no longer retains an inactive Borrow Supply reference pointer. The _borrowNameCache (a Supply Name) is used instead of a Supply pointer to address the possibility that the previosly-referenced Supply is deleted. If, when that reference needs to be recovered, a Supply by the cached name no longer exists, then the cached Supply name is wiped out. ----------------------------- QtAccounting/QtSplyMgrDlg.cpp QtAccounting/QtSplyMgrDlg.hpp ----------------------------- New method factored out of the QSupplyListViewItem (a Q3ListViewItem subclass) constructor: void initFields(); ... used also in the previously incomplete implementation of method: void QtSplyMgrDlg::updateSupplyListItem (const Supply* sply). Added Supply Changed callback on the Account Manager (not on the individual Supplies). CallbackId _supplyChangedCBId; void supplyChangedHandler (const Supply *changedSupply); friend void _QtSplyMgrDlg__supplyChangedCBNotProg ( CallbackId, CallbackType, CallbackData*, void *clientData); =================== Gnats 4631: Exchange configuration can clobber supply role. ... Part 2: Changes which were made for the Borrow Supply configuration were implemented also for the Payback Destination Supply. ----------------------- Accounting/Exchange.cpp Accounting/Exchange.hpp ----------------------- bool _hasDestSupply; // destination supply flag <<< *** REMOVED *** Supply *_destSupply; // destination supply The Exchange class no longer retains a pointer to a previously defined Destination Supply. When the user selects the (o) No Destination radio button, the Destination Supply pointer is wiped out (clearing the Role from the referenced Supply). A separate _hasDestSupply flag is no longer relevant and has been removed. ------------------------------- QtAccounting/ExchangeCfgDlg.cpp QtAccounting/ExchangeCfgDlg.hpp ------------------------------- Added field: QString _destNameCache; When switching away from (o) Select Destination to (o) No Destination, the name of the previously active Destination Supply is cached, and is restored when switching back. However, if the cached name no longer represents an existing and available Supply (role == standalone), the cached name is not used, and is wiped out. ===================