Bug 724578 - Problems clearing incompletely paid invoices

This commit is contained in:
Geert Janssens 2014-02-18 02:03:44 +01:00
parent f0f3a8e812
commit 0c7c335602
2 changed files with 14 additions and 7 deletions

View File

@ -666,9 +666,14 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots); gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots);
/* If the 'xfer_acct' account and the post account don't have the same /* When the payment amount is 0, the selected documents cancel each other out
currency, we need to get the user to specify the exchange rate */ * so no money is actually transferred.
if (!gnc_commodity_equal(xaccAccountGetCommodity(pw->xfer_acct), xaccAccountGetCommodity(pw->post_acct))) * For non-zero payments money will be transferred between the post account
* and the transfer account. In that case if these two accounts don't have
* the same currency the user is asked to enter the exchange rate.
*/
if (!gnc_numeric_zero_p (pw->amount_tot) &&
!gnc_commodity_equal(xaccAccountGetCommodity(pw->xfer_acct), xaccAccountGetCommodity(pw->post_acct)))
{ {
XferDialog* xfer; XferDialog* xfer;

View File

@ -1034,12 +1034,14 @@ gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,
GList *selected_lots = NULL; GList *selected_lots = NULL;
/* Verify our arguments */ /* Verify our arguments */
if (!owner || !posted_acc || !xfer_acc) return; if (!owner || !posted_acc
|| (!xfer_acc && !gnc_numeric_zero_p (amount)) ) return;
g_return_if_fail (owner->owner.undefined); g_return_if_fail (owner->owner.undefined);
/* Create a lot for this payment */ /* If there's a real amount to transfer create a lot for this payment */
payment_lot = gncOwnerCreatePaymentLot (owner, txn, posted_acc, xfer_acc, if (!gnc_numeric_zero_p (amount))
amount, exch, date, memo, num); payment_lot = gncOwnerCreatePaymentLot (owner, txn, posted_acc, xfer_acc,
amount, exch, date, memo, num);
if (lots) if (lots)
selected_lots = lots; selected_lots = lots;