Skip to content

Commit

Permalink
Bug 760398 - Cancelling the creation of a duplicate bill or invoice d…
Browse files Browse the repository at this point in the history
…oesn't reset the invoice number counter

Don't set the invoice ID before the user has clicked OK in the dialog.
If the user cancels in the dialog the counter would have already been
incrementd. Making the ID an empty string makes the ID be set in
gnc_invoice_window_verify_ok().
  • Loading branch information
EvansMike committed Jan 10, 2016
1 parent abeb07b commit d8a74b3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/business/business-gnome/dialog-invoice.c
Expand Up @@ -2697,7 +2697,6 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
{
InvoiceWindow *iw;
GncInvoice *new_invoice = NULL;
gchar *new_id;
GDate new_date_gdate;

g_assert(old_invoice);
Expand All @@ -2718,11 +2717,8 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
}
}

// Set a new id from the respective counter
new_id = gncInvoiceNextID(gnc_get_current_book(),
gncInvoiceGetOwner(new_invoice));
gncInvoiceSetID(new_invoice, new_id);
g_free(new_id);
// Unset the invoice ID, let it get allocated later
gncInvoiceSetID(new_invoice, "");

// Modify the date to today
if (new_date)
Expand Down

0 comments on commit d8a74b3

Please sign in to comment.