#8 Pull in a couple of fixes from upstream
Merged 3 months ago by limb. Opened 3 months ago by pghmcfc.
rpms/ pghmcfc/gnucash rawhide  into  rawhide

file added
+31
@@ -0,0 +1,31 @@ 

+ From 0f026f6a100e336b1f6a41ab1556d3d79f232e64 Mon Sep 17 00:00:00 2001

+ From: Robert Fewell <14uBobIT@gmail.com>

+ Date: Thu, 8 Jul 2021 09:33:10 +0100

+ Subject: [PATCH] Bug 798221 - Transfer funds between accounts with different

+  currencies crashes Gnucash on macOS

+ 

+ In the scrub function find_account_matching_name_in_list there was a

+ test for account names being the same for currency but condition was

+ backwards so was matching on account names being different. There was

+ also a g_list_free resulting in a double free which was removed.

+ ---

+  libgnucash/engine/Scrub.c | 5 +----

+  1 file changed, 1 insertion(+), 4 deletions(-)

+ 

+ diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c

+ index 88965cefb02..888378cdeed 100644

+ --- a/libgnucash/engine/Scrub.c

+ +++ b/libgnucash/engine/Scrub.c

+ @@ -1434,11 +1434,8 @@ find_account_matching_name_in_list (GList *acc_list, const char* accname)

+      {

+          Account *acc = GNC_ACCOUNT (node->data);

+          if (G_UNLIKELY (!acc)) continue;

+ -        if (g_strcmp0 (accname, xaccAccountGetName(acc)))

+ -        {

+ -            g_list_free (acc_list);

+ +        if (g_strcmp0 (accname, xaccAccountGetName (acc)) == 0)

+              return acc;

+ -        }

+      }

+      return NULL;

+  }

file added
+44
@@ -0,0 +1,44 @@ 

+ From 8d66754429e1fda7020ebdd3cc0e756a4f5dfb74 Mon Sep 17 00:00:00 2001

+ From: Robert Fewell <14uBobIT@gmail.com>

+ Date: Thu, 8 Jul 2021 14:56:48 +0100

+ Subject: [PATCH] Bug 798219 - Price dialog prices truncated

+ 

+ Correct previous commit that truncates decimal places of prices entered

+ in the price dialog to that of the currency, they should not be rounded.

+ ---

+  gnucash/gnome/dialog-price-editor.c | 8 ++++++--

+  1 file changed, 6 insertions(+), 2 deletions(-)

+ 

+ diff --git a/gnucash/gnome/dialog-price-editor.c b/gnucash/gnome/dialog-price-editor.c

+ index 94812eb65ef..74880aa813f 100644

+ --- a/gnucash/gnome/dialog-price-editor.c

+ +++ b/gnucash/gnome/dialog-price-editor.c

+ @@ -138,6 +138,7 @@ type_index_to_string (int index)

+  static void

+  price_to_gui (PriceEditDialog *pedit_dialog)

+  {

+ +    GNCPrintAmountInfo print_info;

+      gnc_commodity *commodity = NULL;

+      gnc_commodity *currency = NULL;

+      const gchar *name_space, *fullname;

+ @@ -189,6 +190,10 @@ price_to_gui (PriceEditDialog *pedit_dialog)

+      gtk_combo_box_set_active (GTK_COMBO_BOX(pedit_dialog->type_combobox),

+                                type_string_to_index (type));

+  

+ +    print_info = gnc_commodity_print_info (currency, FALSE);

+ +    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), print_info);

+ +    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), 0);

+ +

+      gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), value);

+  }

+  

+ @@ -277,8 +282,7 @@ gui_to_price (PriceEditDialog *pedit_dialog)

+  

+      print_info = gnc_commodity_print_info (currency, FALSE);

+      gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), print_info);

+ -    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit),

+ -                                  gnc_commodity_get_fraction (currency));

+ +    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), 0);

+  

+      if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), NULL))

+          return _("You must enter a valid amount.");

file modified
+16 -2
@@ -2,12 +2,19 @@ 

  Summary: Finance management application

  Version: 4.6

  URL: https://gnucash.org/

- Release: 1%{?dist}

+ Release: 2%{?dist}

  License: GPLv2+

  Source: https://downloads.sourceforge.net/sourceforge/gnucash/gnucash-%{version}.tar.bz2

  

  Patch0: rpath.patch

  

+ # https://bugs.gnucash.org/show_bug.cgi?id=798243

+ # https://bugs.gnucash.org/show_bug.cgi?id=798221

+ Patch1: https://github.com/Gnucash/gnucash/commit/0f026f6a.patch

+ 

+ # https://bugs.gnucash.org/show_bug.cgi?id=798219

+ Patch2: https://github.com/Gnucash/gnucash/commit/8d66754.patch

+ 

  # https://bugzilla.redhat.com/show_bug.cgi?id=1563466

  ExcludeArch: ppc64 s390x

  
@@ -48,7 +55,7 @@ 

  balanced books.

  

  %prep

- %autosetup -p0

+ %autosetup -p1

  

  %build

  # thanks gcc8
@@ -99,6 +106,13 @@ 

  %config(noreplace) %{_sysconfdir}/gnucash/*

  

  %changelog

+ * Fri Jul 16 2021 Paul Howarth <paul@city-fan.org> - 4.6-2

+ - Add fix for crash in transfers between accounts with different currencies

+   https://bugs.gnucash.org/show_bug.cgi?id=798221

+   https://bugs.gnucash.org/show_bug.cgi?id=798243

+ - Add fix for truncation of fund/currency prices

+   https://bugs.gnucash.org/show_bug.cgi?id=798219

+ 

  * Mon Jun 28 2021 Gwyn Ciesla <gwync@protonmail.com> - 4.6-1

  - 4.6

  

file modified
+2 -2
@@ -1,5 +1,5 @@ 

- --- CMakeLists.txt~	2021-03-27 16:28:14.000000000 -0500

- +++ CMakeLists.txt	2021-06-02 10:33:58.859551966 -0500

+ --- a/CMakeLists.txt~	2021-03-27 16:28:14.000000000 -0500

+ +++ b/CMakeLists.txt	2021-06-02 10:33:58.859551966 -0500

  @@ -594,9 +594,9 @@

     set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")

   endif()

This PR includes a couple of upstream fixes for issues I have been seeing:

  1. Crash when adding transaction that results in transfer between accounts with different currencies
  2. Truncation of fund/currency prices when adding to price database

Pull-Request has been merged by limb

3 months ago