gnucash maint: Bug 762971 - Duplicating multiple invoices results in invoices without an ID number

Mike Evans mikee at code.gnucash.org
Thu Mar 3 07:22:13 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/b89723a5 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e4e19a4c (commit)



commit b89723a561d3c5efdee13eeca35bc6132d89eee8
Author: Mike Evans <mikee at saxicola.co.uk>
Date:   Thu Mar 3 12:13:36 2016 +0000

    Bug 762971 - Duplicating multiple invoices results in invoices without an ID number
    
    If a duplicated invoice doesn't have an ID (which it won't if multiple invoices are
    duplicated) allocate it (them) the next ID.

diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c
index 8bf4448..c5b2b6e 100644
--- a/src/business/business-gnome/dialog-invoice.c
+++ b/src/business/business-gnome/dialog-invoice.c
@@ -2695,7 +2695,7 @@ set_gncEntry_date(gpointer data, gpointer user_data)
 
 InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open_properties, const GDate *new_date)
 {
-    InvoiceWindow *iw;
+    InvoiceWindow *iw = NULL;
     GncInvoice *new_invoice = NULL;
     GDate new_date_gdate;
 
@@ -2746,10 +2746,14 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
     }
     else
     {
-        // Open the newly created invoice in the "edit" window
+         // Open the newly created invoice in the "edit" window
         iw = gnc_ui_invoice_edit (new_invoice);
+        // Check the ID; set one if necessary
+        if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (iw->id_entry)), "") == 0)
+        {
+            gncInvoiceSetID (new_invoice, gncInvoiceNextID(iw->book, &(iw->owner)));
+        }
     }
-
     return iw;
 }
 



Summary of changes:
 src/business/business-gnome/dialog-invoice.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list