r23458 - gnucash/trunk/src/business/business-gnome - Bug 715184 - Bill or Invoice; a new Bill gives a new Invoice

Mike Evans mikee at code.gnucash.org
Fri Nov 29 08:23:07 EST 2013


Author: mikee
Date: 2013-11-29 08:23:07 -0500 (Fri, 29 Nov 2013)
New Revision: 23458
Trac: http://svn.gnucash.org/trac/changeset/23458

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
Log:
Bug 715184 - Bill or Invoice; a new Bill gives a new Invoice

Fixes the labelling in the bill or voucher windows and the new dialog.
It doesn't fix the bug, but is related to it.

Note to translators:  Introduces four new strings
"Voucher Information", "Bill Information", "Bill", "Voucher",

modified:   src/business/business-gnome/dialog-invoice.c
modified:   src/business/business-gnome/gnc-plugin-page-invoice.c

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2013-11-29 06:24:20 UTC (rev 23457)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2013-11-29 13:23:07 UTC (rev 23458)
@@ -142,6 +142,8 @@
     GtkWidget  * total_tax_label;
 
     /* Data Widgets */
+    GtkWidget  * info_label; /*Default in glade is "Invoice Information"*/
+    GtkWidget  * id_label; /* Default in glade is Invoice ID */
     GtkWidget  * type_label;
     GtkWidget  * type_hbox;
     GtkWidget  * type_choice;
@@ -1704,7 +1706,8 @@
     }
 
     /* Set the type label */
-    gtk_label_set_text (GTK_LABEL(iw->type_label), iw->is_credit_note ? _("Credit Note") : _("Invoice"));
+    gtk_label_set_text (GTK_LABEL(iw->type_label), iw->is_credit_note ? _("Credit Note") 
+                        : gtk_label_get_text (GTK_LABEL(iw->type_label)));
 
     if (iw->owner_choice)
         gtk_widget_show_all (iw->owner_choice);
@@ -2190,6 +2193,7 @@
 {
     GncInvoice *invoice;
     GtkBuilder *builder;
+    GtkWidget *id_label;
     GtkWidget *dialog, *hbox;
     GncEntryLedger *entry_ledger = NULL;
     GncOwnerType owner_type;
@@ -2212,7 +2216,9 @@
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, iw);
 
     /* Grab the widgets */
+    iw->id_label = GTK_WIDGET (gtk_builder_get_object (builder, "label3"));
     iw->type_label = GTK_WIDGET (gtk_builder_get_object (builder, "page_type_label"));
+    iw->info_label = GTK_WIDGET (gtk_builder_get_object (builder, "label25"));
     iw->id_entry = GTK_WIDGET (gtk_builder_get_object (builder, "page_id_entry"));
     iw->billing_id_entry = GTK_WIDGET (gtk_builder_get_object (builder, "page_billing_id_entry"));
     iw->terms_menu = GTK_WIDGET (gtk_builder_get_object (builder, "page_terms_menu"));
@@ -2319,6 +2325,22 @@
         }
         break;
     }
+    /* Default labels are for invoices, change them if they are anything else. */
+    switch (owner_type)
+        {
+        case GNC_OWNER_VENDOR:
+            gtk_label_set_text (GTK_LABEL(iw->info_label),  _("Bill Information"));
+            gtk_label_set_text (GTK_LABEL(iw->type_label),  _("Bill")); 
+            gtk_label_set_text (GTK_LABEL(iw->id_label),  _("Bill ID")); 
+            break;
+        case GNC_OWNER_EMPLOYEE:
+            gtk_label_set_text (GTK_LABEL(iw->info_label),  _("Voucher Information"));
+            gtk_label_set_text (GTK_LABEL(iw->type_label),  _("Voucher"));
+            gtk_label_set_text (GTK_LABEL(iw->id_label),  _("Voucher ID")); 
+        default:
+            break;
+        }
+    
     entry_ledger = gnc_entry_ledger_new (iw->book, ledger_type);
 
     /* Save the ledger... */
@@ -2386,10 +2408,12 @@
     InvoiceWindow *iw;
     GtkBuilder *builder;
     GtkWidget *hbox;
+    GtkWidget *invoice_radio;
     GncOwner *billto;
     const GncOwner *start_owner;
     GncBillTerm *owner_terms = NULL;
-
+    GncOwnerType owner_type;
+    
     g_assert (dialog_type == NEW_INVOICE || dialog_type == MOD_INVOICE || dialog_type == DUP_INVOICE);
 
     if (invoice)
@@ -2469,8 +2493,33 @@
 
     /* Grab the widgets */
     iw->type_label = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_type_label"));
+    iw->id_label = GTK_WIDGET (gtk_builder_get_object (builder, "label14"));
+    iw->info_label = GTK_WIDGET (gtk_builder_get_object (builder, "label1"));
+    invoice_radio = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_invoice_type"));
+     
     iw->type_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_type_choice_hbox"));
     iw->type_choice = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_type_invoice"));
+    
+    /* The default GUI lables are for invoices, so change them if it isn't. */
+    owner_type = gncOwnerGetType (&iw->owner);
+    switch(owner_type)
+    {
+        case GNC_OWNER_VENDOR:
+            gtk_label_set_text (GTK_LABEL(iw->info_label),  _("Bill Information"));
+            gtk_label_set_text (GTK_LABEL(iw->type_label),  _("Bill")); 
+            gtk_button_set_label (GTK_BUTTON(invoice_radio),  _("Bill"));
+            gtk_label_set_text (GTK_LABEL(iw->id_label),  _("Bill ID"));
+             
+            break;
+        case GNC_OWNER_EMPLOYEE:
+            gtk_label_set_text (GTK_LABEL(iw->info_label),  _("Voucher Information"));
+            gtk_label_set_text (GTK_LABEL(iw->type_label),  _("Voucher"));
+            gtk_button_set_label (GTK_BUTTON(invoice_radio),  _("Voucher"));
+            gtk_label_set_text (GTK_LABEL(iw->id_label),  _("Voucher ID"));
+        default:
+        break;
+    }
+    
     /* configure the type related widgets based on dialog type and invoice type */
     switch (dialog_type)
     {

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2013-11-29 06:24:20 UTC (rev 23457)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2013-11-29 13:23:07 UTC (rev 23458)
@@ -90,7 +90,7 @@
 /************************************************************
  *                          Actions                         *
  ************************************************************/
-
+// FIXME:  The texts are wrong if we have a Bill or Expence Voucher.
 static GtkActionEntry gnc_plugin_page_invoice_actions [] =
 {
     /* Toplevel */



More information about the gnucash-changes mailing list