Merge branch 'maint' after 2.6.12 release.

This commit is contained in:
John Ralls 2016-03-27 17:06:43 -07:00
commit 5485c9de37
52 changed files with 91404 additions and 87721 deletions

440
ChangeLog
View File

@ -1,6 +1,438 @@
2016-03-24 Geert Janssens
* Bug 693342 - Print (bottom) prints to middle for 3-check pages (HEAD, origin/maint, maint)
2016-03-23 Geert Janssens
* Revert "Bug 118391 - Long currency names untranslated"
2016-03-23 Geert Janssens
* Disable debug message that got enabled by accident last year
2016-03-23 Geert Janssens
* Bug 687504 - Not possible to reset an invoice/bill counter format
2016-03-23 Geert Janssens
* Bug 642292 - General Ledger report - 'Primary Sort Key' value is not persistent
2016-03-22 John Ralls
* New Xcode, new errors, sigh.
2016-03-22 Geert Janssens
* Bug 482186 - Customer and vendor report for partners who get invoiced/paid in foreign currency show total labeled with the symbol of the default currency.
2016-03-21 Geert Janssens
* Bug 728074 - Posting bill converts currency to itself using 0 rate
2016-03-21 Geert Janssens
* Bug 118391 - Long currency names untranslated
2016-03-21 Geert Janssens
* Fix typo
2016-03-20 John Ralls
* Open correct xea directory if user has worked around bug 725296
2016-03-20 John Ralls
* OSX: Get the locale for account trees from the OS instead of setlocale().
2016-03-19 Geert Janssens
* Fix doxigen comment after changed const behaviour
2016-03-19 Geert Janssens
* Bug 620281 - Adding reversing transaction to bill transactions creates undeleteable transactions
2016-03-19 Geert Janssens
* Refuse to void read-only transactions.
2016-03-19 Geert Janssens
* Bug 754209 - Bills can be posted multiple times from "find bill" search results - follow up
2016-03-17 John Ralls
* Bug 733164 - Command-H Invokes Help->Help Contents
2016-03-17 John Ralls
* Set the transaction currency during auto-completion.
2016-03-17 John Ralls
* Correctly re-value splits when the transaction currency is changed.
2016-03-17 Geert Janssens
* Use PRIi64 instead of PRIx64
2016-03-17 Geert Janssens
* Bug 728722 - Setting number format details appear wrong in Help, section 10.3.4. Counters Book Options Tab
2016-03-16 Mike Evans
* Bug 754209 - Bills can be posted from "find bill" search results even if bill is already posted and results in extra $ posted to A/P
2016-03-14 Geert Janssens
* Bug 720934 - Barcharts with many data points have overlapping x-axis labels
2016-02-28 Chris Good
* Add Tip Of The Day re using multiple windows to do comparisons - Bug 762800
2016-03-13 Geert Janssens
* Fixup previous commit
2015-12-21 Matt G
* Bug 742352 - Budget Summary section does not show expense totals
2015-11-11 Gilles Dartiguelongue
* Bug 760015 - guile support is automagic
2016-03-11 John Ralls
* Bug 763146 - Invalid exchange rate is recorded when entering multi-currency transaction
2016-03-11 John Ralls
* Ensure numerator is positive before checking if the value is < 1.
2016-03-11 John Ralls
* Ensure price is set when the amount is entered and user doesn't tab out.
2016-03-11 John Ralls
* Test rounded values, but don't store them, to minimize jitter in prices.
2016-03-11 John Ralls
* Check price_source precedence first to save computation.
2016-03-11 John Ralls
* Ensure that xferData->price_source is always set correctly.
2016-03-11 John Ralls
* Fix double semicolon.
2016-03-11 John Ralls
* Remove price-direction code for to default currency and alphabetic order.
2016-03-11 John Ralls
* Extract functions update_price and new_price from create_price.
2016-03-10 John Ralls
* Fix typo in HTML header.
2016-03-10 John Ralls
* Bug 763111 - commodities prices editor creates hidden db entries
2016-03-10 John Ralls
* Bug 763279 - GnuCash has empty reports
2016-03-08 John Ralls
* Bug 722996 - Cannot add stock price on Price Editor
2016-03-10 Geert Janssens
* Minor tweaks to Bayesian feature flag
2016-03-10 Robert Fewell
* Make gnucash 2.7+ rerun bayesian data conversion whenever needed
2016-02-20 Robert Fewell
* Allow matching accounts to be found also by their GUID which will be used in newer versions. The default behaviour is still to create new entries under the account fullname.
2016-03-10 Robert Fewell
* Introduce GUID_BAYES feature flag
2016-03-03 Mike Evans
* Bug 762971 - Duplicating multiple invoices results in invoices without an ID number
2016-03-02 Mike Evans
* Bug - 761172 Importing invoices posts incorrect values.
2016-02-28 Phil Longstaff
* Memory leak in gnc-gsettings.c
2016-02-28 Phil Longstaff
* Close some more memory leaks
2016-02-28 Phil Longstaff
* Close some memory leaks identified by valgrind.
2016-02-22 Geert Janssens
* Bug 744157 - Tip about subaccount is confusing
2016-02-18 pmralbuquerque
* Updated translations after TACG translation
2016-02-17 fell
* Update the list of Finance::Quote methods
2016-02-11 Sebastien Bourdelin
* Fix a typo
2016-02-09 fell
* Add comment about replacement of 10000 BYR by 1 BYN
2016-01-27 RobGowin
* cmake - Increase test pass rate on Windows
2016-02-01 Prayag Verma
* Fix Typos in doc/README.translator.txt
2016-01-18 RobGowin
* cmake - Add ability to run tests under CMake
2016-01-23 RobGowin
* Don't skip test under clang when using Guile 2.x
2016-01-23 RobGowin
* Change test to use LIBDIR to find dynamic libraries
2016-01-23 RobGowin
* Add TEST_PATH variable to test
2016-01-24 John Ralls
* Fix Travis build error.
2016-01-24 John Ralls
* Pretty up the SLR error dialog.
2016-01-24 John Ralls
* Bug 754856 - scheduled transaction <gnc.app-utils.sx> fails without warning
2016-01-24 John Ralls
* Bug 754856 - scheduled transaction <gnc.app-utils.sx> fails without warning.
2016-01-23 John Ralls
* Revert "Use python 3.3 VirtualEnv on travis."
2016-01-23 John Ralls
* Use python 3.3 VirtualEnv on travis.
2016-01-20 RobGowin
* [cmake] Reflect commit db0fd2 (Replace the TP pt.po ...) in CMake build.
2016-01-22 Geert Janssens
* Align gtkmm test suite with recent template updates
2016-01-22 Geert Janssens
* Revert "Fix typo"
2016-01-22 Geert Janssens
* Fix typo
2016-01-21 John Ralls
* Fix typo.
2016-01-21 John Ralls
* Fix segfault in utest-gnc-csv-model Teardown.
2016-01-21 John Ralls
* Fix new cdv-import tests for running in a separate build directory.
2016-01-21 Alexander Pushkarev
* adding BYN currency according to ISO 4217 ammendment #161 http://www.currency-iso.org/en/shared/amendments/iso-4217-amendment.html
2016-01-20 Geert Janssens
* csv-imp - add parse test for semicolon separated strings
2016-01-20 Geert Janssens
* csv-imp - new parse test starting from an in-source string struct
2015-09-28 Geert Janssens
* csv-imp - use GNC_TEST_ADD_FUNC for test_parse_date as well
2015-09-28 Geert Janssens
* csv-imp - test_gnc_csv_new_parse_data doesn't use the fixture
2015-09-23 Geert Janssens
* Match calls to g_string_chunk_new with g_string_chunk_free
2015-09-28 Geert Janssens
* csv-imp - don't free the parse data just created for testing
2015-09-28 Geert Janssens
* csv-imp - move tests for gnc_csv_load_file to separate function
2015-09-23 Geert Janssens
* csv-imp - test for gnc_csv_new_parse_data and skip gnc_csv_parse_data_free
2015-09-23 Geert Janssens
* csv-imp - use setup and teardown for test_gnc_csv_parse
2015-09-23 Geert Janssens
* Mark static functions as not testable
2016-01-20 Geert Janssens
* Test Date fixup
2015-09-22 Geert Janssens
* csv-imp - add test for parse_date
2015-09-22 Geert Janssens
* csv-imp - add basic test for gnc_csv_parse
2015-05-11 Geert Janssens
* csv-imp - add initial (empty) test framework
2015-09-22 Geert Janssens
* Set fixed time values so test results won't depend on the time the test is run
2015-05-12 Geert Janssens
* Adjust GError usage to comply with the GError rules
2015-09-22 Geert Janssens
* Cumulated minor spelling fixes in comments and other non-code texts
2015-05-12 Geert Janssens
* Some indentation adapations
2016-01-20 Geert Janssens
* Hide owner abstraction from user oriented gui
2016-01-19 John Ralls
* Add small utility to print message catalog statistics.
2016-01-19 John Ralls
* Replace the TP pt.po with the directly-contributed pt_PT.po
2016-01-18 Robert Gill
* Bug 723689 - Splash screen doesnt set the floating hint.
2016-01-17 John Ralls
* Bug 760711 - Non-ASCII characters not shown in Report Name when a report is created with 2.6.11
2016-01-17 fell
* Fix a mistyped error message in configure.ac
2016-01-17 fell
* Supplement to commit 837b258: Add ChangeLog.2015 to dist_doc_DATA
2016-01-15 John Ralls
* Fix reset of PKG_CONFIG_PATH to unset variable.
2016-01-15 RobGowin
* Tweak handling of COPYING file
2016-01-13 RobGowin
* Support CMake 3.0 for Debian Jessie
2016-01-14 Mike Evans
* Bug 756469 - CSV Invoice Import - Items with double quote escape not imported.
2015-12-26 Rob Gowin
* CMake build changes for maint
2015-12-07 Rob Gowin
* Add ability to build GnuCash with CMake
2016-01-12 John Ralls
* Bug 760529 - Get Quotes updates value just once per day
2016-01-12 Mike Evans
* Added some comments.
2016-01-11 strainu
* Update Romanian translations
2016-01-10 John Ralls
* Release 2.6.11 (HEAD, maint)
* Release 2.6.11 (tag: 2.6.11)
2016-01-10 John Ralls
@ -16,7 +448,7 @@
2016-01-10 Mike Evans
* Bug 760398 - Cancelling the creation of a duplicate bill or invoice doesn't reset the invoice number counter (origin/maint)
* Bug 760398 - Cancelling the creation of a duplicate bill or invoice doesn't reset the invoice number counter
2016-01-09 John Ralls
@ -98,3 +530,7 @@
* Add a missing gettext in plugin page owner tree
2016-01-01 fell
* Bug 760052 - missing flag translatable in Custom Report

65
NEWS
View File

@ -1,5 +1,70 @@
Version history:
------- -------
2.6.12 - 26 March 2016
Announcement: GnuCash 2.6.12 Release 2016-03-26
GnuCash 2.6.10 released
The GnuCash development team proudly announces GnuCash 2.6.12, the
twelfth maintenance release in the 2.6-stable series.
The following bugs are fixed:
Bug 482186 - Customer and vendor report for partners who get invoiced/paid
in foreign currency show total labeled with the symbol of the
default currency
Bug 620281 - Adding reversing transaction to bill transactions creates
undeleteable transactions
Bug 642292 - General Ledger report - 'Primary Sort Key' value is not
persistent
Bug 687504 - Not possible to reset an invoice/bill counter format
Bug 693342 - Print (bottom) prints to middle for 3-check pages
Bug 719904 - Decide payment type only based on the account type involved
Bug 720934 - Barcharts with many data points have overlapping x-axis labels
Bug 722996 - Cannot add stock price on Price Editor
Bug 723689 - Splash screen doesnt set the floating hint.
Bug 728074 - Posting bill converts currency to itself using 0 rate
Bug 728722 - Setting number format details appear wrong in Help,
section 10.3.4. Counters Book Options Tab
Bug 733164 - {MacOSX] Command-H Invokes Help->Help Contents
Bug 742352 - Budget Summary section does not show expense totals
Bug 744157 - Tip about subaccount is confusing
Bug 754209 - Bills can be posted from "find bill" search results even if
bill is already posted and results in extra $ posted to A/P
Bug 754856 - scheduled transaction <gnc.app-utils.sx> fails without warning
Bug 756469 - CSV Invoice Import - Items with double quote escape not
imported.
Bug 760015 - guile support is automagic
Bug 760529 - Get Quotes updates value just once per day
Bug 760711 - Non-ASCII characters not shown in Report Name when a report
is created with 2.6.11
Bug 762971 - Duplicating multiple invoices results in invoices without an
ID number
Bug 763111 - commodities prices editor creates hidden db entries
Bug 763146 - Invalid exchange rate is recorded when entering multi-currency
transaction
Bug 763279 - GnuCash has empty reports in recent Gentoo builds.
Other repairs that weren't marked as bugs in git:
Various memory leaks.
More multi-currency fixes related to bug 763146.
Be more liberal in accepting business counter custom formats: li, lli, I64i,
and whatever is defined to G_GINT_64 or PRIx64 on the system on which
GnuCash is compiled.
Correctly re-value splits when the transaction currency is changed.
Reset the transaction currency to match the currently open account when
auto-completing.
Refine the MacOS X localization when the system-generated POSIX locale
isn't a supported locale: Prefer the country to language when selecting
an alternate locale, but still pass the original language to gettext.
Check printing: extract address from invoice/bill for payment transactions
Robert Fewell has contributed changes needed to allow the 2.6 series
to read files from future major versions which use GUIDs instead of
names to identify matched accounts with the Bayesian import matcher.
Translation Updates: Azeri, Basque, Catalan, Chinese (Simplified), Czech,
Danish, Dutch, Farsi, Japanese, Kinyarwandan, Portuguese,
Slovak, Serbian, Swedish, Turkish, Ukrainian.
2.6.11 - 11 January 2016
Announcement: GnuCash 2.6.11 Release 2016-01-11
GnuCash 2.6.11 released

View File

@ -213,7 +213,6 @@ src/gnome/dialog-lot-viewer.c
src/gnome/dialog-new-user.c
src/gnome/dialog-price-edit-db.c
src/gnome/dialog-price-editor.c
src/gnome/dialog-print-check2.c
src/gnome/dialog-print-check.c
src/gnome/dialog-progress.c
src/gnome/dialog-sx-editor2.c

11830
po/az.po

File diff suppressed because it is too large Load Diff

11859
po/ca.po

File diff suppressed because it is too large Load Diff

11845
po/cs.po

File diff suppressed because it is too large Load Diff

11841
po/da.po

File diff suppressed because it is too large Load Diff

11850
po/eu.po

File diff suppressed because it is too large Load Diff

11838
po/fa.po

File diff suppressed because it is too large Load Diff

11890
po/ja.po

File diff suppressed because it is too large Load Diff

11865
po/nl.po

File diff suppressed because it is too large Load Diff

11851
po/rw.po

File diff suppressed because it is too large Load Diff

11845
po/sk.po

File diff suppressed because it is too large Load Diff

11847
po/sr.po

File diff suppressed because it is too large Load Diff

11944
po/sv.po

File diff suppressed because it is too large Load Diff

11843
po/tr.po

File diff suppressed because it is too large Load Diff

11845
po/uk.po

File diff suppressed because it is too large Load Diff

11845
po/zh_CN.po

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,7 @@
(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)

View File

@ -459,17 +459,27 @@
;; This defines an option to set a counter format, which has the same
;; exception as gnc:make-counter-option above.
;; Note this function uses a hack to make sure there never is a default value
;; (default-value is set to #f and value subsequently set to whatever was passed as default-value)
;; This hack was introduced to fix https://bugzilla.gnome.org/show_bug.cgi?id=687504
(define (gnc:make-counter-format-option
section
name
key
key
sort-tag
documentation-string
default-value)
(let ((option (gnc:make-string-option section name sort-tag documentation-string default-value)))
(gnc:set-option-scm->kvp option (lambda (b p) (qof-book-set-option b ((gnc:option-getter option)) (list "counter_formats" key))))
(gnc:set-option-kvp->scm option (lambda (b p)
(let ((v (qof-book-get-option b (list "counter_formats" key))))
(let ((option (gnc:make-string-option section name sort-tag documentation-string #f)))
(gnc:option-set-value option default-value)
(gnc:set-option-scm->kvp option
(lambda (f p)
(let ((value ((gnc:option-getter option)))
(path (list "counter_formats" key)))
(if (and (string? value)(not (string-null? value)))
(kvp-frame-set-slot-path-gslist f value path)
(gnc-kvp-frame-delete-at-path f path)))))
(gnc:set-option-kvp->scm option (lambda (f p)
(let ((v (kvp-frame-get-slot-path-gslist f (list "counter_formats" key))))
(if (and v (string? v))
((gnc:option-setter option) v)))))
option))

View File

@ -177,6 +177,17 @@
(let ((getter (gnc:option-default-getter option)))
(getter)))
;; Attention: this function can only be used with restrictions
;; - only during option generation, not in arbitrary code
;; - only for option types for which no conversion is required
;; between default-value and value. In the various gnc:make-option
;; functions below this is ok when
;; 1. there's (value default-value) in the let* call
;; 2. default-getter is set to (lambda() default-value)
(define (gnc:option-set-default-value option default-value)
(vector-set! option 7 (lambda() default-value))
(gnc:option-set-value option default-value))
(define (gnc:restore-form-generator value->string)
(lambda () (string-append

View File

@ -93,7 +93,7 @@ test_db (GNCPriceDB *db)
{
sixtp *parser;
load_counter lc;
load_counter lc = {0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0};
sixtp_gdv2 data = {book, lc, NULL, NULL, FALSE};
parser = sixtp_new ();

View File

@ -162,62 +162,9 @@ gnc_print_unstable_message(void)
#ifdef MAC_INTEGRATION
static void
set_mac_locale()
mac_set_currency_locale(NSLocale *locale, NSString *locale_str)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey: @"AppleLanguages"];
const gchar *langs = NULL;
NSLocale *locale = [NSLocale currentLocale];
NSString *locale_str;
@try
{
locale_str = [[[locale objectForKey: NSLocaleLanguageCode]
stringByAppendingString: @"_"]
stringByAppendingString:
[locale objectForKey: NSLocaleCountryCode]];
}
@catch (NSException *err)
{
PWARN("Locale detection raised error %s: %s. "
"Check that your locale settings in "
"System Preferences>Languages & Text are set correctly.",
[[err name] UTF8String], [[err reason] UTF8String]);
locale_str = @"_";
}
/* If we didn't get a valid current locale, the string will be just "_" */
if ([locale_str isEqualToString: @"_"])
locale_str = @"en_US";
if (!setlocale(LC_ALL, [locale_str UTF8String]))
{
NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
NSEnumerator *locale_iter = [all_locales objectEnumerator];
NSString *this_locale, *new_locale = nil;
NSString *lang = [locale objectForKey: NSLocaleLanguageCode];
PWARN("Apple Locale is set to a value %s not supported"
" by the C runtime", [locale_str UTF8String]);
while ((this_locale = (NSString*)[locale_iter nextObject]))
if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
objectForKey: NSLocaleLanguageCode]
isEqualToString: lang] &&
setlocale (LC_ALL, [this_locale UTF8String]))
{
new_locale = this_locale;
break;
}
if (new_locale)
locale_str = new_locale;
else
{
locale_str = @"en_US";
setlocale(LC_ALL, [locale_str UTF8String]);
}
PWARN("Using %s instead.", [locale_str UTF8String]);
}
if (g_getenv("LANG") == NULL)
g_setenv("LANG", [locale_str UTF8String], TRUE);
/* If the currency doesn't match the base locale, we need to find a locale that does match, because setlocale won't know what to do with just a currency identifier. */
/* If the currency doesn't match the base locale, we need to find a locale that does match, because setlocale won't know what to do with just a currency identifier. */
if (![[locale objectForKey: NSLocaleCurrencyCode] isEqualToString:
[[[NSLocale alloc] initWithLocaleIdentifier: locale_str] objectForKey: NSLocaleCurrencyCode]]) {
NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
@ -241,49 +188,149 @@ set_mac_locale()
if (money_locale)
setlocale(LC_MONETARY, [money_locale UTF8String]);
}
}
/* The locale that we got from AppKit isn't a supported POSIX one, so we need to
* find something close. First see if we can find another locale for the
* country; failing that, try the language. Ultimately fall back on en_US.
*/
static NSString*
mac_find_close_country(NSString *locale_str, NSString *country_str,
NSString *lang_str)
{
NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
NSEnumerator *locale_iter = [all_locales objectEnumerator];
NSString *this_locale, *new_locale = nil;
PWARN("Apple Locale is set to a value %s not supported"
" by the C runtime", [locale_str UTF8String]);
while ((this_locale = (NSString*)[locale_iter nextObject]))
if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
objectForKey: NSLocaleCountryCode]
isEqualToString: country_str] &&
setlocale (LC_ALL, [this_locale UTF8String]))
{
new_locale = this_locale;
break;
}
if (new_locale)
locale_str = new_locale;
else
while ((this_locale = (NSString*)[locale_iter nextObject]))
if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
objectForKey: NSLocaleLanguageCode]
isEqualToString: lang_str] &&
setlocale (LC_ALL, [this_locale UTF8String]))
{
new_locale = this_locale;
break;
}
if (new_locale)
locale_str = new_locale;
else
{
locale_str = @"en_US";
setlocale(LC_ALL, [locale_str UTF8String]);
}
PWARN("Using %s instead.", [locale_str UTF8String]);
return locale_str;
}
/* Language subgroups (e.g., US English) are reported in the form "ll-SS"
* (e.g. again, "en-US"), not what gettext wants. We convert those to
* old-style locales, which is easy for most cases. There are two where it
* isn't, though: Simplified Chinese (zh-Hans) and traditional Chinese
* (zh-Hant), which are normally assigned the locales zh_CN and zh_TW,
* respectively. Those are handled specially.
*/
static NSString*
mac_convert_complex_language(NSString* this_lang)
{
NSArray *elements = [this_lang componentsSeparatedByString: @"-"];
if ([elements count] == 1)
return this_lang;
if ([[elements objectAtIndex: 0] isEqualToString: @"zh"]) {
if ([[elements objectAtIndex: 1] isEqualToString: @"Hans"])
this_lang = @"zh_CN";
else
this_lang = @"zh_TW";
}
else
this_lang = [elements componentsJoinedByString: @"_"];
return this_lang;
}
static void
mac_set_languages(NSArray* languages, NSString *lang_str)
{
/* Process the language list. */
const gchar *langs = NULL;
NSEnumerator *lang_iter = [languages objectEnumerator];
NSArray *new_languages = [NSArray array];
NSString *this_lang = NULL;
while ((this_lang = [lang_iter nextObject])) {
this_lang = [this_lang stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString: @"\""]];
this_lang = mac_convert_complex_language(this_lang);
new_languages = [new_languages arrayByAddingObject: this_lang];
/* If it's an English language, add the "C" locale after it so that
* any messages can default to it */
if ( [this_lang containsString: @"en"])
new_languages = [new_languages arrayByAddingObject: @"C"];
if (![new_languages containsObject: lang_str]) {
NSArray *temp_array = [NSArray arrayWithObject: lang_str];
new_languages = [temp_array arrayByAddingObjectsFromArray: new_languages];
}
langs = [[new_languages componentsJoinedByString:@":"] UTF8String];
}
if (langs && strlen(langs) > 0)
{
PWARN("Language list: %s", langs);
g_setenv("LANGUAGE", langs, TRUE);
}
}
static void
set_mac_locale()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSLocale *locale = [NSLocale currentLocale];
NSString *lang_str, *country_str, *locale_str;
NSArray *languages = [[defs arrayForKey: @"AppleLanguages"] retain];
@try
{
lang_str = [locale objectForKey: NSLocaleLanguageCode];
country_str = [locale objectForKey: NSLocaleCountryCode];
locale_str = [[lang_str stringByAppendingString: @"_"]
stringByAppendingString: country_str];
}
@catch (NSException *err)
{
PWARN("Locale detection raised error %s: %s. "
"Check that your locale settings in "
"System Preferences>Languages & Text are set correctly.",
[[err name] UTF8String], [[err reason] UTF8String]);
locale_str = @"_";
}
/* If we didn't get a valid current locale, the string will be just "_" */
if ([locale_str isEqualToString: @"_"])
locale_str = @"en_US";
lang_str = mac_convert_complex_language(lang_str);
if (!setlocale(LC_ALL, [locale_str UTF8String]))
locale_str = mac_find_close_country(locale_str, country_str, lang_str);
if (g_getenv("LANG") == NULL)
g_setenv("LANG", [locale_str UTF8String], TRUE);
mac_set_currency_locale(locale, locale_str);
/* Now call gnc_localeconv() to force creation of the app locale
* before another call to setlocale messes it up. */
gnc_localeconv ();
/* Process the language list.
*
* Language subgroups (e.g., US English) are reported in the form
* "ll-SS" (e.g. again, "en-US"), not what gettext wants. We convert
* those to old-style locales, which is easy for most cases. There are
* two where it isn't, though: Simplified Chinese (zh-Hans) and
* traditional Chinese (zh-Hant), which are normally assigned the
* locales zh_CN and zh_TW, respectively. Those are handled
* specially.*/
if ([languages count] > 0) {
NSEnumerator *lang_iter = [languages objectEnumerator];
NSString *this_lang;
NSArray *elements;
NSArray *new_languages = [NSArray array];
while ((this_lang = [lang_iter nextObject])) {
this_lang = [this_lang stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:
@"\""]];
elements = [this_lang componentsSeparatedByString: @"-"];
if ([elements count] > 1) {
if ([[elements objectAtIndex: 0] isEqualToString: @"zh"]) {
if ([[elements objectAtIndex: 1] isEqualToString: @"Hans"])
this_lang = @"zh_CN";
else
this_lang = @"zh_TW";
}
else
this_lang = [elements componentsJoinedByString: @"_"];
}
new_languages = [new_languages arrayByAddingObject: this_lang];
/* If it's an English language, add the "C" locale after it so that
* any messages can default to it */
if ( [[elements objectAtIndex: 0] isEqualToString: @"en"])
new_languages = [new_languages arrayByAddingObject: @"C"];
}
langs = [[new_languages componentsJoinedByString:@":"] UTF8String];
}
if (langs && strlen(langs) > 0)
g_setenv("LANGUAGE", langs, TRUE);
/* Process the languages, including the one from the Apple locale. */
if ([languages count] > 0)
mac_set_languages(languages, lang_str);
else
g_setenv("LANGUAGE", [lang_str UTF8String], TRUE);
[languages release];
[pool drain];
}
#endif /* MAC_INTEGRATION */

View File

@ -811,10 +811,13 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params)
/* Yep, we're posting. So, save the invoice...
* Note that we can safely ignore the return value; we checked
* the verify_ok earlier, so we know it's ok.
* Additionally make sure the invoice has the owner's currency
* refer to https://bugzilla.gnome.org/show_bug.cgi?id=728074
*/
gnc_suspend_gui_refresh ();
gncInvoiceBeginEdit (invoice);
gnc_invoice_window_ok_save (iw);
gncInvoiceSetCurrency (invoice, gncOwnerGetCurrency (gncInvoiceGetOwner (invoice)));
/* Fill in the conversion prices with feedback from the user */
text = _("One or more of the entries are for accounts different from the invoice/bill currency. You will be asked a conversion rate for each.");

View File

@ -51,6 +51,7 @@
#include "business-gnome-utils.h"
#include "dialog-transfer.h"
#include "dialog-print-check.h"
#include "gnome-search/gnc-general-search.h"
#define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
@ -72,6 +73,7 @@ struct _payment_window
GtkWidget * acct_tree;
GtkWidget * docs_list_tree_view;
GtkWidget * commodity_label;
GtkWidget * print_check;
gint component_id;
QofBook * book;
@ -84,6 +86,7 @@ struct _payment_window
GList * acct_commodities;
Transaction * pre_existing_txn;
gboolean print_check_state;
};
void gnc_ui_payment_window_set_num (PaymentWindow *pw, const char* num)
@ -236,6 +239,16 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
update_cleanup:
gtk_widget_set_sensitive (pw->acct_tree, enable_xfer_acct);
/* Disable "Print Check" widget if amount is zero but save current
state to restore when the widget is re-enabled */
if (gtk_widget_is_sensitive (pw->print_check))
pw->print_check_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check));
if (!enable_xfer_acct)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), FALSE);
gtk_widget_set_sensitive (pw->print_check, enable_xfer_acct);
if (gtk_widget_is_sensitive (pw->print_check))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), pw->print_check_state);
/* Check if there are issues preventing a successful payment */
gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
if (conflict_msg)
@ -725,15 +738,24 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
else
auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
gncOwnerApplyPayment (&pw->owner, pw->pre_existing_txn, selected_lots,
pw->post_acct, pw->xfer_acct, pw->amount_tot,
exch, date, memo, num, auto_pay);
gncOwnerApplyPayment (&pw->owner, &(pw->pre_existing_txn), selected_lots,
pw->post_acct, pw->xfer_acct, pw->amount_tot, exch,
date, memo, num, auto_pay);
}
gnc_resume_gui_refresh ();
/* Save the transfer account, xfer_acct */
gnc_payment_dialog_remember_account(pw, pw->xfer_acct);
if (gtk_widget_is_sensitive (pw->print_check) &&
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check)))
{
Split *split = xaccTransFindSplitByAccount (pw->pre_existing_txn, pw->xfer_acct);
GList *splits = NULL;
splits = g_list_append(splits, split);
gnc_ui_print_check_dialog_create(NULL, splits);
}
gnc_ui_payment_window_destroy (pw);
}
@ -810,15 +832,6 @@ gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
gnc_payment_window_check_payment (pw);
}
static gboolean AccountTypeOkForPayments (GNCAccountType type)
{
if (xaccAccountIsAssetLiabType(type) ||
xaccAccountIsEquityType(type))
return TRUE;
else
return FALSE;
}
/* Select the list of accounts to show in the tree */
static void
gnc_payment_set_account_types (GncTreeViewAccount *tree)
@ -829,7 +842,7 @@ gnc_payment_set_account_types (GncTreeViewAccount *tree)
gnc_tree_view_account_get_view_info (tree, &avi);
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
avi.include_type[i] = AccountTypeOkForPayments (i);
avi.include_type[i] = gncBusinessIsPaymentAcctType (i);
gnc_tree_view_account_set_view_info (tree, &avi);
}
@ -973,6 +986,7 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
box = GTK_WIDGET (gtk_builder_get_object (builder, "date_box"));
pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), pw->date_edit, TRUE, TRUE, 0);
pw->print_check = GTK_WIDGET (gtk_builder_get_object (builder, "print_check"));
pw->docs_list_tree_view = GTK_WIDGET (gtk_builder_get_object (builder, "docs_list_tree_view"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
@ -1140,86 +1154,45 @@ gnc_ui_payment_new (GncOwner *owner, QofBook *book)
return gnc_ui_payment_new_with_invoice (owner, book, NULL);
}
// ////////////////////////////////////////////////////////////
static void increment_if_asset_account (gpointer data,
gpointer user_data)
{
int *r = user_data;
const Split *split = data;
const Account *account = xaccSplitGetAccount(split);
if (AccountTypeOkForPayments(xaccAccountGetType (account)))
++(*r);
}
static int countAssetAccounts(SplitList* slist)
{
int result = 0;
g_list_foreach(slist, &increment_if_asset_account, &result);
return result;
}
static gint predicate_is_asset_account(gconstpointer a,
gconstpointer user_data)
{
const Split *split = a;
const Account *account = xaccSplitGetAccount(split);
if (AccountTypeOkForPayments(xaccAccountGetType(account)))
return 0;
else
return -1;
}
static gint predicate_is_apar_account(gconstpointer a,
gconstpointer user_data)
{
const Split *split = a;
const Account *account = xaccSplitGetAccount(split);
if (xaccAccountIsAPARType(xaccAccountGetType(account)))
return 0;
else
return -1;
}
static Split *getFirstAssetAccountSplit(SplitList* slist)
{
GList *r = g_list_find_custom(slist, NULL, &predicate_is_asset_account);
if (r)
return r->data;
else
return NULL;
}
static Split *getFirstAPARAccountSplit(SplitList* slist)
{
GList *r = g_list_find_custom(slist, NULL, &predicate_is_apar_account);
if (r)
return r->data;
else
return NULL;
}
// ///////////////
gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
{
SplitList *slist;
gboolean result = TRUE;
Split *assetaccount_split;
Split *assetaccount_split, *aparaccount_split;
gnc_numeric amount;
if (!txn)
return result;
// We require the txn to have one split in an A/R or A/P account.
slist = xaccTransGetSplitList(txn);
if (!slist)
if (!xaccTransGetSplitList(txn))
return result;
if (countAssetAccounts(slist) == 0)
/* First test if one split is in an A/R or A/P account.
* That will give us the best Customer vs Vendor/Employee distinction */
aparaccount_split = xaccTransGetFirstAPARAcctSplit(txn);
if (aparaccount_split)
{
if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_RECEIVABLE)
return TRUE; // Type is Customer
else if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_PAYABLE)
return FALSE; // Type is Vendor/Employee, there's not enough information to refine more
}
/* For the lack of an A/R or A/P account we'll assume positive changes to an
* Asset/Liability or Equity account are Customer payments the others will be
* considered Vendor payments */
assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
if (!assetaccount_split)
{
/* Transaction isn't valid for a payment, just return the default
* Calling code will have to handle this situation properly */
g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
xaccTransGetDescription(txn));
return result;
}
assetaccount_split = getFirstAssetAccountSplit(slist);
assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
amount = xaccSplitGetValue(assetaccount_split);
result = gnc_numeric_positive_p(amount); // positive amounts == customer
//g_message("Amount=%s", gnc_numeric_to_string(amount));
@ -1230,8 +1203,6 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
{
SplitList *slist;
Split *assetaccount_split;
Split *postaccount_split;
gnc_numeric amount;
@ -1242,23 +1213,22 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
// We require the txn to have one split in an Asset account.
slist = xaccTransGetSplitList(txn);
if (!slist)
if (!xaccTransGetSplitList(txn))
return NULL;
if (countAssetAccounts(slist) == 0)
assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
if (!assetaccount_split)
{
g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
xaccTransGetDescription(txn));
return NULL;
}
assetaccount_split = getFirstAssetAccountSplit(slist);
postaccount_split = getFirstAPARAccountSplit(slist); // watch out: Might be NULL
postaccount_split = xaccTransGetFirstAPARAcctSplit(txn); // watch out: Might be NULL
amount = xaccSplitGetValue(assetaccount_split);
pw = gnc_ui_payment_new(owner,
qof_instance_get_book(QOF_INSTANCE(txn)));
g_assert(assetaccount_split); // we can rely on this because of the countAssetAccounts() check above
g_assert(assetaccount_split); // we can rely on this because of the check above
g_debug("Amount=%s", gnc_numeric_to_string(amount));
// Fill in the values from the given txn

View File

@ -822,7 +822,9 @@ static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
SplitRegister *reg;
Split *split;
Transaction *trans;
gboolean is_customer;
gboolean have_owner;
GncOwner owner;
GncOwner *owner_p;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
@ -846,16 +848,20 @@ static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
trans = xaccSplitGetParent(split);
g_return_if_fail(trans);
is_customer = gnc_ui_payment_is_customer_payment(trans);
plugin_business = GNC_PLUGIN_BUSINESS (mw->data);
plugin_business_priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin_business);
have_owner = gncOwnerGetOwnerFromTxn (trans, &owner);
if (have_owner)
owner_p = &owner;
else if (gnc_ui_payment_is_customer_payment(trans))
owner_p = plugin_business_priv->last_customer;
else
owner_p = plugin_business_priv->last_vendor;
gnc_business_assign_payment (gnc_plugin_page_get_window(plugin_page),
trans,
is_customer
? plugin_business_priv->last_customer
: plugin_business_priv->last_vendor);
trans, owner_p);
}
static const gchar *register_txn_actions[] =

View File

@ -262,7 +262,7 @@
<object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">8</property>
<property name="n_rows">9</property>
<property name="n_columns">2</property>
<property name="column_spacing">3</property>
<property name="row_spacing">3</property>
@ -549,6 +549,24 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="print_check">
<property name="label" translatable="yes">Print Check</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@ -65,6 +65,7 @@ struct timeval
#include <gnc-gdate-utils.h>
#include "SchedXaction.h"
#include "qofbackend-p.h"
#include "gncBusiness.h"
/* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and
* xaccTransRollback():
@ -2233,6 +2234,28 @@ xaccTransGetSplitList (const Transaction *trans)
return trans ? trans->splits : NULL;
}
Split *xaccTransGetFirstPaymentAcctSplit(const Transaction *trans)
{
FOR_EACH_SPLIT (trans,
const Account *account = xaccSplitGetAccount(s);
if (gncBusinessIsPaymentAcctType(xaccAccountGetType(account)))
return s;
);
return NULL;
}
Split *xaccTransGetFirstAPARAcctSplit(const Transaction *trans)
{
FOR_EACH_SPLIT (trans,
const Account *account = xaccSplitGetAccount(s);
if (xaccAccountIsAPARType(xaccAccountGetType(account)))
return s;
);
return NULL;
}
int
xaccTransCountSplits (const Transaction *trans)
{

View File

@ -376,6 +376,21 @@ int xaccTransGetSplitIndex(const Transaction *trans, const Split *split);
SplitList * xaccTransGetSplitList (const Transaction *trans);
gboolean xaccTransStillHasSplit(const Transaction *trans, const Split *s);
/** The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first
split in this transaction that belongs to an account which is considered a
valid account for business payments.
@param trans The transaction
If there is no such split in the transaction NULL will be returned. */
Split * xaccTransGetFirstPaymentAcctSplit (const Transaction *trans);
/** The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first
split in this transaction that belongs to an AR or AP account.
@param trans The transaction
If there is no such split in the transaction NULL will be returned. */
Split * xaccTransGetFirstAPARAcctSplit (const Transaction *trans);
/** Set the transaction to be ReadOnly by setting a non-NULL value as "reason".
*
* FIXME: If "reason" is NULL, this function does nothing, instead of removing the

View File

@ -88,3 +88,12 @@ GList * gncBusinessGetOwnerList (QofBook *book, const char *type_name,
return data.result;
}
gboolean gncBusinessIsPaymentAcctType (GNCAccountType type)
{
if (xaccAccountIsAssetLiabType(type) ||
xaccAccountIsEquityType(type))
return TRUE;
else
return FALSE;
}

View File

@ -36,6 +36,7 @@
#include <glib.h>
#include "qof.h"
#include "Account.h"
/* KVP key for report PDF directories */
#define OWNER_EXPORT_PDF_DIRNAME "export-pdf-directory"
@ -86,5 +87,10 @@ typedef GList OwnerList;
OwnerList * gncBusinessGetOwnerList (QofBook *book, QofIdTypeConst type_name,
gboolean all_including_inactive);
/** Returns whether the given account type is a valid type to use in
* business payments. Currently payments are allowed to/from assets,
* liabilities and equity accounts. */
gboolean gncBusinessIsPaymentAcctType (GNCAccountType type);
#endif /* GNC_BUSINESS_H_ */

View File

@ -1849,7 +1849,7 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn,
g_return_if_fail (owner->owner.undefined);
/* Create a lot for this payment */
payment_lot = gncOwnerCreatePaymentLot (owner, txn, invoice->posted_acc, xfer_acc,
payment_lot = gncOwnerCreatePaymentLot (owner, &txn, invoice->posted_acc, xfer_acc,
amount, exch, date, memo, num);
/* Select the invoice as only payment candidate */

View File

@ -647,6 +647,31 @@ gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner)
return (owner->owner.undefined != NULL);
}
gboolean gncOwnerGetOwnerFromTxn (Transaction *txn, GncOwner *owner)
{
Split *apar_split = NULL;
if (!txn || !owner) return FALSE;
if (xaccTransGetTxnType (txn) == TXN_TYPE_NONE)
return FALSE;
apar_split = xaccTransGetFirstAPARAcctSplit (txn);
if (apar_split)
{
GNCLot *lot = xaccSplitGetLot (apar_split);
GncInvoice *invoice = gncInvoiceGetInvoiceFromLot (lot);
if (invoice)
gncOwnerCopy (gncInvoiceGetOwner (invoice), owner);
else if (!gncOwnerGetOwnerFromLot (lot, owner))
return FALSE;
return TRUE; // Got owner from either invoice or lot
}
return FALSE;
}
gboolean gncOwnerIsValid (const GncOwner *owner)
{
if (!owner) return FALSE;
@ -698,7 +723,7 @@ gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB)
}
GNCLot *
gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction **preset_txn,
Account *posted_acc, Account *xfer_acc,
gnc_numeric amount, gnc_numeric exch, Timespec date,
const char *memo, const char *num)
@ -708,6 +733,7 @@ gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
const char *name;
gnc_commodity *commodity;
Split *xfer_split = NULL;
Transaction *txn = NULL;
GNCLot *payment_lot;
/* Verify our arguments */
@ -720,6 +746,9 @@ gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
commodity = gncOwnerGetCurrency (owner);
// reverse = use_reversed_payment_amounts(owner);
if (preset_txn && *preset_txn)
txn = *preset_txn;
if (txn)
{
/* Pre-existing transaction was specified. We completely clear it,
@ -838,6 +867,8 @@ gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
/* Commit this new transaction */
xaccTransCommitEdit (txn);
if (preset_txn)
*preset_txn = txn;
return payment_lot;
}
@ -1350,7 +1381,7 @@ void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots)
* then all open lots for the owner are considered.
*/
void
gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,
gncOwnerApplyPayment (const GncOwner *owner, Transaction **preset_txn, GList *lots,
Account *posted_acc, Account *xfer_acc,
gnc_numeric amount, gnc_numeric exch, Timespec date,
const char *memo, const char *num, gboolean auto_pay)
@ -1365,7 +1396,7 @@ gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,
/* If there's a real amount to transfer create a lot for this payment */
if (!gnc_numeric_zero_p (amount))
payment_lot = gncOwnerCreatePaymentLot (owner, txn, posted_acc, xfer_acc,
payment_lot = gncOwnerCreatePaymentLot (owner, preset_txn, posted_acc, xfer_acc,
amount, exch, date, memo, num);
if (lots)

View File

@ -195,6 +195,15 @@ gint gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB);
*/
gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
/** Convenience function to get the owner from a transaction.
* Transactions don't really have an owner. What this function will
* do it figure out whether the transaction is part of a business
* transaction (either a posted invoice/bill/voucher/credit note or
* a payment transaction) and use the business object behind it
* to extract owner information.
*/
gboolean gncOwnerGetOwnerFromTxn (Transaction *txn, GncOwner *owner);
gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GncGUID *guid);
/**
@ -205,7 +214,7 @@ gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType
* split in the transfer account).
*/
GNCLot *
gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction **preset_txn,
Account *posted_acc, Account *xfer_acc,
gnc_numeric amount, gnc_numeric exch, Timespec date,
const char *memo, const char *num);
@ -258,7 +267,7 @@ void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots);
* details on what happens exactly.
*/
void
gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,
gncOwnerApplyPayment (const GncOwner *owner, Transaction **preset_txn, GList *lots,
Account *posted_acc, Account *xfer_acc,
gnc_numeric amount, gnc_numeric exch, Timespec date,
const char *memo, const char *num, gboolean auto_pay);

View File

@ -537,7 +537,7 @@ which_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gt
GncCombott *combott = GNC_COMBOTT (user_data);
GncCombottPrivate *priv = GNC_COMBOTT_GET_PRIVATE (combott);
if(!priv->active == 0)
if(priv->active != 0)
{
gtk_tree_model_get( priv->model, &priv->active_iter, priv->tip_col, &text, -1 );
if(g_strcmp0(text, "") && (text != NULL))

View File

@ -3292,7 +3292,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
{
gnc_commodity *split_com;
split_com = xaccAccountGetCommodity (acc);
if (!g_strcmp0 (gnc_commodity_get_namespace (split_com), "template") == 0)
if (g_strcmp0 (gnc_commodity_get_namespace (split_com), "template") != 0)
{
DEBUG("Insert trans %p for gl (%s)", trans, name);
gtm_sr_insert_trans (model, trans, TRUE);

View File

@ -1408,7 +1408,7 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
gboolean is_template = FALSE;
gboolean negative_in_red = FALSE;
gboolean show_extra_dates = FALSE;
gnc_numeric num;
gnc_numeric num = gnc_numeric_zero();
const gchar *s = "";
const gchar *row_color;
RowDepth depth;

View File

@ -15,7 +15,6 @@ SET (gnc_gnome_noinst_HEADERS
dialog-lot-viewer.h
dialog-new-user.h
dialog-print-check.h
dialog-print-check2.h
dialog-progress.h
dialog-sx-editor.h
dialog-sx-editor2.h
@ -60,7 +59,6 @@ SET (gnc_gnome_SOURCES
dialog-price-editor.c
dialog-price-edit-db.c
dialog-print-check.c
dialog-print-check2.c
dialog-progress.c
dialog-sx-editor.c
dialog-sx-editor2.c

View File

@ -38,7 +38,6 @@ libgnc_gnome_la_SOURCES = \
dialog-price-editor.c \
dialog-price-edit-db.c \
dialog-print-check.c \
dialog-print-check2.c \
dialog-progress.c \
dialog-sx-editor.c \
dialog-sx-editor2.c \
@ -89,7 +88,6 @@ noinst_HEADERS = \
dialog-lot-viewer.h \
dialog-new-user.h \
dialog-print-check.h \
dialog-print-check2.h \
dialog-progress.h \
dialog-sx-editor.h \
dialog-sx-editor2.h \

View File

@ -36,6 +36,10 @@
#include <sys/types.h>
#include <unistd.h>
#ifdef PLATFORM_OSX
#include <Foundation/Foundation.h>
#endif
#include "gnc-account-merge.h"
#include "dialog-new-user.h"
#include "dialog-options.h"
@ -187,6 +191,36 @@ set_final_balance (GHashTable *hash, Account *account, gnc_numeric in_balance)
g_hash_table_insert (hash, account, balance);
}
#ifdef PLATFORM_OSX
/* Repeat retrieving the locale from defaults in case it was overridden in
* gnucash-bin because it wasn't a supported POSIX locale.
*/
static char*
mac_locale()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLocale* locale = [NSLocale currentLocale];
NSString* locale_str;
char *retval = NULL;
@try
{
locale_str =[[[locale objectForKey: NSLocaleLanguageCode]
stringByAppendingString: @"_"]
stringByAppendingString:
[locale objectForKey: NSLocaleCountryCode]];
}
@catch (NSException *err)
{
locale_str = @"_";
}
/* If we didn't get a valid current locale, the string will be just "_" */
if ([locale_str isEqualToString: @"_"])
locale_str = @"en_US";
retval = g_strdup([locale_str UTF8String]);
[pool drain];
return retval;
}
#endif
static gchar*
gnc_get_ea_locale_dir(const char *top_dir)
{
@ -196,26 +230,31 @@ gnc_get_ea_locale_dir(const char *top_dir)
struct stat buf;
int i;
#ifdef HAVE_LC_MESSAGES
locale = g_strdup(setlocale(LC_MESSAGES, NULL));
#else
# ifdef G_OS_WIN32
/* On win32, setlocale() doesn't say anything useful. Use
glib's function instead. */
locale = g_win32_getlocale();
if (!locale)
{
PWARN ("Couldn't retrieve locale. Falling back to default one.");
locale = g_strdup ("C");
}
# else
/*
* Mac OS X 10.1 and earlier, not only doesn't have LC_MESSAGES
* setlocale can sometimes return NULL instead of "C"
#ifdef PLATFORM_WIN32
/* On win32, setlocale() doesn't say anything useful, so we check
* g_win32_getlocale(). Unfortunately it checks the value of $LANG first,
* and the user might have worked around the absence of sv in gettext's
* Microsoft Conversion Array by setting it to "Swedish_Sweden", so first
* check that.
*/
locale = g_strdup(setlocale(LC_ALL, NULL) ?
setlocale(LC_ALL, NULL) : "C");
# endif
locale = g_getenv("LANG");
if (g_strcmp0(locale, "Swedish_Sweden") == 0)
locale = g_strdup("sv_SV");
else if (g_strcmp0(locale, "Swedish_Finland") == 0)
locale =g_strdup("sv_FI");
else
{
locale = g_win32_getlocale();
if (!locale)
{
PWARN ("Couldn't retrieve locale. Falling back to default one.");
locale = g_strdup ("C");
}
}
#elif defined PLATFORM_OSX
locale = mac_locale();
# else
locale = g_strdup(setlocale(LC_MESSAGES, NULL));
#endif
i = strlen(locale);

View File

@ -277,7 +277,6 @@ struct _print_check_dialog
GtkWidget *dialog;
GtkWindow *caller_window;
GncPluginPageRegister *plugin_page;
Split *split;
GList *splits;
@ -1601,7 +1600,7 @@ initialize_format_combobox (PrintCheckDialog *pcd)
* make a new print check dialog and wait for it. *
*****************************************************/
void
gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
gnc_ui_print_check_dialog_create(GtkWidget *parent,
GList *splits)
{
PrintCheckDialog *pcd;
@ -1612,7 +1611,7 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
Transaction *trans = NULL;
pcd = g_new0(PrintCheckDialog, 1);
pcd->plugin_page = plugin_page;
pcd->caller_window = GTK_WINDOW(parent);
pcd->splits = g_list_copy(splits);
builder = gtk_builder_new();
@ -1682,9 +1681,7 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
pcd->check_rotation = GTK_SPIN_BUTTON(gtk_builder_get_object (builder, "check_rotation_entry"));
pcd->units_combobox = GTK_WIDGET(gtk_builder_get_object (builder, "units_combobox"));
window = GTK_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
gtk_window_set_transient_for(GTK_WINDOW(pcd->dialog), window);
pcd->caller_window = GTK_WINDOW(window);
gtk_window_set_transient_for(GTK_WINDOW(pcd->dialog), pcd->caller_window);
/* Create and attach the date-format chooser */
table = GTK_WIDGET(gtk_builder_get_object (builder, "options_table"));
@ -1708,17 +1705,27 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
/* Can't access business objects e.g. Customer,Vendor,Employee because
* it would create build problems */
if (g_list_length(pcd->splits) == 1)
{
GncOwner txn_owner;
trans = xaccSplitGetParent((Split *)(pcd->splits->data));
else
trans = NULL;
if ( trans )
{
if (gncOwnerGetOwnerFromTxn (trans, &txn_owner))
{
GncOwner owner;
gncOwnerCopy (gncOwnerGetEndOwner (&txn_owner), &owner);
/* Got a business owner, get the address */
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_name), gncOwnerGetName(&owner));
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_1), gncAddressGetAddr1 (gncOwnerGetAddr(&owner)));
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_2), gncAddressGetAddr2 (gncOwnerGetAddr(&owner)));
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_3), gncAddressGetAddr3 (gncOwnerGetAddr(&owner)));
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_4), gncAddressGetAddr4 (gncOwnerGetAddr(&owner)));
}
}
/* Use transaction description as address name if no better address has been found */
if ( trans && (0 == gtk_entry_get_text_length (GTK_ENTRY(pcd->check_address_name))) )
gtk_entry_set_text(GTK_ENTRY(pcd->check_address_name), xaccTransGetDescription(trans));
}
else
{
/* nothing to do - defaults to blank */
}
gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "lower_left")));
@ -2256,8 +2263,8 @@ draw_check_format(GtkPrintContext *context, gint position,
/* Standard positioning is used.
* Note that the first check on the page (position 0) doesn't
* need to be moved (hence the test for position > 0 above. */
cairo_translate(cr, 0, format->height);
g_debug("Position %d translated by %f (pre-defined)", position, format->height);
cairo_translate(cr, 0, position * format->height);
g_debug("Position %d translated by %f (pre-defined)", position, position * format->height);
}
else if (position == pcd->position_max)
{

View File

@ -28,7 +28,7 @@
typedef struct _print_check_dialog PrintCheckDialog;
void gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page,
void gnc_ui_print_check_dialog_create(GtkWidget *parent,
GList *splits);
#endif

View File

@ -1,34 +0,0 @@
/********************************************************************\
* dialog-print-check2.h : dialog to control check printing *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
* *
* 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 *
\********************************************************************/
#ifndef DIALOG_PRINT_CHECK2_H
#define DIALOG_PRINT_CHECK2_H
#include "print-session.h"
typedef struct _print_check_dialog PrintCheckDialog;
void gnc_ui_print_check_dialog_create2 (GncPluginPageRegister2 *plugin_page,
GList *splits);
#endif

View File

@ -2723,6 +2723,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
GList * splits = NULL, *item;
GNCLedgerDisplayType ledger_type;
Account * account;
GtkWidget * window;
ENTER("(action %p, plugin_page %p)", action, plugin_page);
@ -2731,6 +2732,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
reg = gnc_ledger_display_get_split_register (priv->ledger);
ledger_type = gnc_ledger_display_type(priv->ledger);
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
{
account = gnc_plugin_page_register_get_account (plugin_page);
@ -2742,7 +2744,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
if (xaccSplitGetAccount(split) == account)
{
splits = g_list_append(splits, split);
gnc_ui_print_check_dialog_create(plugin_page, splits);
gnc_ui_print_check_dialog_create(window, splits);
g_list_free(splits);
}
else
@ -2753,7 +2755,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
if (split)
{
splits = g_list_append(splits, split);
gnc_ui_print_check_dialog_create(plugin_page, splits);
gnc_ui_print_check_dialog_create(window, splits);
g_list_free(splits);
}
}
@ -2775,14 +2777,13 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
{
if (xaccSplitGetAccount(split) != common_acct)
{
GtkWidget *dialog, *window;
GtkWidget *dialog;
gint response;
const gchar *title = _("Print checks from multiple accounts?");
const gchar *message =
_("This search result contains splits from more than one account. "
"Do you want to print the checks even though they are not all "
"from the same account?");
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@ -2804,11 +2805,11 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
}
}
}
gnc_ui_print_check_dialog_create(plugin_page, splits);
gnc_ui_print_check_dialog_create(window, splits);
}
else
{
gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page)), "%s",
gnc_error_dialog(window, "%s",
_("You can only print checks from a bank account register or search results."));
LEAVE("Unsupported ledger type");
return;

View File

@ -56,7 +56,7 @@
#include "dialog-account.h"
#include "dialog-find-transactions2.h"
#include "dialog-print-check2.h"
#include "dialog-print-check.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "SX-book.h"
@ -2562,6 +2562,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
GList * splits = NULL, *item;
GNCLedgerDisplay2Type ledger_type;
Account * account;
GtkWidget * window;
ENTER("(action %p, plugin_page %p)", action, plugin_page);
@ -2571,6 +2572,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
model = gnc_ledger_display2_get_split_model_register (priv->ledger);
ledger_type = gnc_ledger_display2_type (priv->ledger);
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
{
@ -2610,7 +2612,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
if (xaccSplitGetAccount(split) == account)
{
splits = g_list_append(splits, split);
gnc_ui_print_check_dialog_create2 (plugin_page, splits);
gnc_ui_print_check_dialog_create (window, splits);
g_list_free(splits);
}
else
@ -2621,7 +2623,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
if (split)
{
splits = g_list_append(splits, split);
gnc_ui_print_check_dialog_create2 (plugin_page, splits);
gnc_ui_print_check_dialog_create (window, splits);
g_list_free(splits);
}
}
@ -2643,14 +2645,13 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
{
if (xaccSplitGetAccount (split) != common_acct)
{
GtkWidget *dialog, *window;
GtkWidget *dialog;
gint response;
const gchar *title = _("Print checks from multiple accounts?");
const gchar *message =
_("This search result contains splits from more than one account. "
"Do you want to print the checks even though they are not all "
"from the same account?");
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@ -2672,11 +2673,11 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
}
}
}
gnc_ui_print_check_dialog_create2 (plugin_page, splits);
gnc_ui_print_check_dialog_create (window, splits);
}
else
{
gnc_error_dialog (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)), "%s",
gnc_error_dialog (window, "%s",
_("You can only print checks from a bank account register or search results."));
LEAVE("Unsupported ledger type");
return;

View File

@ -457,7 +457,7 @@ csv_import_assistant_summary_page_prepare (GtkAssistant *assistant,
if (info->new_book)
info->new_book = gnc_new_book_option_display (info->window);
if (!g_strcmp0 (info->error, "") == 0)
if (g_strcmp0 (info->error, "") != 0)
{
GtkTextBuffer *buffer;

View File

@ -262,14 +262,14 @@ csv_account_import (CsvImportInfo *info)
xaccAccountSetName (acc, name);
xaccAccountSetType (acc, xaccAccountStringToEnum (type));
if (!g_strcmp0 (notes, "") == 0)
if (g_strcmp0 (notes, "") != 0)
xaccAccountSetNotes (acc, notes);
if (!g_strcmp0 (description, "") == 0)
if (g_strcmp0 (description, "") != 0)
xaccAccountSetDescription (acc, description);
if (!g_strcmp0 (code, "") == 0)
if (g_strcmp0 (code, "") != 0)
xaccAccountSetCode (acc, code);
if (!g_strcmp0 (color, "") == 0)
if (g_strcmp0 (color, "") != 0)
{
if (gdk_color_parse (color, &testcolor))
xaccAccountSetColor (acc, color);
@ -309,19 +309,19 @@ csv_account_import (CsvImportInfo *info)
/* Lets try and update the color, notes, description, code entries */
DEBUG("Existing account, will try and update account %s", full_name);
info->num_updates = info->num_updates + 1;
if (!g_strcmp0 (color, "") == 0)
if (g_strcmp0 (color, "") != 0)
{
if (gdk_color_parse (color, &testcolor))
xaccAccountSetColor (acc, color);
}
if (!g_strcmp0 (notes, "") == 0)
if (g_strcmp0 (notes, "") != 0)
xaccAccountSetNotes (acc, notes);
if (!g_strcmp0 (description, "") == 0)
if (g_strcmp0 (description, "") != 0)
xaccAccountSetDescription (acc, description);
if (!g_strcmp0 (code, "") == 0)
if (g_strcmp0 (code, "") != 0)
xaccAccountSetCode (acc, code);
}
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (info->store), &iter);

View File

@ -505,7 +505,7 @@ int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,
parse_data->raw_str.end = parse_data->raw_str.begin + g_mapped_file_get_length (parse_data->raw_mapping);
/* Make a guess at the encoding of the data. */
if (!g_mapped_file_get_length (parse_data->raw_mapping) == 0)
if (g_mapped_file_get_length (parse_data->raw_mapping) != 0)
guess_enc = go_guess_encoding ((const char*)(parse_data->raw_str.begin),
(size_t)(parse_data->raw_str.end - parse_data->raw_str.begin),
"UTF-8", NULL);

View File

@ -215,11 +215,10 @@
(define oldintervalreversed (reverse (make-interval-list to-date)))
(reverse (cons dayforcurrent oldintervalreversed)))
(define (make-aging-table options query bucket-intervals reverse? date-type)
(define (make-aging-table options query bucket-intervals reverse? date-type currency)
(let ((lots (xaccQueryGetLots query QUERY-TXN-MATCH-ANY))
(buckets (new-bucket-vector))
(payments (gnc-numeric-zero))
(currency (gnc-default-currency)) ;XXX
(table (gnc:make-html-table)))
(define (in-interval this-date current-bucket)
@ -418,9 +417,10 @@
(total (gnc-numeric-zero))
(debit (gnc-numeric-zero))
(credit (gnc-numeric-zero))
(tax (gnc-numeric-zero))
(sale (gnc-numeric-zero))
(currency (gnc-default-currency)) ;XXX
(currency (xaccAccountGetCommodity acc))
(table (gnc:make-html-table))
(reverse? (gnc:option-value (gnc:lookup-option options "__reg"
"reverse?"))))
@ -523,7 +523,7 @@
"grand-total"
(list (gnc:make-html-table-cell/size
1 columns-used-size
(make-aging-table options query interval-vec reverse? date-type)))))
(make-aging-table options query interval-vec reverse? date-type currency)))))
table))

View File

@ -53,7 +53,7 @@
)
(define (set-option! section name value)
(gnc:option-set-value
(gnc:option-set-default-value
(gnc:lookup-option options section name) value))
;; Match, by default, all non-void transactions ever recorded in

View File

@ -57,7 +57,7 @@
(define pagename-sorting (N_ "Sorting"))
(define (set-option! section name value)
(gnc:option-set-value
(gnc:option-set-default-value
(gnc:lookup-option options section name) value))
;; set options in the accounts tab...

View File

@ -1487,7 +1487,7 @@ Credit Card, and Income accounts.")))))
(set! splits (qof-query-run query))
(gnc:warn "Splits in trep-renderer:" splits)
;;(gnc:warn "Splits in trep-renderer:" splits)
;;(gnc:warn "Filter account names:" (get-other-account-names c_account_2))