Commit Graph

391 Commits

Author SHA1 Message Date
Andreas Köhler
dcfda18f7c Revert some qof_instance_get_guid() calls to qof_entity_get_guid().
Those two functions were merged into one, qof_instance_get_guid(), in
r15773, but they returned different values if the parameter was NULL.
Some code depends on the return value being guid_null(), or maybe even
NULL, so revert the changes entity->instance, where the entity is not
guaranteed to be non-NULL.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16212 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-06-25 17:18:28 +00:00
David Hampton
9ec864163d Collapse the various "idata" fields into a single field attached to
the QofInstance object.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16042 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-05-03 03:56:31 +00:00
David Hampton
cad2164810 Collapse the various "version" and "version_check" fields into a
single pair of fields attached to the QofInstance object.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16041 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-05-03 02:56:56 +00:00
David Hampton
285a5216b3 Move QofInstance guid property from its public data structure to its
private data structure.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16039 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-05-02 05:42:41 +00:00
David Hampton
4f6fd1b090 Move QofInstance book properties from its public data structure to its
private data structure.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16038 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-05-02 03:18:46 +00:00
David Hampton
ce65024722 Start putting an API in place for access to the members of the
QofInstance object.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16025 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-30 05:33:33 +00:00
David Hampton
ecd3e31481 Changing the transaction number can affect the split sort order and
thus the running account balances.  Fixes #386074.
BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15989 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-22 20:04:53 +00:00
Derek Atkins
18c4cbf122 First step of QOF/Object GObjectification.
- Merge QofEntity into QofInstance
- Derive QofInstance from GObject
- Convert all QofInstance-derived objects to use GObject framework
- renamed qof_instance_init() to qof_instance_init_data()
- removed qof_instance_release() because it's no longer needed

Merge from branches/gobject-engine-dev-warlord  (r15827)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15846 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-07 16:02:27 +00:00
David Hampton
df0cfeddc2 The function name xaccSplitDateOrder is misleading, so rename it to
xaccSplitOrder.  Add a new xaccSplitOrderDateOnly function.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15838 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-06 02:31:28 +00:00
David Hampton
392cd816a3 Balance ENTER/LEAVE calls on some functions.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15829 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-06 00:19:08 +00:00
Derek Atkins
8c6e7b8394 Add hooks for the gobject dispose() function so that we can
migrate each object's "free()" function to a combination of
dispose() and finalize().
(and yes, "make check" still passes all its tests)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15827 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-05 03:10:26 +00:00
Derek Atkins
e097404f0b Convert the Transaction object to GObject Initialization
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15808 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-05 00:23:58 +00:00
David Hampton
8c332ae13b Implement idea from Mike Alexander (in #346063) to key lot scrubbing
off the environment variable GNC_AUTO_SCRUB_LOTS instead of commenting
it out of the code.  This make it easier for developers to test/users
to try lot scrubbing.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15791 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-04 04:58:07 +00:00
Derek Atkins
12461c5b30 * Merge QofEntity into QofInstance
- QofEntity -> QofInstance
  - qof_entity -> qof_instance
  - QOF_ENTITY -> QOF_INSTANCE
* remove references to instance.entity
* keep qof_entity_init() and qof_entity_release() for now


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/gobject-engine-dev-warlord@15773 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-01 22:18:50 +00:00
David Hampton
6fbada92ec Remove all traces of the AccountGroup data structure. Accounts now
point directly to their parent and have a simple GList of children.
(The old method was alternating data structures in the form Account,
AccountGroup, Account, AccountGroup, etc.)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15647 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-02-23 01:23:31 +00:00
Derek Atkins
c7c9199800 Add the ability to override the default sort (#150799).
Override the Transaction Number to sort numerically.
	* lib/libqof/qof/qofclass.h:
	* lib/libqof/qof/qofquery.c:
	* lib/libqof/qof/qofquerycore-p.h:
	* lib/libqof/qof/qofquerycore.[ch]:
	  - Publish the QofCompareFunc prototype.
	  - Add a new QofParam param_compfcn parameter
	  - Change QofQuery to use the param_compfcn over the
	    default type compare function.
	  - create (and publish) a qof API to compare strings
	    as numbers:  qof_string_number_compare_func()
	* src/engine/Transaction.c:
	  Assign TRANS_NUM to use qof_string_numer_compare_func()



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14903 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-09-27 13:39:32 +00:00
Derek Atkins
8bf369217a Revert r14892 in order to try a different approach.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14902 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-09-27 13:30:05 +00:00
Derek Atkins
2bb357def4 Add a new QOF_TYPE_NUMSTRING to add numeric sorts. (#150799).
This new type is like QOF_TYPE_STRING but it sorts numerically
	  (first) and then sorts alphanumerically (by the tail of the
	  number).  Added the QOF Type, the gnome-search support, and
	  modified TRANS_NUM to use the new type.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14892 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-09-26 00:36:30 +00:00
David Hampton
4c16d03e99 Restore 1.8 behavior by using the full date/time when sorting on the
posted date.  Fixes #346954.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14470 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-07-08 15:35:31 +00:00
Chris Shoemaker
97062a3b81 Merge 'misc-backend' -r 14160:14184 into trunk.
This includes the now semi-functional postgres backend.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14198 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-26 00:10:35 +00:00
Chris Shoemaker
9b64ae68a7 Disable Lots scrubbing, which is causing test-suite failures.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14050 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-14 21:30:22 +00:00
Chris Shoemaker
7bb7a5536c Remove some unnecessary calls to xaccGroupMarkNotSaved() which were
dirtying the book implicitly without setting any time of first change.
   Instead, make sure that committed Splits dirty their parent Transaction.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13958 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-08 04:56:17 +00:00
Chris Shoemaker
40a9ed1925 Move some gains-related transaction-scrubbing operations to from
cap-gains.c to Transaction.c.
   Fix a logic error where "split->gains |= ~GAINS_STATUS_ADIRTY" was supposed
   to be "split->gains &= ~GAINS_STATUS_ADIRTY".

   Disable the loop-restart code in xaccTransScrubGainsDate() because I think
   the state changes inside the loop will never cause a previously-skipped 
   Split to be not skipped during another pass.

   Incidental:
      make both xaccTransFindSplitByAccount() arguments 'const'
      Internalize Begin/Commit edit block into xaccTransScrubSplits()


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13921 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-05 00:40:15 +00:00
Chris Shoemaker
0589407c66 Hide the Transaction's management of the "reverse-by" KVP inside the engine.
Add new function xaccTransGetReversedBy() to find the reversing transaction
   if there is one.
   This also ensures that the KVP changes are inside a Begin/Commit block.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13916 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-04 00:06:58 +00:00
David Hampton
4a5f6e30ca Mike Alexander's patch to fix lot date calculation, and to include all
splits when computing capital gain's instead of just the opening lot.
Scrub lots when scrubbing everything else.  Some MacOs X fixes.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13872 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-28 21:11:01 +00:00
Chris Shoemaker
cf8d35eb04 Internalize the transactional semantics for all Transaction setters.
This is what I actually intended in r13130, but we want the stuff that
   xaccTransCommitEdit provides over-and-above what qof_commit_edit provides.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13830 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-22 05:14:48 +00:00
Chris Shoemaker
39d4d945b8 Replace calls to QOF_COMMIT_EDIT_PART1 macro with calls to qof_commit_edit()
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13827 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-22 04:42:29 +00:00
David Hampton
dc28af130f The kvp_frame_get_string() function returns a pointer to an internal
string.  Mark it 'const' to prevent callers from trying to free it.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13786 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-15 16:40:03 +00:00
Derek Atkins
d9c78bd0fe Fix a bunch of 64-bit compile issues.
* src/engine/Transaction.c:
	* src/engine/test/test-date.c:
	* src/backend/file/test/test-dom-converters1.c:
	  Fix 64-bit compile: Use G_GUINT64_FORMAT instead of %llu or lld
	  for Timespec seconds.
	* src/app-utils/gnc-ui-util.c:
	  Fix 64-bit compile issues:
	  - Use QOF_SCANF_LLD instead of GNC_SCANF_LLD.
	  - Use QOF_SCANF_LLD and G_GINT64_FORMAT properly.
	  - replace %lld with G_GINT64_FORMAT



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13780 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-14 16:45:10 +00:00
David Hampton
4ee1e008a8 Add a new event for when a split associated with account is changed.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13779 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-14 05:37:34 +00:00
Chris Shoemaker
7b489a6943 Avoid generating Transaction modified events for Transaction roll-back.
Enable emission of some new Split events.
   Use xaccSplitRollbackEdit() in implementation of xaccTransRollbackEdit().
   Avoid rollback of Splits not owned by the Transaction.  This was actually
   impossible to encounter, but the algorithm is now correct even for some
   cases that aren't permitted by other code. 


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13766 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-11 02:55:57 +00:00
Derek Atkins
422bf34bfe Get gnucash to build properly with the new QOF changes (0.6.4+)
* src/backend/file/sixtp-utils.c:
	  use QOF_SCANF_LLD to read 64-bit numbers.
	* src/gnome-utils/QuickFill.c:
	* src/engine/gnc-pricedb.c:
	* src/engine/Transaction.c:
	* src/engine/gnc-commodity.c:
	  convert gnc_string_cache* APIs to CACHE_* APIs.
	* src/engine/Account.c:
	  Properly convert usage of SAFE_STRCMP() to safe_strcmp()
	* src/engine/kvp-scm.c:
	  #include <qof.h> instead of <kvp_frame.h>
	* src/engine/gnc-engine.c:
	  Update the method used to shutdown QOF.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13765 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-10 22:20:12 +00:00
Derek Atkins
5028d178ea Revert r13749. Wedon't need to explicitly #include glib.h
because qof.h includes it for us.  Also, this changeset contains
lots of other stuff that has nothing to do with glib.h.  Note
that this revision wont build, but I'll fix that shortly.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13763 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-10 21:49:44 +00:00
Neil Williams
66a9c0b6ac Explicitly including glib.h instead of relying on libqof to reduce dependency problems.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13749 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-04-07 18:51:52 +00:00
David Hampton
e615f2ec5a Restore sorting transactions by date posted. Fixes 335190.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13719 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-31 06:38:47 +00:00
Christian Stimming
04998d5e37 Add substitution code for unavailable function gettimeofday
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13563 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-09 16:44:11 +00:00
David Hampton
61a12b2715 Remove more functions to be deprecated in libqof2. (Pass Two - more
trivial substitutions, some simple translations.)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13547 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-09 03:48:49 +00:00
David Hampton
41db89c516 Remove functions to be deprecated in libqof2. (Pass One - trivial
substitutions)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13545 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-09 02:29:29 +00:00
Chris Shoemaker
a1b27bc933 More line-wraps, cleanups, factoring new function: xaccTransGetSplitIndex().
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13538 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-08 05:47:36 +00:00
David Hampton
399f475f2c Use utf8 collation routines when sorting splits in a register. Also,
only sort on the date of transactions (not date and time) since
gnucash doesn't allow times to be input.  Fixes #127809.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13497 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-05 21:14:19 +00:00
Chris Shoemaker
84bcf5685b Convert xaccTransGetSplit() and xaccTransCountSplits() to return the
index and count reflective of any in-progress edit.
   Convert some split iterators from directly using the GList of Splits to 
   using xaccTransGetSplit().


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13487 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-05 04:14:38 +00:00
David Hampton
d46c86ca3a Rename a data structure field.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13482 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 23:06:39 +00:00
Chris Shoemaker
9a65cc1cc6 When the book is shutting down, don't be so eager to destroy the whole
transaction.  This makes it easier to safely iterate over a split list.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13471 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 06:56:27 +00:00
Chris Shoemaker
803e157ed6 Destroy Transactions without rebalancing when shutting down the book.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13469 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 05:10:15 +00:00
Chris Shoemaker
d0f3042d8f Generate REMOVE events when a Split is removed from a Transaction.
Pass the *old* parent transaction (since the Split may be moving into 
   a new transaction) and the old index of the Split in the old Transaction's
   list of Splits.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13468 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 03:21:34 +00:00
Chris Shoemaker
6782a2b49d The xaccTransRollbackEdit() part of the Begin/Commit edit-block rewrite.
Broken out just for clarity.

   Note: There's one piece that I didn't change that I think is conceptually
   awkward.  It has to do with how/when we would discover that another
   user has deleted the transaction we're currently editing.  I think it makes
   more sense to detect and handle this case in xaccTransCommitEdit() instead
   of xaccTransRollbackEdit(), because (a) we don't actually have to do the 
   rollback if we just destroy the trans, (b) some rollbacks are not backend-
   induced, but rather voluntary, (c) we need a generalized mechanism
   anyway for detecting and handling deleted transactions even when
   we're not editing them.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13461 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 00:11:16 +00:00
Chris Shoemaker
7bad37599c A good bit of notes about how the Transaction Begin/Commit
edit-blocks should work, and why. 

   Converts the very important xaccTransCommitEdit function to use the 
   qof_commit_edit_part2() function instead of something that is 90%
   similar.

   Transactions have a Split list that keeps track of Splits during the edit.
   During edits, this list only grows and never shrinks.  Splits that
   have been destroyed or reparented to other transactions remain in
   the list, along with pre-edit Splits and newly added Splits.  Only after a 
   successful commit does the Split list drop reparented or destroyed
   Splits.  A couple out-of-engine users (mainly the register) call
   xaccTransGetSplitList() an work from the Transaction's split list,
   but they expect to be working with only the Splits that would still be in 
   the Transaction if the in-progress edit would be committed.  So, we
   provide the function xaccTransStillHasSplit(t, s) to allow users to query 
   the in-edit state of the Transaction's Split list.

   xaccTransRemoveSplit() and xaccTransInsertSplit() have been replaced by
   xaccSplitSetParent().

   The new xaccTransCommitEdit tries to take a more conservative approach
   to event generation, too.  Instead of generating every possible event for 
   any commit, it should generate only events that indicate a change to an 
   engine object or relation.

   Move some of the financial-constraint-enforcing functions closer to the 
   relevant data-structures. (from Scrub.c)



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13459 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-04 00:10:12 +00:00
David Hampton
bf46ee7847 Move the storage for the account separator character into Account.c
(default ':') and set it with an accessor function at startup and when
it is changed in the preferences/gconf.  Eliminate unnecessary passing
around of the account separator character.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13435 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-02 07:20:33 +00:00
Chris Shoemaker
3d6a06e208 Separate the Split functions from Transaction.c into Split.c.
Introduce xaccSplitVoid() and xaccSplitUnvoid() to aid the separation.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13363 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-02-22 21:52:46 +00:00
Chris Shoemaker
00ba10ef00 Add some comments, error checks, ENTER/LEAVE balances and a special-case
early-return for the conversion-rate calculation.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13362 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-02-22 17:41:58 +00:00