GnuCash  5.6-150-g038405b370+
gnc-transaction-xml-v2.cpp
1 /********************************************************************
2  * gnc-transactions-xml-v2.c -- xml routines for transactions *
3  * Copyright (C) 2001 Rob Browning *
4  * Copyright (C) 2002 Linas Vepstas <linas@linas.org> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License*
17  * along with this program; if not, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA gnu@gnu.org *
22  * *
23  *******************************************************************/
24 #include <glib.h>
25 
26 #include <config.h>
27 #include <string.h>
28 #include "AccountP.hpp"
29 #include "Transaction.h"
30 #include "TransactionP.hpp"
31 #include "gnc-lot.h"
32 #include "gnc-lot-p.h"
33 
34 #include "gnc-xml-helper.h"
35 
36 #include "sixtp.h"
37 #include "sixtp-utils.h"
38 #include "sixtp-parsers.h"
39 #include "sixtp-utils.h"
40 #include "sixtp-dom-parsers.h"
41 #include "sixtp-dom-generators.h"
42 
43 #include "gnc-xml.h"
44 
45 #include "io-gncxml-gen.h"
46 
47 #include "sixtp-dom-parsers.h"
48 
49 [[maybe_unused]] static const QofLogModule log_module = G_LOG_DOMAIN;
50 const gchar* transaction_version_string = "2.0.0";
51 
52 static void
53 add_gnc_num (xmlNodePtr node, const gchar* tag, gnc_numeric num)
54 {
55  xmlAddChild (node, gnc_numeric_to_dom_tree (tag, &num));
56 }
57 
58 static void
59 add_time64 (xmlNodePtr node, const gchar * tag, time64 time, gboolean always)
60 {
61  if (always || time)
62  xmlAddChild (node, time64_to_dom_tree (tag, time));
63 }
64 
65 static xmlNodePtr
66 split_to_dom_tree (const gchar* tag, Split* spl)
67 {
68  xmlNodePtr ret;
69 
70  ret = xmlNewNode (NULL, BAD_CAST tag);
71 
72  xmlAddChild (ret, guid_to_dom_tree ("split:id", xaccSplitGetGUID (spl)));
73 
74  {
75  char* memo = g_strdup (xaccSplitGetMemo (spl));
76 
77  if (memo && g_strcmp0 (memo, "") != 0)
78  {
79  xmlNewTextChild (ret, NULL, BAD_CAST "split:memo",
80  checked_char_cast (memo));
81  }
82  g_free (memo);
83  }
84 
85  {
86  char* action = g_strdup (xaccSplitGetAction (spl));
87 
88  if (action && g_strcmp0 (action, "") != 0)
89  {
90  xmlNewTextChild (ret, NULL, BAD_CAST "split:action",
91  checked_char_cast (action));
92  }
93  g_free (action);
94  }
95 
96  {
97  char tmp[2];
98 
99  tmp[0] = xaccSplitGetReconcile (spl);
100  tmp[1] = '\0';
101 
102  xmlNewTextChild (ret, NULL, BAD_CAST "split:reconciled-state",
103  BAD_CAST tmp);
104  }
105 
106  add_time64 (ret, "split:reconcile-date",
107  xaccSplitGetDateReconciled (spl), FALSE);
108 
109  add_gnc_num (ret, "split:value", xaccSplitGetValue (spl));
110 
111  add_gnc_num (ret, "split:quantity", xaccSplitGetAmount (spl));
112 
113  {
114  Account* account = xaccSplitGetAccount (spl);
115 
116  xmlAddChild (ret, guid_to_dom_tree ("split:account",
117  xaccAccountGetGUID (account)));
118  }
119  {
120  GNCLot* lot = xaccSplitGetLot (spl);
121 
122  if (lot)
123  {
124  xmlAddChild (ret, guid_to_dom_tree ("split:lot",
125  gnc_lot_get_guid (lot)));
126  }
127  }
128  /* xmlAddChild won't do anything with a NULL, so tests are superfluous. */
129  xmlAddChild (ret, qof_instance_slots_to_dom_tree ("split:slots",
130  QOF_INSTANCE (spl)));
131  return ret;
132 }
133 
134 static void
135 add_trans_splits (xmlNodePtr node, Transaction* trn)
136 {
137  GList* n;
138  xmlNodePtr toaddto;
139 
140  toaddto = xmlNewChild (node, NULL, BAD_CAST "trn:splits", NULL);
141 
142  for (n = xaccTransGetSplitList (trn); n; n = n->next)
143  {
144  Split* s = static_cast<decltype (s)> (n->data);
145  xmlAddChild (toaddto, split_to_dom_tree ("trn:split", s));
146  }
147 }
148 
149 xmlNodePtr
150 gnc_transaction_dom_tree_create (Transaction* trn)
151 {
152  xmlNodePtr ret;
153  gchar* str = NULL;
154 
155  ret = xmlNewNode (NULL, BAD_CAST "gnc:transaction");
156 
157  xmlSetProp (ret, BAD_CAST "version",
158  BAD_CAST transaction_version_string);
159 
160  xmlAddChild (ret, guid_to_dom_tree ("trn:id", xaccTransGetGUID (trn)));
161 
162  xmlAddChild (ret, commodity_ref_to_dom_tree ("trn:currency",
163  xaccTransGetCurrency (trn)));
164  str = g_strdup (xaccTransGetNum (trn));
165  if (str && (g_strcmp0 (str, "") != 0))
166  {
167  xmlNewTextChild (ret, NULL, BAD_CAST "trn:num",
168  checked_char_cast (str));
169  }
170  g_free (str);
171 
172  add_time64 (ret, "trn:date-posted", xaccTransRetDatePosted (trn), TRUE);
173 
174  add_time64 (ret, "trn:date-entered",
175  xaccTransRetDateEntered (trn), TRUE);
176 
177  str = g_strdup (xaccTransGetDescription (trn));
178  if (str)
179  {
180  xmlNewTextChild (ret, NULL, BAD_CAST "trn:description",
181  checked_char_cast (str));
182  }
183  g_free (str);
184 
185  /* xmlAddChild won't do anything with a NULL, so tests are superfluous. */
186  xmlAddChild (ret, qof_instance_slots_to_dom_tree ("trn:slots",
187  QOF_INSTANCE (trn)));
188 
189  add_trans_splits (ret, trn);
190 
191  return ret;
192 }
193 
194 /***********************************************************************/
195 
197 {
198  Split* split;
199  QofBook* book;
200 };
201 
202 static inline gboolean
203 set_spl_string (xmlNodePtr node, Split* spl,
204  void (*func) (Split* spl, const char* txt))
205 {
206  gchar* tmp = dom_tree_to_text (node);
207  g_return_val_if_fail (tmp, FALSE);
208 
209  func (spl, tmp);
210 
211  g_free (tmp);
212 
213  return TRUE;
214 }
215 
216 static inline gboolean
217 set_spl_gnc_num (xmlNodePtr node, Split* spl,
218  void (*func) (Split* spl, gnc_numeric gn))
219 {
220  func (spl, dom_tree_to_gnc_numeric (node));
221  return TRUE;
222 }
223 
224 static gboolean
225 spl_id_handler (xmlNodePtr node, gpointer data)
226 {
227  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
228  GncGUID* tmp = dom_tree_to_guid (node);
229  g_return_val_if_fail (tmp, FALSE);
230 
231  xaccSplitSetGUID (pdata->split, tmp);
232 
233  guid_free (tmp);
234  return TRUE;
235 }
236 
237 static gboolean
238 spl_memo_handler (xmlNodePtr node, gpointer data)
239 {
240  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
241  return set_spl_string (node, pdata->split, xaccSplitSetMemo);
242 }
243 
244 static gboolean
245 spl_action_handler (xmlNodePtr node, gpointer data)
246 {
247  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
248  return set_spl_string (node, pdata->split, xaccSplitSetAction);
249 }
250 
251 static gboolean
252 spl_reconciled_state_handler (xmlNodePtr node, gpointer data)
253 {
254  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
255  gchar* tmp = dom_tree_to_text (node);
256  g_return_val_if_fail (tmp, FALSE);
257 
258  xaccSplitSetReconcile (pdata->split, tmp[0]);
259 
260  g_free (tmp);
261 
262  return TRUE;
263 }
264 
265 static gboolean
266 spl_reconcile_date_handler (xmlNodePtr node, gpointer data)
267 {
268  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
269  time64 time = dom_tree_to_time64 (node);
270  if (!dom_tree_valid_time64 (time, node->name)) time = 0;
271  xaccSplitSetDateReconciledSecs (pdata->split, time);
272  return TRUE;
273 }
274 
275 static gboolean
276 spl_value_handler (xmlNodePtr node, gpointer data)
277 {
278  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
279  return set_spl_gnc_num (node, pdata->split, xaccSplitSetValue);
280 }
281 
282 static gboolean
283 spl_quantity_handler (xmlNodePtr node, gpointer data)
284 {
285  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
286  return set_spl_gnc_num (node, pdata->split, xaccSplitSetAmount);
287 }
288 
289 gboolean gnc_transaction_xml_v2_testing = FALSE;
290 
291 static gboolean
292 spl_account_handler (xmlNodePtr node, gpointer data)
293 {
294  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
295  GncGUID* id = dom_tree_to_guid (node);
296  Account* account;
297 
298  g_return_val_if_fail (id, FALSE);
299 
300  account = xaccAccountLookup (id, pdata->book);
301  if (!account && gnc_transaction_xml_v2_testing &&
302  !guid_equal (id, guid_null ()))
303  {
304  account = xaccMallocAccount (pdata->book);
305  xaccAccountSetGUID (account, id);
307  xaccSplitGetAmount (pdata->split).denom);
308  }
309 
310  xaccAccountInsertSplit (account, pdata->split);
311 
312  guid_free (id);
313 
314  return TRUE;
315 }
316 
317 static gboolean
318 spl_lot_handler (xmlNodePtr node, gpointer data)
319 {
320  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
321  GncGUID* id = dom_tree_to_guid (node);
322  GNCLot* lot;
323 
324  g_return_val_if_fail (id, FALSE);
325 
326  lot = gnc_lot_lookup (id, pdata->book);
327  if (!lot && gnc_transaction_xml_v2_testing &&
328  !guid_equal (id, guid_null ()))
329  {
330  lot = gnc_lot_new (pdata->book);
331  gnc_lot_set_guid (lot, *id);
332  }
333 
334  gnc_lot_add_split (lot, pdata->split);
335 
336  guid_free (id);
337 
338  return TRUE;
339 }
340 
341 static gboolean
342 spl_slots_handler (xmlNodePtr node, gpointer data)
343 {
344  struct split_pdata* pdata = static_cast<decltype (pdata)> (data);
345  gboolean successful;
346 
347  successful = dom_tree_create_instance_slots (node,
348  QOF_INSTANCE (pdata->split));
349  g_return_val_if_fail (successful, FALSE);
350 
351  return TRUE;
352 }
353 
354 struct dom_tree_handler spl_dom_handlers[] =
355 {
356  { "split:id", spl_id_handler, 1, 0 },
357  { "split:memo", spl_memo_handler, 0, 0 },
358  { "split:action", spl_action_handler, 0, 0 },
359  { "split:reconciled-state", spl_reconciled_state_handler, 1, 0 },
360  { "split:reconcile-date", spl_reconcile_date_handler, 0, 0 },
361  { "split:value", spl_value_handler, 1, 0 },
362  { "split:quantity", spl_quantity_handler, 1, 0 },
363  { "split:account", spl_account_handler, 1, 0 },
364  { "split:lot", spl_lot_handler, 0, 0 },
365  { "split:slots", spl_slots_handler, 0, 0 },
366  { NULL, NULL, 0, 0 },
367 };
368 
369 static Split*
370 dom_tree_to_split (xmlNodePtr node, QofBook* book)
371 {
372  struct split_pdata pdata;
373  Split* ret;
374 
375  g_return_val_if_fail (book, NULL);
376 
377  ret = xaccMallocSplit (book);
378  g_return_val_if_fail (ret, NULL);
379 
380  pdata.split = ret;
381  pdata.book = book;
382 
383  /* this isn't going to work in a testing setup */
384  if (dom_tree_generic_parse (node, spl_dom_handlers, &pdata))
385  {
386  return ret;
387  }
388  else
389  {
390  xaccSplitDestroy (ret);
391  return NULL;
392  }
393 }
394 
395 /***********************************************************************/
396 
398 {
399  Transaction* trans;
400  QofBook* book;
401 };
402 
403 static inline gboolean
404 set_tran_string (xmlNodePtr node, Transaction* trn,
405  void (*func) (Transaction* trn, const char* txt))
406 {
407  gchar* tmp;
408 
409  tmp = dom_tree_to_text (node);
410 
411  g_return_val_if_fail (tmp, FALSE);
412 
413  func (trn, tmp);
414 
415  g_free (tmp);
416 
417  return TRUE;
418 }
419 
420 static gboolean
421 set_tran_time64 (xmlNodePtr node, Transaction * trn,
422  void (*func) (Transaction *, time64))
423 {
424  time64 time = dom_tree_to_time64 (node);
425  if (!dom_tree_valid_time64 (time, node->name)) time = 0;
426  func (trn, time);
427  return TRUE;
428 }
429 
430 static gboolean
431 trn_id_handler (xmlNodePtr node, gpointer trans_pdata)
432 {
433  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
434  Transaction* trn = pdata->trans;
435  GncGUID* tmp = dom_tree_to_guid (node);
436 
437  g_return_val_if_fail (tmp, FALSE);
438 
439  xaccTransSetGUID ((Transaction*)trn, tmp);
440 
441  guid_free (tmp);
442 
443  return TRUE;
444 }
445 
446 static gboolean
447 trn_currency_handler (xmlNodePtr node, gpointer trans_pdata)
448 {
449  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
450  Transaction* trn = pdata->trans;
451  gnc_commodity* ref;
452 
453  ref = dom_tree_to_commodity_ref (node, pdata->book);
454  xaccTransSetCurrency (trn, ref);
455 
456  return TRUE;
457 }
458 
459 static gboolean
460 trn_num_handler (xmlNodePtr node, gpointer trans_pdata)
461 {
462  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
463  Transaction* trn = pdata->trans;
464 
465  return set_tran_string (node, trn, xaccTransSetNum);
466 }
467 
468 static gboolean
469 trn_date_posted_handler (xmlNodePtr node, gpointer trans_pdata)
470 {
471  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
472  Transaction* trn = pdata->trans;
473 
474  return set_tran_time64 (node, trn, xaccTransSetDatePostedSecs);
475 }
476 
477 static gboolean
478 trn_date_entered_handler (xmlNodePtr node, gpointer trans_pdata)
479 {
480  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
481  Transaction* trn = pdata->trans;
482 
483  return set_tran_time64 (node, trn, xaccTransSetDateEnteredSecs);
484 }
485 
486 static gboolean
487 trn_description_handler (xmlNodePtr node, gpointer trans_pdata)
488 {
489  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
490  Transaction* trn = pdata->trans;
491 
492  return set_tran_string (node, trn, xaccTransSetDescription);
493 }
494 
495 static gboolean
496 trn_slots_handler (xmlNodePtr node, gpointer trans_pdata)
497 {
498  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
499  Transaction* trn = pdata->trans;
500  gboolean successful;
501 
502  successful = dom_tree_create_instance_slots (node, QOF_INSTANCE (trn));
503 
504  g_return_val_if_fail (successful, FALSE);
505 
506  return TRUE;
507 }
508 
509 static gboolean
510 trn_splits_handler (xmlNodePtr node, gpointer trans_pdata)
511 {
512  struct trans_pdata* pdata = static_cast<decltype (pdata)> (trans_pdata);
513  Transaction* trn = pdata->trans;
514  xmlNodePtr mark;
515 
516  g_return_val_if_fail (node, FALSE);
517  g_return_val_if_fail (node->xmlChildrenNode, FALSE);
518 
519  for (mark = node->xmlChildrenNode; mark; mark = mark->next)
520  {
521  Split* spl;
522 
523  if (g_strcmp0 ("text", (char*)mark->name) == 0)
524  continue;
525 
526  if (g_strcmp0 ("trn:split", (char*)mark->name))
527  {
528  return FALSE;
529  }
530 
531  spl = dom_tree_to_split (mark, pdata->book);
532 
533  if (spl)
534  {
535  xaccTransAppendSplit (trn, spl);
536  }
537  else
538  {
539  return FALSE;
540  }
541  }
542  return TRUE;
543 }
544 
545 struct dom_tree_handler trn_dom_handlers[] =
546 {
547  { "trn:id", trn_id_handler, 1, 0 },
548  { "trn:currency", trn_currency_handler, 0, 0},
549  { "trn:num", trn_num_handler, 0, 0 },
550  { "trn:date-posted", trn_date_posted_handler, 1, 0 },
551  { "trn:date-entered", trn_date_entered_handler, 1, 0 },
552  { "trn:description", trn_description_handler, 0, 0 },
553  { "trn:slots", trn_slots_handler, 0, 0 },
554  { "trn:splits", trn_splits_handler, 1, 0 },
555  { NULL, NULL, 0, 0 },
556 };
557 
558 static gboolean
559 gnc_transaction_end_handler (gpointer data_for_children,
560  GSList* data_from_children, GSList* sibling_data,
561  gpointer parent_data, gpointer global_data,
562  gpointer* result, const gchar* tag)
563 {
564  Transaction* trn = NULL;
565  xmlNodePtr tree = (xmlNodePtr)data_for_children;
566  gxpf_data* gdata = (gxpf_data*)global_data;
567 
568  if (parent_data)
569  {
570  return TRUE;
571  }
572 
573  /* OK. For some messed up reason this is getting called again with a
574  NULL tag. So we ignore those cases */
575  if (!tag)
576  {
577  return TRUE;
578  }
579 
580  g_return_val_if_fail (tree, FALSE);
581 
582  trn = dom_tree_to_transaction (tree,
583  static_cast<QofBook*> (gdata->bookdata));
584  if (trn != NULL)
585  {
586  gdata->cb (tag, gdata->parsedata, trn);
587  }
588 
589  xmlFreeNode (tree);
590 
591  return trn != NULL;
592 }
593 
594 Transaction*
595 dom_tree_to_transaction (xmlNodePtr node, QofBook* book)
596 {
597  Transaction* trn;
598  gboolean successful;
599  struct trans_pdata pdata;
600 
601  g_return_val_if_fail (node, NULL);
602  g_return_val_if_fail (book, NULL);
603 
604  trn = xaccMallocTransaction (book);
605  g_return_val_if_fail (trn, NULL);
606  xaccTransBeginEdit (trn);
607 
608  pdata.trans = trn;
609  pdata.book = book;
610 
611  successful = dom_tree_generic_parse (node, trn_dom_handlers, &pdata);
612 
613  xaccTransCommitEdit (trn);
614 
615  if (!successful)
616  {
617  xmlElemDump (stdout, NULL, node);
618  xaccTransBeginEdit (trn);
619  xaccTransDestroy (trn);
620  xaccTransCommitEdit (trn);
621  trn = NULL;
622  }
623 
624  return trn;
625 }
626 
627 sixtp*
628 gnc_transaction_sixtp_parser_create (void)
629 {
630  return sixtp_dom_parser_new (gnc_transaction_end_handler, NULL, NULL);
631 }
void xaccSplitSetValue(Split *split, gnc_numeric val)
The xaccSplitSetValue() method sets the value of this split in the transaction&#39;s commodity.
Definition: gmock-Split.cpp:92
This is the private header for the account structure.
#define xaccTransAppendSplit(t, s)
Add a split to the transaction.
Definition: Transaction.h:381
Transaction * xaccMallocTransaction(QofBook *book)
The xaccMallocTransaction() will malloc memory and initialize it.
Definition: sixtp.h:129
void xaccSplitSetAction(Split *split, const char *actn)
The Action is an arbitrary user-assigned string.
Definition: Split.cpp:1752
#define G_LOG_DOMAIN
Functions providing the SX List as a plugin page.
gboolean xaccSplitDestroy(Split *split)
Destructor.
Definition: Split.cpp:1472
STRUCTS.
char xaccSplitGetReconcile(const Split *split)
Returns the value of the reconcile flag.
void gnc_lot_add_split(GNCLot *lot, Split *split)
Adds a split to this lot.
Definition: gnc-lot.cpp:594
void xaccTransSetDescription(Transaction *trans, const char *desc)
Sets the transaction Description.
void xaccTransSetNum(Transaction *trans, const char *xnum)
Sets the transaction Number (or ID) field; rather than use this function directly, see &#39;gnc_set_num_action&#39; in engine/engine-helpers.c & .h which takes a user-set book option for selecting the source for the num-cell (the transaction-number or the split-action field) in registers/reports into account automatically.
void xaccSplitSetReconcile(Split *split, char recn)
Set the reconcile flag.
const char * xaccTransGetNum(const Transaction *trans)
Gets the transaction Number (or ID) field; rather than use this function directly, see &#39;gnc_get_num_action&#39; and &#39;gnc_get_action_num&#39; in engine/engine-helpers.c & .h which takes a user-set book option for selecting the source for the num-cell (the transaction-number or the split-action field) in registers/reports into account automatically.
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
Set a new currency on a transaction.
void xaccTransDestroy(Transaction *trans)
Destroys a transaction.
#define xaccAccountGetGUID(X)
Definition: Account.h:252
void xaccSplitSetAmount(Split *split, gnc_numeric amt)
The xaccSplitSetAmount() method sets the amount in the account&#39;s commodity that the split should have...
Definition: gmock-Split.cpp:77
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Given two GUIDs, return TRUE if they are non-NULL and equal.
Definition: guid.cpp:204
void xaccSplitSetMemo(Split *split, const char *memo)
The memo is an arbitrary string associated with a split.
time64 xaccTransRetDatePosted(const Transaction *trans)
Retrieve the posted date of the transaction.
const char * xaccTransGetDescription(const Transaction *trans)
Gets the transaction Description.
void xaccTransCommitEdit(Transaction *trans)
The xaccTransCommitEdit() method indicates that the changes to the transaction and its splits are com...
#define xaccSplitGetGUID(X)
Definition: Split.h:552
void xaccTransBeginEdit(Transaction *trans)
The xaccTransBeginEdit() method must be called before any changes are made to a transaction or any of...
void xaccAccountSetCommoditySCU(Account *acc, int scu)
Set the SCU for the account.
Definition: Account.cpp:2693
Split * xaccMallocSplit(QofBook *book)
Constructor.
Definition: gmock-Split.cpp:37
#define xaccTransGetGUID(X)
Definition: Transaction.h:788
void xaccSplitSetDateReconciledSecs(Split *split, time64 secs)
Set the date on which this split was reconciled by specifying the time as time64. ...
time64 xaccSplitGetDateReconciled(const Split *split)
Retrieve the date when the Split was reconciled.
Definition: Split.cpp:1825
void xaccTransSetDatePostedSecs(Transaction *trans, time64 secs)
The xaccTransSetDatePostedSecs() method will modify the posted date of the transaction, specified by a time64 (see ctime(3)).
gnc_numeric xaccSplitGetValue(const Split *split)
Returns the value of this split in the transaction&#39;s commodity.
Definition: gmock-Split.cpp:84
Account * xaccSplitGetAccount(const Split *split)
Returns the account of this split, which was set through xaccAccountInsertSplit().
Definition: gmock-Split.cpp:53
const GncGUID * guid_null(void)
Returns a GncGUID which is guaranteed to never reference any entity.
Definition: guid.cpp:130
gnc_commodity * xaccTransGetCurrency(const Transaction *trans)
Returns the valuation commodity of this transaction.
#define xaccAccountInsertSplit(acc, s)
The xaccAccountInsertSplit() method will insert the indicated split into the indicated account...
Definition: Account.h:1052
Account * xaccMallocAccount(QofBook *book)
Constructor.
Definition: Account.cpp:1273
const char * xaccSplitGetMemo(const Split *split)
Returns the memo string.
Definition: gmock-Split.cpp:99
const char * xaccSplitGetAction(const Split *split)
Returns the action string.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition: gnc-date.h:87
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
Modify the date of when the transaction was entered.
time64 xaccTransRetDateEntered(const Transaction *trans)
Retrieve the date of when the transaction was entered.
API for Transactions and Splits (journal entries)
The type used to store guids in C.
Definition: guid.h:75
SplitList * xaccTransGetSplitList(const Transaction *trans)
The xaccTransGetSplitList() method returns a GList of the splits in a transaction.
GNCLot * xaccSplitGetLot(const Split *split)
Returns the pointer to the debited/credited Lot where this split belongs to, or NULL if it doesn&#39;t be...
Definition: Split.cpp:1886
gnc_numeric xaccSplitGetAmount(const Split *split)
Returns the amount of the split in the account&#39;s commodity.
Definition: gmock-Split.cpp:69
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)
The xaccAccountLookup() subroutine will return the account associated with the given id...
Definition: Account.cpp:2052