r22352 - gnucash/trunk/src/business/business-gnome - Payment dialog: use more sensible names for payment amounts

Geert Janssens gjanssens at code.gnucash.org
Thu Aug 30 13:37:05 EDT 2012


Author: gjanssens
Date: 2012-08-30 13:37:05 -0400 (Thu, 30 Aug 2012)
New Revision: 22352
Trac: http://svn.gnucash.org/trac/changeset/22352

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-payment.c
   gnucash/trunk/src/business/business-gnome/gtkbuilder/dialog-payment.glade
Log:
Payment dialog: use more sensible names for payment amounts

Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c	2012-08-29 20:09:16 UTC (rev 22351)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c	2012-08-30 17:37:05 UTC (rev 22352)
@@ -749,7 +749,7 @@
 {
     PaymentWindow *pw;
     GtkBuilder *builder;
-    GtkWidget *box, *label;
+    GtkWidget *box, *label, *credit_box, *debit_box;
     GtkTreeSelection *selection;
     char * cm_class = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER ?
                        DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
@@ -806,9 +806,30 @@
     box = GTK_WIDGET (gtk_builder_get_object (builder, "owner_box"));
     pw->owner_choice = gnc_owner_select_create (label, box, book, owner);
 
-    box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_debit_box"));
+    /* Some terminology:
+     * Invoices are paid, credit notes are refunded.
+     * A customer payment is a credit action, paying a vendor is debit
+     *
+     * So depending on the owner the payment amount should be considered
+     * credit (customer) or debit (vendor/employee) and refunds should be
+     * considered debit (customer) or credit (vendor/employee).
+     * For visual consistency, the dialog box will always show a payment and
+     * a refund field. Internally they are treated as credit or debit depending
+     * on the owner type.
+     */
+    if (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER)
+    {
+        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
+        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
+    }
+    else
+    {
+        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
+        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
+    }
+
     pw->amount_debit_edit = gnc_amount_edit_new ();
-    gtk_box_pack_start (GTK_BOX (box), pw->amount_debit_edit, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (debit_box), pw->amount_debit_edit, TRUE, TRUE, 0);
     gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_debit_edit),
                                            TRUE);
     gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit), gnc_numeric_zero());
@@ -816,9 +837,8 @@
                      "focus-out-event",
                      G_CALLBACK(gnc_payment_leave_amount_cb), pw);
 
-    box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_credit_box"));
     pw->amount_credit_edit = gnc_amount_edit_new ();
-    gtk_box_pack_start (GTK_BOX (box), pw->amount_credit_edit, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (credit_box), pw->amount_credit_edit, TRUE, TRUE, 0);
     gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_credit_edit),
                                            TRUE);
     gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit), gnc_numeric_zero());

Modified: gnucash/trunk/src/business/business-gnome/gtkbuilder/dialog-payment.glade
===================================================================
--- gnucash/trunk/src/business/business-gnome/gtkbuilder/dialog-payment.glade	2012-08-29 20:09:16 UTC (rev 22351)
+++ gnucash/trunk/src/business/business-gnome/gtkbuilder/dialog-payment.glade	2012-08-30 17:37:05 UTC (rev 22352)
@@ -341,7 +341,7 @@
 
 In case of an over-payment or if no invoice was selected, GnuCash will automatically assign the remaining amount to the first unpaid invoice for this company.</property>
                                 <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Debit</property>
+                                <property name="label" translatable="yes">Payment</property>
                                 <property name="justify">right</property>
                               </object>
                               <packing>
@@ -367,7 +367,7 @@
 
 In case of an over-payment or if no invoice was selected, GnuCash will automatically assign the remaining amount to the first unpaid invoice for this company.</property>
                                 <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Credit</property>
+                                <property name="label" translatable="yes">Refund</property>
                                 <property name="justify">right</property>
                               </object>
                               <packing>
@@ -408,7 +408,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="amount_debit_box">
+                              <object class="GtkHBox" id="amount_payment_box">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="has_tooltip">True</property>
@@ -434,7 +434,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="amount_credit_box">
+                              <object class="GtkHBox" id="amount_refund_box">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="has_tooltip">True</property>
@@ -565,7 +565,7 @@
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Payment Information</property>
+                    <property name="label" translatable="yes">Transaction Details</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
                     </attributes>



More information about the gnucash-changes mailing list