gnucash/libgnucash/app-utils/app-utils.scm

320 lines
12 KiB
Scheme
Raw Normal View History

;; 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
(define-module (gnucash app-utils))
(eval-when
(compile load eval expand)
(load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
(use-modules (sw_app_utils))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_app_utils))))
(use-modules (srfi srfi-1))
(use-modules (gnucash utilities))
(use-modules (gnucash engine))
(use-modules (gnucash core-utils))
;; c-interface.scm
2017-12-19 09:53:40 -06:00
(export gnc:apply-with-error-handling)
(export gnc:eval-string-with-error-handling)
(export gnc:backtrace-if-exception)
(export gnc:make-string-database)
;; options.scm
(export gnc:make-option)
(export gnc:option-section)
(export gnc:option-name)
(export gnc:option-sort-tag)
(export gnc:option-type)
(export gnc:option-documentation)
(export gnc:option-getter)
(export gnc:option-setter)
(export gnc:option-default-getter)
(export gnc:option-generate-restore-form)
(export gnc:option-scm->kvp)
(export gnc:set-option-scm->kvp)
(export gnc:option-kvp->scm)
(export gnc:set-option-kvp->scm)
(export gnc:option-value-validator)
(export gnc:option-data)
(export gnc:option-data-fns)
(export gnc:option-set-changed-callback)
(export gnc:option-strings-getter)
(export gnc:option-widget-changed-proc)
(export gnc:option-value)
(export gnc:option-set-value)
(export gnc:option-index-get-name)
(export gnc:option-index-get-description)
(export gnc:option-index-get-value)
(export gnc:option-value-get-index)
(export gnc:option-number-of-indices)
(export gnc:option-default-value)
(export gnc:option-set-default-value)
(export gnc:restore-form-generator)
(export gnc:value->string)
(export gnc:make-string-option)
(export gnc:make-text-option)
(export gnc:make-font-option)
(export gnc:make-currency-option)
(export gnc:make-commodity-option)
(export gnc:make-simple-boolean-option)
(export gnc:make-complex-boolean-option)
(export gnc:make-pixmap-option)
(export gnc:make-date-option)
(export gnc:make-budget-option)
(export gnc:get-rd-option-data-subtype)
(export gnc:get-rd-option-data-show-time)
(export gnc:get-rd-option-data-rd-list)
(export gnc:date-option-get-subtype)
(export gnc:date-option-show-time?)
(export gnc:date-option-value-type)
(export gnc:date-option-absolute-time)
(export gnc:date-option-relative-time)
(export gnc:make-account-list-option)
(export gnc:make-account-list-limited-option)
(export gnc:make-account-sel-option)
(export gnc:make-account-sel-limited-option)
(export gnc:multichoice-list-lookup)
(export gnc:make-multichoice-option)
(export gnc:make-multichoice-callback-option)
(export gnc:make-radiobutton-option)
(export gnc:make-radiobutton-callback-option)
(export gnc:make-list-option)
(export gnc:options-make-end-date!)
(export gnc:options-make-date-interval!)
(export gnc:option-make-internal!)
(export gnc:make-number-range-option)
(export gnc:make-number-plot-size-option)
(export gnc:plot-size-option-value-type)
(export gnc:plot-size-option-value)
(export gnc:make-internal-option)
(export gnc:make-query-option)
(export gnc:make-color-option)
(export gnc:make-dateformat-option)
(export gnc:dateformat-get-format)
Book-Currency Feature Step 3 Add an option to the File->Properties dialog to select a Currency Accounting Method, and to specify the book-currency and a default gains/loss policy if the 'book-currency' method is selected. Revert some changes made in prior commits. Other than storing and retrieving the book-currency and policy in book KVPs, the behavior of gnucash has not been affected by these changes. The changes made are: engine/policy.c & .h - define valid policies and their descriptions and hints; define functions gnc_get_valid_policy_list and gnc_valid_policy engine/engine.i - include policy.h; define 'CURRENCY-ACCOUNTING', 'BOOK-CURRENCY', and 'DEFAULT-GAINS-POLICY' as option names engine/test/utest-Split.cpp - revert prior commit that modified test function for trading accounts engine/test/utest-Transaction.c - revert prior commit that modified test function for trading accounts libqof/qof/qofbookslots.h - revert prior commit that defined Currency Accounting Method; modify definitions of Currency Accounting and Book Currency; add definition of default gains policy; keep the previous Trading Accounts definition libqof/qof/qofbook.cpp & .h - reverted function to determine currency accounting method; add function to get book-currency, revert previously committed changes to function to determine if book uses trading accounts; add function to get gains policy; modify gobject properties accordingly libqof/qof/test/test-qofbook.c - revert prior modification to test function for trading accounts; define tests for book-currency and default gains policies app-utils/options.scm - define make-currency-accounting-option and required support functions app-utils/options-util.c & .h - make support functions of make-currency-accounting-option available in c code app-utils/test/test-options-util.c - include tests for using book-currency app-utils/gnc-ui-util.c & .h - define gnc_book_use_book_currency, gnc_book_get_book_currency and gnc_book_get_default_gains_policy functions app-utils/test/test-gnc-ui-util.c - set up tests for new gnc-ui-util functions app-utils/test/test-app-utils.c - include test-gnc-ui-util.c app-utils/test/Makefile.am - include test-gnc-ui-util.c app-utils/app-utils.scm - define and export book options for Currency Accounting, Book-Currency and Default Gains Policy; export required currency-accounting-option support functions app-utils/business-prefs.scm - replace the Trading Accounts boolean option with a currency-accounting-option and rearrange the order of the options gnome-utils/dialog-options.c - define functions for set-ui-widget, set-ui-value, and get-ui-value for 'currency-accounting' option and various other support functions
2015-06-27 18:06:56 -05:00
(export gnc:currency-accounting-option-get-curr-doc-string)
(export gnc:currency-accounting-option-get-default-curr)
(export gnc:currency-accounting-option-get-policy-doc-string)
(export gnc:currency-accounting-option-get-default-policy)
Book-Currency Feature step 6 Modify File->Properties dialog to maintain a default gain/loss account in a book KVP. The changes made are: app-utils/app-utils.scm - define items related to book default gain/loss acct app-utils/business-prefs.scm - define items related to book default gain/loss acct;re-arrange sequence of options to make default (neither) first app-utils/gnc-ui-util.c - refine gnc_book_get_default_gains_policy to check for hidden and/or placeholder status app-utils/option-util.c & h - define items related to book default gain/loss acct app-utils/options.scm - add functionality related to book default gain/loss acct app-utils/test/test-gnc-ui-util.c - for gnc_book_get_default_gains_policy, add tests to check for hidden and/or placeholder status app-utils/test/test-option-util.cpp - add tests related to book default gain/loss acct engine/engine.i - define item related to book default gain/loss acct gnome-utils/dialog-options.c & h - add functionality related to book default gain/loss acct and rearrange dialog layout; make gain/loss acct widget refresh on account maintenance gnome-utils/gnc-main-window.c - only allow one book-option dialog if called from file->properties gnome-utils/gtkbuilder/dialog-options.glade - increase dialog height to accomodate book default gain/loss acct widget; add tooltip text for dialog buttons gnome/assistant-hierarchy.c - change sequence of pages: book options before currency selection; if book currency selected, currency also selected gnome/gtkbuilder/assistant-hierarchy.glade - increase dialog height to accomodate book default gain/loss acct widget
2017-07-09 14:19:36 -05:00
(export gnc:currency-accounting-option-get-gain-loss-account-doc-string)
Book-Currency Feature Step 3 Add an option to the File->Properties dialog to select a Currency Accounting Method, and to specify the book-currency and a default gains/loss policy if the 'book-currency' method is selected. Revert some changes made in prior commits. Other than storing and retrieving the book-currency and policy in book KVPs, the behavior of gnucash has not been affected by these changes. The changes made are: engine/policy.c & .h - define valid policies and their descriptions and hints; define functions gnc_get_valid_policy_list and gnc_valid_policy engine/engine.i - include policy.h; define 'CURRENCY-ACCOUNTING', 'BOOK-CURRENCY', and 'DEFAULT-GAINS-POLICY' as option names engine/test/utest-Split.cpp - revert prior commit that modified test function for trading accounts engine/test/utest-Transaction.c - revert prior commit that modified test function for trading accounts libqof/qof/qofbookslots.h - revert prior commit that defined Currency Accounting Method; modify definitions of Currency Accounting and Book Currency; add definition of default gains policy; keep the previous Trading Accounts definition libqof/qof/qofbook.cpp & .h - reverted function to determine currency accounting method; add function to get book-currency, revert previously committed changes to function to determine if book uses trading accounts; add function to get gains policy; modify gobject properties accordingly libqof/qof/test/test-qofbook.c - revert prior modification to test function for trading accounts; define tests for book-currency and default gains policies app-utils/options.scm - define make-currency-accounting-option and required support functions app-utils/options-util.c & .h - make support functions of make-currency-accounting-option available in c code app-utils/test/test-options-util.c - include tests for using book-currency app-utils/gnc-ui-util.c & .h - define gnc_book_use_book_currency, gnc_book_get_book_currency and gnc_book_get_default_gains_policy functions app-utils/test/test-gnc-ui-util.c - set up tests for new gnc-ui-util functions app-utils/test/test-app-utils.c - include test-gnc-ui-util.c app-utils/test/Makefile.am - include test-gnc-ui-util.c app-utils/app-utils.scm - define and export book options for Currency Accounting, Book-Currency and Default Gains Policy; export required currency-accounting-option support functions app-utils/business-prefs.scm - replace the Trading Accounts boolean option with a currency-accounting-option and rearrange the order of the options gnome-utils/dialog-options.c - define functions for set-ui-widget, set-ui-value, and get-ui-value for 'currency-accounting' option and various other support functions
2015-06-27 18:06:56 -05:00
(export gnc:currency-accounting-option-selected-method)
(export gnc:currency-accounting-option-selected-currency)
(export gnc:currency-accounting-option-selected-policy)
Book-Currency Feature step 6 Modify File->Properties dialog to maintain a default gain/loss account in a book KVP. The changes made are: app-utils/app-utils.scm - define items related to book default gain/loss acct app-utils/business-prefs.scm - define items related to book default gain/loss acct;re-arrange sequence of options to make default (neither) first app-utils/gnc-ui-util.c - refine gnc_book_get_default_gains_policy to check for hidden and/or placeholder status app-utils/option-util.c & h - define items related to book default gain/loss acct app-utils/options.scm - add functionality related to book default gain/loss acct app-utils/test/test-gnc-ui-util.c - for gnc_book_get_default_gains_policy, add tests to check for hidden and/or placeholder status app-utils/test/test-option-util.cpp - add tests related to book default gain/loss acct engine/engine.i - define item related to book default gain/loss acct gnome-utils/dialog-options.c & h - add functionality related to book default gain/loss acct and rearrange dialog layout; make gain/loss acct widget refresh on account maintenance gnome-utils/gnc-main-window.c - only allow one book-option dialog if called from file->properties gnome-utils/gtkbuilder/dialog-options.glade - increase dialog height to accomodate book default gain/loss acct widget; add tooltip text for dialog buttons gnome/assistant-hierarchy.c - change sequence of pages: book options before currency selection; if book currency selected, currency also selected gnome/gtkbuilder/assistant-hierarchy.glade - increase dialog height to accomodate book default gain/loss acct widget
2017-07-09 14:19:36 -05:00
(export gnc:currency-accounting-option-selected-gain-loss-account)
(export gnc:color->html)
(export gnc:color-option->html)
(export gnc:color-option->hex-string)
(export gnc:new-options)
(export gnc:register-option)
(export gnc:unregister-option)
(export gnc:options-register-callback)
(export gnc:options-register-c-callback)
(export gnc:options-unregister-callback-id)
(export gnc:options-for-each)
(export gnc:options-for-each-general)
(export gnc:lookup-option)
(export gnc:generate-restore-forms)
(export gnc:options-fancy-date)
(export gnc:options-scm->kvp)
(export gnc:options-kvp->scm)
(export gnc:options-clear-changes)
(export gnc:options-touch)
(export gnc:options-run-callbacks)
(export gnc:options-set-default-section)
(export gnc:options-get-default-section)
(export gnc:options-copy-values)
(export gnc:send-options)
(define (gnc:option-get-value book category key)
;;Access an option directly
(qof-book-get-option book
(if (list? key)
(append (list category) key)
(list category key))))
(export gnc:option-get-value)
;; gw-engine-spec.scm
(re-export HOOK-SAVE-OPTIONS)
;; date-utilities.scm
(export gnc:reldate-list)
(export gnc:date-get-year)
(export gnc:date-get-quarter)
(export gnc:date-get-month-day)
(export gnc:date-get-month)
(export gnc:date-get-week-day)
(export gnc:date-get-week)
(export gnc:date-get-year-day)
(export gnc:time64-get-year)
(export gnc:time64-get-quarter)
(export gnc:time64-get-month-day)
(export gnc:time64-get-month)
(export gnc:time64-get-week-day)
(export gnc:time64-get-week)
(export gnc:time64-get-year-day)
(export gnc:date-get-year-string)
(export gnc:date-get-quarter-string)
(export gnc:date-get-quarter-year-string)
(export gnc:date-get-month-string)
(export gnc:date-get-month-year-string)
(export gnc:date-get-week-year-string)
(export gnc:leap-year?)
(export gnc:days-in-year)
(export gnc:days-in-month)
(export gnc:date-to-year-fraction)
(export gnc:date-year-delta)
(export gnc:date-to-month-fraction)
(export gnc:date-to-week-fraction)
(export gnc:date-to-week)
(export gnc:date-to-day-fraction)
(export gnc:date-get-fraction-func)
(export moddatek)
(export decdate)
(export incdate)
(export decdate)
(export incdate)
(export gnc:make-date-interval-list)
(export gnc:make-date-list)
(export SecDelta)
(export DayDelta)
(export WeekDelta )
(export TwoWeekDelta)
(export MonthDelta)
(export QuarterDelta)
(export HalfYearDelta)
(export YearDelta )
(export ThirtyDayDelta)
(export NinetyDayDelta)
(export gnc:deltasym-to-delta)
(export gnc:time64-start-day-time)
(export gnc:time64-end-day-time)
(export gnc:time64-previous-day)
(export gnc:time64-next-day)
(export gnc:reldate-get-symbol)
(export gnc:reldate-get-string)
(export gnc:reldate-get-desc)
(export gnc:reldate-get-fn)
(export gnc:get-absolute-from-relative-date)
(export gnc:get-relative-date-string)
(export gnc:get-relative-date-desc)
(export gnc:get-start-cal-year)
(export gnc:get-end-cal-year)
(export gnc:get-start-prev-year)
(export gnc:get-end-prev-year)
(export gnc:get-start-this-month)
(export gnc:get-end-this-month)
(export gnc:get-start-prev-month)
(export gnc:get-end-prev-month)
(export gnc:get-start-current-quarter)
(export gnc:get-end-current-quarter)
(export gnc:get-start-prev-quarter)
(export gnc:get-end-prev-quarter)
(export gnc:get-today)
(export gnc:get-one-month-ago)
(export gnc:get-three-months-ago)
(export gnc:get-six-months-ago)
(export gnc:get-one-year-ago)
(export gnc:reldate-initialize)
(export gnc:get-end-next-month)
(export gnc:get-end-next-quarter)
(export gnc:get-end-next-year)
(export gnc:get-one-month-ahead)
(export gnc:get-one-year-ahead)
(export gnc:get-six-months-ahead)
(export gnc:get-start-next-month)
(export gnc:get-start-next-quarter)
(export gnc:get-start-next-year)
(export gnc:get-three-months-ahead)
Bug #612212: Provide a method to set the default budget Patch by Jeff Kletsky. (Cstim: Accepted even though string freeze is in effect because it was submitted before the freeze. Also, the string additions are very minor.) Summary of Changes: * Initial story related to providing default budget control * Add a "Budgeting" tab to the book-level preferences dialog * Add a "Default Budget" selector to the "Budgeting" tab * Modify gnc_budget_get_default() to * Respect the new KVP, if present * Fall back to 2.2.x behavior, if not present * Modify gnc:make-budget-option * Reformatted for readability with additional comments * Default is now "#f" so that selected value is always saved Otherwise, if selection happened to be the current default and the default was later changed, the report would change * getter, setter, and generate-restore-form all now consistent * setter now always takes a budget object * generate-restore-form does not rely on "hack" in setter that previously allowed either a budget object or a GUID string This is a different fix for 603215 -- see Known Issues * Provide translation support for "Trading Acccounts" (and "Budgeting") * Refactor #define names for consistency and extensibility * KVP_OPTION_PATH for consistency with Guile usage * OPTION_SECTION_blahblah * OPTION_NAME_blahblah * Modify qofbookslots.h to be "SWIG-aware" * Pick up qofbookslots.h in make-gnucash-potfiles.in and po/POTFILES.in Known Issues: * There is no selection (yet) for "Use default budget" so changing the default budget and reloading a report does not change the budget used * setter is no more robust to "bad" values than in previous code * Budget reports created with 2.3.x after r18528 (between 2.3.8 and 2.3.9) may not load or re-render as they relied on the setter taking either a budget object or a GUID as a string This should not impact any 2.2.x users as nothing was saved under 2.2.x related to the default budget. This can be resolved through removing the option restore code in ~/.gnucash/saved-reports-2.4 and, if affected reports were open, in ~/.gnucash/books/<name_of_book> * Budget reports prior to r18528 did not save budget selection (603215) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19123 57a11ea4-9604-0410-9ed3-97b8803252fd
2010-05-06 04:01:46 -05:00
(define gnc:*kvp-option-path* (list KVP-OPTION-PATH))
(export gnc:*kvp-option-path*)
(load-from-path "gnucash/app-utils/c-interface")
(load-from-path "gnucash/app-utils/options")
(load-from-path "gnucash/app-utils/date-utilities")
;; Business options
(define gnc:*business-label* (N_ "Business"))
(define gnc:*company-name* (N_ "Company Name"))
(define gnc:*company-addy* (N_ "Company Address"))
(define gnc:*company-id* (N_ "Company ID"))
(define gnc:*company-phone* (N_ "Company Phone Number"))
(define gnc:*company-fax* (N_ "Company Fax Number"))
(define gnc:*company-url* (N_ "Company Website URL"))
(define gnc:*company-email* (N_ "Company Email Address"))
(define gnc:*company-contact* (N_ "Company Contact Person"))
(define gnc:*fancy-date-label* (N_ "Fancy Date Format"))
(define gnc:*fancy-date-format* (N_ "custom"))
(define gnc:*tax-label* (N_ "Tax"))
(define gnc:*tax-nr-label* (N_ "Tax Number"))
(define (gnc:company-info book key)
;; Access company info from key-value pairs for current book
(gnc:option-get-value book gnc:*business-label* key))
(define (gnc:fancy-date-info book key)
;; Access fancy date info from key-value pairs for current book
(gnc:option-get-value book gnc:*business-label* (list gnc:*fancy-date-label* key)))
(export gnc:*business-label* gnc:*company-name* gnc:*company-addy*
gnc:*company-id* gnc:*company-phone* gnc:*company-fax*
gnc:*company-url* gnc:*company-email* gnc:*company-contact*
gnc:*fancy-date-label* gnc:*fancy-date-format*
gnc:company-info gnc:fancy-date-info)
(define gnc:*option-section-accounts* OPTION-SECTION-ACCOUNTS)
(define gnc:*option-name-trading-accounts* OPTION-NAME-TRADING-ACCOUNTS)
Book-Currency Feature Step 3 Add an option to the File->Properties dialog to select a Currency Accounting Method, and to specify the book-currency and a default gains/loss policy if the 'book-currency' method is selected. Revert some changes made in prior commits. Other than storing and retrieving the book-currency and policy in book KVPs, the behavior of gnucash has not been affected by these changes. The changes made are: engine/policy.c & .h - define valid policies and their descriptions and hints; define functions gnc_get_valid_policy_list and gnc_valid_policy engine/engine.i - include policy.h; define 'CURRENCY-ACCOUNTING', 'BOOK-CURRENCY', and 'DEFAULT-GAINS-POLICY' as option names engine/test/utest-Split.cpp - revert prior commit that modified test function for trading accounts engine/test/utest-Transaction.c - revert prior commit that modified test function for trading accounts libqof/qof/qofbookslots.h - revert prior commit that defined Currency Accounting Method; modify definitions of Currency Accounting and Book Currency; add definition of default gains policy; keep the previous Trading Accounts definition libqof/qof/qofbook.cpp & .h - reverted function to determine currency accounting method; add function to get book-currency, revert previously committed changes to function to determine if book uses trading accounts; add function to get gains policy; modify gobject properties accordingly libqof/qof/test/test-qofbook.c - revert prior modification to test function for trading accounts; define tests for book-currency and default gains policies app-utils/options.scm - define make-currency-accounting-option and required support functions app-utils/options-util.c & .h - make support functions of make-currency-accounting-option available in c code app-utils/test/test-options-util.c - include tests for using book-currency app-utils/gnc-ui-util.c & .h - define gnc_book_use_book_currency, gnc_book_get_book_currency and gnc_book_get_default_gains_policy functions app-utils/test/test-gnc-ui-util.c - set up tests for new gnc-ui-util functions app-utils/test/test-app-utils.c - include test-gnc-ui-util.c app-utils/test/Makefile.am - include test-gnc-ui-util.c app-utils/app-utils.scm - define and export book options for Currency Accounting, Book-Currency and Default Gains Policy; export required currency-accounting-option support functions app-utils/business-prefs.scm - replace the Trading Accounts boolean option with a currency-accounting-option and rearrange the order of the options gnome-utils/dialog-options.c - define functions for set-ui-widget, set-ui-value, and get-ui-value for 'currency-accounting' option and various other support functions
2015-06-27 18:06:56 -05:00
(define gnc:*option-name-currency-accounting* OPTION-NAME-CURRENCY-ACCOUNTING)
(define gnc:*option-name-book-currency* OPTION-NAME-BOOK-CURRENCY)
(define gnc:*option-name-default-gains-policy* OPTION-NAME-DEFAULT-GAINS-POLICY)
Book-Currency Feature step 6 Modify File->Properties dialog to maintain a default gain/loss account in a book KVP. The changes made are: app-utils/app-utils.scm - define items related to book default gain/loss acct app-utils/business-prefs.scm - define items related to book default gain/loss acct;re-arrange sequence of options to make default (neither) first app-utils/gnc-ui-util.c - refine gnc_book_get_default_gains_policy to check for hidden and/or placeholder status app-utils/option-util.c & h - define items related to book default gain/loss acct app-utils/options.scm - add functionality related to book default gain/loss acct app-utils/test/test-gnc-ui-util.c - for gnc_book_get_default_gains_policy, add tests to check for hidden and/or placeholder status app-utils/test/test-option-util.cpp - add tests related to book default gain/loss acct engine/engine.i - define item related to book default gain/loss acct gnome-utils/dialog-options.c & h - add functionality related to book default gain/loss acct and rearrange dialog layout; make gain/loss acct widget refresh on account maintenance gnome-utils/gnc-main-window.c - only allow one book-option dialog if called from file->properties gnome-utils/gtkbuilder/dialog-options.glade - increase dialog height to accomodate book default gain/loss acct widget; add tooltip text for dialog buttons gnome/assistant-hierarchy.c - change sequence of pages: book options before currency selection; if book currency selected, currency also selected gnome/gtkbuilder/assistant-hierarchy.glade - increase dialog height to accomodate book default gain/loss acct widget
2017-07-09 14:19:36 -05:00
(define gnc:*option-name-default-gain-loss-account* OPTION-NAME-DEFAULT-GAINS-LOSS-ACCT-GUID)
(define gnc:*option-name-auto-readonly-days* 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
(define gnc:*option-name-num-field-source* OPTION-NAME-NUM-FIELD-SOURCE)
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
(export gnc:*option-section-accounts* gnc:*option-name-trading-accounts*
Book-Currency Feature step 6 Modify File->Properties dialog to maintain a default gain/loss account in a book KVP. The changes made are: app-utils/app-utils.scm - define items related to book default gain/loss acct app-utils/business-prefs.scm - define items related to book default gain/loss acct;re-arrange sequence of options to make default (neither) first app-utils/gnc-ui-util.c - refine gnc_book_get_default_gains_policy to check for hidden and/or placeholder status app-utils/option-util.c & h - define items related to book default gain/loss acct app-utils/options.scm - add functionality related to book default gain/loss acct app-utils/test/test-gnc-ui-util.c - for gnc_book_get_default_gains_policy, add tests to check for hidden and/or placeholder status app-utils/test/test-option-util.cpp - add tests related to book default gain/loss acct engine/engine.i - define item related to book default gain/loss acct gnome-utils/dialog-options.c & h - add functionality related to book default gain/loss acct and rearrange dialog layout; make gain/loss acct widget refresh on account maintenance gnome-utils/gnc-main-window.c - only allow one book-option dialog if called from file->properties gnome-utils/gtkbuilder/dialog-options.glade - increase dialog height to accomodate book default gain/loss acct widget; add tooltip text for dialog buttons gnome/assistant-hierarchy.c - change sequence of pages: book options before currency selection; if book currency selected, currency also selected gnome/gtkbuilder/assistant-hierarchy.glade - increase dialog height to accomodate book default gain/loss acct widget
2017-07-09 14:19:36 -05:00
gnc:*option-name-currency-accounting* gnc:*option-name-book-currency*
gnc:*option-name-default-gains-policy*
gnc:*option-name-default-gain-loss-account*
gnc:*tax-label* gnc:*tax-nr-label*
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
gnc:*option-name-auto-readonly-days* gnc:*option-name-num-field-source*)
(define gnc:*option-section-budgeting* OPTION-SECTION-BUDGETING)
(define gnc:*option-name-default-budget* OPTION-NAME-DEFAULT-BUDGET)
(export gnc:*option-section-budgeting* gnc:*option-name-default-budget*)
(load-from-path "gnucash/app-utils/business-options")
(load-from-path "gnucash/app-utils/business-prefs")
;; Symbols deprecated in 4.x, to remove for 5.x
(define-public (gnc:get-debit-string acct-type)
(issue-deprecation-warning "gnc:get-debit-string is deprecated in 4.x. Please use (gnucash engine)'s gnc-account-get-debit-string instead.")
(gnc-account-get-debit-string acct-type))
(define-public (gnc:get-credit-string acct-type)
(issue-deprecation-warning "gnc:get-credit-string is deprecated in 4.x. Please use (gnucash engine)'s gnc-account-get-credit-string instead.")
(gnc-account-get-debit-string acct-type))
(define-public (gnc:config-file-format-version version)
(issue-deprecation-warning "gnc:config-file-format-version is deprecated in 4.x and will be removed from a future version.")
#t)