(qif_parser_t::parse): Propogate commodity flags when parsing amounts
from a QIF file.
This commit is contained in:
parent
e42c5c794f
commit
65bfc5756c
1 changed files with 11 additions and 1 deletions
12
qif.cc
12
qif.cc
|
|
@ -92,15 +92,25 @@ unsigned int qif_parser_t::parse(std::istream& in,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
case '$':
|
case '$': {
|
||||||
in >> line;
|
in >> line;
|
||||||
xact->amount.parse(line);
|
xact->amount.parse(line);
|
||||||
|
|
||||||
|
unsigned long flags = xact->amount.commodity().flags;
|
||||||
|
unsigned short prec = xact->amount.commodity().precision;
|
||||||
|
|
||||||
if (! def_commodity)
|
if (! def_commodity)
|
||||||
def_commodity = commodity_t::find_commodity("$", true);
|
def_commodity = commodity_t::find_commodity("$", true);
|
||||||
xact->amount.set_commodity(*def_commodity);
|
xact->amount.set_commodity(*def_commodity);
|
||||||
|
|
||||||
|
def_commodity->flags |= flags;
|
||||||
|
if (prec > def_commodity->precision)
|
||||||
|
def_commodity->precision = prec;
|
||||||
|
|
||||||
if (c == '$')
|
if (c == '$')
|
||||||
xact->amount.negate();
|
xact->amount.negate();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
if (in.peek() == '*') {
|
if (in.peek() == '*') {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue