Don't create a new book in the new-user dialog unless the user says to.
Don't automatically create a new book when retrieving default commodities
because the retrieve might be requested in a context like the Preferences
dialog when there is no book.
Some report tests relied on requesting the default commodity creating
the book, so in those tests ensure that the book is created first.
Control character check doesn't need normalization, the control character
codepoints aren't graphic and so can't be composed nor have compatible
equivalents.
By embedding a minimal Info.plist with a bundle ID into the executable.
This necessitated a change to binreloc because the unix-style install
depended on there being a bundle ID only when the program was run from
an application bundle.
Plus there's no need for a "not found" version string because GncQuotes
construction will throw if Finance::Quote isn't correctly installed. No
object, nothing to call version() on.
With XCode 14 or newer CMake tries to use the "new build system" which has a
requirement that if two targets depend on the same generated file one of them
must depend on the other. This commit adds reduntant dependencies to satisfy
this requirement.
A check of the F::Q modules found that the only ones that return a quote
time return a bogus one and do so only to mollify GnuCash.
Since there's no good way to determine the TZ of the exchange originating
the quote there's no good way to decide if the quote is current or from
a previous market session, so we just punt and use a time of 16:00 for
all quotes.
Allows for cleaner code with less state, less coupling of the GncQuotes
class, and better transfer of error messages to client code.
Also translates some error messages for presentation to users.
Provide a specialization GncFQQuoteSource and move the F::Q command
construction and query functions to GncFQQuoteSource.
This allows for dependency injection to provide testing that doesn't
need F::Q to be installed.
- make more use of auto
- mark user visible strings as translatable
- return early on input errors
- fix date conversion fallback to actually fall back to today
The book parameter is only needed while fetching quotes.
In case the user passes one or more commodities to process
the book can be readily derived from the commodity/commodities.
In the other case (fetch all quotes) the user now is
required to pass a book to the call.
This code will convert the json data into GncPrice objects and add them
to the pricedb, effectively doing what price-quotes.scm does.
A few notable remarks:
- still requires plenty of cleaning up. This is the first proof of concept
- like the original scm based code, this parser completely ignores timezone
information. As it wasn't used before and nobody complained, it may not
be that important. Or it can be implemented later.
- price-quotes.scm would first check if a price already existed in the pricedb
and try to update that one instead of adding one (only if the old price's
type is inferior). However that is redundant as gnc_pricedb_add_price does
the same check. So I have omitted this extra check from GncQuotes.
- currency quotes can be inverted. I have slightly changed the way to handle
this. The perl wrapper code will simply set an "inverted" flag in that case,
but will otherwise not swap currency and commodity as it used to be the case.
On parsing, the inversion flag will cause the GncNumeric that's parsed from
the price to be inverted. As it's still a GncNumeric that shouldn't result
in any loss of precision, while keeping prices in the db always in the default
currency.
That allows the private implementation to pass a number of variables
based on various boost libraries. It's better to not have them in
the public interface to keep compilation times down.
For all but the basic check a book is required. Might
as well be able to pass it directly and store a reference
to it. That will simplify member function declarations.
I have been reading on singleton implementations and there appears
to be a lot of pushback against those.
We can revisit this if it turns out performance degrades
significantly by running the F::Q check multiple times.