gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Fri Nov 8 05:45:11 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/952c6561 (commit)
via https://github.com/Gnucash/gnucash/commit/ee191083 (commit)
via https://github.com/Gnucash/gnucash/commit/21d60803 (commit)
from https://github.com/Gnucash/gnucash/commit/e991fe85 (commit)
commit 952c6561447a3ad560865af34d60dc7d05ab9f4f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 06:52:30 2019 +0800
[dialog-payment] instead of tooltip, render in gtklabel
The warning icon is used to show blocking and non-blocking warnings in
a payment. Increase visibility by showing the warning as a gtklabel
instead of a tooltip.
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 244046b67..3c4ad9a4f 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -81,6 +81,7 @@ struct _payment_window
GtkWidget * dialog;
GtkWidget * payment_warning;
+ GtkWidget * conflict_message;
GtkWidget * ok_button;
GtkWidget * num_entry;
GtkWidget * memo_entry;
@@ -288,7 +289,7 @@ update_cleanup:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), pw->print_check_state);
/* Check if there are issues preventing a successful payment */
- gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
+ gtk_label_set_text (GTK_LABEL(pw->conflict_message), conflict_msg);
gtk_widget_set_sensitive (pw->ok_button, allow_payment);
if (conflict_msg)
{
@@ -1192,6 +1193,7 @@ new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_inf
/* Grab the widgets and build the dialog */
pw->payment_warning = GTK_WIDGET (gtk_builder_get_object (builder, "payment_warning"));
+ pw->conflict_message = GTK_WIDGET (gtk_builder_get_object (builder, "conflict_message"));
pw->ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "okbutton"));
pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
diff --git a/gnucash/gtkbuilder/dialog-payment.glade b/gnucash/gtkbuilder/dialog-payment.glade
index f0c866651..a500f2952 100644
--- a/gnucash/gtkbuilder/dialog-payment.glade
+++ b/gnucash/gtkbuilder/dialog-payment.glade
@@ -108,18 +108,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkImage" id="payment_warning">
- <property name="can_focus">False</property>
- <property name="icon_name">dialog-warning</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- <property name="secondary">True</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -761,6 +749,38 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="table4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">5</property>
+ <child>
+ <object class="GtkImage" id="payment_warning">
+ <property name="can_focus">False</property>
+ <property name="icon_name">dialog-warning</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="conflict_message">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
commit ee19108321631931a386dc4d1018b8f295df3f80
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 06:33:43 2019 +0800
[dialog-payment] tooltip warning if payment is unattached
Completing a payment for a customer without associating with an open
invoice is allowable and is used for prepayments.
Previously this was done silently.
This commit will enable a warning to inform that the payment does not
have an invoice/bill document attached. This warning does not block
the payment however.
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index b1f96523a..244046b67 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -218,6 +218,8 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
const char *conflict_msg = NULL;
gnc_numeric amount_deb, amount_cred;
gboolean enable_xfer_acct = TRUE;
+ gboolean allow_payment = TRUE;
+ GtkTreeSelection *selection;
if (!pw)
return FALSE;
@@ -226,6 +228,7 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!pw->post_acct)
{
conflict_msg = _("You must enter a valid account name for posting.");
+ allow_payment = FALSE;
goto update_cleanup;
}
@@ -234,6 +237,7 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!gncOwnerIsValid(&pw->owner))
{
conflict_msg = _("You must select a company for payment processing.");
+ allow_payment = FALSE;
goto update_cleanup;
}
@@ -255,9 +259,21 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!pw->xfer_acct)
{
conflict_msg = _("You must select a transfer account from the account tree.");
+ allow_payment = FALSE;
+ goto update_cleanup;
}
}
+ /* this last test checks whether documents were selected. if none,
+ emit warning but still allow as an unattached payment. */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+ if (gtk_tree_selection_count_selected_rows (selection) == 0)
+ {
+ conflict_msg = _("No documents were selected to assign this payment to. This may create an unattached payment.");
+ allow_payment = TRUE;
+ }
+
+
update_cleanup:
gtk_widget_set_sensitive (pw->acct_tree, enable_xfer_acct);
@@ -273,19 +289,17 @@ update_cleanup:
/* Check if there are issues preventing a successful payment */
gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
+ gtk_widget_set_sensitive (pw->ok_button, allow_payment);
if (conflict_msg)
{
gtk_widget_show (pw->payment_warning);
- gtk_widget_set_sensitive (pw->ok_button, FALSE);
- return FALSE;
}
else
{
gtk_widget_hide (pw->payment_warning);
- gtk_widget_set_sensitive (pw->ok_button, TRUE);
}
- return TRUE;
+ return allow_payment;
}
static void
commit 21d608038eadbe573e52a47a99bd57c1ee000474
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 20:12:36 2019 +0800
Addendum to UI Jump to Invoice at 535632b02
Previous trans->invoice strategy was flawed. A payment for multiple
invoices would always return the first invoice found.
A safer approach is to find split->invoice -- this enables a split
from a payment for multiple invoices to retrieve the corresponding
invoice.
The disadvantage is that we cannot jump from bank split to invoice
split anymore; this is acceptable because a payment which covers
multiple invoices would lead to ambiguity and would require UI to
select the invoice for jump.
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index d2de0dbb1..9f50b16ec 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -199,7 +199,7 @@ static void gnc_plugin_page_register_event_handler (QofInstance *entity,
GncPluginPageRegister *page,
GncEventData *ed);
-static GncInvoice * invoice_from_trans (Transaction *trans);
+static GncInvoice * invoice_from_split (Split *split);
/************************************************************/
/* Actions */
@@ -1025,7 +1025,7 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
gtk_action_set_sensitive (GTK_ACTION(action), (uri && *uri));
/* Set 'ExecAssociatedInvoice' */
- inv = invoice_from_trans(trans);
+ inv = invoice_from_split (gnc_split_register_get_current_split (reg));
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
"JumpAssociatedInvoiceAction");
gtk_action_set_sensitive (GTK_ACTION(action), inv != NULL);
@@ -4328,37 +4328,23 @@ gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
}
-static GncInvoice * invoice_from_trans (Transaction *trans)
+static GncInvoice * invoice_from_split (Split *split)
{
GncInvoice *invoice;
- SplitList *splits;
-
- g_return_val_if_fail (GNC_IS_TRANSACTION(trans), NULL);
- invoice = gncInvoiceGetInvoiceFromTxn(trans);
-
- if (invoice)
- return invoice;
-
- for (splits = xaccTransGetSplitList (trans); splits; splits = splits->next)
- {
- Split *split = splits->data;
- GNCLot *lot;
-
- if (!split)
- continue;
+ GNCLot *lot;
- lot = xaccSplitGetLot (split);
- if (!lot)
- continue;
+ if (!split)
+ return NULL;
- invoice = gncInvoiceGetInvoiceFromLot (lot);
- if (!invoice)
- continue;
+ lot = xaccSplitGetLot (split);
+ if (!lot)
+ return NULL;
- return invoice;
- }
+ invoice = gncInvoiceGetInvoiceFromLot (lot);
+ if (!invoice)
+ return NULL;
- return NULL;
+ return invoice;
}
static void
@@ -4374,8 +4360,7 @@ gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction *action,
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
reg = gnc_ledger_display_get_split_register (priv->gsr->ledger);
- invoice = invoice_from_trans (xaccSplitGetParent
- (gnc_split_register_get_current_split (reg)));
+ invoice = invoice_from_split (gnc_split_register_get_current_split (reg));
if (invoice)
gnc_ui_invoice_edit (NULL, invoice);
Summary of changes:
gnucash/gnome/dialog-payment.c | 26 +++++++++++++++----
gnucash/gnome/gnc-plugin-page-register.c | 43 ++++++++++---------------------
gnucash/gtkbuilder/dialog-payment.glade | 44 +++++++++++++++++++++++---------
3 files changed, 67 insertions(+), 46 deletions(-)
More information about the gnucash-changes
mailing list