Behaviour is as follows:
If
single line provides a price
And
at some point in the import process we get into a
situation where the base account and transfer
account have a different commodity
Then
transfer_acct amount = base_acct amount * price
If on the other hand base_acct and transfer_acct turn
out to have the same commodity, price is ignored.
There is no added value in storing the book and account together
The book is easily retrieved from the account (as was
illustrated in the gnc_account_imap_new function).
I looked through the commit history to understand why this struct
was originally created and a long time ago it also had
a reference to a kvp frame.
This change was inspired by mildred's #PR1247 and uses the new
GncReportCombo to allow selection of 'Saved Invoice reports' when the
invoice print button is used or when printing multiple invoices.
This change presents a dialog with the default for the report combo set
to the properties setting. This dialog has a timeout which is
adjustable under properties and will stop if a key is pressed or combo
popped so that a different report template can be selected and used.
There is also an 'OK' button that stops the time out and prints and a
'Cancel' button which cancels the print.
This commit changes the preference in Business->'Report for Printing'
to be saved as a book property and allow the selection of any Invoice
Report to be used as the default.
- Show proper amount in dialog when applying or editing an existing transaction as payment
- Be more careful not to waste the existing payment split
- If the user changed the payment amount while starting from an existing transaction
unreconcile the changed payment split
- Avoid needlessly changing transaction currency (only do so if the user chose
a new transfer account and the old currency is neither the new transfer account's
currency nor the post account's currency)
gnc_commodity_compare is used for sorting and so needs to have a less-than
return value. The only place it's used presents nothing to the UI; a GncGUID
ordering is fast and stable.
GnuCash allows only one commodity per book for any namespace/mnemonic pair, so
the exhaustive string comparisons are superflous. While the current engine
design allows only one instance of any object, meaning that a pointer comparison
is sufficient to determine equality, that may not be true in the future, but the
GncGUID is guaranteed to sufficiently identify a single commodity. Note that
gnc_commodity_equiv is used to enforce that single-commodity rule and so cannot
use GncGUID comparison.
from .../gnucash-4.8/libgnucash/app-utils/gnc-quotes.cpp:33:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message:
The practice of declaring the Bind placeholders (_1, _2, ...) in the
global namespace is deprecated.
Please use <boost/bind/bind.hpp> + using namespace boost::placeholders,
or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
The issue was fixed in boost 1.76, but, e.g ubuntu 22.04 has boost 1.74
The idea behind this is to not assume the project is always built
as "gnucash" exactly.
One example where it can be useful to use a different project name
would be when building multiple development versions of the project
on the same system and don't want these different versions share
the same settings in GSettings or the same stored passwords.
When higher and lower limits are zero, when used for a a suspense
account, change the icon to 'dialog-warning'. This type of use is to
indicate that a non zero balance exists.
Root cause is using boost::locale::translate because it ignores
the LANGUAGES environment variable and doesn't support different
values for LC_MESSAGES, LC_DATE, LC_MONETARY, and LC_NUMERIC.
That makes it impossible to configure a user environment that
presents translated strings in a different locale from the one
applied to formatting dates and numbers.
To correct this replace all use of boost::locale::translate
with GNU gettext.
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.
There were two issues here, the first one was that the copied doclink
was pointing to the original doclink which lead to a double-free. The
second is the setting of the doclink on the copied invoice needs to be
done with gncInvoiceSetDocLink otherwise on closure the doclink value
will disappear.
- avoid hashing Account* twice. one call to operator[] is sufficient.
- don't need use std::move with better constructors
- sanity check - can't have a budget with num_periods = 0
- remove unused headers
- don't need to create/destroy GHashTable for each feature query
- plugs leak: g_hash_table_unref (features_used) not always called properly
- to check 1 feature, don't need to traverse whole GHashTable
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.
This rewritten version takes JSON input and spits out JSON.
Additionally inverted currency quotes will only be flagged.
The old code also swapped currencies in the result.
GncQuotes will be written towards these new implementation
choices.
At the same time do an explicit reinstantiation of quotes_cached at first use
to work around what seems to be a race condition between static instantiation
and binreloc.
This library intends to wrap Finance::Quote the way price-quotes.scm currently does.
In this first commit the library replaces price-quotes.scm's library to install
quote sources. In addition it exposes a new command line parameter in gnucash-cli
to show which version of Finance::Quote is installed on the system (if any) and
which quotes sources that verions exposes.
Instead of using static_assert. This prevents the compiler from even
trying and avoids weird compilation errors when testing types for
instantiating other templates.
The compiler complains that there's no matching
gnc_register_number_range_option for GncOptionDB*, which without this
commit is true because the explicit templates are for GncOptionDBPtr&.
Note that the original template definition is for GncOptionDB* and
that the header-defined inlines that take GncOptionDBPtr& call the
GncOptionDB* version.
Instead of using static_assert. This prevents the compiler from even
trying and avoids weird compilation errors when testing types for
instantiating other templates.
The compiler complains that there's no matching
gnc_register_number_range_option for GncOptionDB*, which without this
commit is true because the explicit templates are for GncOptionDBPtr&.
Note that the original template definition is for GncOptionDB* and
that the header-defined inlines that take GncOptionDBPtr& call the
GncOptionDB* version.