mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
csv-impport - Allow empty amount fields
Treat empty amount fields as 0. This is necessary for example in the case the csv import file has both a deposit and a withdrawal column. Note this issue was masked by the bug fixed in the previus commit.
This commit is contained in:
parent
10f8f6a750
commit
7321c995b4
@ -102,7 +102,11 @@ GncTransPropType sanitize_trans_prop (GncTransPropType prop, bool multi_split)
|
||||
*/
|
||||
GncNumeric parse_amount (const std::string &str, int currency_format)
|
||||
{
|
||||
/* If a cell is empty or just spaces return invalid amount */
|
||||
/* An empty field is treated as zero */
|
||||
if (str.empty())
|
||||
return GncNumeric{};
|
||||
|
||||
/* Strings otherwise containing not digits will be considered invalid */
|
||||
if(!boost::regex_search(str, boost::regex("[0-9]")))
|
||||
throw std::invalid_argument (_("Value doesn't appear to contain a valid number."));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user