mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add account defaulting for posting vendor bill
In the post screen for vendor bills, in trunk, the account combo box initially has no entry and the user needs to pick one. This isn't a bug, but is an extra step for the user, so the trunk patch does defaulting. I tested the "memory" function to make sure the defaulting doesn't smash the account the user picked for this vendor the last time through, and it works (doesn't conflict). Patch by aradzak <aradzak@oracleatbelfry.com>. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17644 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
631c045e11
commit
1401b066bd
@ -101,7 +101,7 @@ gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
GNCAccountSel *gas = GNC_ACCOUNT_SEL (ddc->acct_combo);
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ fill_in_acct_info (DialogDateClose *ddc)
|
|||||||
gnc_account_sel_set_acct_filters( gas, ddc->acct_types );
|
gnc_account_sel_set_acct_filters( gas, ddc->acct_types );
|
||||||
gnc_account_sel_set_new_account_ability( gas, TRUE );
|
gnc_account_sel_set_new_account_ability( gas, TRUE );
|
||||||
gnc_account_sel_set_new_account_modal( gas, TRUE );
|
gnc_account_sel_set_new_account_modal( gas, TRUE );
|
||||||
gnc_account_sel_set_account( gas, ddc->acct );
|
gnc_account_sel_set_account( gas, ddc->acct, set_default_acct );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -227,6 +227,7 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
|
|||||||
const char *acct_label_message,
|
const char *acct_label_message,
|
||||||
const char *question_check_message,
|
const char *question_check_message,
|
||||||
gboolean ok_is_default,
|
gboolean ok_is_default,
|
||||||
|
gboolean set_default_acct,
|
||||||
GList * acct_types, GNCBook *book,
|
GList * acct_types, GNCBook *book,
|
||||||
GncBillTerm *terms,
|
GncBillTerm *terms,
|
||||||
/* Returned Data... */
|
/* Returned Data... */
|
||||||
@ -311,7 +312,7 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
|
|||||||
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ddue);
|
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ddue);
|
||||||
|
|
||||||
/* Setup the account widget */
|
/* Setup the account widget */
|
||||||
fill_in_acct_info (ddc);
|
fill_in_acct_info (ddc, set_default_acct);
|
||||||
|
|
||||||
/* Setup signals */
|
/* Setup signals */
|
||||||
glade_xml_signal_autoconnect_full( xml,
|
glade_xml_signal_autoconnect_full( xml,
|
||||||
@ -371,7 +372,7 @@ gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
acct_box = glade_xml_get_widget (xml, "acct_hbox");
|
acct_box = glade_xml_get_widget (xml, "acct_hbox");
|
||||||
ddc->acct_combo = gnc_account_sel_new();
|
ddc->acct_combo = gnc_account_sel_new();
|
||||||
if (*acct)
|
if (*acct)
|
||||||
gnc_account_sel_set_account (GNC_ACCOUNT_SEL(ddc->acct_combo), *acct);
|
gnc_account_sel_set_account (GNC_ACCOUNT_SEL(ddc->acct_combo), *acct, FALSE);
|
||||||
gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
|
||||||
|
|
||||||
date_box = glade_xml_get_widget (xml, "date_box");
|
date_box = glade_xml_get_widget (xml, "date_box");
|
||||||
@ -393,7 +394,7 @@ gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *date);
|
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *date);
|
||||||
|
|
||||||
/* Setup the account widget */
|
/* Setup the account widget */
|
||||||
fill_in_acct_info (ddc);
|
fill_in_acct_info (ddc, FALSE);
|
||||||
|
|
||||||
/* Setup signals */
|
/* Setup signals */
|
||||||
glade_xml_signal_autoconnect_full( xml,
|
glade_xml_signal_autoconnect_full( xml,
|
||||||
|
@ -52,6 +52,7 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
|
|||||||
const char *acct_label_message,
|
const char *acct_label_message,
|
||||||
const char *question_check_message,
|
const char *question_check_message,
|
||||||
gboolean ok_is_default,
|
gboolean ok_is_default,
|
||||||
|
gboolean set_default_acct,
|
||||||
GList * acct_types, GNCBook *book,
|
GList * acct_types, GNCBook *book,
|
||||||
GncBillTerm *terms,
|
GncBillTerm *terms,
|
||||||
/* Returned Data... */
|
/* Returned Data... */
|
||||||
|
@ -549,7 +549,7 @@ gnc_employee_new_window (GNCBook *bookp,
|
|||||||
gtk_widget_set_sensitive (ew->ccard_acct_sel, FALSE);
|
gtk_widget_set_sensitive (ew->ccard_acct_sel, FALSE);
|
||||||
} else {
|
} else {
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), TRUE);
|
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 */
|
/* XXX: Set the ACL */
|
||||||
|
@ -664,7 +664,7 @@ gnc_invoice_window_postCB (GtkWidget *widget, gpointer data)
|
|||||||
accumulate = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, "accumulate_splits", NULL);
|
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,
|
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,
|
acct_types, iw->book, iw->terms,
|
||||||
&ddue, &postdate, &memo, &acc, &accumulate))
|
&ddue, &postdate, &memo, &acc, &accumulate))
|
||||||
return;
|
return;
|
||||||
|
@ -2384,7 +2384,8 @@ gnc_option_set_ui_value_account_sel (GNCOption *option, gboolean use_default,
|
|||||||
acc = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_Account"), 4, 0);
|
acc = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_Account"), 4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnc_account_sel_set_account (GNC_ACCOUNT_SEL(widget), acc);
|
//doesn't default because this function is called to set a specific account
|
||||||
|
gnc_account_sel_set_account (GNC_ACCOUNT_SEL(widget), acc, FALSE);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -285,11 +285,18 @@ gnc_account_sel_find_account (GtkTreeModel *model,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
void
|
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;
|
gas_find_data data;
|
||||||
|
|
||||||
|
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 );
|
gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), -1 );
|
||||||
|
}
|
||||||
if ( acct == NULL )
|
if ( acct == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ GtkWidget* gnc_account_sel_new (void);
|
|||||||
/**
|
/**
|
||||||
* Sets the GAS to the given account. If the account doesn't exist in the
|
* 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
|
* 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
|
* Returns the currently-selected Account. If, for some reason the selection
|
||||||
* is in a bad state, NULL will be returned.
|
* is in a bad state, NULL will be returned.
|
||||||
|
@ -1277,7 +1277,7 @@ ld_opts_prep( GnomeDruidPage *gdp, gpointer arg1, gpointer ud )
|
|||||||
if ( ldd->ld.escrowAcct ) {
|
if ( ldd->ld.escrowAcct ) {
|
||||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->optEscrowCb),
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->optEscrowCb),
|
||||||
TRUE );
|
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++ ) {
|
for ( i=0; i<ldd->ld.repayOptCount; i++ ) {
|
||||||
rouid = ldd->repayOptsUI[i];
|
rouid = ldd->repayOptsUI[i];
|
||||||
@ -1414,11 +1414,11 @@ ld_rep_prep( GnomeDruidPage *gdp, gpointer arg1, gpointer ud )
|
|||||||
gtk_entry_set_text( ldd->repAmtEntry, ldd->ld.repAmount );
|
gtk_entry_set_text( ldd->repAmtEntry, ldd->ld.repAmount );
|
||||||
|
|
||||||
gnc_account_sel_set_account( ldd->repAssetsFromGAS,
|
gnc_account_sel_set_account( ldd->repAssetsFromGAS,
|
||||||
ldd->ld.repFromAcct );
|
ldd->ld.repFromAcct, FALSE );
|
||||||
gnc_account_sel_set_account( ldd->repPrincToGAS,
|
gnc_account_sel_set_account( ldd->repPrincToGAS,
|
||||||
ldd->ld.repPriAcct );
|
ldd->ld.repPriAcct, FALSE );
|
||||||
gnc_account_sel_set_account( ldd->repIntToGAS,
|
gnc_account_sel_set_account( ldd->repIntToGAS,
|
||||||
ldd->ld.repIntAcct );
|
ldd->ld.repIntAcct, FALSE );
|
||||||
gnc_frequency_setup_recurrence(ldd->repGncFreq,
|
gnc_frequency_setup_recurrence(ldd->repGncFreq,
|
||||||
ldd->ld.repayment_schedule,
|
ldd->ld.repayment_schedule,
|
||||||
ldd->ld.repStartDate);
|
ldd->ld.repStartDate);
|
||||||
@ -1483,7 +1483,7 @@ ld_pay_prep( GnomeDruidPage *gdp, gpointer arg1, gpointer ud )
|
|||||||
ldd );
|
ldd );
|
||||||
}
|
}
|
||||||
|
|
||||||
gnc_account_sel_set_account( ldd->payAcctToGAS, rod->to );
|
gnc_account_sel_set_account( ldd->payAcctToGAS, rod->to, FALSE );
|
||||||
|
|
||||||
uniq = (rod->schedule != NULL);
|
uniq = (rod->schedule != NULL);
|
||||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->payTxnFreqPartRb),
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ldd->payTxnFreqPartRb),
|
||||||
@ -1684,9 +1684,9 @@ ld_pay_use_esc_setup( LoanDruidData *ldd, gboolean newState )
|
|||||||
if ( newState )
|
if ( newState )
|
||||||
{
|
{
|
||||||
gnc_account_sel_set_account( ldd->payAcctEscToGAS,
|
gnc_account_sel_set_account( ldd->payAcctEscToGAS,
|
||||||
ldd->ld.escrowAcct );
|
ldd->ld.escrowAcct, FALSE );
|
||||||
gnc_account_sel_set_account( ldd->payAcctEscFromGAS,
|
gnc_account_sel_set_account( ldd->payAcctEscFromGAS,
|
||||||
ldd->ld.escrowAcct );
|
ldd->ld.escrowAcct, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,7 +1711,7 @@ ld_pay_spec_src_setup( LoanDruidData *ldd, gboolean newState )
|
|||||||
{
|
{
|
||||||
gnc_account_sel_set_account( ldd->payAcctFromGAS,
|
gnc_account_sel_set_account( ldd->payAcctFromGAS,
|
||||||
ldd->ld.repayOpts[ldd->currentIdx]
|
ldd->ld.repayOpts[ldd->currentIdx]
|
||||||
->from );
|
->from, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user