mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 13:09:41 -06:00
Add getter/setter for fake Employee name propery.
This is done to get a more consistent owner interface and simplifies the python bindings git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22173 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
572a4fb52c
commit
dbcd08db01
@ -447,6 +447,18 @@ void gncEmployeeSetUsername (GncEmployee *employee, const char *username)
|
||||
gncEmployeeCommitEdit (employee);
|
||||
}
|
||||
|
||||
/* Employees don't have a name property defined, but
|
||||
* in order to get a consistent interface with other owner types,
|
||||
* this function fakes one by setting the name property of
|
||||
* the employee's address.
|
||||
*/
|
||||
void gncEmployeeSetName (GncEmployee *employee, const char *name)
|
||||
{
|
||||
if (!employee) return;
|
||||
if (!name) return;
|
||||
gncAddressSetName (gncEmployeeGetAddr (employee), name);
|
||||
}
|
||||
|
||||
void gncEmployeeSetLanguage (GncEmployee *employee, const char *language)
|
||||
{
|
||||
if (!employee) return;
|
||||
@ -555,6 +567,17 @@ const char * gncEmployeeGetUsername (const GncEmployee *employee)
|
||||
return employee->username;
|
||||
}
|
||||
|
||||
/* Employees don't have a name property defined, but
|
||||
* in order to get a consistent interface with other owner types,
|
||||
* this function fakes one by returning the name property of
|
||||
* the employee's address.
|
||||
*/
|
||||
const char * gncEmployeeGetName (const GncEmployee *employee)
|
||||
{
|
||||
if (!employee) return NULL;
|
||||
return gncAddressGetName ( gncEmployeeGetAddr (employee));
|
||||
}
|
||||
|
||||
GncAddress * gncEmployeeGetAddr (const GncEmployee *employee)
|
||||
{
|
||||
if (!employee) return NULL;
|
||||
@ -812,6 +835,10 @@ gboolean gncEmployeeRegister (void)
|
||||
EMPLOYEE_USERNAME, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetUsername,
|
||||
(QofSetterFunc)gncEmployeeSetUsername
|
||||
},
|
||||
{
|
||||
EMPLOYEE_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetName,
|
||||
(QofSetterFunc)gncEmployeeSetName
|
||||
},
|
||||
{
|
||||
EMPLOYEE_LANGUAGE, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetLanguage,
|
||||
(QofSetterFunc)gncEmployeeSetLanguage
|
||||
|
@ -66,6 +66,12 @@ int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
|
||||
@{ */
|
||||
void gncEmployeeSetID (GncEmployee *employee, const char *id);
|
||||
void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
|
||||
/* Note: Employees don't have a name property defined, but
|
||||
* in order to get a consistent interface with other owner types,
|
||||
* this function fakes one by setting the name property of
|
||||
* the employee's address.
|
||||
*/
|
||||
void gncEmployeeSetName (GncEmployee *employee, const char *name);
|
||||
void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
|
||||
void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
|
||||
void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
|
||||
@ -82,6 +88,12 @@ void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
|
||||
QofBook * gncEmployeeGetBook (GncEmployee *employee);
|
||||
const char * gncEmployeeGetID (const GncEmployee *employee);
|
||||
const char * gncEmployeeGetUsername (const GncEmployee *employee);
|
||||
/* Note: Employees don't have a name property defined, but
|
||||
* in order to get a consistent interface with other owner types,
|
||||
* this function fakes one by returning the name property of
|
||||
* the employee's address.
|
||||
*/
|
||||
const char * gncEmployeeGetName (const GncEmployee *employee);
|
||||
GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
|
||||
const char * gncEmployeeGetLanguage (const GncEmployee *employee);
|
||||
const char * gncEmployeeGetAcl (const GncEmployee *employee);
|
||||
@ -107,6 +119,7 @@ static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUI
|
||||
|
||||
#define EMPLOYEE_ID "id"
|
||||
#define EMPLOYEE_USERNAME "username"
|
||||
#define EMPLOYEE_NAME "name"
|
||||
#define EMPLOYEE_ADDR "addr"
|
||||
#define EMPLOYEE_LANGUAGE "native language"
|
||||
#define EMPLOYEE_ACL "acl"
|
||||
|
@ -397,7 +397,7 @@ const char * gncOwnerGetName (const GncOwner *owner)
|
||||
case GNC_OWNER_VENDOR:
|
||||
return gncVendorGetName (owner->owner.vendor);
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
return gncAddressGetName(gncEmployeeGetAddr (owner->owner.employee));
|
||||
return gncEmployeeGetName (owner->owner.employee);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user