commit b1986139cd19bc457bfc13bd8837cb5e821cd7cf
Author: Matthijs Kooijman <matthijs@stdin.nl>
Date:   Sat Nov 20 13:54:50 2010 +0100

    Fix "Pay invoice" while the invoice dialog is open.
    
    If you use "Pay invoice", normally a new payment dialog is opened which
    is completely filled in. However, when there was already a dialog open,
    it was reused but only the owner would be filled in. This patch makes
    sure that the invoice and amount are filled in as well.

diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index af8c541..5d5fdfb 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -463,8 +463,8 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
 
     /*
      * Find an existing payment window.  If found, bring it to
-     * the front.  If we have an actual owner, then set it in
-     * the window.
+     * the front.  If we have an actual owner and/or invoice, then set
+     * it in the window.
      */
 
     pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
@@ -472,6 +472,8 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
     {
         if (owner->owner.undefined)
             gnc_payment_set_owner (pw, owner);
+        if (invoice)
+            gnc_invoice_set_invoice (pw->invoice_choice, invoice);
 
         gtk_window_present (GTK_WINDOW(pw->dialog));
         return(pw);
