2015-09-29 14:08:48 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
%module sw_engine
|
|
|
|
%{
|
|
|
|
/* Includes the header in the wrapper code */
|
|
|
|
#include <glib.h>
|
2022-08-23 11:22:56 -05:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
2011-04-05 15:18:45 -05:00
|
|
|
#include "qof.h"
|
2019-07-05 22:14:50 -05:00
|
|
|
#include "qoflog.h"
|
2011-04-05 15:18:45 -05:00
|
|
|
#include "Query.h"
|
|
|
|
#include "gnc-budget.h"
|
|
|
|
#include "gnc-commodity.h"
|
|
|
|
#include "gnc-engine.h"
|
|
|
|
#include "gnc-filepath-utils.h"
|
|
|
|
#include "gnc-pricedb.h"
|
|
|
|
#include "gnc-lot.h"
|
2017-12-30 14:06:52 -06:00
|
|
|
#include "gnc-session.h"
|
2011-04-05 15:18:45 -05:00
|
|
|
#include "engine-helpers.h"
|
2019-10-05 09:48:37 -05:00
|
|
|
#include "gnc-engine-guile.h"
|
2015-06-27 18:06:56 -05:00
|
|
|
#include "policy.h"
|
2011-04-05 15:18:45 -05:00
|
|
|
#include "SX-book.h"
|
2019-10-05 10:27:48 -05:00
|
|
|
#include "gnc-kvp-guile.h"
|
2019-10-05 09:48:37 -05:00
|
|
|
#include "glib-guile.h"
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2011-11-21 04:40:17 -06:00
|
|
|
#include "gncAddress.h"
|
|
|
|
#include "gncBillTerm.h"
|
|
|
|
#include "gncCustomer.h"
|
|
|
|
#include "gncEmployee.h"
|
|
|
|
#include "gncEntry.h"
|
|
|
|
#include "gncInvoice.h"
|
|
|
|
#include "gncJob.h"
|
|
|
|
#include "gncOrder.h"
|
|
|
|
#include "gncOwner.h"
|
|
|
|
#include "gncTaxTable.h"
|
|
|
|
#include "gncVendor.h"
|
2022-08-23 11:22:56 -05:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2013-12-14 10:40:42 -06:00
|
|
|
%}
|
2022-08-23 11:22:56 -05:00
|
|
|
#if defined(SWIGGUILE) //Always C++
|
2013-12-14 10:40:42 -06:00
|
|
|
%{
|
2022-08-23 11:22:56 -05:00
|
|
|
extern "C"
|
|
|
|
{
|
2013-12-14 10:40:42 -06:00
|
|
|
#include "guile-mappings.h"
|
2011-11-21 04:40:17 -06:00
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
SCM scm_init_sw_engine_module (void);
|
2022-08-23 11:22:56 -05:00
|
|
|
}
|
2006-10-15 14:02:05 -05:00
|
|
|
%}
|
2022-08-23 11:22:56 -05:00
|
|
|
%include "gnc-optiondb.i"
|
2013-12-14 10:40:42 -06:00
|
|
|
#endif
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2006-10-15 22:35:56 -05:00
|
|
|
%import "base-typemaps.i"
|
2022-08-23 11:22:56 -05:00
|
|
|
%apply struct tm* { tm* };
|
2008-07-07 16:11:02 -05:00
|
|
|
GLIST_HELPER_INOUT(SplitList, SWIGTYPE_p_Split);
|
|
|
|
GLIST_HELPER_INOUT(TransList, SWIGTYPE_p_Transaction);
|
|
|
|
GLIST_HELPER_INOUT(LotList, SWIGTYPE_p_GNCLot);
|
|
|
|
GLIST_HELPER_INOUT(AccountList, SWIGTYPE_p_Account);
|
|
|
|
GLIST_HELPER_INOUT(PriceList, SWIGTYPE_p_GNCPrice);
|
2021-10-16 09:42:24 -05:00
|
|
|
// TODO: free PriceList?
|
2008-07-07 16:11:02 -05:00
|
|
|
GLIST_HELPER_INOUT(CommodityList, SWIGTYPE_p_gnc_commodity);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%typemap(newfree) gchar * "g_free($1);"
|
|
|
|
|
2009-09-08 18:48:42 -05:00
|
|
|
/* These need to be here so that they are *before* the function
|
|
|
|
declarations in the header files, some of which are included by
|
|
|
|
engine-common.i */
|
|
|
|
|
2009-09-10 21:11:38 -05:00
|
|
|
%newobject gnc_account_get_full_name;
|
2021-07-12 05:20:52 -05:00
|
|
|
%newobject xaccTransGetAPARAcctSplitList;
|
|
|
|
%newobject xaccTransGetPaymentAcctSplitList;
|
2009-09-08 18:48:42 -05:00
|
|
|
|
2008-07-10 19:34:56 -05:00
|
|
|
%include "engine-common.i"
|
2019-07-06 19:30:41 -05:00
|
|
|
|
|
|
|
#if defined(SWIGGUILE)
|
|
|
|
%ignore QofLogModule;
|
|
|
|
%typemap(in) QofLogModule {
|
|
|
|
$1 = (const char *)SWIG_scm2str($input);
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(freearg) QofLogModule {
|
|
|
|
SWIG_free((char*)$1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-07-05 22:14:50 -05:00
|
|
|
%include "qoflog.h"
|
2008-07-10 19:34:56 -05:00
|
|
|
|
|
|
|
%inline %{
|
2021-03-17 09:04:02 -05:00
|
|
|
static void gnc_log_warn(const char *msg)
|
|
|
|
{ g_log("gnc.scm", G_LOG_LEVEL_WARNING, "%s", msg); }
|
|
|
|
static void gnc_log_error(const char *msg)
|
|
|
|
{ g_log("gnc.scm", G_LOG_LEVEL_CRITICAL, "%s", msg); }
|
|
|
|
static void gnc_log_msg(const char *msg)
|
|
|
|
{ g_log("gnc.scm", G_LOG_LEVEL_MESSAGE, "%s", msg); }
|
|
|
|
static void gnc_log_debug(const char *msg)
|
|
|
|
{ g_log("gnc.scm", G_LOG_LEVEL_DEBUG, "%s", msg); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static const GncGUID * gncPriceGetGUID(GNCPrice *x)
|
2008-07-10 19:34:56 -05:00
|
|
|
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
2010-03-27 16:01:21 -05:00
|
|
|
static const GncGUID * gncBudgetGetGUID(GncBudget *x)
|
2008-07-10 19:34:56 -05:00
|
|
|
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
|
|
|
%}
|
|
|
|
|
2006-10-15 22:35:56 -05:00
|
|
|
/* NB: The object ownership annotations should already cover all the
|
|
|
|
functions currently used in guile, but not all the functions that are
|
|
|
|
wrapped. So, we should contract the interface to wrap only the used
|
|
|
|
functions. */
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%delobject gnc_price_list_destroy;
|
|
|
|
%newobject gnc_pricedb_lookup_latest_any_currency;
|
|
|
|
|
|
|
|
%newobject gnc_pricedb_lookup_nearest_in_time_any_currency;
|
2018-08-02 17:46:27 -05:00
|
|
|
%newobject gnc_pricedb_lookup_nearest_in_time_any_currency_t64;
|
2006-10-15 14:02:05 -05:00
|
|
|
%newobject gnc_pricedb_lookup_latest_before_any_currency;
|
2018-08-02 17:46:27 -05:00
|
|
|
%newobject gnc_pricedb_lookup_latest_before_any_currency_t64;
|
2006-10-15 14:02:05 -05:00
|
|
|
%newobject gnc_pricedb_get_prices;
|
|
|
|
%newobject gnc_pricedb_lookup_at_time;
|
2018-08-02 17:46:27 -05:00
|
|
|
%newobject gnc_pricedb_lookup_at_time64;
|
2006-10-15 14:02:05 -05:00
|
|
|
%newobject gnc_pricedb_lookup_day;
|
2018-08-02 17:46:27 -05:00
|
|
|
%newobject gnc_pricedb_lookup_day_t64;
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%newobject xaccQueryGetSplitsUniqueTrans;
|
|
|
|
%newobject xaccQueryGetTransactions;
|
|
|
|
%newobject xaccQueryGetLots;
|
|
|
|
|
|
|
|
%newobject xaccSplitGetCorrAccountFullName;
|
|
|
|
%newobject gnc_numeric_to_string;
|
|
|
|
|
2017-04-04 01:23:44 -05:00
|
|
|
%newobject gnc_localtime;
|
|
|
|
%newobject gnc_gmtime;
|
|
|
|
|
2021-08-24 20:12:25 -05:00
|
|
|
%newobject gnc_budget_get_account_period_note;
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
/* Parse the header file to generate wrappers */
|
|
|
|
%inline {
|
|
|
|
static QofIdType QOF_ID_BOOK_SCM (void) { return QOF_ID_BOOK; }
|
|
|
|
}
|
|
|
|
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
/* Allow '#f' in guile to be used to represent NULL in 'C' for functions *
|
|
|
|
* 'gnc_set_num_action', 'gnc_get_num_action' and 'gnc_get_action_num' in *
|
|
|
|
* 'engine-helpers.c' */
|
|
|
|
%typemap(in) Transaction *trans {
|
|
|
|
if ($input == SCM_BOOL_F)
|
|
|
|
$1 = NULL;
|
|
|
|
else
|
|
|
|
$1 = (Transaction *)SWIG_MustGetPtr($input, SWIGTYPE_p_Transaction, 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(in) Split *split {
|
|
|
|
if ($input == SCM_BOOL_F)
|
|
|
|
$1 = NULL;
|
|
|
|
else
|
|
|
|
$1 = (Split *)SWIG_MustGetPtr($input, SWIGTYPE_p_Split, 2, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(in) char * num (int must_free = 0) {
|
|
|
|
if ($input == SCM_BOOL_F)
|
|
|
|
$1 = NULL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$1 = (char *)SWIG_scm2str($input);
|
|
|
|
must_free3 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(in) char * action (int must_free = 0) {
|
|
|
|
if ($input == SCM_BOOL_F)
|
|
|
|
$1 = NULL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$1 = (char *)SWIG_scm2str($input);
|
|
|
|
must_free4 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <engine-helpers.h>
|
2019-10-05 09:48:37 -05:00
|
|
|
%include <gnc-engine-guile.h>
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
%typemap(in) Transaction *trans;
|
|
|
|
%typemap(in) Split *split;
|
|
|
|
%typemap(in) char * num;
|
|
|
|
%typemap(in) char * action;
|
|
|
|
|
2015-06-27 18:06:56 -05:00
|
|
|
%include <policy.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <gnc-pricedb.h>
|
|
|
|
|
2018-06-17 18:43:33 -05:00
|
|
|
QofSession * qof_session_new (QofBook* book);
|
2006-10-15 14:02:05 -05:00
|
|
|
QofBook * qof_session_get_book (QofSession *session);
|
|
|
|
// TODO: Unroll/remove
|
|
|
|
const char *qof_session_get_url (QofSession *session);
|
|
|
|
|
2016-04-16 08:57:32 -05:00
|
|
|
%ignore qof_print_date_time_buff;
|
2017-04-04 01:23:44 -05:00
|
|
|
%ignore gnc_tm_free;
|
2021-07-30 10:16:01 -05:00
|
|
|
%newobject qof_print_date;
|
2021-08-05 08:39:49 -05:00
|
|
|
%newobject gnc_ctime;
|
2021-07-30 10:16:01 -05:00
|
|
|
%newobject gnc_print_time64;
|
2016-04-16 08:57:32 -05:00
|
|
|
%include <gnc-date.h>
|
2008-06-24 17:28:40 -05:00
|
|
|
extern const char *gnc_default_strftime_date_format;
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
GncGUID guid_new_return(void);
|
2007-12-02 05:47:35 -06:00
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
%inline {
|
|
|
|
static QofQuery * qof_query_create_for_splits(void) {
|
|
|
|
return qof_query_create_for(GNC_ID_SPLIT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SplitList * qof_query_run (QofQuery *q);
|
2010-10-13 11:16:17 -05:00
|
|
|
SplitList * qof_query_last_run (QofQuery *q);
|
|
|
|
SplitList * qof_query_run_subquery (QofQuery *q, const QofQuery *q);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2010-11-27 15:57:00 -06:00
|
|
|
%typemap(in) QofQueryParamList * "$1 = gnc_query_scm2path($input);"
|
|
|
|
|
2017-12-30 14:06:52 -06:00
|
|
|
%include <gnc-session.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <Query.h>
|
|
|
|
%ignore qof_query_run;
|
2010-10-13 11:16:17 -05:00
|
|
|
%ignore qof_query_last_run;
|
|
|
|
%ignore qof_query_run_subquery;
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <qofquery.h>
|
|
|
|
%include <qofquerycore.h>
|
2009-12-04 14:26:48 -06:00
|
|
|
%include <qofbookslots.h>
|
2010-01-08 22:54:02 -06:00
|
|
|
%include <qofbook.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2011-12-12 16:42:14 -06:00
|
|
|
%ignore GNC_DENOM_AUTO;
|
|
|
|
%ignore GNCNumericErrorCodes;
|
|
|
|
%ignore GNC_ERROR_OK;
|
|
|
|
%ignore GNC_ERROR_ARG;
|
|
|
|
%ignore GNC_ERROR_OVERFLOW;
|
|
|
|
%ignore GNC_ERROR_DENOM_DIFF;
|
|
|
|
%ignore GNC_ERROR_REMAINDER;
|
2010-10-13 11:16:17 -05:00
|
|
|
%include <gnc-numeric.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2017-11-11 19:19:30 -06:00
|
|
|
time64 time64CanonicalDayTime(time64 t);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%include <gnc-budget.h>
|
2021-08-23 11:13:45 -05:00
|
|
|
%typemap (freearg) GList * "g_list_free_full ($1, g_free);"
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <gnc-commodity.h>
|
|
|
|
|
|
|
|
void gnc_hook_add_scm_dangler (const gchar *name, SCM proc);
|
|
|
|
void gnc_hook_run (const gchar *name, gpointer data);
|
|
|
|
%include <gnc-hooks.h>
|
|
|
|
|
2007-02-22 19:23:31 -06:00
|
|
|
Account * gnc_book_get_template_root(QofBook *book);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
// KVP stuff
|
|
|
|
%typemap(in) KvpValue * " $1 = gnc_scm_to_kvp_value_ptr($input); "
|
|
|
|
%typemap(out) KvpValue * " $result = gnc_kvp_value_ptr_to_scm($1); "
|
|
|
|
%typemap(in) GSList *key_path " $1 = gnc_scm_to_gslist_string($input);"
|
2021-08-20 04:01:20 -05:00
|
|
|
%typemap(freearg) GSList *key_path "g_slist_free_full ($1, g_free);"
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2018-06-17 18:43:33 -05:00
|
|
|
QofBook* qof_book_new (void);
|
2016-11-28 13:39:10 -06:00
|
|
|
void qof_book_options_delete (QofBook *book, GSList *key_path);
|
2015-06-12 17:19:45 -05:00
|
|
|
void qof_book_set_option (QofBook *book, KvpValue *new_value, GSList *key_path);
|
|
|
|
KvpValue* qof_book_get_option (QofBook *book, GSList *key_path);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%clear GSList *key_path;
|
|
|
|
|
2016-03-30 08:09:57 -05:00
|
|
|
const char* qof_book_get_string_option(const QofBook* book, const char* opt_name);
|
|
|
|
void qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val);
|
|
|
|
|
2011-01-27 13:09:27 -06:00
|
|
|
#if defined(SWIGGUILE)
|
2006-10-15 14:02:05 -05:00
|
|
|
%init {
|
|
|
|
{
|
|
|
|
char tmp[100];
|
2019-10-05 09:03:52 -05:00
|
|
|
char * no_args[1] = { NULL };
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
|
|
|
|
scm_c_eval_string(tmp);
|
|
|
|
|
|
|
|
SET_ENUM("TXN-TYPE-NONE");
|
|
|
|
SET_ENUM("TXN-TYPE-INVOICE");
|
|
|
|
SET_ENUM("TXN-TYPE-PAYMENT");
|
2019-12-18 09:59:23 -06:00
|
|
|
SET_ENUM("TXN-TYPE-LINK");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
SET_ENUM("ACCT-TYPE-INVALID");
|
|
|
|
SET_ENUM("ACCT-TYPE-NONE");
|
|
|
|
SET_ENUM("ACCT-TYPE-BANK");
|
|
|
|
SET_ENUM("ACCT-TYPE-CASH");
|
|
|
|
SET_ENUM("ACCT-TYPE-CREDIT");
|
|
|
|
SET_ENUM("ACCT-TYPE-ASSET");
|
|
|
|
SET_ENUM("ACCT-TYPE-LIABILITY");
|
|
|
|
SET_ENUM("ACCT-TYPE-STOCK");
|
|
|
|
SET_ENUM("ACCT-TYPE-MUTUAL");
|
|
|
|
SET_ENUM("ACCT-TYPE-CURRENCY");
|
|
|
|
SET_ENUM("ACCT-TYPE-INCOME");
|
|
|
|
SET_ENUM("ACCT-TYPE-EXPENSE");
|
|
|
|
SET_ENUM("ACCT-TYPE-EQUITY");
|
|
|
|
SET_ENUM("ACCT-TYPE-RECEIVABLE");
|
|
|
|
SET_ENUM("ACCT-TYPE-PAYABLE");
|
Bug #537476: Implement currency trading accounts optionally, to be enabled per-book.
Patch by Mike Alexander:
This patch implements trading accounts somewhat as described in Peter
Selinger's document at
<http://www.mathstat.dal.ca/~selinger/accounting/gnucash.html>. Although he
describes it as a multiple currency problem, it really applies to any
transactions involving multiple commodities (for example buying or selling a
stock) Hence I've called the trading accounts "commodity exchange accounts"
which seems more descriptive.
In summary these patches add an option to use commodity exchange accounts and
if it is on a transaction must be balanced both in value (in the transaction
currency) and in each commodity or currency used in any split in the
transaction. If a transaction only contains splits in the transaction currency
then this is the same rule as Gnucash has always enforced.
In this patch, the option to use trading accounts has been moved from
Edit->Preferences to File->Properties and is now associated with the active
book instead of being a global option. If you have set the global value on in
a previous version you will need to set it on again in each file for which you
want trading accounts, the previous global setting will be ignored.
A more detailed list of changes follows:
1. Added a "Use commodity exchange accounts" per-book option.
2. Added gnc_monetary and MonetaryList data types.
3. Renamed xaccTransGetImbalance to xaccTransGetImbalanceValue and added a new
xaccTransGetImbalance that returns a MonetaryList. Also added
xaccTransIsBalanced to see if the transaction is balanced without returning a
GList that needs to be freed. It calls both xaccTransGetImbalance and
xaccTransGetImbalanceValue since a transaction may be unbalanced with regard to
either without being unbalanced with regard to the other.
4. Changed gnc_split_register_get_debcred_bg_color to use xaccTransIsBalanced.
5. Changed gnc_split_register_balance_trans to not offer to adjust an existing
split if there imbalances in multiple currencies. Because of bugs in the
register code this is rarely called.
6. Changed importers to use xaccTransGetImbalanceValue to check for imbalance,
assuming that they won't create multiple currency trasactions.
7. Changed xaccTransScrubImbalance to create a balancing split for each
imbalanced commodity in the transaction. Also balances the transaction value.
The commodity balancing splits go into accounts in the hierarchy
Trading:NAMESPACE:COMMODITY. The value balancing splits go into
Imbalance-CURRENCY as before.
8. Changed xaccSplitConvertAmount to use xaccTransIsBalanced instead of
xaccTransGetImbalance.
9. Changed gnc_split_register_get_debcred_entry to sometimes use the split
amount instead of value if using currency accounts.
If the register is a stock register (i.e., shows shares and prices), it uses
the value if the split is in the register commodity (i.e. is for the stock) and
the amount otherwise. It shows the currency symbol unless the commodity is the
default currency.
If the register is not a stock register it always uses the amount and shows the
currency symbol if the split is not in the register commodity.
Also changed it to not return a value for a null split unless the transaction
is unbalanced in exactly one currency. This is what goes in a blank split as
the proposed value.
10. Changed refresh_model_row to use xaccTransGetImbalanceValue to get the
imbalance, assuming that importers don't create transactions in multiple
currencies. Also same change in gnc_import_process_trans_item,
downloaded_transaction_append, and gnc_import_TransInfo_is_balanced.
11. Changed the TRANS_IMBALANCE accessor method in xaccTransRegister to use
xaccTransGetImbalanceValue. As far as I can tell this is only used by the
"pd-balance" query type in gnc_scm2query_term_query_v1() defined in
engine-helpers.c. This query type only tests the result for zero/non-zero.
12. Changed xaccTransGetAccountConvRate to accept any split into the correct
commodity instead of insisting on one into the provided account. Then can use
it in xaccTransScrubImbalance to set the value of the imbalance split from its
amount, however later changed xaccTransScrubImbalance to not use it. Instead
it sets the value for the new split correctly to keep the value of the whole
transaction balanced.
13. Changed the balance sheet report to include a new option to not compute
unrealized gains and losses.
14. Related to 9 above, changed gnc_split_register_auto_calc to not do anything
if given a stock register where the value cell doesn't contain the value.
15. Also related to 9, changed gnc_split_register_save_amount_values to set the
amount and value fields in the split correctly when using trading accounts.
16. Changed the new account and edit account dialogs to allow any commodity or
currency for an income account if using trading accounts. It would be better
to add a new account type for trading accounts, but that's a big deal and I'll
leave that for later after we see whether this set of changes is going to be
accepted or rejected.
17. Change gnc_xfer_dialog_run_exchange_dialog to understand that the new value
is really the split's amount if using trading accounts.
18. Changed xaccSplitGetOtherSplit to ignore trading splits if using commodity
exchange accounts.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18429 57a11ea4-9604-0410-9ed3-97b8803252fd
2009-11-20 14:11:03 -06:00
|
|
|
SET_ENUM("ACCT-TYPE-ROOT");
|
|
|
|
SET_ENUM("ACCT-TYPE-TRADING");
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("NUM-ACCOUNT-TYPES");
|
|
|
|
SET_ENUM("ACCT-TYPE-CHECKING");
|
|
|
|
SET_ENUM("ACCT-TYPE-SAVINGS");
|
|
|
|
SET_ENUM("ACCT-TYPE-MONEYMRKT");
|
|
|
|
SET_ENUM("ACCT-TYPE-CREDITLINE");
|
|
|
|
|
|
|
|
SET_ENUM("QOF-QUERY-AND");
|
|
|
|
SET_ENUM("QOF-QUERY-OR");
|
|
|
|
|
|
|
|
SET_ENUM("QUERY-TXN-MATCH-ALL");
|
|
|
|
SET_ENUM("QUERY-TXN-MATCH-ANY");
|
|
|
|
|
|
|
|
SET_ENUM("QOF-GUID-MATCH-ALL");
|
|
|
|
SET_ENUM("QOF-GUID-MATCH-ANY");
|
|
|
|
SET_ENUM("QOF-GUID-MATCH-NULL");
|
|
|
|
SET_ENUM("QOF-GUID-MATCH-NONE");
|
|
|
|
SET_ENUM("QOF-GUID-MATCH-LIST-ANY");
|
|
|
|
|
|
|
|
SET_ENUM("QOF-COMPARE-LT");
|
|
|
|
SET_ENUM("QOF-COMPARE-LTE");
|
|
|
|
SET_ENUM("QOF-COMPARE-EQUAL");
|
|
|
|
SET_ENUM("QOF-COMPARE-GT");
|
|
|
|
SET_ENUM("QOF-COMPARE-GTE");
|
|
|
|
SET_ENUM("QOF-COMPARE-NEQ");
|
2015-02-21 05:28:29 -06:00
|
|
|
SET_ENUM("QOF-COMPARE-CONTAINS");
|
|
|
|
SET_ENUM("QOF-COMPARE-NCONTAINS");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2019-07-06 19:30:41 -05:00
|
|
|
SET_ENUM("QOF-LOG-DEBUG");
|
|
|
|
SET_ENUM("QOF-LOG-FATAL");
|
|
|
|
SET_ENUM("QOF-LOG-ERROR");
|
|
|
|
SET_ENUM("QOF-LOG-WARNING");
|
|
|
|
SET_ENUM("QOF-LOG-MESSAGE");
|
|
|
|
SET_ENUM("QOF-LOG-INFO");
|
2019-07-05 22:14:50 -05:00
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("QOF-NUMERIC-MATCH-ANY");
|
|
|
|
SET_ENUM("QOF-NUMERIC-MATCH-CREDIT");
|
|
|
|
SET_ENUM("QOF-NUMERIC-MATCH-DEBIT");
|
|
|
|
|
2008-09-10 12:52:16 -05:00
|
|
|
SET_ENUM("QOF-PARAM-BOOK");
|
|
|
|
SET_ENUM("QOF-PARAM-GUID");
|
|
|
|
SET_ENUM("QOF-PARAM-KVP");
|
|
|
|
SET_ENUM("QOF-PARAM-ACTIVE");
|
|
|
|
SET_ENUM("QOF-PARAM-VERSION");
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("CLEARED-NO");
|
|
|
|
SET_ENUM("CLEARED-CLEARED");
|
|
|
|
SET_ENUM("CLEARED-FROZEN");
|
|
|
|
SET_ENUM("CLEARED-RECONCILED");
|
|
|
|
SET_ENUM("CLEARED-VOIDED");
|
2020-09-14 21:16:25 -05:00
|
|
|
SET_ENUM("CLEARED-ALL");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
SET_ENUM("HOOK-REPORT");
|
|
|
|
SET_ENUM("HOOK-SAVE-OPTIONS");
|
|
|
|
|
|
|
|
//SET_ENUM("GNC-ID-ACCOUNT");
|
|
|
|
SET_ENUM("QOF-ID-BOOK-SCM");
|
|
|
|
//SET_ENUM("GNC-ID-BUDGET");
|
|
|
|
//SET_ENUM("GNC-ID-LOT");
|
|
|
|
//SET_ENUM("GNC-ID-PRICE");
|
|
|
|
//SET_ENUM("GNC-ID-SPLIT");
|
|
|
|
//SET_ENUM("GNC-ID-SCHEDXACTION");
|
|
|
|
//SET_ENUM("QOF-ID-SESSION");
|
|
|
|
//SET_ENUM("GNC-ID-TRANS");
|
|
|
|
|
|
|
|
SET_ENUM("QUERY-DEFAULT-SORT");
|
|
|
|
SET_ENUM("SPLIT-LOT");
|
|
|
|
SET_ENUM("SPLIT-TRANS");
|
|
|
|
SET_ENUM("SPLIT-ACCOUNT");
|
|
|
|
SET_ENUM("SPLIT-VALUE");
|
|
|
|
SET_ENUM("SPLIT-MEMO");
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
SET_ENUM("SPLIT-ACTION");
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("SPLIT-DATE-RECONCILED");
|
2007-04-14 05:36:53 -05:00
|
|
|
SET_ENUM("SPLIT-ACCT-FULLNAME");
|
|
|
|
SET_ENUM("SPLIT-CORR-ACCT-NAME");
|
|
|
|
SET_ENUM("SPLIT-CORR-ACCT-CODE");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
SET_ENUM("TRANS-DATE-POSTED");
|
|
|
|
SET_ENUM("TRANS-DESCRIPTION");
|
|
|
|
SET_ENUM("TRANS-NUM");
|
2015-09-03 18:22:14 -05:00
|
|
|
|
2010-05-06 04:01:46 -05:00
|
|
|
SET_ENUM("KVP-OPTION-PATH");
|
|
|
|
|
|
|
|
SET_ENUM("OPTION-SECTION-ACCOUNTS");
|
|
|
|
SET_ENUM("OPTION-NAME-TRADING-ACCOUNTS");
|
2012-03-24 17:34:59 -05:00
|
|
|
SET_ENUM("OPTION-NAME-AUTO-READONLY-DAYS");
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
SET_ENUM("OPTION-NAME-NUM-FIELD-SOURCE");
|
2010-05-06 04:01:46 -05:00
|
|
|
|
|
|
|
SET_ENUM("OPTION-SECTION-BUDGETING");
|
|
|
|
SET_ENUM("OPTION-NAME-DEFAULT-BUDGET");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
SET_ENUM("ACCOUNT-CODE-"); /* sic */
|
|
|
|
|
2010-10-13 11:16:17 -05:00
|
|
|
SET_ENUM("GNC-HOW-RND-CEIL");
|
|
|
|
SET_ENUM("GNC-HOW-RND-TRUNC");
|
|
|
|
SET_ENUM("GNC-HOW-RND-PROMOTE");
|
|
|
|
SET_ENUM("GNC-HOW-RND-ROUND-HALF-DOWN");
|
|
|
|
SET_ENUM("GNC-HOW-RND-ROUND-HALF-UP");
|
|
|
|
SET_ENUM("GNC-HOW-RND-ROUND");
|
|
|
|
SET_ENUM("GNC-HOW-RND-NEVER");
|
|
|
|
|
2015-09-03 18:22:14 -05:00
|
|
|
SET_ENUM("PRICE-SOURCE-EDIT-DLG");
|
|
|
|
SET_ENUM("PRICE-SOURCE-FQ");
|
|
|
|
SET_ENUM("PRICE-SOURCE-USER-PRICE");
|
|
|
|
SET_ENUM("PRICE-SOURCE-XFER-DLG-VAL");
|
|
|
|
SET_ENUM("PRICE-SOURCE-SPLIT-REG");
|
2021-02-21 15:03:39 -06:00
|
|
|
SET_ENUM("PRICE-SOURCE-SPLIT-IMPORT");
|
2015-09-03 18:22:14 -05:00
|
|
|
SET_ENUM("PRICE-SOURCE-STOCK-SPLIT");
|
2015-10-26 17:46:28 -05:00
|
|
|
SET_ENUM("PRICE-SOURCE-TEMP");
|
2015-09-03 18:22:14 -05:00
|
|
|
SET_ENUM("PRICE-SOURCE-INVALID");
|
|
|
|
|
2016-04-16 08:57:32 -05:00
|
|
|
SET_ENUM("QOF-DATE-FORMAT-US");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-UK");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-CE");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-ISO");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-LOCALE");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-UTC");
|
|
|
|
SET_ENUM("QOF-DATE-FORMAT-CUSTOM");
|
|
|
|
|
|
|
|
|
2015-02-23 17:26:45 -06:00
|
|
|
#undef SET_ENUM
|
2019-10-05 09:03:52 -05:00
|
|
|
|
|
|
|
gnc_engine_init(0, no_args);
|
2006-10-15 14:02:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-01-27 13:09:27 -06:00
|
|
|
#endif
|
2011-11-21 04:40:17 -06:00
|
|
|
|
|
|
|
%include business-core.i
|
2019-11-17 11:59:36 -06:00
|
|
|
|
|
|
|
%typemap(in) GList * {
|
|
|
|
SCM path_scm = $input;
|
|
|
|
GList *path = NULL;
|
|
|
|
while (!scm_is_null (path_scm))
|
|
|
|
{
|
|
|
|
SCM key_scm = SCM_CAR (path_scm);
|
|
|
|
char *key;
|
|
|
|
if (!scm_is_string (key_scm))
|
|
|
|
break;
|
|
|
|
key = scm_to_locale_string (key_scm);
|
2021-10-16 09:50:09 -05:00
|
|
|
path = g_list_prepend (path, key);
|
2019-11-17 11:59:36 -06:00
|
|
|
path_scm = SCM_CDR (path_scm);
|
|
|
|
}
|
|
|
|
$1 = g_list_reverse (path);
|
|
|
|
}
|