gnucash unstable: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Sat Apr 14 06:41:36 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/a8c17c20 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d567ee10 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7321c995 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/10f8f6a7 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e2535abb (commit)



commit a8c17c2078bbd2dc901fc8d3f88ee326f4759b86
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Apr 14 12:05:30 2018 +0200

    Bug 795155 - CSV import does not distinguish between deposit and withdrawal

diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
index db16b7f..7c4246d 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
@@ -624,7 +624,7 @@ void GncPreSplit::create_split (Transaction* trans)
     if (m_withdrawal)
         withdrawal = *m_withdrawal;
 
-    amount = deposit + withdrawal;
+    amount = deposit - withdrawal;
 
     /* Add a split with the cumulative amount value. */
     trans_add_split (trans, account, amount, m_action, m_memo, m_rec_state, m_rec_date, m_price);

commit d567ee104923b4e567d7369cb545107186473fe8
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Apr 14 11:48:11 2018 +0200

    Bug 769686 - Notes not imported when using update and reconcile in import transactions from CSV

diff --git a/gnucash/import-export/import-backend.c b/gnucash/import-export/import-backend.c
index 83a013c..e538563 100644
--- a/gnucash/import-export/import-backend.c
+++ b/gnucash/import-export/import-backend.c
@@ -982,6 +982,10 @@ gnc_import_process_trans_item (GncImportMatchMap *matchmap,
                                     xaccTransGetDescription(
                                         gnc_import_TransInfo_get_trans(trans_info)));
 
+            xaccTransSetNotes(selected_match->trans,
+                                    xaccTransGetNotes(
+                                        gnc_import_TransInfo_get_trans(trans_info)));
+
             if (xaccSplitGetReconcile(selected_match->split) == NREC)
             {
                 xaccSplitSetReconcile(selected_match->split, CREC);

commit 7321c995b4ec73574255ba55f5e1ce50fe7e9d25
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Apr 14 12:01:32 2018 +0200

    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.

diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
index 650f4e9..db16b7f 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp
@@ -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."));
 

commit 10f8f6a7507d3b46eea82255166894024fc0fc70
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Apr 14 11:27:06 2018 +0200

    Bug 795082 - CSV import crashes if a transaction's 'Account' field is empty and no default Account set

diff --git a/gnucash/import-export/csv-imp/gnc-import-tx.cpp b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
index 8dd940e..34d68b7 100644
--- a/gnucash/import-export/csv-imp/gnc-import-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
@@ -790,17 +790,14 @@ void GncTxImport::update_pre_split_props (uint32_t row, uint32_t col, GncTransPr
         return; /* Only deal with split related properties. */
 
     auto split_props = std::get<PL_PRESPLIT>(m_parsed_lines[row]);
-    auto value = std::string();
 
-    if (col < std::get<PL_INPUT>(m_parsed_lines[row]).size())
-        value = std::get<PL_INPUT>(m_parsed_lines[row]).at(col);
-
-    if (value.empty())
+    if (col == std::get<PL_INPUT>(m_parsed_lines[row]).size())
         split_props->reset (prop_type);
     else
     {
         try
         {
+            auto value = std::get<PL_INPUT>(m_parsed_lines[row]).at(col);
             split_props->set(prop_type, value);
         }
         catch (const std::exception& e)



Summary of changes:
 gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp | 8 ++++++--
 gnucash/import-export/csv-imp/gnc-import-tx.cpp    | 7 ++-----
 gnucash/import-export/import-backend.c             | 4 ++++
 3 files changed, 12 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list