get rid of memo field in transaction

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@374 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-01-06 02:33:06 +00:00
parent 3b6c2588a3
commit 8c97a6b8d0
6 changed files with 25 additions and 35 deletions

View File

@ -890,7 +890,7 @@ xaccConsolidateTransactions (Account * acc)
if (ta->date.day != tb->date.day) continue;
if (strcmp (ta->num, tb->num)) continue;
if (strcmp (ta->description, tb->description)) continue;
if (strcmp (ta->memo, tb->memo)) continue;
if (strcmp (ta->credit_split.memo, tb->credit_split.memo)) continue;
if (strcmp (ta->action, tb->action)) continue;
if (0 == DEQ(ta->damount, tb->damount)) continue;
if (0 == DEQ(ta->share_price, tb->share_price)) continue;

View File

@ -519,8 +519,8 @@ readTransaction( int fd, Account *acc, int token )
return NULL;
}
trans->memo = readString( fd, token );
if( trans->memo == NULL )
trans->credit_split.memo = readString( fd, token );
if( trans->credit_split.memo == NULL )
{
PERR ("Premature end of Transaction at memo");
freeTransaction(trans);
@ -990,7 +990,7 @@ writeTransaction( int fd, Transaction *trans )
if( -1 == err )
return err;
err = writeString( fd, trans->memo );
err = writeString( fd, trans->credit_split.memo );
if( -1 == err )
return err;

View File

@ -600,25 +600,8 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
double adjust = 0.0;
if (!acc) return NULL;
trans = (Transaction *)_malloc(sizeof(Transaction));
trans = mallocTransaction ();
trans -> num = 0x0; /* string */
trans -> description = 0x0; /* string */
trans -> memo = 0x0; /* string */
trans -> action = 0x0; /* string */
trans -> damount = 0.0; /* amount is double */
trans -> share_price= 1.0; /* share_price is double */
trans -> reconciled = NREC; /* reconciled is byte */
/* other possible values ... */
/* trans->reconciled = YREC; trans->reconciled = CREC; */
trans -> date.year = 1970; /* int */
trans -> date.month = 1; /* int */
trans -> date.day = 1; /* int */
trans -> debit = NULL;
trans -> credit = NULL;
qifline = xaccReadQIFLine (fd);
if (!qifline) {
@ -656,7 +639,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
/* M == memo field */
if ('M' == qifline [0]) {
XACC_PREP_STRING (trans->memo);
XACC_PREP_STRING (trans->credit_split.memo);
} else
/* N == check numbers for Banks, but Action for portfolios */
@ -797,7 +780,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
}
XACC_PREP_NULL_STRING (trans->num);
XACC_PREP_NULL_STRING (trans->memo);
XACC_PREP_NULL_STRING (trans->credit_split.memo);
XACC_PREP_NULL_STRING (trans->description);
XACC_PREP_NULL_STRING (trans->action);

View File

@ -619,7 +619,7 @@ regRefresh( RegWindow *regData )
sprintf( buf, "%s", trans->description );
newData[row+DESC_CELL_R][DESC_CELL_C] = XtNewString(buf);
sprintf( buf, "%s", trans->memo );
sprintf( buf, "%s", trans->credit_split.memo );
newData[row+MEMO_CELL_R][MEMO_CELL_C] = XtNewString(buf);
sprintf( buf, "%c", trans->reconciled );
@ -1413,9 +1413,8 @@ regSaveTransaction( RegWindow *regData, int position )
String tmp;
DEBUG("MOD_MEMO\n");
/* ... the memo ... */
XtFree( trans->memo );
tmp = XbaeMatrixGetCell(regData->reg,row+MEMO_CELL_R,MEMO_CELL_C);
trans->memo = XtNewString( tmp );
xaccTransSetMemo (trans, tmp);
}
if( regData->changed & MOD_ACTN )
@ -1558,7 +1557,7 @@ regSaveTransaction( RegWindow *regData, int position )
if (regData->changed & MOD_NEW) {
if( (strcmp("",trans->num) == 0) &&
(strcmp("",trans->description) == 0) &&
(strcmp("",trans->memo) == 0) &&
(strcmp("",trans->credit_split.memo) == 0) &&
/* (strcmp("",trans->action) == 0) && annoying! */
/* (0 == trans->catagory) && not implemented ! */
/* (NULL == trans->credit) && annoying! */
@ -3080,7 +3079,7 @@ regCB( Widget mw, XtPointer cd, XtPointer cb )
if( regData->qf != NULL ) {
if( regData->qf->trans != NULL ) {
XbaeMatrixSetCell( reg, tcbs->next_row, tcbs->next_column,
regData->qf->trans->memo );
regData->qf->trans->credit_split.memo );
}
}
}

View File

@ -128,7 +128,6 @@ initTransaction( Transaction * trans )
trans->num = XtNewString("");
trans->description = XtNewString("");
trans->memo = XtNewString("");
trans->action = XtNewString("");
trans->debit_splits = (Split **) _malloc (sizeof (Split *));
@ -183,13 +182,11 @@ implemented and tested.
_free (trans->debit_splits);
XtFree(trans->num);
XtFree(trans->description);
XtFree(trans->memo);
XtFree(trans->action);
/* just in case someone looks up freed memory ... */
trans->num = 0x0;
trans->description = 0x0;
trans->memo = 0x0;
trans->action = 0x0;
trans->reconciled = NREC;
trans->damount = 0.0;
@ -329,8 +326,8 @@ xaccTransOrder (Transaction **ta, Transaction **tb)
}
/* otherwise, sort on transaction strings */
da = (*ta)->memo;
db = (*tb)->memo;
da = (*ta)->credit_split.memo;
db = (*tb)->credit_split.memo;
if (da && db) {
retval = strcmp (da, db);
/* if strings differ, return */
@ -380,6 +377,17 @@ xaccCountTransactions (Transaction **tarray)
return ntrans;
}
/********************************************************************\
\********************************************************************/
void
xaccTransSetMemo (Transaction *trans, char *memo)
{
if (trans->credit_split.memo) XtFree (trans->credit_split.memo);
trans->credit_split.memo = XtNewString (memo);
}
/************************ END OF ************************************\
\************************* FILE *************************************/

View File

@ -468,7 +468,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
trans->damount = val;
trans->num = XtNewString("");
trans->memo = XmTextGetString(xferData->memo);
xaccTransSetMemo (trans, XmTextGetString(xferData->memo));
trans->description = XmTextGetString(xferData->desc);
trans->reconciled = NREC;