gnucash maint: Bug 759294 - New the billing term are not saved during invoice editing. Prevent editing the terms from the invoice view. This has to be edited via the edit invoice button or menu Edit->Edit Invoice. The dropdown in the invoice view has been replaced with an edit text box set to non-editable in the glade file.

Mike Evans mikee at code.gnucash.org
Fri Dec 11 05:11:54 EST 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/35b5d944 (commit)
	from  https://github.com/Gnucash/gnucash/commit/b2ced3d7 (commit)



commit 35b5d944840e4439e9d1b0328410c601063884ee
Author: Mike Evans <mikee at saxicola.co.uk>
Date:   Thu Dec 10 22:01:52 2015 +0000

    Bug 759294 - New the billing term are not saved during invoice editing.
    Prevent editing the terms from the invoice view. This has to be edited
    via the edit invoice button or menu Edit->Edit Invoice. The dropdown
    in the invoice view has been replaced with an edit text box set to
    non-editable in the glade file.

diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c
index 0a24b69..54652a1 100644
--- a/src/business/business-gnome/dialog-invoice.c
+++ b/src/business/business-gnome/dialog-invoice.c
@@ -121,6 +121,7 @@ struct _invoice_select_window
     GncOwner	owner_def;
 };
 
+static QofLogModule log_module = G_LOG_DOMAIN; //G_LOG_BUSINESS;
 
 /** This data structure does double duty.  It is used to maintain
  *  information for the "New Invoice" dialog, and it is also used to
@@ -1755,9 +1756,29 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget)
             gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts);
         }
 
-        /* fill in the terms menu */
+        /* fill in the terms text */
         iw->terms = gncInvoiceGetTerms (invoice);
-        gnc_simple_combo_set_value (GTK_COMBO_BOX(iw->terms_menu), iw->terms);
+        //DEBUG("iw->dialog_type: %d",iw->dialog_type);
+        switch (iw->dialog_type)
+        {
+            case NEW_INVOICE:
+            case MOD_INVOICE:
+            case DUP_INVOICE: //??
+                gnc_simple_combo_set_value (GTK_COMBO_BOX(iw->terms_menu), iw->terms);
+                break;
+
+            case EDIT_INVOICE:
+            case VIEW_INVOICE:
+                // Fill in the invoice view version
+                if(gncBillTermGetName (iw->terms) != NULL)
+                    gtk_entry_set_text (GTK_ENTRY (iw->terms_menu),gncBillTermGetName (iw->terms));
+                else
+                    gtk_entry_set_text (GTK_ENTRY (iw->terms_menu),"None");
+                break;
+
+            default:
+                break;
+        }
 
         /*
          * Next, figure out if we've been posted, and if so set the
@@ -2404,7 +2425,6 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
     gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
 
     /* Now fill in a lot of the pieces and display properly */
-    gnc_billterms_combo (GTK_COMBO_BOX(iw->terms_menu), iw->book, TRUE, iw->terms);
     gnc_invoice_update_window (iw, dialog);
 
     gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
@@ -2600,7 +2620,23 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
                                          QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
     /* Now fill in a lot of the pieces and display properly */
-    gnc_billterms_combo (GTK_COMBO_BOX(iw->terms_menu), iw->book, TRUE, iw->terms);
+    switch(dialog_type)
+    {
+        case NEW_INVOICE:
+        case MOD_INVOICE:
+        case DUP_INVOICE:
+            gnc_billterms_combo (GTK_COMBO_BOX(iw->terms_menu), iw->book, TRUE, iw->terms);
+            break;
+        case EDIT_INVOICE:
+        case VIEW_INVOICE:
+            // Fill in the invoice view version
+            if(gncBillTermGetName (iw->terms) != NULL)
+                gtk_entry_set_text (GTK_ENTRY (iw->terms_menu),gncBillTermGetName (iw->terms));
+            else
+                gtk_entry_set_text (GTK_ENTRY (iw->terms_menu),"None");
+        break;
+    }
+
     gnc_invoice_update_window (iw, iw->dialog);
     gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
 
diff --git a/src/business/business-gnome/gtkbuilder/dialog-invoice.glade b/src/business/business-gnome/gtkbuilder/dialog-invoice.glade
index bbfcd67..e76322ae 100644
--- a/src/business/business-gnome/gtkbuilder/dialog-invoice.glade
+++ b/src/business/business-gnome/gtkbuilder/dialog-invoice.glade
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkWindow" id="Invoice Entry Window">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -153,6 +154,10 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="editable">False</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -193,6 +198,10 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="editable">False</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -203,11 +212,9 @@
                         <child>
                           <object class="GtkCheckButton" id="active_check">
                             <property name="label" translatable="yes">Active</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="gnc_invoice_window_active_toggled_cb" swapped="no"/>
@@ -382,6 +389,10 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="editable">False</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -390,21 +401,19 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="page_terms_menu">
+                          <object class="GtkEntry" id="page_terms_menu">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="model">terms_store</property>
-                            <signal name="changed" handler="gnc_invoice_terms_changed_cb" swapped="no"/>
-                            <child>
-                              <object class="GtkCellRendererText" id="page_cell_renderer_text"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="editable">False</property>
+                            <property name="invisible_char">●</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                           </object>
                           <packing>
                             <property name="expand">True</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
@@ -660,25 +669,22 @@
     <property name="type_hint">dialog</property>
     <signal name="destroy" handler="gnc_invoice_window_destroy_cb" swapped="no"/>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox2">
+      <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">8</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="helpbutton">
                 <property name="label">gtk-help</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
                 <signal name="clicked" handler="gnc_invoice_window_help_cb" swapped="no"/>
               </object>
@@ -691,12 +697,10 @@
             <child>
               <object class="GtkButton" id="cancelbutton">
                 <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
                 <signal name="clicked" handler="gnc_invoice_window_cancel_cb" swapped="no"/>
               </object>
@@ -709,12 +713,10 @@
             <child>
               <object class="GtkButton" id="okbutton">
                 <property name="label">gtk-ok</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
                 <signal name="clicked" handler="gnc_invoice_window_ok_cb" swapped="no"/>
               </object>
@@ -830,11 +832,9 @@
                                 <child>
                                   <object class="GtkRadioButton" id="dialog_invoice_type">
                                     <property name="label" translatable="yes">Invoice</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="xalign">0</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
@@ -849,11 +849,9 @@
                                 <child>
                                   <object class="GtkRadioButton" id="dialog_creditnote_type">
                                     <property name="label" translatable="yes">Credit Note</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="xalign">0</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
@@ -886,6 +884,10 @@
                             <property name="has_focus">True</property>
                             <property name="tooltip_text" translatable="yes">The invoice ID number. If left blank a reasonable number will be chosen for you.</property>
                             <property name="activates_default">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                             <signal name="changed" handler="gnc_invoice_id_changed_cb" swapped="no"/>
                           </object>
                           <packing>
@@ -1048,6 +1050,10 @@
                           <object class="GtkEntry" id="dialog_billing_id_entry">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -1263,24 +1269,21 @@
     <property name="modal">True</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox3">
+      <object class="GtkVBox" id="dialog-vbox3">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area3">
+          <object class="GtkHButtonBox" id="dialog-action_area3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="cancelbutton1">
                 <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -1292,12 +1295,10 @@
             <child>
               <object class="GtkButton" id="okbutton1">
                 <property name="label">gtk-ok</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -1370,11 +1371,9 @@ Are you sure you want to unpost it?</property>
                     <child>
                       <object class="GtkRadioButton" id="yes_tt_reset">
                         <property name="label" translatable="yes">Yes, reset the Tax Tables</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
                         <signal name="toggled" handler="on_yes_tt_reset_toggled" object="Invoice Entry Window" swapped="yes"/>
@@ -1388,11 +1387,9 @@ Are you sure you want to unpost it?</property>
                     <child>
                       <object class="GtkRadioButton" id="no_tt_reset">
                         <property name="label" translatable="yes">No, keep them as they are</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="active">True</property>
                         <property name="draw_indicator">True</property>



Summary of changes:
 src/business/business-gnome/dialog-invoice.c       | 44 ++++++++++++--
 .../business-gnome/gtkbuilder/dialog-invoice.glade | 71 +++++++++++-----------
 2 files changed, 74 insertions(+), 41 deletions(-)



More information about the gnucash-changes mailing list