mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 754209 - Bills can be posted from "find bill" search results
even if bill is already posted and results in extra $ posted to A/P This adds a test in gncInvoice to return NULL it already posted. Adds checks in dialog-invoice to test for already posted invoices. Messages user and refuses to post entire selection if more than one selected. Translators: This adds a message string.
This commit is contained in:
parent
1121cd0795
commit
8117a7c17f
@ -2886,17 +2886,41 @@ static void post_one_invoice_cb(gpointer data, gpointer user_data)
|
|||||||
gnc_invoice_post(iw, post_params);
|
gnc_invoice_post(iw, post_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gnc_invoice_is_posted(gpointer inv, gpointer test_value)
|
||||||
|
{
|
||||||
|
GncInvoice *invoice = inv;
|
||||||
|
gboolean *test = (gboolean*)test_value;
|
||||||
|
|
||||||
|
if (gncInvoiceIsPosted (invoice))
|
||||||
|
{
|
||||||
|
*test = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
|
multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct post_invoice_params post_params;
|
struct post_invoice_params post_params;
|
||||||
|
gboolean test;
|
||||||
InvoiceWindow *iw;
|
InvoiceWindow *iw;
|
||||||
|
|
||||||
if (g_list_length(invoice_list) == 0)
|
if (g_list_length(invoice_list) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the posting parameters for these invoices
|
// Get the posting parameters for these invoices
|
||||||
iw = gnc_ui_invoice_edit(invoice_list->data);
|
iw = gnc_ui_invoice_edit(invoice_list->data);
|
||||||
|
test = FALSE;
|
||||||
|
gnc_suspend_gui_refresh (); // Turn off GUI refresh for the duration.
|
||||||
|
// Check if any of the selected invoices have already been posted.
|
||||||
|
g_list_foreach(invoice_list, gnc_invoice_is_posted, &test);
|
||||||
|
gnc_resume_gui_refresh ();
|
||||||
|
if (test)
|
||||||
|
{
|
||||||
|
gnc_error_dialog (iw_get_window(iw), "%s",
|
||||||
|
_("One or more selected invoices have already been posted.\nRe-check you selection."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gnc_dialog_post_invoice(iw, _("Do you really want to post these invoices?"),
|
if (!gnc_dialog_post_invoice(iw, _("Do you really want to post these invoices?"),
|
||||||
&post_params.ddue, &post_params.postdate,
|
&post_params.ddue, &post_params.postdate,
|
||||||
&post_params.memo, &post_params.acc,
|
&post_params.memo, &post_params.acc,
|
||||||
|
@ -1389,7 +1389,8 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
|||||||
const GncOwner *owner;
|
const GncOwner *owner;
|
||||||
|
|
||||||
if (!invoice || !acc) return NULL;
|
if (!invoice || !acc) return NULL;
|
||||||
|
if (gncInvoiceIsPosted (invoice)) return NULL;
|
||||||
|
|
||||||
gncInvoiceBeginEdit (invoice);
|
gncInvoiceBeginEdit (invoice);
|
||||||
book = qof_instance_get_book(invoice);
|
book = qof_instance_get_book(invoice);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user