diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 895c0958be..f8363bc1df 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -2307,6 +2307,9 @@ xaccSRSaveRegEntryToSCM (SplitRegister *reg, SCM trans_scm, SCM split_scm, if (MOD_DESC & changed) gnc_trans_scm_set_description(trans_scm, reg->descCell->cell.value); + if (MOD_NOTES & changed) + gnc_trans_scm_set_notes(trans_scm, reg->notesCell->cell.value); + if (MOD_RECN & changed) gnc_split_scm_set_reconcile_state(split_scm, xaccRecnCellGetFlag(reg->recnCell)); @@ -2338,24 +2341,11 @@ xaccSRSaveRegEntryToSCM (SplitRegister *reg, SCM trans_scm, SCM split_scm, if (other_split_scm == SCM_UNDEFINED) { if (gnc_trans_scm_get_num_splits(trans_scm) == 1) { Split *temp_split; - char *temp_string; temp_split = xaccMallocSplit (); other_split_scm = gnc_copy_split(temp_split, use_cut_semantics); xaccSplitDestroy(temp_split); - temp_string = gnc_split_scm_get_memo(split_scm); - if (temp_string != NULL) { - gnc_split_scm_set_memo(other_split_scm, temp_string); - free(temp_string); - } - - temp_string = gnc_split_scm_get_action(split_scm); - if (temp_string != NULL) { - gnc_split_scm_set_action(other_split_scm, temp_string); - free(temp_string); - } - gnc_trans_scm_append_split_scm(trans_scm, other_split_scm); } } @@ -2595,25 +2585,27 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) } if (MOD_DESC & changed) { - DEBUG ("MOD_DESC: %s\n", - reg->descCell->cell.value); + DEBUG ("MOD_DESC: %s", reg->descCell->cell.value); xaccTransSetDescription (trans, reg->descCell->cell.value); } + if (MOD_NOTES & changed) { + DEBUG ("MOD_NOTES: %s", reg->notesCell->cell.value); + xaccTransSetNotes (trans, reg->notesCell->cell.value); + } + if (MOD_RECN & changed) { - DEBUG ("MOD_RECN: %c\n", xaccRecnCellGetFlag(reg->recnCell)); + DEBUG ("MOD_RECN: %c", xaccRecnCellGetFlag(reg->recnCell)); xaccSplitSetReconcile (split, xaccRecnCellGetFlag(reg->recnCell)); } if (MOD_ACTN & changed) { - DEBUG ("MOD_ACTN: %s\n", - reg->actionCell->cell.value); + DEBUG ("MOD_ACTN: %s", reg->actionCell->cell.value); xaccSplitSetAction (split, reg->actionCell->cell.value); } if (MOD_MEMO & changed) { - DEBUG ("MOD_MEMO: %s\n", - reg->memoCell->cell.value); + DEBUG ("MOD_MEMO: %s", reg->memoCell->cell.value); xaccSplitSetMemo (split, reg->memoCell->cell.value); } @@ -2627,18 +2619,17 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) * XFRM or XTO should be in a given cursor. */ if ((MOD_XFRM | MOD_XTO) & changed) { - Account *old_acc=NULL, *new_acc=NULL; + Account *old_acc; + Account *new_acc; char *new_name; if (MOD_XFRM & changed) { - DEBUG ("MOD_XFRM: %s\n", - reg->xfrmCell->cell.value); + DEBUG ("MOD_XFRM: %s", reg->xfrmCell->cell.value); } else { - DEBUG ("MOD_XTO: %s\n", - reg->xtoCell->cell.value); + DEBUG ("MOD_XTO: %s", reg->xtoCell->cell.value); } /* do some reparenting. Insertion into new account will automatically @@ -2693,8 +2684,7 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split) if (MOD_MXFRM & changed) { - DEBUG ("MOD_MXFRM: %s\n", - reg->mxfrmCell->cell.value); + DEBUG ("MOD_MXFRM: %s", reg->mxfrmCell->cell.value); other_split = xaccGetOtherSplit(split); @@ -3106,6 +3096,10 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc, short _cell_type, return xaccTransGetDescription (trans); break; + case NOTES_CELL: + return xaccTransGetNotes (trans); + break; + case RECN_CELL: { static char s[2]; @@ -3733,16 +3727,17 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, * fill up the quickfill cells. */ if (info->first_pass) { - int j, num_splits; - Split *s; + GList *node; xaccQuickFillAddCompletion (reg->descCell, xaccTransGetDescription (trans)); - num_splits = xaccTransCountSplits (trans); - for (j = 0; j < num_splits; j++) + xaccQuickFillAddCompletion (reg->notesCell, + xaccTransGetNotes (trans)); + + for (node = xaccTransGetSplitList (trans); node; node = node->next) { - s = xaccTransGetSplit (trans, j); + Split *s = node->data; xaccQuickFillAddCompletion (reg->memoCell, xaccSplitGetMemo (s)); } } diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 606e155ebd..5a641a59ed 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1933,9 +1933,10 @@ xaccTransSetNotes (Transaction *trans, const char *notes) kvp_value *new_value; if (!trans || !notes) return; + CHECK_OPEN (trans); - new_value = kvp_value_new_string(notes); + new_value = kvp_value_new_string (notes); if (new_value) { diff --git a/src/engine/io-gncbin-r.c b/src/engine/io-gncbin-r.c index 9a8ffcbc59..e677f6556d 100644 --- a/src/engine/io-gncbin-r.c +++ b/src/engine/io-gncbin-r.c @@ -1107,6 +1107,7 @@ readTransaction( int fd, Account *acc, int token ) } else { /* else, read version 5 and above files */ Split *split; int offset = 0; + const char *notes = NULL; if (5 == token) { @@ -1145,6 +1146,12 @@ readTransaction( int fd, Account *acc, int token ) } else { xaccTransAppendSplit(trans, split); } + + if (!notes) { + notes = xaccSplitGetMemo (split); + if (notes) + xaccTransSetNotes (trans, notes); + } } } xaccTransCommitEdit (trans); diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 3141a39c0f..7a646e7aa6 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -41,12 +41,12 @@ #include #include +#include "gnc-engine-util.h" +#include "messages.h" #include "recncell.h" #include "splitreg.h" #include "table-allgui.h" #include "textcell.h" -#include "messages.h" -#include "gnc-engine-util.h" /* This static indicates the debugging module that this .o belongs to. */ @@ -80,29 +80,31 @@ struct _SplitRegisterBuffer CellBuffer priceCell; CellBuffer sharesCell; CellBuffer mxfrmCell; + CellBuffer notesCell; }; static char *cell_sample_strings[] = { - N_("sample:12/12/2000"+7), /* date cell */ - N_("sample:99999"+7), /* num cell */ - N_("sample:Description of a transaction"+7), /* desc cell */ - N_("Reconciled:R"+11), /* recn cell */ - N_("sample:999,999.000"+7), /* share balance cell */ - N_("sample:999,999.000"+7), /* balance cell */ - N_("Transfer"), /* action cell */ - N_("sample:Expenses:Automobile:Gasoline"+7), /* xfrm cell */ - N_("sample:Expenses:Automobile:Gasoline"+7), /* xto cell */ - N_("sample:Memo field sample text string"+7), /* memo cell */ - N_("sample:999,999.000"+7), /* credit cell */ - N_("sample:999,999.000"+7), /* debit cell */ - N_("sample:999,999.000"+7), /* price cell */ - N_("sample:999,999.000"+7), /* shares cell */ - N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */ - N_("sample:999,999.000"+7), /* tcredit cell */ - N_("sample:999,999.000"+7), /* tdebit cell */ - N_("sample:999,999.000"+7), /* tshrbaln cell */ - N_("sample:999,999.000"+7), /* tbalance cell */ + N_("sample:12/12/2000"+7), /* date cell */ + N_("sample:99999"+7), /* num cell */ + N_("sample:Description of a transaction"+7), /* desc cell */ + N_("Reconciled:R"+11), /* recn cell */ + N_("sample:999,999.000"+7), /* share balance cell */ + N_("sample:999,999.000"+7), /* balance cell */ + N_("Transfer"), /* action cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* xfrm cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* xto cell */ + N_("sample:Memo field sample text string"+7), /* memo cell */ + N_("sample:999,999.000"+7), /* credit cell */ + N_("sample:999,999.000"+7), /* debit cell */ + N_("sample:999,999.000"+7), /* price cell */ + N_("sample:999,999.000"+7), /* shares cell */ + N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */ + N_("sample:999,999.000"+7), /* tcredit cell */ + N_("sample:999,999.000"+7), /* tdebit cell */ + N_("sample:999,999.000"+7), /* tshrbaln cell */ + N_("sample:999,999.000"+7), /* tbalance cell */ + N_("sample:Notes field sample text string"+7), /* notes cell */ }; static CellAlignment cell_alignments[] = @@ -126,6 +128,7 @@ static CellAlignment cell_alignments[] = CELL_ALIGN_RIGHT, /* tdebit cell */ CELL_ALIGN_RIGHT, /* tshrbaln cell */ CELL_ALIGN_RIGHT, /* tbalance cell */ + CELL_ALIGN_LEFT, /* notes cell */ }; @@ -196,6 +199,7 @@ configLabels (SplitRegister *reg) LABEL (TDEBT, _("Total")); LABEL (TSHRBALN, _("Total Shares")); LABEL (TBALN, _("Balance")); + LABEL (NOTES, _("Notes")); if (debit_getter != NULL) { @@ -433,8 +437,8 @@ configLayout (SplitRegister *reg) curs = reg->cursor_ledger_double; copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0); - set_cell (reg, curs, ACTN_CELL, 1, 1); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, ACTN_CELL, 1, 1); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_journal_single; set_cell (reg, curs, DATE_CELL, 0, 0); @@ -448,7 +452,7 @@ configLayout (SplitRegister *reg) curs = reg->cursor_journal_double; copy_cursor_row (reg, curs, reg->cursor_journal_single, 0); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_split; set_cell (reg, curs, ACTN_CELL, 0, 1); @@ -478,8 +482,8 @@ configLayout (SplitRegister *reg) curs = reg->cursor_ledger_double; copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0); - set_cell (reg, curs, ACTN_CELL, 1, 1); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, ACTN_CELL, 1, 1); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_journal_single; set_cell (reg, curs, DATE_CELL, 0, 0); @@ -493,7 +497,7 @@ configLayout (SplitRegister *reg) curs = reg->cursor_journal_double; copy_cursor_row (reg, curs, reg->cursor_journal_single, 0); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_split; set_cell (reg, curs, ACTN_CELL, 0, 1); @@ -525,8 +529,8 @@ configLayout (SplitRegister *reg) curs = reg->cursor_ledger_double; copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0); - set_cell (reg, curs, ACTN_CELL, 1, 1); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, ACTN_CELL, 1, 1); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_journal_single; set_cell (reg, curs, DATE_CELL, 0, 0); @@ -543,7 +547,7 @@ configLayout (SplitRegister *reg) curs = reg->cursor_journal_double; copy_cursor_row (reg, curs, reg->cursor_journal_single, 0); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_split; set_cell (reg, curs, ACTN_CELL, 0, 1); @@ -573,8 +577,8 @@ configLayout (SplitRegister *reg) curs = reg->cursor_ledger_double; copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0); - set_cell (reg, curs, ACTN_CELL, 1, 1); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, ACTN_CELL, 1, 1); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_journal_single; set_cell (reg, curs, DATE_CELL, 0, 0); @@ -590,7 +594,7 @@ configLayout (SplitRegister *reg) curs = reg->cursor_journal_double; copy_cursor_row (reg, curs, reg->cursor_journal_single, 0); - set_cell (reg, curs, MEMO_CELL, 1, 2); + set_cell (reg, curs, NOTES_CELL, 1, 2); curs = reg->cursor_split; set_cell (reg, curs, ACTN_CELL, 0, 1); @@ -790,6 +794,7 @@ xaccInitSplitRegister (SplitRegister *reg, NEW (TDEBT, tdebit, Price); NEW (TSHRBALN, tshrbaln, Price); NEW (TBALN, tbalance, Price); + NEW (NOTES, notes, QuickFill); /* --------------------------- */ @@ -845,6 +850,10 @@ xaccInitSplitRegister (SplitRegister *reg, xaccSetBasicCellBlankHelp (®->descCell->cell, _("Enter a description of the transaction")); + /* the notes cell */ + xaccSetBasicCellBlankHelp (®->notesCell->cell, + _("Enter notes for the transaction")); + /* The balance and total cells are just placeholders */ reg->balanceCell->cell.input_output = XACC_CELL_ALLOW_NONE; reg->shrbalnCell->cell.input_output = XACC_CELL_ALLOW_NONE; @@ -1011,6 +1020,7 @@ xaccDestroySplitRegister (SplitRegister *reg) xaccDestroyPriceCell (reg->tdebitCell); xaccDestroyPriceCell (reg->tshrbalnCell); xaccDestroyPriceCell (reg->tbalanceCell); + xaccDestroyQuickFillCell (reg->notesCell); reg->dateCell = NULL; reg->numCell = NULL; @@ -1031,6 +1041,7 @@ xaccDestroySplitRegister (SplitRegister *reg) reg->tdebitCell = NULL; reg->tshrbalnCell = NULL; reg->tbalanceCell = NULL; + reg->notesCell = NULL; for (i = 0; i < CELL_TYPE_COUNT; i++) { @@ -1058,16 +1069,16 @@ xaccSplitRegisterGetChangeFlag (SplitRegister *reg) changed |= MOD_NUM & reg->numCell->cell.changed; changed |= MOD_DESC & reg->descCell->cell.changed; changed |= MOD_RECN & reg->recnCell->cell.changed; - changed |= MOD_ACTN & reg->actionCell->cell.changed; changed |= MOD_XFRM & reg->xfrmCell->cell.changed; - changed |= MOD_MXFRM & reg->mxfrmCell->cell.changed; changed |= MOD_XTO & reg->xtoCell->cell.changed; changed |= MOD_MEMO & reg->memoCell->cell.changed; changed |= MOD_AMNT & reg->creditCell->cell.changed; changed |= MOD_AMNT & reg->debitCell->cell.changed; changed |= MOD_PRIC & reg->priceCell->cell.changed; changed |= MOD_SHRS & reg->sharesCell->cell.changed; + changed |= MOD_MXFRM & reg->mxfrmCell->cell.changed; + changed |= MOD_NOTES & reg->notesCell->cell.changed; return changed; } @@ -1082,16 +1093,16 @@ xaccSplitRegisterGetConditionalChangeFlag (SplitRegister *reg) changed |= MOD_NUM & reg->numCell->cell.conditionally_changed; changed |= MOD_DESC & reg->descCell->cell.conditionally_changed; changed |= MOD_RECN & reg->recnCell->cell.conditionally_changed; - changed |= MOD_ACTN & reg->actionCell->cell.conditionally_changed; changed |= MOD_XFRM & reg->xfrmCell->cell.conditionally_changed; - changed |= MOD_MXFRM & reg->mxfrmCell->cell.conditionally_changed; changed |= MOD_XTO & reg->xtoCell->cell.conditionally_changed; changed |= MOD_MEMO & reg->memoCell->cell.conditionally_changed; changed |= MOD_AMNT & reg->creditCell->cell.conditionally_changed; changed |= MOD_AMNT & reg->debitCell->cell.conditionally_changed; changed |= MOD_PRIC & reg->priceCell->cell.conditionally_changed; changed |= MOD_SHRS & reg->sharesCell->cell.conditionally_changed; + changed |= MOD_MXFRM & reg->mxfrmCell->cell.conditionally_changed; + changed |= MOD_NOTES & reg->notesCell->cell.conditionally_changed; return changed; } @@ -1105,16 +1116,16 @@ xaccSplitRegisterClearChangeFlag (SplitRegister *reg) reg->numCell->cell.changed = 0; reg->descCell->cell.changed = 0; reg->recnCell->cell.changed = 0; - reg->actionCell->cell.changed = 0; reg->xfrmCell->cell.changed = 0; - reg->mxfrmCell->cell.changed = 0; reg->xtoCell->cell.changed = 0; reg->memoCell->cell.changed = 0; reg->creditCell->cell.changed = 0; reg->debitCell->cell.changed = 0; reg->priceCell->cell.changed = 0; reg->sharesCell->cell.changed = 0; + reg->mxfrmCell->cell.changed = 0; + reg->notesCell->cell.changed = 0; } /* ============================================== */ @@ -1182,50 +1193,14 @@ xaccSplitRegisterGetCursorClass (SplitRegister *reg, static CellType sr_cell_type (SplitRegister *reg, void * cell) { - if (cell == reg->dateCell) - return DATE_CELL; + int i; - if (cell == reg->numCell) - return NUM_CELL; + if (reg == NULL) + return NO_CELL; - if (cell == reg->descCell) - return DESC_CELL; - - if (cell == reg->recnCell) - return RECN_CELL; - - if (cell == reg->shrbalnCell) - return SHRBALN_CELL; - - if (cell == reg->balanceCell) - return BALN_CELL; - - if (cell == reg->actionCell) - return ACTN_CELL; - - if (cell == reg->xfrmCell) - return XFRM_CELL; - - if (cell == reg->mxfrmCell) - return MXFRM_CELL; - - if (cell == reg->xtoCell) - return XTO_CELL; - - if (cell == reg->memoCell) - return MEMO_CELL; - - if (cell == reg->creditCell) - return CRED_CELL; - - if (cell == reg->debitCell) - return DEBT_CELL; - - if (cell == reg->priceCell) - return PRIC_CELL; - - if (cell == reg->sharesCell) - return SHRS_CELL; + for (i = 0; i < CELL_TYPE_COUNT; i++) + if (cell == reg->cells[i]) + return i; return NO_CELL; } @@ -1244,8 +1219,7 @@ xaccSplitRegisterGetCurrentCellType (SplitRegister *reg) if (table == NULL) return NO_CELL; - return - xaccSplitRegisterGetCellType(reg, table->current_cursor_loc); + return xaccSplitRegisterGetCellType(reg, table->current_cursor_loc); } /* ============================================== */ @@ -1402,13 +1376,14 @@ xaccDestroySplitRegisterBuffer (SplitRegisterBuffer *srb) destroyCellBuffer(&srb->balanceCell); destroyCellBuffer(&srb->actionCell); destroyCellBuffer(&srb->xfrmCell); - destroyCellBuffer(&srb->mxfrmCell); destroyCellBuffer(&srb->xtoCell); destroyCellBuffer(&srb->memoCell); destroyCellBuffer(&srb->creditCell); destroyCellBuffer(&srb->debitCell); destroyCellBuffer(&srb->priceCell); destroyCellBuffer(&srb->sharesCell); + destroyCellBuffer(&srb->mxfrmCell); + destroyCellBuffer(&srb->notesCell); g_free(srb); } @@ -1442,13 +1417,14 @@ xaccSplitRegisterSaveCursor(SplitRegister *sr, SplitRegisterBuffer *srb) saveCell(&sr->balanceCell->cell, &srb->balanceCell); saveCell(&sr->actionCell->cell, &srb->actionCell); saveCell(&sr->xfrmCell->cell, &srb->xfrmCell); - saveCell(&sr->mxfrmCell->cell, &srb->mxfrmCell); saveCell(&sr->xtoCell->cell, &srb->xtoCell); saveCell(&sr->memoCell->cell, &srb->memoCell); saveCell(&sr->creditCell->cell, &srb->creditCell); saveCell(&sr->debitCell->cell, &srb->debitCell); saveCell(&sr->priceCell->cell, &srb->priceCell); saveCell(&sr->sharesCell->cell, &srb->sharesCell); + saveCell(&sr->mxfrmCell->cell, &srb->mxfrmCell); + saveCell(&sr->notesCell->cell, &srb->notesCell); } /* ============================================== */ @@ -1505,13 +1481,14 @@ xaccSplitRegisterRestoreCursorChanged(SplitRegister *sr, restoreCellChanged(&sr->balanceCell->cell, &srb->balanceCell, cursor); restoreCellChanged(&sr->actionCell->cell, &srb->actionCell, cursor); restoreCellChanged(&sr->xfrmCell->cell, &srb->xfrmCell, cursor); - restoreCellChanged(&sr->mxfrmCell->cell, &srb->mxfrmCell, cursor); restoreCellChanged(&sr->xtoCell->cell, &srb->xtoCell, cursor); restoreCellChanged(&sr->memoCell->cell, &srb->memoCell, cursor); restoreCellChanged(&sr->creditCell->cell, &srb->creditCell, cursor); restoreCellChanged(&sr->debitCell->cell, &srb->debitCell, cursor); restoreCellChanged(&sr->priceCell->cell, &srb->priceCell, cursor); restoreCellChanged(&sr->sharesCell->cell, &srb->sharesCell, cursor); + restoreCellChanged(&sr->mxfrmCell->cell, &srb->mxfrmCell, cursor); + restoreCellChanged(&sr->notesCell->cell, &srb->notesCell, cursor); } /* keep in sync with CellType enum */ @@ -1531,7 +1508,12 @@ static const char *cell_names[] = "debit", "price", "shares", - "transfer" + "transfer", + "trans-credit", + "trans-debit", + "trans-share-balance", + "trans-balance", + "notes" }; const char * diff --git a/src/register/splitreg.h b/src/register/splitreg.h index a7a48574c7..2e0835c1f5 100644 --- a/src/register/splitreg.h +++ b/src/register/splitreg.h @@ -98,6 +98,7 @@ typedef enum TDEBT_CELL, TSHRBALN_CELL, TBALN_CELL, + NOTES_CELL, CELL_TYPE_COUNT } CellType; @@ -119,20 +120,24 @@ typedef enum } SplitRegisterStyle; /* modified flags -- indicate which cell values have been modified by user */ -#define MOD_NONE 0x0000 -#define MOD_DATE 0x0001 -#define MOD_NUM 0x0002 -#define MOD_DESC 0x0004 -#define MOD_RECN 0x0008 -#define MOD_ACTN 0x0010 -#define MOD_XFRM 0x0020 -#define MOD_MXFRM 0x0040 -#define MOD_XTO 0x0080 -#define MOD_MEMO 0x0100 -#define MOD_AMNT 0x0200 -#define MOD_PRIC 0x0400 -#define MOD_SHRS 0x0800 -#define MOD_ALL 0xffff +typedef enum +{ + MOD_NONE = 0, + MOD_DATE = 1 << 0, + MOD_NUM = 1 << 1, + MOD_DESC = 1 << 2, + MOD_RECN = 1 << 3, + MOD_ACTN = 1 << 4, + MOD_XFRM = 1 << 5, + MOD_MXFRM = 1 << 6, + MOD_XTO = 1 << 7, + MOD_MEMO = 1 << 8, + MOD_AMNT = 1 << 9, + MOD_PRIC = 1 << 10, + MOD_SHRS = 1 << 11, + MOD_NOTES = 1 << 12, + MOD_ALL = 0xffff +} CellModifiedFlags; /* Types of cursors */ typedef enum @@ -194,6 +199,7 @@ struct _SplitRegister PriceCell * tdebitCell; PriceCell * tshrbalnCell; PriceCell * tbalanceCell; + QuickFillCell * notesCell; SplitRegisterType type; SplitRegisterStyle style; diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 3d6c193965..aef9cf9108 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -172,6 +172,7 @@ gnc_table_get_entry_internal (Table *table, VirtualLocation virt_loc, { VirtualCell *vcell; CellBlockCell *cb_cell; + const char *entry; vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc); if (vcell == NULL) @@ -185,9 +186,13 @@ gnc_table_get_entry_internal (Table *table, VirtualLocation virt_loc, if (cb_cell->cell_type < 0) return ""; - return table->entry_handler (virt_loc, cb_cell->cell_type, - conditionally_changed, - table->handler_user_data); + entry = table->entry_handler (virt_loc, cb_cell->cell_type, + conditionally_changed, + table->handler_user_data); + if (!entry) + entry = ""; + + return entry; } const char * @@ -195,6 +200,7 @@ gnc_table_get_entry (Table *table, VirtualLocation virt_loc) { VirtualCell *vcell; CellBlockCell *cb_cell; + const char *entry; vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc); if (vcell == NULL) @@ -218,8 +224,12 @@ gnc_table_get_entry (Table *table, VirtualLocation virt_loc) return cb_cell->cell->value; } - return table->entry_handler (virt_loc, cb_cell->cell_type, NULL, - table->handler_user_data); + entry = table->entry_handler (virt_loc, cb_cell->cell_type, NULL, + table->handler_user_data); + if (!entry) + entry = ""; + + return entry; } /* ==================================================== */ diff --git a/src/scm/engine-interface.scm b/src/scm/engine-interface.scm index c845e84d08..59352ffb53 100644 --- a/src/scm/engine-interface.scm +++ b/src/scm/engine-interface.scm @@ -145,7 +145,8 @@ (define gnc:transaction-structure (make-record-type "gnc:transaction-structure" - '(transaction-guid date-entered date-posted num description split-scms))) + '(transaction-guid date-entered date-posted + num description notes split-scms))) ;; constructor (define gnc:make-transaction-scm @@ -171,6 +172,9 @@ (define gnc:transaction-scm-get-description (record-accessor gnc:transaction-structure 'description)) +(define gnc:transaction-scm-get-notes + (record-accessor gnc:transaction-structure 'notes)) + (define gnc:transaction-scm-get-split-scms (record-accessor gnc:transaction-structure 'split-scms)) @@ -203,6 +207,9 @@ (define gnc:transaction-scm-set-description (record-modifier gnc:transaction-structure 'description)) +(define gnc:transaction-scm-set-notes + (record-modifier gnc:transaction-structure 'notes)) + (define gnc:transaction-scm-set-split-scms (record-modifier gnc:transaction-structure 'split-scms)) @@ -230,6 +237,7 @@ (gnc:transaction-get-num trans) #f) (gnc:transaction-get-description trans) + (gnc:transaction-get-notes trans) (trans-splits 0))) ;; Copy a scheme representation of a transaction onto a C transaction. @@ -240,7 +248,6 @@ (if (pointer-token-null? trans) #f (begin - ;; open the transaction for editing (if (not (gnc:transaction-is-open trans)) (gnc:transaction-begin-edit trans #t)) @@ -248,9 +255,11 @@ ;; copy in the transaction values (let ((description (gnc:transaction-scm-get-description trans-scm)) (num (gnc:transaction-scm-get-num trans-scm)) + (notes (gnc:transaction-scm-get-notes trans-scm)) (date-posted (gnc:transaction-scm-get-date-posted trans-scm))) (if description (gnc:transaction-set-description trans description)) (if num (gnc:transaction-set-xnum trans num)) + (if notes (gnc:transaction-set-notes trans notes)) (if date-posted (gnc:transaction-set-date-time-pair trans date-posted)))