r17645 - gnucash/branches/2.2/src - [r17644] Fix account defaulting for posting vendor bill
Christian Stimming
cstim at cvs.gnucash.org
Sat Oct 25 05:01:54 EDT 2008
Author: cstim
Date: 2008-10-25 05:01:53 -0400 (Sat, 25 Oct 2008)
New Revision: 17645
Trac: http://svn.gnucash.org/trac/changeset/17645
Modified:
gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.c
gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.h
gnucash/branches/2.2/src/business/business-gnome/dialog-employee.c
gnucash/branches/2.2/src/business/business-gnome/dialog-invoice.c
gnucash/branches/2.2/src/gnome-utils/dialog-options.c
gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.c
gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.h
gnucash/branches/2.2/src/gnome/druid-loan.c
Log:
[r17644] Fix account defaulting for posting vendor bill
In the post screen for vendor bills, in 2.2.7, the account combo box
shows an account but doesn't consider it selected.. this patch allows it
to behave as it appears that it should behave (aka, using the account
visible in the combo box).
This commit contains most parts of r17644 but is still slightly different
as explained in the paragraph above.
Patch by aradzak <aradzak at oracleatbelfry.com>
Modified: gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.c
===================================================================
--- gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -101,7 +101,7 @@
}
static void
-fill_in_acct_info (DialogDateClose *ddc)
+fill_in_acct_info (DialogDateClose *ddc, gboolean set_default_acct)
{
GNCAccountSel *gas = GNC_ACCOUNT_SEL (ddc->acct_combo);
@@ -111,7 +111,7 @@
gnc_account_sel_set_new_account_modal( gas, TRUE );
/* XXX: Some way to remember the last selection? */
- gnc_account_sel_set_account( gas, NULL );
+ gnc_account_sel_set_account( gas, NULL, set_default_acct );
}
static void
@@ -229,6 +229,7 @@
const char *acct_label_message,
const char *question_check_message,
gboolean ok_is_default,
+ gboolean set_default_acct,
GList * acct_types, GNCBook *book,
GncBillTerm *terms,
/* Returned Data... */
@@ -312,7 +313,7 @@
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ddue);
/* Setup the account widget */
- fill_in_acct_info (ddc);
+ fill_in_acct_info (ddc, set_default_acct);
/* Setup signals */
glade_xml_signal_autoconnect_full( xml,
@@ -391,7 +392,7 @@
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *date);
/* Setup the account widget */
- fill_in_acct_info (ddc);
+ fill_in_acct_info (ddc, FALSE);
/* Setup signals */
glade_xml_signal_autoconnect_full( xml,
Modified: gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.h
===================================================================
--- gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.h 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/business/business-gnome/dialog-date-close.h 2008-10-25 09:01:53 UTC (rev 17645)
@@ -50,6 +50,7 @@
const char *acct_label_message,
const char *question_check_message,
gboolean ok_is_default,
+ gboolean set_default_acct,
GList * acct_types, GNCBook *book,
GncBillTerm *terms,
/* Returned Data... */
Modified: gnucash/branches/2.2/src/business/business-gnome/dialog-employee.c
===================================================================
--- gnucash/branches/2.2/src/business/business-gnome/dialog-employee.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/business/business-gnome/dialog-employee.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -549,7 +549,7 @@
gtk_widget_set_sensitive (ew->ccard_acct_sel, FALSE);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), TRUE);
- gnc_account_sel_set_account (GNC_ACCOUNT_SEL (ew->ccard_acct_sel), ccard_acct);
+ gnc_account_sel_set_account (GNC_ACCOUNT_SEL (ew->ccard_acct_sel), ccard_acct, FALSE);
}
/* XXX: Set the ACL */
Modified: gnucash/branches/2.2/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/branches/2.2/src/business/business-gnome/dialog-invoice.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/business/business-gnome/dialog-invoice.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -650,7 +650,7 @@
accumulate = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, "accumulate_splits", NULL);
if (!gnc_dialog_dates_acct_question_parented (iw_get_window(iw), message, ddue_label,
- post_label, acct_label, question_label, TRUE,
+ post_label, acct_label, question_label, TRUE, TRUE,
acct_types, iw->book, iw->terms,
&ddue, &postdate, &memo, &acc, &accumulate))
return;
Modified: gnucash/branches/2.2/src/gnome/druid-loan.c
===================================================================
--- gnucash/branches/2.2/src/gnome/druid-loan.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/gnome/druid-loan.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -1277,7 +1277,7 @@
if ( ldd->ld.escrowAcct ) {
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->optEscrowCb),
TRUE );
- gnc_account_sel_set_account( ldd->optEscrowGAS, ldd->ld.escrowAcct );
+ gnc_account_sel_set_account( ldd->optEscrowGAS, ldd->ld.escrowAcct, FALSE );
}
for ( i=0; i<ldd->ld.repayOptCount; i++ ) {
rouid = ldd->repayOptsUI[i];
@@ -1414,11 +1414,11 @@
gtk_entry_set_text( ldd->repAmtEntry, ldd->ld.repAmount );
gnc_account_sel_set_account( ldd->repAssetsFromGAS,
- ldd->ld.repFromAcct );
+ ldd->ld.repFromAcct, FALSE );
gnc_account_sel_set_account( ldd->repPrincToGAS,
- ldd->ld.repPriAcct );
+ ldd->ld.repPriAcct, FALSE );
gnc_account_sel_set_account( ldd->repIntToGAS,
- ldd->ld.repIntAcct );
+ ldd->ld.repIntAcct, FALSE );
gnc_frequency_setup_recurrence(ldd->repGncFreq,
ldd->ld.repayment_schedule,
ldd->ld.repStartDate);
@@ -1483,7 +1483,7 @@
ldd );
}
- gnc_account_sel_set_account( ldd->payAcctToGAS, rod->to );
+ gnc_account_sel_set_account( ldd->payAcctToGAS, rod->to, FALSE );
uniq = (rod->schedule != NULL);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->payTxnFreqPartRb),
@@ -1684,9 +1684,9 @@
if ( newState )
{
gnc_account_sel_set_account( ldd->payAcctEscToGAS,
- ldd->ld.escrowAcct );
+ ldd->ld.escrowAcct, FALSE );
gnc_account_sel_set_account( ldd->payAcctEscFromGAS,
- ldd->ld.escrowAcct );
+ ldd->ld.escrowAcct, FALSE );
}
}
@@ -1711,7 +1711,7 @@
{
gnc_account_sel_set_account( ldd->payAcctFromGAS,
ldd->ld.repayOpts[ldd->currentIdx]
- ->from );
+ ->from, FALSE );
}
}
Modified: gnucash/branches/2.2/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/branches/2.2/src/gnome-utils/dialog-options.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/gnome-utils/dialog-options.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -2384,7 +2384,7 @@
acc = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_Account"), 4, 0);
}
- gnc_account_sel_set_account (GNC_ACCOUNT_SEL(widget), acc);
+ gnc_account_sel_set_account (GNC_ACCOUNT_SEL(widget), acc, FALSE);
return FALSE;
}
Modified: gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.c
===================================================================
--- gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.c 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.c 2008-10-25 09:01:53 UTC (rev 17645)
@@ -282,11 +282,19 @@
return TRUE;
}
void
-gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct )
+gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct, gboolean set_default_acct )
{
gas_find_data data;
- gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), -1 );
+ if (set_default_acct)
+ {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), 0 );
+ }
+ else
+ {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), -1 );
+ }
+
if ( acct == NULL )
return;
Modified: gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.h
===================================================================
--- gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.h 2008-10-25 08:59:40 UTC (rev 17644)
+++ gnucash/branches/2.2/src/gnome-utils/gnc-account-sel.h 2008-10-25 09:01:53 UTC (rev 17645)
@@ -70,9 +70,10 @@
/**
* Sets the GAS to the given account. If the account doesn't exist in the
* list, then it doesn't change the state of the GAS. If the account is
- * NULL, then the first list selection is made.
+ * NULL, then the first list selection is made if set_default_acct is TRUE.
**/
-void gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct );
+void gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct,
+ gboolean set_default_acct );
/**
* Returns the currently-selected Account. If, for some reason the selection
* is in a bad state, NULL will be returned.
More information about the gnucash-changes
mailing list