mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add some convenience getter functions to gncOwner.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20433 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
105cf24222
commit
7f70514f7e
@ -299,6 +299,26 @@ gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b)
|
||||
return (a->owner.undefined == b->owner.undefined);
|
||||
}
|
||||
|
||||
const char * gncOwnerGetID (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
switch (owner->type)
|
||||
{
|
||||
case GNC_OWNER_NONE:
|
||||
case GNC_OWNER_UNDEFINED:
|
||||
default:
|
||||
return NULL;
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
return gncCustomerGetID (owner->owner.customer);
|
||||
case GNC_OWNER_JOB:
|
||||
return gncJobGetID (owner->owner.job);
|
||||
case GNC_OWNER_VENDOR:
|
||||
return gncVendorGetID (owner->owner.vendor);
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
return gncEmployeeGetID (owner->owner.employee);
|
||||
}
|
||||
}
|
||||
|
||||
const char * gncOwnerGetName (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
@ -319,6 +339,25 @@ const char * gncOwnerGetName (const GncOwner *owner)
|
||||
}
|
||||
}
|
||||
|
||||
GncAddress * gncOwnerGetAddr (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
switch (owner->type)
|
||||
{
|
||||
case GNC_OWNER_NONE:
|
||||
case GNC_OWNER_UNDEFINED:
|
||||
case GNC_OWNER_JOB:
|
||||
default:
|
||||
return NULL;
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
return gncCustomerGetAddr (owner->owner.customer);
|
||||
case GNC_OWNER_VENDOR:
|
||||
return gncVendorGetAddr (owner->owner.vendor);
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
return gncEmployeeGetAddr (owner->owner.employee);
|
||||
}
|
||||
}
|
||||
|
||||
gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
@ -339,6 +378,27 @@ gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean gncOwnerGetActive (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return FALSE;
|
||||
switch (owner->type)
|
||||
{
|
||||
case GNC_OWNER_NONE:
|
||||
case GNC_OWNER_UNDEFINED:
|
||||
default:
|
||||
return FALSE;
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
return gncCustomerGetActive (owner->owner.customer);
|
||||
case GNC_OWNER_VENDOR:
|
||||
return gncVendorGetActive (owner->owner.vendor);
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
return gncEmployeeGetActive (owner->owner.employee);
|
||||
/* Jobs don't really have an active status, so we consider them always active */
|
||||
case GNC_OWNER_JOB:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
const GncGUID * gncOwnerGetGUID (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
|
@ -119,7 +119,10 @@ void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
|
||||
gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
|
||||
int gncOwnerCompare (const GncOwner *a, const GncOwner *b);
|
||||
|
||||
const char * gncOwnerGetID (const GncOwner *owner);
|
||||
const char * gncOwnerGetName (const GncOwner *owner);
|
||||
GncAddress * gncOwnerGetAddr (const GncOwner *owner);
|
||||
gboolean gncOwnerGetActive (const GncOwner *owner);
|
||||
gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
|
||||
|
||||
/** Get the GncGUID of the immediate owner */
|
||||
|
Loading…
Reference in New Issue
Block a user