* .../business-core/gncCustomer.[ch]:

* .../business-core/gncVendor.[ch]:
	* .../business-core/gncEmployee.[ch]:
	  Rename ...Commodity() to ...Currency()
	* .../business-core/gw-business-core-spec.scm: fix function wrappings
	* .../business-core/file/gnc-customer-xml-v2.c:
	* .../business-core/file/gnc-vendor-xml-v2.c:
	* .../business-core/file/gnc-employee-xml-v2.c:
	  Use new function names.
	* .../business-gnome/business-gnome.scm:
	* .../business-gnome/dialog-customer.c:
	* .../business-gnome/dialog-vendor.c:
	* .../business-gnome/dialog-employee.c:
	  Use new ...Currency() functions
	More prep to fix #101001


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7819 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2003-01-12 22:53:02 +00:00
parent 82268e98b3
commit c1adfb5be8
16 changed files with 89 additions and 71 deletions

View File

@ -24,6 +24,22 @@
for printing the invoice.
PARTITAL fix for #101001
* .../business-core/gncCustomer.[ch]:
* .../business-core/gncVendor.[ch]:
* .../business-core/gncEmployee.[ch]:
Rename ...Commodity() to ...Currency()
* .../business-core/gw-business-core-spec.scm: fix function wrappings
* .../business-core/file/gnc-customer-xml-v2.c:
* .../business-core/file/gnc-vendor-xml-v2.c:
* .../business-core/file/gnc-employee-xml-v2.c:
Use new function names.
* .../business-gnome/business-gnome.scm:
* .../business-gnome/dialog-customer.c:
* .../business-gnome/dialog-vendor.c:
* .../business-gnome/dialog-employee.c:
Use new ...Currency() functions
More prep to fix #101001
2003-01-12 David Hampton <hampton@employees.org>
* src/register/register-gnome/gnucash-sheet.c

View File

@ -69,7 +69,7 @@ const gchar *customer_version_string = "2.0.0";
#define cust_active_string "cust:active"
#define cust_discount_string "cust:discount"
#define cust_credit_string "cust:credit"
#define cust_commodity_string "cust:commodity"
#define cust_currency_string "cust:currency"
#define cust_taxtable_string "cust:taxtable"
#define cust_taxtableoverride_string "cust:use-tt"
@ -128,8 +128,8 @@ customer_dom_tree_create (GncCustomer *cust)
xmlAddChild
(ret,
commodity_ref_to_dom_tree(cust_commodity_string,
gncCustomerGetCommodity (cust)));
commodity_ref_to_dom_tree(cust_currency_string,
gncCustomerGetCurrency (cust)));
xmlAddChild (ret, int_to_dom_tree (cust_taxtableoverride_string,
gncCustomerGetTaxTableOverride (cust)));
@ -324,7 +324,7 @@ customer_credit_handler (xmlNodePtr node, gpointer cust_pdata)
}
static gboolean
customer_commodity_handler (xmlNodePtr node, gpointer customer_pdata)
customer_currency_handler (xmlNodePtr node, gpointer customer_pdata)
{
struct customer_pdata *pdata = customer_pdata;
gnc_commodity *com;
@ -332,7 +332,7 @@ customer_commodity_handler (xmlNodePtr node, gpointer customer_pdata)
com = dom_tree_to_commodity_ref(node, pdata->book);
g_return_val_if_fail (com, FALSE);
gncCustomerSetCommodity (pdata->customer, com);
gncCustomerSetCurrency (pdata->customer, com);
return TRUE;
}
@ -379,7 +379,8 @@ static struct dom_tree_handler customer_handlers_v2[] = {
{ cust_active_string, customer_active_handler, 1, 0 },
{ cust_discount_string, customer_discount_handler, 1, 0 },
{ cust_credit_string, customer_credit_handler, 1, 0 },
{ cust_commodity_string, customer_commodity_handler, 1, 0 },
{ cust_currency_string, customer_currency_handler, 0, 0 }, /* XXX */
{ "cust:commodity", customer_currency_handler, 0, 0 }, /* XXX */
{ cust_taxtable_string, customer_taxtable_handler, 0, 0 },
{ cust_taxtableoverride_string, customer_taxtableoverride_handler, 0, 0 },
{ NULL, 0, 0, 0 }

View File

@ -65,7 +65,7 @@ const gchar *employee_version_string = "2.0.0";
#define employee_active_string "employee:active"
#define employee_workday_string "employee:workday"
#define employee_rate_string "employee:rate"
#define employee_commodity_string "employee:commodity"
#define employee_currency_string "employee:currency"
static void
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
@ -110,8 +110,8 @@ employee_dom_tree_create (GncEmployee *employee)
xmlAddChild
(ret,
commodity_ref_to_dom_tree(employee_commodity_string,
gncEmployeeGetCommodity (employee)));
commodity_ref_to_dom_tree(employee_currency_string,
gncEmployeeGetCurrency (employee)));
return ret;
}
@ -245,7 +245,7 @@ employee_rate_handler (xmlNodePtr node, gpointer employee_pdata)
}
static gboolean
employee_commodity_handler (xmlNodePtr node, gpointer employee_pdata)
employee_currency_handler (xmlNodePtr node, gpointer employee_pdata)
{
struct employee_pdata *pdata = employee_pdata;
gnc_commodity *com;
@ -253,7 +253,7 @@ employee_commodity_handler (xmlNodePtr node, gpointer employee_pdata)
com = dom_tree_to_commodity_ref(node, pdata->book);
g_return_val_if_fail (com, FALSE);
gncEmployeeSetCommodity (pdata->employee, com);
gncEmployeeSetCurrency (pdata->employee, com);
return TRUE;
}
@ -268,7 +268,8 @@ static struct dom_tree_handler employee_handlers_v2[] = {
{ employee_active_string, employee_active_handler, 1, 0 },
{ employee_workday_string, employee_workday_handler, 1, 0 },
{ employee_rate_string, employee_rate_handler, 1, 0 },
{ employee_commodity_string, employee_commodity_handler, 1, 0 },
{ employee_currency_string, employee_currency_handler, 0, 0 }, /* XXX */
{ "employee:commodity", employee_currency_handler, 0, 0 }, /* XXX */
{ NULL, 0, 0, 0 }
};

View File

@ -66,7 +66,7 @@ const gchar *vendor_version_string = "2.0.0";
#define vendor_terms_string "vendor:terms"
#define vendor_taxincluded_string "vendor:taxincluded"
#define vendor_active_string "vendor:active"
#define vendor_commodity_string "vendor:commodity"
#define vendor_currency_string "vendor:currency"
#define vendor_taxtable_string "vendor:taxtable"
#define vendor_taxtableoverride_string "vendor:use-tt"
@ -115,8 +115,8 @@ vendor_dom_tree_create (GncVendor *vendor)
xmlAddChild
(ret,
commodity_ref_to_dom_tree(vendor_commodity_string,
gncVendorGetCommodity (vendor)));
commodity_ref_to_dom_tree(vendor_currency_string,
gncVendorGetCurrency (vendor)));
xmlAddChild (ret, int_to_dom_tree (vendor_taxtableoverride_string,
gncVendorGetTaxTableOverride (vendor)));
@ -271,7 +271,7 @@ vendor_active_handler (xmlNodePtr node, gpointer vendor_pdata)
}
static gboolean
vendor_commodity_handler (xmlNodePtr node, gpointer vendor_pdata)
vendor_currency_handler (xmlNodePtr node, gpointer vendor_pdata)
{
struct vendor_pdata *pdata = vendor_pdata;
gnc_commodity *com;
@ -279,7 +279,7 @@ vendor_commodity_handler (xmlNodePtr node, gpointer vendor_pdata)
com = dom_tree_to_commodity_ref(node, pdata->book);
g_return_val_if_fail (com, FALSE);
gncVendorSetCommodity (pdata->vendor, com);
gncVendorSetCurrency (pdata->vendor, com);
return TRUE;
}
@ -323,7 +323,8 @@ static struct dom_tree_handler vendor_handlers_v2[] = {
{ vendor_terms_string, vendor_terms_handler, 0, 0 },
{ vendor_taxincluded_string, vendor_taxincluded_handler, 1, 0 },
{ vendor_active_string, vendor_active_handler, 1, 0 },
{ vendor_commodity_string, vendor_commodity_handler, 1, 0 },
{ vendor_currency_string, vendor_currency_handler, 0, 0 }, /* XXX */
{ "vendor:commodity", vendor_currency_handler, 0, 0 }, /* XXX */
{ vendor_taxtable_string, vendor_taxtable_handler, 0, 0 },
{ vendor_taxtableoverride_string, vendor_taxtableoverride_handler, 0, 0 },
{ NULL, 0, 0, 0 }

View File

@ -33,7 +33,7 @@ struct _gncCustomer {
GncBillTerm * terms;
GncAddress * addr;
GncAddress * shipaddr;
gnc_commodity * commodity;
gnc_commodity * currency;
gnc_numeric discount;
gnc_numeric credit;
GncTaxIncluded taxincluded;
@ -229,12 +229,12 @@ void gncCustomerSetCredit (GncCustomer *cust, gnc_numeric credit)
gncCustomerCommitEdit (cust);
}
void gncCustomerSetCommodity (GncCustomer *cust, gnc_commodity *com)
void gncCustomerSetCurrency (GncCustomer *cust, gnc_commodity *currency)
{
if (!cust || !com) return;
if (cust->commodity && gnc_commodity_equal (cust->commodity, com)) return;
if (!cust || !currency) return;
if (cust->currency && gnc_commodity_equal (cust->currency, currency)) return;
gncCustomerBeginEdit (cust);
cust->commodity = com;
cust->currency = currency;
mark_customer (cust);
gncCustomerCommitEdit (cust);
}
@ -374,10 +374,10 @@ GncTaxIncluded gncCustomerGetTaxIncluded (GncCustomer *cust)
return cust->taxincluded;
}
gnc_commodity * gncCustomerGetCommodity (GncCustomer *cust)
gnc_commodity * gncCustomerGetCurrency (GncCustomer *cust)
{
if (!cust) return NULL;
return cust->commodity;
return cust->currency;
}
gboolean gncCustomerGetActive (GncCustomer *cust)

View File

@ -34,7 +34,7 @@ void gncCustomerSetTaxIncluded (GncCustomer *customer, GncTaxIncluded taxincl);
void gncCustomerSetActive (GncCustomer *customer, gboolean active);
void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount);
void gncCustomerSetCredit (GncCustomer *customer, gnc_numeric credit);
void gncCustomerSetCommodity (GncCustomer *customer, gnc_commodity *com);
void gncCustomerSetCurrency (GncCustomer *customer, gnc_commodity *currency);
void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override);
void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table);
@ -59,7 +59,7 @@ GncTaxIncluded gncCustomerGetTaxIncluded (GncCustomer *customer);
gboolean gncCustomerGetActive (GncCustomer *customer);
gnc_numeric gncCustomerGetDiscount (GncCustomer *customer);
gnc_numeric gncCustomerGetCredit (GncCustomer *customer);
gnc_commodity * gncCustomerGetCommodity (GncCustomer *customer);
gnc_commodity * gncCustomerGetCurrency (GncCustomer *customer);
gboolean gncCustomerGetTaxTableOverride (GncCustomer *customer);
GncTaxTable* gncCustomerGetTaxTable (GncCustomer *customer);

View File

@ -32,7 +32,7 @@ struct _gncEmployee {
char * language;
char * acl;
GncAddress * addr;
gnc_commodity * commodity;
gnc_commodity * currency;
gnc_numeric workday;
gnc_numeric rate;
gboolean active;
@ -193,14 +193,14 @@ void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate)
gncEmployeeCommitEdit (employee);
}
void gncEmployeeSetCommodity (GncEmployee *employee, gnc_commodity *com)
void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity *currency)
{
if (!employee || !com) return;
if (employee->commodity &&
gnc_commodity_equal (employee->commodity, com))
if (!employee || !currency) return;
if (employee->currency &&
gnc_commodity_equal (employee->currency, currency))
return;
gncEmployeeBeginEdit (employee);
employee->commodity = com;
employee->currency = currency;
mark_employee (employee);
gncEmployeeCommitEdit (employee);
}
@ -271,10 +271,10 @@ gnc_numeric gncEmployeeGetRate (GncEmployee *employee)
return employee->rate;
}
gnc_commodity * gncEmployeeGetCommodity (GncEmployee *employee)
gnc_commodity * gncEmployeeGetCurrency (GncEmployee *employee)
{
if (!employee) return NULL;
return employee->commodity;
return employee->currency;
}
gboolean gncEmployeeGetActive (GncEmployee *employee)

View File

@ -27,7 +27,7 @@ void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
void gncEmployeeSetCommodity (GncEmployee *employee, gnc_commodity * com);
void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
/* Get Functions */
@ -41,7 +41,7 @@ const char * gncEmployeeGetLanguage (GncEmployee *employee);
const char * gncEmployeeGetAcl (GncEmployee *employee);
gnc_numeric gncEmployeeGetWorkday (GncEmployee *employee);
gnc_numeric gncEmployeeGetRate (GncEmployee *employee);
gnc_commodity * gncEmployeeGetCommodity (GncEmployee *employee);
gnc_commodity * gncEmployeeGetCurrency (GncEmployee *employee);
gboolean gncEmployeeGetActive (GncEmployee *employee);
GncEmployee * gncEmployeeLookup (GNCBook *book, const GUID *guid);

View File

@ -104,9 +104,9 @@ gnc_commodity * gncOwnerGetCurrency (GncOwner *owner)
default:
return NULL;
case GNC_OWNER_CUSTOMER:
return gncCustomerGetCommodity (owner->owner.customer);
return gncCustomerGetCurrency (owner->owner.customer);
case GNC_OWNER_VENDOR:
return gncVendorGetCommodity (owner->owner.vendor);
return gncVendorGetCurrency (owner->owner.vendor);
case GNC_OWNER_JOB:
return gncOwnerGetCurrency (gncJobGetOwner (owner->owner.job));
}

View File

@ -31,7 +31,7 @@ struct _gncVendor {
char * notes;
GncBillTerm * terms;
GncAddress * addr;
gnc_commodity * commodity;
gnc_commodity * currency;
GncTaxIncluded taxincluded;
gboolean active;
GList * jobs;
@ -190,14 +190,14 @@ void gncVendorSetTaxIncluded (GncVendor *vendor, GncTaxIncluded taxincl)
gncVendorCommitEdit (vendor);
}
void gncVendorSetCommodity (GncVendor *vendor, gnc_commodity *com)
void gncVendorSetCurrency (GncVendor *vendor, gnc_commodity *currency)
{
if (!vendor || !com) return;
if (vendor->commodity &&
gnc_commodity_equal (vendor->commodity, com))
if (!vendor || !currency) return;
if (vendor->currency &&
gnc_commodity_equal (vendor->currency, currency))
return;
gncVendorBeginEdit (vendor);
vendor->commodity = com;
vendor->currency = currency;
mark_vendor (vendor);
gncVendorCommitEdit (vendor);
}
@ -286,10 +286,10 @@ GncTaxIncluded gncVendorGetTaxIncluded (GncVendor *vendor)
return vendor->taxincluded;
}
gnc_commodity * gncVendorGetCommodity (GncVendor *vendor)
gnc_commodity * gncVendorGetCurrency (GncVendor *vendor)
{
if (!vendor) return NULL;
return vendor->commodity;
return vendor->currency;
}
gboolean gncVendorGetActive (GncVendor *vendor)

View File

@ -29,7 +29,7 @@ void gncVendorSetName (GncVendor *vendor, const char *name);
void gncVendorSetNotes (GncVendor *vendor, const char *notes);
void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms);
void gncVendorSetTaxIncluded (GncVendor *vendor, GncTaxIncluded taxincl);
void gncVendorSetCommodity (GncVendor *vendor, gnc_commodity *com);
void gncVendorSetCurrency (GncVendor *vendor, gnc_commodity *currency);
void gncVendorSetActive (GncVendor *vendor, gboolean active);
void gncVendorSetTaxTableOverride (GncVendor *vendor, gboolean override);
@ -51,7 +51,7 @@ GncAddress * gncVendorGetAddr (GncVendor *vendor);
const char * gncVendorGetNotes (GncVendor *vendor);
GncBillTerm * gncVendorGetTerms (GncVendor *vendor);
GncTaxIncluded gncVendorGetTaxIncluded (GncVendor *vendor);
gnc_commodity * gncVendorGetCommodity (GncVendor *vendor);
gnc_commodity * gncVendorGetCurrency (GncVendor *vendor);
gboolean gncVendorGetActive (GncVendor *vendor);
gboolean gncVendorGetTaxTableOverride (GncVendor *vendor);

View File

@ -275,11 +275,11 @@
(gw:wrap-function
ws
'gnc:customer-set-commodity
'gnc:customer-set-currency
'<gw:void>
"gncCustomerSetCommodity"
'((<gnc:GncCustomer*> customer) (<gnc:commodity*> commodity))
"Set the Customer Commodity")
"gncCustomerSetCurrency"
'((<gnc:GncCustomer*> customer) (<gnc:commodity*> currency))
"Set the Customer Currency")
; Get Functions
@ -341,11 +341,11 @@
(gw:wrap-function
ws
'gnc:customer-get-commodity
'gnc:customer-get-currency
'<gnc:commodity*>
"gncCustomerGetCommodity"
"gncCustomerGetCurrency"
'((<gnc:GncCustomer*> customer))
"Get the Customer Commodity")
"Get the Customer Currency")
;;
;; gncEmployee.h
@ -574,7 +574,7 @@
'gnc:invoice-set-currency
'<gw:void>
"gncInvoiceSetCurrency"
'((<gnc:GncInvoice*> invoice) (<gnc:commodity*> commodity))
'((<gnc:GncInvoice*> invoice) (<gnc:commodity*> currency))
"Set the Invoice Currency")
; Get Functions

View File

@ -316,7 +316,7 @@
;; Create Customer
(gnc:customer-set-id customer "000001")
(gnc:customer-set-name customer "Test Customer")
(gnc:customer-set-commodity customer
(gnc:customer-set-currency customer
(gnc:default-currency))
(gnc:address-set-name address "Contact Person")
(gnc:address-set-addr1 address
@ -332,7 +332,7 @@
(gnc:invoice-set-owner invoice owner)
(gnc:invoice-set-date-opened
invoice (cons (current-time) 0))
(gnc:invoice-set-common-commodity
(gnc:invoice-set-currency
invoice (gnc:default-currency))
;; Create the Job

View File

@ -384,7 +384,7 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
GladeXML *xml;
GtkWidget *hbox, *edit;
GnomeDialog *cwd;
gnc_commodity *commodity;
gnc_commodity *currency;
GNCPrintAmountInfo print_info;
/*
@ -466,12 +466,12 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
/* CREDIT: Monetary Value */
edit = gnc_amount_edit_new();
commodity = gnc_default_currency ();
print_info = gnc_commodity_print_info (commodity, FALSE);
currency = gnc_default_currency ();
print_info = gnc_commodity_print_info (currency, FALSE);
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit),
gnc_commodity_get_fraction (commodity));
gnc_commodity_get_fraction (currency));
cw->credit_amount = edit;
gtk_widget_show (edit);
@ -581,7 +581,7 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
} else {
cust = gncCustomerCreate (bookp);
gncCustomerSetCommodity (cust, commodity);
gncCustomerSetCurrency (cust, currency);
cw->customer_guid = *gncCustomerGetGUID (cust);
cw->dialog_type = NEW_CUSTOMER;

View File

@ -319,7 +319,7 @@ gnc_employee_new_window (GNCBook *bookp,
GladeXML *xml;
GtkWidget *hbox, *edit;
GnomeDialog *ewd;
gnc_commodity *commodity;
gnc_commodity *currency;
GNCPrintAmountInfo print_info;
/*
@ -386,12 +386,12 @@ gnc_employee_new_window (GNCBook *bookp,
/* RATE: Monetary Value */
edit = gnc_amount_edit_new();
commodity = gnc_default_currency ();
print_info = gnc_commodity_print_info (commodity, FALSE);
currency = gnc_default_currency ();
print_info = gnc_commodity_print_info (currency, FALSE);
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit),
gnc_commodity_get_fraction (commodity));
gnc_commodity_get_fraction (currency));
ew->rate_amount = edit;
gtk_widget_show (edit);
@ -472,7 +472,7 @@ gnc_employee_new_window (GNCBook *bookp,
ew);
} else {
employee = gncEmployeeCreate (bookp);
gncEmployeeSetCommodity (employee, commodity);
gncEmployeeSetCurrency (employee, currency);
ew->employee_guid = *gncEmployeeGetGUID (employee);
ew->dialog_type = NEW_EMPLOYEE;

View File

@ -10,7 +10,6 @@
#include "dialog-utils.h"
#include "global-options.h"
#include "gnc-amount-edit.h"
#include "gnc-component-manager.h"
#include "gnc-ui.h"
#include "gnc-gui-query.h"
@ -446,7 +445,7 @@ gnc_vendor_new_window (GNCBook *bookp, GncVendor *vendor)
} else {
vendor = gncVendorCreate (bookp);
gncVendorSetCommodity (vendor, gnc_default_currency ());
gncVendorSetCurrency (vendor, gnc_default_currency ());
vw->vendor_guid = *gncVendorGetGUID (vendor);
vw->dialog_type = NEW_VENDOR;