A fairly extensive change, because I changed may_clobber from a global
qof function (which passed through qofbackend and fetched up in the
actual backends) to a local static in the individual backends which
raise a new qof_backend_error, QOF_ABCKEND_STORE_EXISTS. This was
necessary to reorder the existence check before the lock, because with
the sql backends, locking creates the database... which then would
return may_clobber as true, even though it really wasn't.
New parameter "force" added to session_begin() functions, and
"create_if_nonexistant" is renamed to simply "create". The reason for
the latter is that the file/database is created regardless of whether it
already exists; that's what the clobber check is about. The new "force"
parameter is set to true the second time through, after the user has
responded to the clobber dialog indicating that the data should be
destroyed.
Many of the extraneous changes are just adding the new parameter to the
session_begin() calls.
gnc-file changes to handle the error in favor of calling the
no-longer-existing qof_check_may_clobber_data() call after
session_begin().
Two minor changes to gnc_file_do_save_as: gnc_add_history and
gnc_hook_run are now called on new_session instead of old_session; this
ensures that the new file/database is used at the next startup of
gnucash. Second, the filename/url is filtered before displaying the
"may_clobber" dialog box to prevent displaying plaintext database
passwords.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19798 57a11ea4-9604-0410-9ed3-97b8803252fd
Patch by Christoph Holtermann:
For the second enhancement proposal i have attached a simple patch which adds
the argument ignore_lock to Session.__init__() which is passed through to
qof_session_begin.
This patch extends the function Session.__init__() with ignore_lock
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19795 57a11ea4-9604-0410-9ed3-97b8803252fd
we can handle. Wrap fileURLWithPath in @try/@catch so that we don't
crash when it throws.
Free bonus fix: If "en" is the language and doesn't have a translation, force the C locale.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19785 57a11ea4-9604-0410-9ed3-97b8803252fd
When I open a report window (barchart in the example) and select only one
account, I get a column header saying "nil" near the only data column.
Someone accidentally wrote "nil" instead of the empty list '().
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19783 57a11ea4-9604-0410-9ed3-97b8803252fd
In the "bills due" dialog we use Bill -> Rechnung, not Lieferantenrechnung.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19782 57a11ea4-9604-0410-9ed3-97b8803252fd
If during startup a file or database turns out to beeing locked the user is
presented a dialog with the options to open anyway, create a new file or abort.
This dialog, however, closes the splash screen. This may cause confusion,
because file loading and report generation may still take quite some time.
Patch by Herbert Thoma.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19781 57a11ea4-9604-0410-9ed3-97b8803252fd
Follow-up to r19757 which was incomplete. Hopefully I now really got everything.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19758 57a11ea4-9604-0410-9ed3-97b8803252fd
The last occurrence wasn't counted because it was still valid
but turned num_occur_rem to zero, hence the counting stopped one too early.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19757 57a11ea4-9604-0410-9ed3-97b8803252fd
* Check for a null gdate before attempting to make it a string. Fixes a bunch
of CRIT errors.
* Comment out the log debug setting in dbi. It's stable enough that it
shouldn't be needed routinely. It can, of course, be enabled from the command
line.
* Add a notice to ignore the warnings about there being no lock on the
database when session 3 is closed. Session 3 has to be run with ignore
locking or it won't run at all.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19755 57a11ea4-9604-0410-9ed3-97b8803252fd
Biggest problem was that almost well-formed transactions missing a currency
element wouldn't import correctly because the FindCommonCurrencies function
only used the old currency values, ignoring the commodity values in the
splits' accounts. A new function, xaccFindCommonCurrencies(), looks at those
first and then calls xaccFindOldCommonCurrencies only if it fails. That
addresses the cause of the import failure reported in 632166 and a big chunk
of the warning messages complained about in 632346.
A secondary problem, also addressed in this change, was that the last block
in xaccTransScrubCurrencyFromSplits always replaced the "amount" with the
"value". This is the right thing to do if the commodity for the split account
is a currency, but if it isn't, the replacement should be reversed.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19744 57a11ea4-9604-0410-9ed3-97b8803252fd
Accounts with security elements would only use the security to update the
commodity if there wasn't a commodity; however, the files in the tests had
accounts which had a security and a commodity, where the commodity was a
currency. That's wrong. so now if the commodity is a currency, the security
will overwrite it.
Added the account name and element name to the log message to assist in
troubleshooting, should that be needed.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19743 57a11ea4-9604-0410-9ed3-97b8803252fd
* dbi_conn_error_flag is deprecated, replace with dbi_conn_error
(Thanks, Christian).
* Switch from OS-determined HOST_NAME_MAX to locally defined
GNC_HOSTNAME_MAX so that the field is always 255 regardless of what
OS creates it.
* Use G_OS_WIN32 instead of naked WIN32
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19740 57a11ea4-9604-0410-9ed3-97b8803252fd
* Accounting Period: reorder options so the dates are on top
* Business: reorder options to clarify which options are general and which apply to invoices or bills only
* Business: remove obscure "Number of lines" option
* Register defaults: remove obscure "Number of lines" option
* General: remove "Show splash screen" option
While removing the "Number of lines" options, I have also removed most of the code that used this option. The number of lines was used to calculate the default window size in various places in the code. The code now simply uses sensible defaults for that.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19733 57a11ea4-9604-0410-9ed3-97b8803252fd
This patch changes the default rounding behaviour in GnuCash from
"Round to nearest even" to "Round away to infinity". See the bugreport
for more details on these different rounding methods.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19695 57a11ea4-9604-0410-9ed3-97b8803252fd
Replaces the pointer arithmetics with string functions and regexes where possible
to avoid typical pointer pitfalls.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19694 57a11ea4-9604-0410-9ed3-97b8803252fd
deletes an existing transaction. Log replay should now do exactly one xaccTransBeginEdit/xaccTransCommitEdit
call per logged transaction.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19689 57a11ea4-9604-0410-9ed3-97b8803252fd
Save as would make a new session the "current session" and attempt to
save it. If it failed, the new session (with an invalid database)
would remain the current session -- and would be marked clean. An
XML-only file-save-as dialog would be presented with no instructions
about what was going on.
With this change, if the "save as" fails, the old session is restored,
still marked unsaved. This should be much less confusing to users and
more likely to avoid data loss.
Yes, there's some duplicated code now, because do_save_as doesn't call
save. That's because save did some extra things that do_save_as
doesn't need and it didn't allow do_save_as to properly correct the
session. This could be refactored into some tiny functions, but that
seems a bit excessive to me.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19687 57a11ea4-9604-0410-9ed3-97b8803252fd