Christian Stimming <[EMAIL PROTECTED]> writes:

> This is a bug discovered by Tobias Krais in the multi-currency transaction 
> handling, version 1.8.4. I'll translate the description:
> 
> Some transactions have been imported (by HBCI, but this doesn't matter here). 
> The transactions are imported into a EUR account, and the problematic 
> transactions have a CHF (swiss franks) account as 'other' account. 
> 
> After finishing the importer GUI, the EUR amount in the EUR account is 
> correctly displayed. However, in the CHF account no amount is displayed at 
> all -- the field is empty. Now Tobias goes into the (empty) amount field and 
> enters an amount. Then he leaves the transaction. The dialog opens: "The 
> current transaction is not balanced". He selected "Adjust current account 
> split" (third out of four radio buttons, picture attached). Gnucash crashes.
> 
> From the importing code I can tell: the Transaction in question has EUR 
> currency; the amount of the split in the EUR account is set by calling  
> xaccSplitSetBaseValue(split, eur_amount, EUR_currency) in 
> import-export/hbci/gnc-hbci-gettrans.c:313; the amount of the split in the 
> CHF account is set by calling xaccSplitSetBaseValue(split, 
> eur_amount_negative, EUR_currency) in import-export/import-backend.c:825 .

Ahh, this is just setting the split->value, not the split->amount.  So
split->amount is left as zero (which is obviously wrong).  From
xaccSplitSetBaseValue():

  /* If the base_currency is the transaction's commodity ('currency'),
   * set the value.  If it's the account commodity, set the
   * amount. If both, set both. */

So what's going on is that you're setting the value but not the
amount, which is causing problems later.  You probably want to use
xaccSplitSetValue() and xaccSplitSetAmount() directly, instead of
using the SetBaseValue() API.

> When any of the other radio buttons are selected, gnucash doesn't crash. In 
> any case, a bunch (50 times) of warnings are printed on the console: 
> Warning: PrintAmountInternal: Bad numeric.
> 
> Anybody (Derek :) an idea?

The bug is that you aren't setting the transaction split amount/values
properly.  This is a bug in the importer, IMHO.

-derek

> Christian
> 
> On Mittwoch, 13. August 2003 22:30, Tobias Krais wrote:
> > Hallo zusammen,
> >
> > ich habe noch einen Fehler entdeckt. Den habe ich schon mal an diese Liste
> > gepostet, allerdings nicht mehr reproduzieren k�nnen, da ich die Daten
> > gel�scht hatte. Jetzt habe ich wieder eine �berweisung von meinem Schweizer
> > Konto auf mein deutsches Konto gemacht und auf meinem deutschen Konto die
> > Ums�tze per HBCI abgerufen. Der Betrag der Buchung wird in meinem deutschen
> > Konto (EUR) im GnuCash richtig eingebucht. In meinem schweizer Konto (CHF)
> > im GnuCash allerdings nicht, d.h. es steht gar kein Betrag in der Buchung.
> > Also gehe ich ins entsprechende Konto und trage den Betrag manuell ein.
> > Darauf �ffnet sich ein Fenster, siehe die angeh�ngte Datei
> > Auswahlmoeglichkeit.png. W�hle ich die dritte Position von oben aus kommt
> > die Fehlermeldung, die in der Datei FehlerGnuCash.png angeh�ngt ist.
> > Au�erdem gibt die Konsole ca. 50 Mal aus:
> >
> > Warning: PrintAmountInternal: Bad numeric.
> >
> > Dieser Fehler auf der Konsole erscheint, egal welche Auswahlm�glichkeit ich
> > w�hle.
> >
> > Meine GnuCash-Versionen (Debian-Sid) ist gnucash 1.8.4. Entsprechend die
> > aktuellen Sid-Pakete bzw. die von Thomas unter www.vman.de/chipcard/sid.
> >
> > Fehlt noch was? Ich hoffe ihr bekommt die Bilder, sind auch nicht gro�.
> >
> > Gr�ssle, Tobias
> 
> _______________________________________________
> gnucash-devel mailing list
> [EMAIL PROTECTED]
> http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       [EMAIL PROTECTED]                        PGP key available
_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel

Reply via email to