mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Inform the user when assign as payment can't be used
This commit is contained in:
parent
954ce1ab11
commit
de4414b2a1
@ -1210,7 +1210,7 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
|
||||
|
||||
// ///////////////
|
||||
|
||||
PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
|
||||
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
|
||||
{
|
||||
Split *assetaccount_split;
|
||||
Split *postaccount_split;
|
||||
@ -1224,9 +1224,19 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
|
||||
|
||||
if (!xaccTransGetSplitList(txn))
|
||||
return NULL;
|
||||
|
||||
assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
|
||||
if (!assetaccount_split)
|
||||
{
|
||||
|
||||
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s",
|
||||
_("The selected transaction doesn't have splits that can be assigned as a payment"));
|
||||
gtk_dialog_run (GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
|
||||
xaccTransGetDescription(txn));
|
||||
return NULL;
|
||||
|
@ -34,7 +34,7 @@ PaymentWindow * gnc_ui_payment_new (GncOwner *owner, QofBook *book);
|
||||
PaymentWindow * gnc_ui_payment_new_with_invoice (const GncOwner *owner,
|
||||
QofBook *book,
|
||||
GncInvoice *invoice);
|
||||
PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn);
|
||||
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget *parent, GncOwner *owner, Transaction *txn);
|
||||
|
||||
/** Returns TRUE if the given transaction (to be used with gnc_ui_payment_new_with_txn() )
|
||||
* is for a customer, or FALSE if it's from a vendor or employee voucher. */
|
||||
|
@ -827,7 +827,7 @@ static void gnc_business_assign_payment (GtkWidget *parent,
|
||||
return;
|
||||
|
||||
//g_message("Creating payment dialog with trans %p", trans);
|
||||
gnc_ui_payment_new_with_txn(owner, trans);
|
||||
gnc_ui_payment_new_with_txn(parent, owner, trans);
|
||||
}
|
||||
|
||||
static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
|
||||
|
Loading…
Reference in New Issue
Block a user