mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
prevent transfers from/to same account
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@242 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e605c00283
commit
3b37a3cc38
@ -300,6 +300,12 @@ insertTransaction( Account *acc, Transaction *trans )
|
||||
}
|
||||
}
|
||||
|
||||
if (trans->debit == trans->credit) {
|
||||
printf ("Internal Error: insertTransaction(): \n");
|
||||
printf ("debited and credit accounts cannot be the same\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* mark the data file as needing to be saved: */
|
||||
if( acc->parent != NULL ) acc->parent->saved = False;
|
||||
|
||||
|
@ -1173,8 +1173,13 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
/* get the new account from the name */
|
||||
xfer_acct = xaccGetAccountFromName (topgroup, name);
|
||||
|
||||
if (xfer_acct) {
|
||||
|
||||
/* if a transfer account exists, and we are not trying to transfer
|
||||
* from ourself to ourself, then proceed, otheriwse ignore. */
|
||||
/* hack alert -- should put up a popup warning if user tries
|
||||
* to transfer from & to the same account -- the two must differ! */
|
||||
if (xfer_acct && ( ((1 < regData->numAcc) && (xfer_acct != (Account *) (trans->credit)))
|
||||
|| ((1 >= regData->numAcc) && (xfer_acct != regData->blackacc[0])) )) {
|
||||
|
||||
/* for a new transaction, the default will be that the
|
||||
* transfer occurs from the debited account */
|
||||
if( regData->changed & MOD_NEW) {
|
||||
|
Loading…
Reference in New Issue
Block a user