mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2003-05-29 Benoit Gr�goire <bock@step.polymtl.ca>
* src/engine/TransLog.c: Now log the transaction notes field (kvp actually). * src/engine/kvp_frame.h: Docs * src/import-export/log-replay/gnc-log-replay.c: Actually make it work:) Thanks Derek for pointing me to the private headers. Support the new note field. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8448 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e437df37be
commit
58816103a3
@ -1,3 +1,9 @@
|
||||
2003-05-29 Benoit Grégoire <bock@step.polymtl.ca>
|
||||
|
||||
* src/engine/TransLog.c: Now log the transaction notes field (kvp actually).
|
||||
* src/engine/kvp_frame.h: Docs
|
||||
* src/import-export/log-replay/gnc-log-replay.c: Actually make it work:) Thanks Derek for pointing me to the private headers. Support the new note field.
|
||||
|
||||
2003-05-29 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* configure.in: OpenHBCI version 0.9.11 is required now. Earlier
|
||||
|
@ -144,7 +144,7 @@ xaccOpenLog (void)
|
||||
fprintf (trans_log, "mod trans_guid split_guid time_now " \
|
||||
"date_entered date_posted " \
|
||||
"acc_guid acc_name num description " \
|
||||
"memo action reconciled " \
|
||||
"notes memo action reconciled " \
|
||||
"amount value date_reconciled\n");
|
||||
fprintf (trans_log, "-----------------\n");
|
||||
}
|
||||
@ -169,6 +169,7 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
||||
{
|
||||
GList *node;
|
||||
char *trans_guid_str, *split_guid_str;
|
||||
const char *trans_notes;
|
||||
char dnow[100], dent[100], dpost[100], drecn[100];
|
||||
Timespec ts;
|
||||
|
||||
@ -185,7 +186,7 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
||||
gnc_timespec_to_iso8601_buff (ts, dpost);
|
||||
|
||||
trans_guid_str = guid_to_string (xaccTransGetGUID(trans));
|
||||
|
||||
trans_notes = xaccTransGetNotes(trans);
|
||||
fprintf (trans_log, "===== START\n");
|
||||
|
||||
for (node = trans->splits; node; node = node->next) {
|
||||
@ -205,7 +206,7 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
||||
/* use tab-separated fields */
|
||||
fprintf (trans_log,
|
||||
"%c\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
|
||||
"%s\t%s\t%s\t%c\t%lld/%lld\t%lld/%lld\t%s\n",
|
||||
"%s\t%s\t%s\t%s\t%c\t%lld/%lld\t%lld/%lld\t%s\n",
|
||||
flag,
|
||||
trans_guid_str, split_guid_str, /* trans+split make up unique id */
|
||||
dnow ? dnow : "",
|
||||
@ -215,6 +216,7 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
||||
accname ? accname : "",
|
||||
trans->num ? trans->num : "",
|
||||
trans->description ? trans->description : "",
|
||||
trans_notes ? trans_notes : "",
|
||||
split->memo ? split->memo : "",
|
||||
split->action ? split->action : "",
|
||||
split->reconciled,
|
||||
|
@ -1,7 +1,4 @@
|
||||
/********************************************************************\
|
||||
* kvp_frame.h -- a key-value frame system for gnucash. *
|
||||
* Copyright (C) 2000 Bill Gribble *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
@ -20,8 +17,12 @@
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
/** @file kvp_frame.h @brief A key-value frame system for gnucash.*/
|
||||
/** @addtogroup Engine
|
||||
@{ */
|
||||
/** @file kvp_frame.h
|
||||
@brief A key-value frame system for gnucash
|
||||
@author Copyright (C) 2000 Bill Gribble
|
||||
*/
|
||||
|
||||
#ifndef KVP_FRAME_H
|
||||
#define KVP_FRAME_H
|
||||
@ -298,3 +299,4 @@ void kvp_frame_for_each_slot(kvp_frame *f,
|
||||
/*@}*/
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
@ -35,22 +35,16 @@
|
||||
#include <libguile.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "import-account-matcher.h"
|
||||
#include "import-commodity-matcher.h"
|
||||
#include "import-utilities.h"
|
||||
#include "import-main-matcher.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
#include "global-options.h"
|
||||
#include "gnc-associate-account.h"
|
||||
#include "gnc-log-replay.h"
|
||||
#include "gnc-file-dialog.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-book.h"
|
||||
#include "gnc-ui-util.h"
|
||||
|
||||
|
||||
#include "dialog-utils.h"
|
||||
|
||||
|
||||
@ -88,6 +82,8 @@ typedef struct _split_record
|
||||
int trans_num_present;
|
||||
char trans_descr[STRING_FIELD_SIZE];
|
||||
int trans_descr_present;
|
||||
char trans_notes[STRING_FIELD_SIZE];
|
||||
int trans_notes_present;
|
||||
char split_memo[STRING_FIELD_SIZE];
|
||||
int split_memo_present;
|
||||
char split_action[STRING_FIELD_SIZE];
|
||||
@ -217,6 +213,11 @@ static split_record interpret_split_record( char *record_line)
|
||||
strncpy(record.trans_descr,tok_ptr,STRING_FIELD_SIZE-1);
|
||||
record.trans_descr_present=TRUE;
|
||||
}
|
||||
if(strlen(tok_ptr = my_strtok(NULL,"\t"))!=0)
|
||||
{
|
||||
strncpy(record.trans_notes,tok_ptr,STRING_FIELD_SIZE-1);
|
||||
record.trans_notes_present=TRUE;
|
||||
}
|
||||
if(strlen(tok_ptr = my_strtok(NULL,"\t"))!=0)
|
||||
{
|
||||
strncpy(record.split_memo,tok_ptr,STRING_FIELD_SIZE-1);
|
||||
@ -276,46 +277,39 @@ static void dump_split_record(split_record record)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(record.trans_guid_present)
|
||||
{
|
||||
string_ptr = guid_to_string (&(record.trans_guid));
|
||||
DEBUG("Transaction GUID: %s", string_ptr);
|
||||
g_free(string_ptr);
|
||||
}
|
||||
|
||||
if(record.split_guid_present)
|
||||
{
|
||||
string_ptr = guid_to_string (&(record.split_guid));
|
||||
DEBUG("Split GUID: %s", string_ptr);
|
||||
g_free(string_ptr);
|
||||
}
|
||||
|
||||
if(record.log_date_present)
|
||||
{
|
||||
gnc_timespec_to_iso8601_buff (record.log_date, string_buf);
|
||||
DEBUG("Log entry date: %s", string_buf);
|
||||
}
|
||||
|
||||
if(record.date_entered_present)
|
||||
{
|
||||
gnc_timespec_to_iso8601_buff (record.date_entered, string_buf);
|
||||
DEBUG("Date entered: %s", string_buf);
|
||||
}
|
||||
|
||||
if(record.date_posted_present)
|
||||
{
|
||||
gnc_timespec_to_iso8601_buff (record.date_posted, string_buf);
|
||||
DEBUG("Date posted: %s", string_buf);
|
||||
}
|
||||
|
||||
if(record.acc_guid_present)
|
||||
{
|
||||
string_ptr = guid_to_string (&(record.acc_guid));
|
||||
DEBUG("Account GUID: %s", string_ptr);
|
||||
g_free(string_ptr);
|
||||
}
|
||||
|
||||
if(record.acc_name_present)
|
||||
{
|
||||
DEBUG("Account name: %s", record.acc_name);
|
||||
@ -328,6 +322,10 @@ static void dump_split_record(split_record record)
|
||||
{
|
||||
DEBUG("Transaction description: %s", record.trans_descr);
|
||||
}
|
||||
if(record.trans_notes_present)
|
||||
{
|
||||
DEBUG("Transaction notes: %s", record.trans_notes);
|
||||
}
|
||||
if(record.split_memo_present)
|
||||
{
|
||||
DEBUG("Split memo: %s", record.split_memo);
|
||||
@ -340,21 +338,18 @@ static void dump_split_record(split_record record)
|
||||
{
|
||||
DEBUG("Split reconcile: %c", record.split_reconcile);
|
||||
}
|
||||
|
||||
if(record.amount_present)
|
||||
{
|
||||
string_ptr = gnc_numeric_to_string(record.amount);
|
||||
DEBUG("Record amount: %s", string_ptr);
|
||||
g_free(string_ptr);
|
||||
}
|
||||
|
||||
if(record.value_present)
|
||||
{
|
||||
string_ptr = gnc_numeric_to_string(record.value);
|
||||
DEBUG("Record value: %s", string_ptr);
|
||||
g_free(string_ptr);
|
||||
}
|
||||
|
||||
if(record.date_reconciled_present)
|
||||
{
|
||||
gnc_timespec_to_iso8601_buff (record.date_reconciled, string_buf);
|
||||
@ -425,6 +420,7 @@ static void process_trans_record( FILE *log_file)
|
||||
DEBUG("process_trans_record(): Creating the new transaction");
|
||||
trans = xaccMallocTransaction (book);
|
||||
xaccTransBeginEdit(trans);
|
||||
xaccTransSetGUID (trans, &(record.trans_guid));
|
||||
/*Fill the transaction info*/
|
||||
if(record.date_entered_present)
|
||||
{
|
||||
@ -442,10 +438,15 @@ static void process_trans_record( FILE *log_file)
|
||||
{
|
||||
xaccTransSetDescription(trans,record.trans_descr);
|
||||
}
|
||||
if(record.trans_notes_present)
|
||||
{
|
||||
xaccTransSetNotes(trans,record.trans_notes);
|
||||
}
|
||||
}
|
||||
if(record.split_guid_present == TRUE) /*Fill the split info*/
|
||||
{
|
||||
split=xaccMallocSplit(book);
|
||||
xaccSplitSetGUID (split, &(record.split_guid));
|
||||
if(record.acc_guid_present)
|
||||
{
|
||||
acct = xaccAccountLookupDirect(record.acc_guid,book);
|
||||
@ -507,7 +508,7 @@ void gnc_file_log_replay (void)
|
||||
char read_buf[256];
|
||||
char *read_retval;
|
||||
FILE *log_file;
|
||||
char * expected_header = "mod trans_guid split_guid time_now date_entered date_posted acc_guid acc_name num description memo action reconciled amount value date_reconciled";
|
||||
char * expected_header = "mod trans_guid split_guid time_now date_entered date_posted acc_guid acc_name num description notes memo action reconciled amount value date_reconciled";
|
||||
char * record_start_str = "===== START";
|
||||
|
||||
gnc_should_log(MOD_IMPORT, GNC_LOG_DEBUG);
|
||||
|
Loading…
Reference in New Issue
Block a user