mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/business/business-core/business-core.scm:
don't need gnc:owner-get-name in scheme add employee support to owners fix bug in (gnc:owner-get-id) * src/business/business-core/gncEmployee.[ch]: add APIs to get-guid and lookup from scheme * src/business/business-core/gw-business-core-spec.scm: wrap employee-get-guid, employee-lookup, employee-get-id, employee-get-username, employee-get-addr, owner-init-employee, owner-get-employee, owner-get-name * src/business/business-gnome/business-options-gnome.c: create an "employee option" widget set * src/business/business-gnome/business-urls.c: define an 'employee' URL type * src/business/business-gnome/dialog-employee.[ch]: remove old, unused search APIs, add new search APIs * src/business/business-gnome/dialog-invoice.c: add _some_ employee support. Still doesn't contain the code to display an employee-owned invoice (expense voucher). * src/business/business-utils/business-options.scm: create an employee option type * src/business/business-core/gncInvoice.c: * src/business/business-core/gncOwner.[ch]: * src/business/business-core/file/gnc-owner-xml-v2.c: * src/business/business-gnome/business-gnome-utils.c * src/business/business-gnome/search-owner.c: add employee support git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8036 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3b4bf7ad45
commit
81a48fdb10
29
ChangeLog
29
ChangeLog
@ -6,6 +6,35 @@
|
|||||||
* src/business/business-core/file/gnc-entry-xml-v2.c:
|
* src/business/business-core/file/gnc-entry-xml-v2.c:
|
||||||
add support for the bill payment type.
|
add support for the bill payment type.
|
||||||
|
|
||||||
|
* src/business/business-core/business-core.scm:
|
||||||
|
don't need gnc:owner-get-name in scheme
|
||||||
|
add employee support to owners
|
||||||
|
fix bug in (gnc:owner-get-id)
|
||||||
|
* src/business/business-core/gncEmployee.[ch]:
|
||||||
|
add APIs to get-guid and lookup from scheme
|
||||||
|
* src/business/business-core/gw-business-core-spec.scm:
|
||||||
|
wrap employee-get-guid, employee-lookup, employee-get-id,
|
||||||
|
employee-get-username, employee-get-addr, owner-init-employee,
|
||||||
|
owner-get-employee, owner-get-name
|
||||||
|
* src/business/business-gnome/business-options-gnome.c:
|
||||||
|
create an "employee option" widget set
|
||||||
|
* src/business/business-gnome/business-urls.c:
|
||||||
|
define an 'employee' URL type
|
||||||
|
* src/business/business-gnome/dialog-employee.[ch]:
|
||||||
|
remove old, unused search APIs,
|
||||||
|
add new search APIs
|
||||||
|
* src/business/business-gnome/dialog-invoice.c:
|
||||||
|
add _some_ employee support. Still doesn't contain the code
|
||||||
|
to display an employee-owned invoice (expense voucher).
|
||||||
|
* src/business/business-utils/business-options.scm:
|
||||||
|
create an employee option type
|
||||||
|
* src/business/business-core/gncInvoice.c:
|
||||||
|
* src/business/business-core/gncOwner.[ch]:
|
||||||
|
* src/business/business-core/file/gnc-owner-xml-v2.c:
|
||||||
|
* src/business/business-gnome/business-gnome-utils.c
|
||||||
|
* src/business/business-gnome/search-owner.c:
|
||||||
|
add employee support
|
||||||
|
|
||||||
2003-03-02 Christian Stimming <stimming@tuhh.de>
|
2003-03-02 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
* src/app-utils/prefs.scm: Adjust the names of register styles in
|
* src/app-utils/prefs.scm: Adjust the names of register styles in
|
||||||
|
@ -32,21 +32,6 @@
|
|||||||
|
|
||||||
(build-string lst)))
|
(build-string lst)))
|
||||||
|
|
||||||
(define (gnc:owner-get-name owner)
|
|
||||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
|
||||||
(gnc:owner-get-type owner) #f)))
|
|
||||||
(case type
|
|
||||||
((gnc-owner-customer)
|
|
||||||
(let ((c (gnc:owner-get-customer owner)))
|
|
||||||
(gnc:customer-get-name c)))
|
|
||||||
((gnc-owner-vendor)
|
|
||||||
(let ((v (gnc:owner-get-vendor owner)))
|
|
||||||
(gnc:vendor-get-name v)))
|
|
||||||
((gnc-owner-job)
|
|
||||||
(gnc:owner-get-name (gnc:job-get-owner
|
|
||||||
(gnc:owner-get-job owner))))
|
|
||||||
(else ""))))
|
|
||||||
|
|
||||||
(define (gnc:owner-get-address owner)
|
(define (gnc:owner-get-address owner)
|
||||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||||
(gnc:owner-get-type owner) #f)))
|
(gnc:owner-get-type owner) #f)))
|
||||||
@ -57,6 +42,9 @@
|
|||||||
((gnc-owner-vendor)
|
((gnc-owner-vendor)
|
||||||
(let ((v (gnc:owner-get-vendor owner)))
|
(let ((v (gnc:owner-get-vendor owner)))
|
||||||
(gnc:vendor-get-addr v)))
|
(gnc:vendor-get-addr v)))
|
||||||
|
((gnc-owner-employee)
|
||||||
|
(let ((e (gnc:owner-get-employee owner)))
|
||||||
|
(gnc:employee-get-addr e)))
|
||||||
((gnc-owner-job)
|
((gnc-owner-job)
|
||||||
(gnc:owner-get-address (gnc:job-get-owner
|
(gnc:owner-get-address (gnc:job-get-owner
|
||||||
(gnc:owner-get-job owner))))
|
(gnc:owner-get-job owner))))
|
||||||
@ -76,6 +64,11 @@
|
|||||||
(name-and-addr
|
(name-and-addr
|
||||||
(gnc:vendor-get-name v)
|
(gnc:vendor-get-name v)
|
||||||
(gnc:vendor-get-addr v))))
|
(gnc:vendor-get-addr v))))
|
||||||
|
((gnc-owner-employee)
|
||||||
|
(let ((e (gnc:owner-get-employee owner)))
|
||||||
|
(name-and-addr
|
||||||
|
""
|
||||||
|
(gnc:employee-get-addr e))))
|
||||||
((gnc-owner-job)
|
((gnc-owner-job)
|
||||||
(gnc:owner-get-address-dep (gnc:job-get-owner
|
(gnc:owner-get-address-dep (gnc:job-get-owner
|
||||||
(gnc:owner-get-job owner))))
|
(gnc:owner-get-job owner))))
|
||||||
@ -87,10 +80,13 @@
|
|||||||
(case type
|
(case type
|
||||||
((gnc-owner-customer)
|
((gnc-owner-customer)
|
||||||
(let ((c (gnc:owner-get-customer owner)))
|
(let ((c (gnc:owner-get-customer owner)))
|
||||||
(gnc:customer-get-id)))
|
(gnc:customer-get-id c)))
|
||||||
((gnc-owner-vendor)
|
((gnc-owner-vendor)
|
||||||
(let ((v (gnc:owner-get-vendor owner)))
|
(let ((v (gnc:owner-get-vendor owner)))
|
||||||
(gnc:vendor-get-id)))
|
(gnc:vendor-get-id v)))
|
||||||
|
((gnc-owner-employee)
|
||||||
|
(let ((e (gnc:owner-get-employee owner)))
|
||||||
|
(gnc:employee-get-id e)))
|
||||||
((gnc-owner-job)
|
((gnc-owner-job)
|
||||||
(gnc:owner-get-id (gnc:job-get-owner (gnc:owner-get-job owner))))
|
(gnc:owner-get-id (gnc:job-get-owner (gnc:owner-get-job owner))))
|
||||||
(else ""))))
|
(else ""))))
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "gncCustomerP.h"
|
#include "gncCustomerP.h"
|
||||||
#include "gncJobP.h"
|
#include "gncJobP.h"
|
||||||
#include "gncVendorP.h"
|
#include "gncVendorP.h"
|
||||||
|
#include "gncEmployeeP.h"
|
||||||
|
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ gnc_owner_to_dom_tree (const char *tag, GncOwner *owner)
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
type_str = GNC_VENDOR_MODULE_NAME;
|
type_str = GNC_VENDOR_MODULE_NAME;
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
type_str = GNC_EMPLOYEE_MODULE_NAME;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PWARN ("Invalid owner type: %d", gncOwnerGetType (owner));
|
PWARN ("Invalid owner type: %d", gncOwnerGetType (owner));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -108,6 +112,8 @@ owner_type_handler (xmlNodePtr node, gpointer owner_pdata)
|
|||||||
gncOwnerInitJob (pdata->owner, NULL);
|
gncOwnerInitJob (pdata->owner, NULL);
|
||||||
else if (!safe_strcmp (txt, GNC_VENDOR_MODULE_NAME))
|
else if (!safe_strcmp (txt, GNC_VENDOR_MODULE_NAME))
|
||||||
gncOwnerInitVendor (pdata->owner, NULL);
|
gncOwnerInitVendor (pdata->owner, NULL);
|
||||||
|
else if (!safe_strcmp (txt, GNC_EMPLOYEE_MODULE_NAME))
|
||||||
|
gncOwnerInitEmployee (pdata->owner, NULL);
|
||||||
else {
|
else {
|
||||||
PWARN ("Unknown owner type: %s", txt);
|
PWARN ("Unknown owner type: %s", txt);
|
||||||
g_free(txt);
|
g_free(txt);
|
||||||
@ -158,6 +164,16 @@ owner_id_handler (xmlNodePtr node, gpointer owner_pdata)
|
|||||||
gncOwnerInitVendor (pdata->owner, vendor);
|
gncOwnerInitVendor (pdata->owner, vendor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
{
|
||||||
|
GncEmployee *employee = gncEmployeeLookup (pdata->book, guid);
|
||||||
|
if (!employee) {
|
||||||
|
employee = gncEmployeeCreate (pdata->book);
|
||||||
|
gncEmployeeSetGUID (employee, guid);
|
||||||
|
}
|
||||||
|
gncOwnerInitEmployee (pdata->owner, employee);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
PWARN ("Invalid owner type: %d\n", gncOwnerGetType (pdata->owner));
|
PWARN ("Invalid owner type: %d\n", gncOwnerGetType (pdata->owner));
|
||||||
g_free (guid);
|
g_free (guid);
|
||||||
|
@ -290,6 +290,20 @@ GncEmployee * gncEmployeeLookup (GNCBook *book, const GUID *guid)
|
|||||||
guid, _GNC_MOD_NAME);
|
guid, _GNC_MOD_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUID gncEmployeeRetGUID (GncEmployee *employee)
|
||||||
|
{
|
||||||
|
if (!employee)
|
||||||
|
return *xaccGUIDNULL();
|
||||||
|
|
||||||
|
return employee->guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
GncEmployee * gncEmployeeLookupDirect (GUID guid, GNCBook *book)
|
||||||
|
{
|
||||||
|
if (!book) return NULL;
|
||||||
|
return gncEmployeeLookup (book, &guid);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean gncEmployeeIsDirty (GncEmployee *employee)
|
gboolean gncEmployeeIsDirty (GncEmployee *employee)
|
||||||
{
|
{
|
||||||
if (!employee) return FALSE;
|
if (!employee) return FALSE;
|
||||||
|
@ -47,6 +47,9 @@ gboolean gncEmployeeGetActive (GncEmployee *employee);
|
|||||||
GncEmployee * gncEmployeeLookup (GNCBook *book, const GUID *guid);
|
GncEmployee * gncEmployeeLookup (GNCBook *book, const GUID *guid);
|
||||||
gboolean gncEmployeeIsDirty (GncEmployee *employee);
|
gboolean gncEmployeeIsDirty (GncEmployee *employee);
|
||||||
|
|
||||||
|
GUID gncEmployeeRetGUID (GncEmployee *employee);
|
||||||
|
GncEmployee * gncEmployeeLookupDirect (GUID guid, GNCBook *book);
|
||||||
|
|
||||||
void gncEmployeeBeginEdit (GncEmployee *employee);
|
void gncEmployeeBeginEdit (GncEmployee *employee);
|
||||||
void gncEmployeeCommitEdit (GncEmployee *employee);
|
void gncEmployeeCommitEdit (GncEmployee *employee);
|
||||||
int gncEmployeeCompare (GncEmployee *a, GncEmployee *b);
|
int gncEmployeeCompare (GncEmployee *a, GncEmployee *b);
|
||||||
|
@ -460,6 +460,8 @@ const char * gncInvoiceGetType (GncInvoice *invoice)
|
|||||||
return _("Invoice");
|
return _("Invoice");
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
return _("Bill");
|
return _("Bill");
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return _("Expense Voucher");
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,13 @@ void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor)
|
|||||||
owner->owner.vendor = vendor;
|
owner->owner.vendor = vendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee)
|
||||||
|
{
|
||||||
|
if (!owner) return;
|
||||||
|
owner->type = GNC_OWNER_EMPLOYEE;
|
||||||
|
owner->owner.employee = employee;
|
||||||
|
}
|
||||||
|
|
||||||
GncOwnerType gncOwnerGetType (const GncOwner *owner)
|
GncOwnerType gncOwnerGetType (const GncOwner *owner)
|
||||||
{
|
{
|
||||||
if (!owner) return GNC_OWNER_NONE;
|
if (!owner) return GNC_OWNER_NONE;
|
||||||
@ -95,6 +102,13 @@ GncVendor * gncOwnerGetVendor (const GncOwner *owner)
|
|||||||
return owner->owner.vendor;
|
return owner->owner.vendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GncEmployee * gncOwnerGetEmployee (const GncOwner *owner)
|
||||||
|
{
|
||||||
|
if (!owner) return NULL;
|
||||||
|
if (owner->type != GNC_OWNER_EMPLOYEE) return NULL;
|
||||||
|
return owner->owner.employee;
|
||||||
|
}
|
||||||
|
|
||||||
gnc_commodity * gncOwnerGetCurrency (GncOwner *owner)
|
gnc_commodity * gncOwnerGetCurrency (GncOwner *owner)
|
||||||
{
|
{
|
||||||
if (!owner) return NULL;
|
if (!owner) return NULL;
|
||||||
@ -107,6 +121,8 @@ gnc_commodity * gncOwnerGetCurrency (GncOwner *owner)
|
|||||||
return gncCustomerGetCurrency (owner->owner.customer);
|
return gncCustomerGetCurrency (owner->owner.customer);
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
return gncVendorGetCurrency (owner->owner.vendor);
|
return gncVendorGetCurrency (owner->owner.vendor);
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return gncEmployeeGetCurrency (owner->owner.employee);
|
||||||
case GNC_OWNER_JOB:
|
case GNC_OWNER_JOB:
|
||||||
return gncOwnerGetCurrency (gncJobGetOwner (owner->owner.job));
|
return gncOwnerGetCurrency (gncJobGetOwner (owner->owner.job));
|
||||||
}
|
}
|
||||||
@ -140,6 +156,8 @@ const char * gncOwnerGetName (GncOwner *owner)
|
|||||||
return gncJobGetName (owner->owner.job);
|
return gncJobGetName (owner->owner.job);
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
return gncVendorGetName (owner->owner.vendor);
|
return gncVendorGetName (owner->owner.vendor);
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return gncEmployeeGetUsername (owner->owner.employee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +176,8 @@ const GUID * gncOwnerGetGUID (GncOwner *owner)
|
|||||||
return gncJobGetGUID (owner->owner.job);
|
return gncJobGetGUID (owner->owner.job);
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
return gncVendorGetGUID (owner->owner.vendor);
|
return gncVendorGetGUID (owner->owner.vendor);
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return gncEmployeeGetGUID (owner->owner.employee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +199,7 @@ GncOwner * gncOwnerGetEndOwner (GncOwner *owner)
|
|||||||
return NULL;
|
return NULL;
|
||||||
case GNC_OWNER_CUSTOMER:
|
case GNC_OWNER_CUSTOMER:
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
return owner;
|
return owner;
|
||||||
case GNC_OWNER_JOB:
|
case GNC_OWNER_JOB:
|
||||||
return gncJobGetOwner (owner->owner.job);
|
return gncJobGetOwner (owner->owner.job);
|
||||||
@ -203,6 +224,8 @@ int gncOwnerCompare (const GncOwner *a, const GncOwner *b)
|
|||||||
return gncCustomerCompare (a->owner.customer, b->owner.customer);
|
return gncCustomerCompare (a->owner.customer, b->owner.customer);
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
return gncVendorCompare (a->owner.vendor, b->owner.vendor);
|
return gncVendorCompare (a->owner.vendor, b->owner.vendor);
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return gncEmployeeCompare (a->owner.employee, b->owner.employee);
|
||||||
case GNC_OWNER_JOB:
|
case GNC_OWNER_JOB:
|
||||||
return gncJobCompare (a->owner.job, b->owner.job);
|
return gncJobCompare (a->owner.job, b->owner.job);
|
||||||
}
|
}
|
||||||
@ -267,6 +290,9 @@ gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner)
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
gncOwnerInitVendor (owner, gncVendorLookup (book, guid));
|
gncOwnerInitVendor (owner, gncVendorLookup (book, guid));
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
gncOwnerInitEmployee (owner, gncEmployeeLookup (book, guid));
|
||||||
|
break;
|
||||||
case GNC_OWNER_JOB:
|
case GNC_OWNER_JOB:
|
||||||
gncOwnerInitJob (owner, gncJobLookup (book, guid));
|
gncOwnerInitJob (owner, gncJobLookup (book, guid));
|
||||||
break;
|
break;
|
||||||
@ -317,6 +343,7 @@ gboolean gncOwnerRegister (void)
|
|||||||
(QueryAccess)gncOwnerGetCustomer },
|
(QueryAccess)gncOwnerGetCustomer },
|
||||||
{ OWNER_JOB, GNC_JOB_MODULE_NAME, (QueryAccess)gncOwnerGetJob },
|
{ OWNER_JOB, GNC_JOB_MODULE_NAME, (QueryAccess)gncOwnerGetJob },
|
||||||
{ OWNER_VENDOR, GNC_VENDOR_MODULE_NAME, (QueryAccess)gncOwnerGetVendor },
|
{ OWNER_VENDOR, GNC_VENDOR_MODULE_NAME, (QueryAccess)gncOwnerGetVendor },
|
||||||
|
{ OWNER_EMPLOYEE, GNC_EMPLOYEE_MODULE_NAME, (QueryAccess)gncOwnerGetEmployee },
|
||||||
{ OWNER_PARENT, _GNC_MOD_NAME, (QueryAccess)gncOwnerGetEndOwner },
|
{ OWNER_PARENT, _GNC_MOD_NAME, (QueryAccess)gncOwnerGetEndOwner },
|
||||||
{ OWNER_PARENTG, QUERYCORE_GUID, (QueryAccess)gncOwnerGetEndGUID },
|
{ OWNER_PARENTG, QUERYCORE_GUID, (QueryAccess)gncOwnerGetEndGUID },
|
||||||
{ OWNER_NAME, QUERYCORE_STRING, (QueryAccess)gncOwnerGetName },
|
{ OWNER_NAME, QUERYCORE_STRING, (QueryAccess)gncOwnerGetName },
|
||||||
|
@ -14,6 +14,7 @@ typedef struct gnc_owner_s GncOwner;
|
|||||||
#include "gncCustomer.h"
|
#include "gncCustomer.h"
|
||||||
#include "gncJob.h"
|
#include "gncJob.h"
|
||||||
#include "gncVendor.h"
|
#include "gncVendor.h"
|
||||||
|
#include "gncEmployee.h"
|
||||||
#include "gnc-lot.h"
|
#include "gnc-lot.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -21,7 +22,8 @@ typedef enum {
|
|||||||
GNC_OWNER_UNDEFINED,
|
GNC_OWNER_UNDEFINED,
|
||||||
GNC_OWNER_CUSTOMER,
|
GNC_OWNER_CUSTOMER,
|
||||||
GNC_OWNER_JOB,
|
GNC_OWNER_JOB,
|
||||||
GNC_OWNER_VENDOR
|
GNC_OWNER_VENDOR,
|
||||||
|
GNC_OWNER_EMPLOYEE
|
||||||
} GncOwnerType;
|
} GncOwnerType;
|
||||||
|
|
||||||
struct gnc_owner_s {
|
struct gnc_owner_s {
|
||||||
@ -31,6 +33,7 @@ struct gnc_owner_s {
|
|||||||
GncCustomer * customer;
|
GncCustomer * customer;
|
||||||
GncJob * job;
|
GncJob * job;
|
||||||
GncVendor * vendor;
|
GncVendor * vendor;
|
||||||
|
GncEmployee * employee;
|
||||||
} owner;
|
} owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,12 +41,14 @@ void gncOwnerInitUndefined (GncOwner *owner, gpointer obj);
|
|||||||
void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer);
|
void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer);
|
||||||
void gncOwnerInitJob (GncOwner *owner, GncJob *job);
|
void gncOwnerInitJob (GncOwner *owner, GncJob *job);
|
||||||
void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor);
|
void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor);
|
||||||
|
void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee);
|
||||||
|
|
||||||
GncOwnerType gncOwnerGetType (const GncOwner *owner);
|
GncOwnerType gncOwnerGetType (const GncOwner *owner);
|
||||||
gpointer gncOwnerGetUndefined (const GncOwner *owner);
|
gpointer gncOwnerGetUndefined (const GncOwner *owner);
|
||||||
GncCustomer * gncOwnerGetCustomer (const GncOwner *owner);
|
GncCustomer * gncOwnerGetCustomer (const GncOwner *owner);
|
||||||
GncJob * gncOwnerGetJob (const GncOwner *owner);
|
GncJob * gncOwnerGetJob (const GncOwner *owner);
|
||||||
GncVendor * gncOwnerGetVendor (const GncOwner *owner);
|
GncVendor * gncOwnerGetVendor (const GncOwner *owner);
|
||||||
|
GncEmployee * gncOwnerGetEmployee (const GncOwner *owner);
|
||||||
|
|
||||||
void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
|
void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
|
||||||
gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
|
gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
|
||||||
@ -77,6 +82,7 @@ gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
|
|||||||
#define OWNER_CUSTOMER "customer"
|
#define OWNER_CUSTOMER "customer"
|
||||||
#define OWNER_JOB "job"
|
#define OWNER_JOB "job"
|
||||||
#define OWNER_VENDOR "vendor"
|
#define OWNER_VENDOR "vendor"
|
||||||
|
#define OWNER_EMPLOYEE "employee"
|
||||||
#define OWNER_PARENT "parent"
|
#define OWNER_PARENT "parent"
|
||||||
#define OWNER_PARENTG "parent-guid"
|
#define OWNER_PARENTG "parent-guid"
|
||||||
#define OWNER_NAME "name"
|
#define OWNER_NAME "name"
|
||||||
|
@ -74,6 +74,7 @@
|
|||||||
(gw:enum-add-value! wt "GNC_OWNER_CUSTOMER" 'gnc-owner-customer)
|
(gw:enum-add-value! wt "GNC_OWNER_CUSTOMER" 'gnc-owner-customer)
|
||||||
(gw:enum-add-value! wt "GNC_OWNER_JOB" 'gnc-owner-job)
|
(gw:enum-add-value! wt "GNC_OWNER_JOB" 'gnc-owner-job)
|
||||||
(gw:enum-add-value! wt "GNC_OWNER_VENDOR" 'gnc-owner-vendor)
|
(gw:enum-add-value! wt "GNC_OWNER_VENDOR" 'gnc-owner-vendor)
|
||||||
|
(gw:enum-add-value! wt "GNC_OWNER_EMPLOYEE" 'gnc-owner-employee)
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
(let ((wt (gw:wrap-enumeration ws '<gnc:GncAmountType> "GncAmountType")))
|
(let ((wt (gw:wrap-enumeration ws '<gnc:GncAmountType> "GncAmountType")))
|
||||||
@ -351,6 +352,46 @@
|
|||||||
;; gncEmployee.h
|
;; gncEmployee.h
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:employee-get-guid
|
||||||
|
'<gnc:guid-scm>
|
||||||
|
"gncEmployeeRetGUID"
|
||||||
|
'((<gnc:GncEmployee*> employee))
|
||||||
|
"Return the GUID of the employee")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:employee-lookup
|
||||||
|
'<gnc:GncEmployee*>
|
||||||
|
"gncEmployeeLookupDirect"
|
||||||
|
'((<gnc:guid-scm> guid) (<gnc:Book*> book))
|
||||||
|
"Lookup the employee with GUID guid.")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:employee-get-id
|
||||||
|
'(<gw:mchars> callee-owned const)
|
||||||
|
"gncEmployeeGetID"
|
||||||
|
'((<gnc:GncEmployee*> employee))
|
||||||
|
"Return the Employee's ID")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:customer-get-username
|
||||||
|
'(<gw:mchars> callee-owned const)
|
||||||
|
"gncEmployeeGetUsername"
|
||||||
|
'((<gnc:GncEmployee*> employee))
|
||||||
|
"Return the Employee's Username")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:employee-get-addr
|
||||||
|
'<gnc:GncAddress*>
|
||||||
|
"gncEmployeeGetAddr"
|
||||||
|
'((<gnc:GncEmployee*> employee))
|
||||||
|
"Return the Employee's Address")
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; gncEntry.h
|
;; gncEntry.h
|
||||||
;;
|
;;
|
||||||
@ -951,6 +992,14 @@
|
|||||||
'((<gnc:GncOwner*> owner) (<gnc:GncVendor*> vendor))
|
'((<gnc:GncOwner*> owner) (<gnc:GncVendor*> vendor))
|
||||||
"Initialize an owner to hold a Vendor. The Vendor may be NULL.")
|
"Initialize an owner to hold a Vendor. The Vendor may be NULL.")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:owner-init-employee
|
||||||
|
'<gw:void>
|
||||||
|
"gncOwnerInitEmployee"
|
||||||
|
'((<gnc:GncOwner*> owner) (<gnc:GncEmployee*> employee))
|
||||||
|
"Initialize an owner to hold a Employee. The Employee may be NULL.")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
ws
|
ws
|
||||||
'gnc:owner-get-type
|
'gnc:owner-get-type
|
||||||
@ -983,6 +1032,14 @@
|
|||||||
'((<gnc:GncOwner*> owner))
|
'((<gnc:GncOwner*> owner))
|
||||||
"Return the vendor of this owner.")
|
"Return the vendor of this owner.")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:owner-get-employee
|
||||||
|
'<gnc:GncEmployee*>
|
||||||
|
"gncOwnerGetEmployee"
|
||||||
|
'((<gnc:GncOwner*> owner))
|
||||||
|
"Return the employee of this owner.")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
ws
|
ws
|
||||||
'gnc:owner-equal
|
'gnc:owner-equal
|
||||||
@ -1015,6 +1072,14 @@
|
|||||||
'((<gnc:GncOwner*> owner))
|
'((<gnc:GncOwner*> owner))
|
||||||
"Return the GUID of this owner")
|
"Return the GUID of this owner")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:owner-get-name
|
||||||
|
'(<gw:mchars> callee-owned const)
|
||||||
|
"gncOwnerGetName"
|
||||||
|
'((<gnc:GncOwner*> owner))
|
||||||
|
"Return the Name of this owner")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
ws
|
ws
|
||||||
'gnc:owner-copy-into-owner
|
'gnc:owner-copy-into-owner
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "dialog-customer.h"
|
#include "dialog-customer.h"
|
||||||
#include "dialog-job.h"
|
#include "dialog-job.h"
|
||||||
#include "dialog-vendor.h"
|
#include "dialog-vendor.h"
|
||||||
|
#include "dialog-employee.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GNCSEARCH_TYPE_SELECT,
|
GNCSEARCH_TYPE_SELECT,
|
||||||
@ -78,6 +79,14 @@ static GtkWidget * gnc_owner_new (GtkWidget *label, GtkWidget *hbox,
|
|||||||
type_name = GNC_VENDOR_MODULE_NAME;
|
type_name = GNC_VENDOR_MODULE_NAME;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
if (type == GNCSEARCH_TYPE_SELECT)
|
||||||
|
search_cb = gnc_employee_search_select;
|
||||||
|
else
|
||||||
|
search_cb = gnc_employee_search_edit;
|
||||||
|
type_name = GNC_EMPLOYEE_MODULE_NAME;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown type");
|
g_warning ("Unknown type");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -209,6 +218,7 @@ gnc_business_account_types (GncOwner *owner)
|
|||||||
case GNC_OWNER_CUSTOMER:
|
case GNC_OWNER_CUSTOMER:
|
||||||
return (g_list_prepend (NULL, (gpointer)RECEIVABLE));
|
return (g_list_prepend (NULL, (gpointer)RECEIVABLE));
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
return (g_list_prepend (NULL, (gpointer)PAYABLE));
|
return (g_list_prepend (NULL, (gpointer)PAYABLE));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -47,6 +47,9 @@ create_owner_widget (GNCOption *option, GncOwnerType type, GtkWidget *hbox)
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
gncOwnerInitVendor (&owner, NULL);
|
gncOwnerInitVendor (&owner, NULL);
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
gncOwnerInitEmployee (&owner, NULL);
|
||||||
|
break;
|
||||||
case GNC_OWNER_JOB:
|
case GNC_OWNER_JOB:
|
||||||
gncOwnerInitJob (&owner, NULL);
|
gncOwnerInitJob (&owner, NULL);
|
||||||
break;
|
break;
|
||||||
@ -279,6 +282,65 @@ vendor_get_value (GNCOption *option, GtkWidget *widget)
|
|||||||
scm_c_eval_string("<gnc:GncVendor*>"));
|
scm_c_eval_string("<gnc:GncVendor*>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
/* "Employee" Option functions */
|
||||||
|
|
||||||
|
|
||||||
|
/* Function to set the UI widget based upon the option */
|
||||||
|
static GtkWidget *
|
||||||
|
employee_set_widget (GNCOption *option, GtkBox *page_box,
|
||||||
|
GtkTooltips *tooltips,
|
||||||
|
char *name, char *documentation,
|
||||||
|
/* Return values */
|
||||||
|
GtkWidget **enclosing, gboolean *packed)
|
||||||
|
{
|
||||||
|
GtkWidget *value;
|
||||||
|
GtkWidget *label;
|
||||||
|
|
||||||
|
*enclosing = gtk_hbox_new (FALSE, 5);
|
||||||
|
label = make_name_label (name);
|
||||||
|
gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
value = create_owner_widget (option, GNC_OWNER_EMPLOYEE, *enclosing);
|
||||||
|
|
||||||
|
gnc_option_set_ui_value (option, FALSE);
|
||||||
|
|
||||||
|
gtk_widget_show_all (*enclosing);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function to set the UI Value for a particular option */
|
||||||
|
static gboolean
|
||||||
|
employee_set_value (GNCOption *option, gboolean use_default,
|
||||||
|
GtkWidget *widget, SCM value)
|
||||||
|
{
|
||||||
|
GncOwner owner;
|
||||||
|
GncEmployee *employee;
|
||||||
|
|
||||||
|
if (!gw_wcp_p (value))
|
||||||
|
scm_misc_error("business_options:employee_set_value",
|
||||||
|
"Item is not a gw:wcp.", value);
|
||||||
|
|
||||||
|
employee = gw_wcp_get_ptr (value);
|
||||||
|
gncOwnerInitEmployee (&owner, employee);
|
||||||
|
|
||||||
|
widget = gnc_option_get_widget (option);
|
||||||
|
gnc_owner_set_owner (widget, &owner);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function to get the UI Value for a particular option */
|
||||||
|
static SCM
|
||||||
|
employee_get_value (GNCOption *option, GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GncOwner owner;
|
||||||
|
|
||||||
|
gnc_owner_get_owner (widget, &owner);
|
||||||
|
|
||||||
|
return gw_wcp_assimilate_ptr (owner.owner.undefined,
|
||||||
|
scm_c_eval_string("<gnc:GncEmployee*>"));
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/* "Invoice" Option functions */
|
/* "Invoice" Option functions */
|
||||||
|
|
||||||
@ -439,6 +501,7 @@ gnc_business_options_gnome_initialize (void)
|
|||||||
{ "customer", customer_set_widget, customer_set_value,
|
{ "customer", customer_set_widget, customer_set_value,
|
||||||
customer_get_value },
|
customer_get_value },
|
||||||
{ "vendor", vendor_set_widget, vendor_set_value, vendor_get_value },
|
{ "vendor", vendor_set_widget, vendor_set_value, vendor_get_value },
|
||||||
|
{ "employee", employee_set_widget, employee_set_value, employee_get_value },
|
||||||
{ "invoice", invoice_set_widget, invoice_set_value, invoice_get_value },
|
{ "invoice", invoice_set_widget, invoice_set_value, invoice_get_value },
|
||||||
{ "taxtable", taxtable_set_widget, taxtable_set_value, taxtable_get_value },
|
{ "taxtable", taxtable_set_widget, taxtable_set_value, taxtable_get_value },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
|
|
||||||
#include "gncCustomer.h"
|
#include "gncCustomer.h"
|
||||||
#include "gncVendor.h"
|
#include "gncVendor.h"
|
||||||
|
#include "gncEmployee.h"
|
||||||
#include "gncInvoice.h"
|
#include "gncInvoice.h"
|
||||||
|
|
||||||
#include "business-urls.h"
|
#include "business-urls.h"
|
||||||
#include "dialog-customer.h"
|
#include "dialog-customer.h"
|
||||||
|
#include "dialog-employee.h"
|
||||||
#include "dialog-vendor.h"
|
#include "dialog-vendor.h"
|
||||||
#include "dialog-invoice.h"
|
#include "dialog-invoice.h"
|
||||||
|
|
||||||
@ -122,6 +124,56 @@ vendorCB (const char *location, const char *label,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
employeeCB (const char *location, const char *label,
|
||||||
|
gboolean new_window, GNCURLResult * result)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (location != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (result != NULL, FALSE);
|
||||||
|
|
||||||
|
result->load_to_stream = FALSE;
|
||||||
|
|
||||||
|
/* href="...:guid=<guid>" */
|
||||||
|
if (strncmp ("guid=", location, 5) == 0) {
|
||||||
|
GUID guid;
|
||||||
|
GNCIdType id_type;
|
||||||
|
GncEmployee *employee;
|
||||||
|
|
||||||
|
if (!string_to_guid (location + 5, &guid)) {
|
||||||
|
result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
id_type = xaccGUIDType (&guid, gnc_get_current_book ());
|
||||||
|
if (id_type == GNC_ID_NONE || !safe_strcmp (id_type, GNC_ID_NULL))
|
||||||
|
{
|
||||||
|
result->error_message = g_strdup_printf (_("No such entity: %s"),
|
||||||
|
location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (!safe_strcmp (id_type, GNC_EMPLOYEE_MODULE_NAME))
|
||||||
|
{
|
||||||
|
employee = gncEmployeeLookup (gnc_get_current_book (), &guid);
|
||||||
|
gnc_ui_employee_edit (employee);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result->error_message =
|
||||||
|
g_strdup_printf (_("Entity type does not match Employee: %s"),
|
||||||
|
location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result->error_message = g_strdup_printf (_("Badly formed URL %s"),
|
||||||
|
location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
invoiceCB (const char *location, const char *label,
|
invoiceCB (const char *location, const char *label,
|
||||||
gboolean new_window, GNCURLResult * result)
|
gboolean new_window, GNCURLResult * result)
|
||||||
@ -212,6 +264,9 @@ ownerreportCB (const char *location, const char *label,
|
|||||||
case 'v':
|
case 'v':
|
||||||
type = GNC_OWNER_VENDOR;
|
type = GNC_OWNER_VENDOR;
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
type = GNC_OWNER_EMPLOYEE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
|
result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -245,6 +300,13 @@ ownerreportCB (const char *location, const char *label,
|
|||||||
&guid));
|
&guid));
|
||||||
etype = "Vendor";
|
etype = "Vendor";
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
if (!safe_strcmp (id_type, GNC_EMPLOYEE_MODULE_NAME))
|
||||||
|
gncOwnerInitEmployee (&owner,
|
||||||
|
gncEmployeeLookup (gnc_get_current_book (),
|
||||||
|
&guid));
|
||||||
|
etype = "Employee";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
etype = "OTHER";
|
etype = "OTHER";
|
||||||
}
|
}
|
||||||
@ -306,6 +368,7 @@ gnc_business_urls_initialize (void)
|
|||||||
} types[] = {
|
} types[] = {
|
||||||
{ GNC_CUSTOMER_MODULE_NAME, GNC_CUSTOMER_MODULE_NAME, customerCB },
|
{ GNC_CUSTOMER_MODULE_NAME, GNC_CUSTOMER_MODULE_NAME, customerCB },
|
||||||
{ GNC_VENDOR_MODULE_NAME, GNC_VENDOR_MODULE_NAME, vendorCB },
|
{ GNC_VENDOR_MODULE_NAME, GNC_VENDOR_MODULE_NAME, vendorCB },
|
||||||
|
{ GNC_EMPLOYEE_MODULE_NAME, GNC_EMPLOYEE_MODULE_NAME, employeeCB },
|
||||||
{ GNC_INVOICE_MODULE_NAME, GNC_INVOICE_MODULE_NAME, invoiceCB },
|
{ GNC_INVOICE_MODULE_NAME, GNC_INVOICE_MODULE_NAME, invoiceCB },
|
||||||
{ URL_TYPE_OWNERREPORT, "gnc-ownerreport", ownerreportCB },
|
{ URL_TYPE_OWNERREPORT, "gnc-ownerreport", ownerreportCB },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
|
@ -643,20 +643,19 @@ gnc_employee_search (GncEmployee *start, GNCBook *book)
|
|||||||
sw, free_employee_cb);
|
sw, free_employee_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer gnc_employee_edit_new_select (gpointer bookp, gpointer employee,
|
GNCSearchWindow *
|
||||||
GtkWidget *toplevel)
|
gnc_employee_search_select (gpointer start, gpointer book)
|
||||||
{
|
{
|
||||||
gnc_employee_search (employee, bookp); /* XXX */
|
if (!book) return NULL;
|
||||||
return employee;
|
|
||||||
|
return gnc_employee_search (start, book);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer gnc_employee_edit_new_edit (gpointer bookp, gpointer v,
|
GNCSearchWindow *
|
||||||
GtkWidget *toplevel)
|
gnc_employee_search_edit (gpointer start, gpointer book)
|
||||||
{
|
{
|
||||||
GncEmployee *employee = v;
|
if (start)
|
||||||
|
gnc_ui_employee_edit (start);
|
||||||
|
|
||||||
g_return_val_if_fail (employee != NULL, NULL);
|
return NULL;
|
||||||
|
|
||||||
gnc_ui_employee_edit (employee);
|
|
||||||
return employee;
|
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,13 @@ EmployeeWindow * gnc_ui_employee_new (GNCBook *book);
|
|||||||
/* Search for an employee */
|
/* Search for an employee */
|
||||||
GNCSearchWindow * gnc_employee_search (GncEmployee *start, GNCBook *book);
|
GNCSearchWindow * gnc_employee_search (GncEmployee *start, GNCBook *book);
|
||||||
|
|
||||||
/* Callbacks to select a employee that match the necessary functions
|
/*
|
||||||
* for use with the gnc_general_select widget.
|
* These callbacks are for use with the gnc_general_search widget
|
||||||
*
|
*
|
||||||
* new_select provides a selection and the ability to create and edit
|
* select() provides a Select Dialog and returns it.
|
||||||
* employees.
|
* edit() opens the existing vendor for editing and returns NULL.
|
||||||
* new_edit provides only the ability to edit the current selection
|
|
||||||
*/
|
*/
|
||||||
gpointer gnc_employee_edit_new_select (gpointer book, gpointer c,
|
GNCSearchWindow * gnc_employee_search_select (gpointer start, gpointer book);
|
||||||
GtkWidget *toplevel);
|
GNCSearchWindow * gnc_employee_search_edit (gpointer start, gpointer book);
|
||||||
gpointer gnc_employee_edit_new_edit (gpointer book, gpointer employee,
|
|
||||||
GtkWidget *toplevel);
|
|
||||||
|
|
||||||
#endif /* GNC_DIALOG_EMPLOYEE_H_ */
|
#endif /* GNC_DIALOG_EMPLOYEE_H_ */
|
||||||
|
@ -950,6 +950,7 @@ gnc_invoice_get_width_prefix (InvoiceWindow *iw)
|
|||||||
case GNC_OWNER_CUSTOMER:
|
case GNC_OWNER_CUSTOMER:
|
||||||
return INV_WIDTH_PREFIX;
|
return INV_WIDTH_PREFIX;
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
return BILL_WIDTH_PREFIX;
|
return BILL_WIDTH_PREFIX;
|
||||||
default:
|
default:
|
||||||
g_warning ("invalid owner");
|
g_warning ("invalid owner");
|
||||||
@ -964,6 +965,7 @@ gnc_invoice_get_width_integer (InvoiceWindow *iw)
|
|||||||
case GNC_OWNER_CUSTOMER:
|
case GNC_OWNER_CUSTOMER:
|
||||||
return &inv_last_width;
|
return &inv_last_width;
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
return &bill_last_width;
|
return &bill_last_width;
|
||||||
default:
|
default:
|
||||||
g_warning ("invalid owner");
|
g_warning ("invalid owner");
|
||||||
@ -1204,6 +1206,9 @@ gnc_invoice_owner_changed_cb (GtkWidget *widget, gpointer data)
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
term = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
|
term = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
term = NULL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
|
g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
|
||||||
break;
|
break;
|
||||||
@ -1626,6 +1631,21 @@ gnc_invoice_id_changed_cb (GtkWidget *widget, gpointer data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
switch (iw->dialog_type)
|
||||||
|
{
|
||||||
|
case NEW_INVOICE:
|
||||||
|
wintitle = _("New Expense Voucher");
|
||||||
|
break;
|
||||||
|
case MOD_INVOICE:
|
||||||
|
case EDIT_INVOICE:
|
||||||
|
wintitle = _("Edit Expense Voucher");
|
||||||
|
break;
|
||||||
|
case VIEW_INVOICE:
|
||||||
|
wintitle = _("View Expense Voucher");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1778,6 +1798,11 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
ledger_type = GNCENTRY_BILL_ENTRY;
|
ledger_type = GNCENTRY_BILL_ENTRY;
|
||||||
break;
|
break;
|
||||||
|
#if 0
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
ledger_type = GNCENTRY_VOUCHER_ENTRY;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
g_warning ("Invalid owner type");
|
g_warning ("Invalid owner type");
|
||||||
}
|
}
|
||||||
@ -1791,6 +1816,11 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
|
|||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
ledger_type = GNCENTRY_BILL_VIEWER;
|
ledger_type = GNCENTRY_BILL_VIEWER;
|
||||||
break;
|
break;
|
||||||
|
#if 0
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
ledger_type = GNCENTRY_VOUCHER_VIEWER;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
g_warning ("Invalid owner type");
|
g_warning ("Invalid owner type");
|
||||||
}
|
}
|
||||||
|
@ -233,6 +233,7 @@ make_type_menu (GNCSearchCoreType *fe)
|
|||||||
ADD_TYPE_MENU_ITEM (_("Customer"), GNC_OWNER_CUSTOMER);
|
ADD_TYPE_MENU_ITEM (_("Customer"), GNC_OWNER_CUSTOMER);
|
||||||
first = item;
|
first = item;
|
||||||
ADD_TYPE_MENU_ITEM (_("Vendor"), GNC_OWNER_VENDOR);
|
ADD_TYPE_MENU_ITEM (_("Vendor"), GNC_OWNER_VENDOR);
|
||||||
|
ADD_TYPE_MENU_ITEM (_("Employee"), GNC_OWNER_EMPLOYEE);
|
||||||
ADD_TYPE_MENU_ITEM (_("Job"), GNC_OWNER_JOB);
|
ADD_TYPE_MENU_ITEM (_("Job"), GNC_OWNER_JOB);
|
||||||
|
|
||||||
opmenu = gtk_option_menu_new ();
|
opmenu = gtk_option_menu_new ();
|
||||||
|
@ -203,6 +203,67 @@
|
|||||||
validator
|
validator
|
||||||
#f #f #f #f)))
|
#f #f #f #f)))
|
||||||
|
|
||||||
|
;; Internally, values are always a guid. Externally, both guids and
|
||||||
|
;; employee pointers may be used to set the value of the option. The
|
||||||
|
;; option always returns a single employee pointer.
|
||||||
|
|
||||||
|
(define (gnc:make-employee-option
|
||||||
|
section
|
||||||
|
name
|
||||||
|
sort-tag
|
||||||
|
documentation-string
|
||||||
|
default-getter
|
||||||
|
value-validator)
|
||||||
|
|
||||||
|
(define (convert-to-guid item)
|
||||||
|
(if (string? item)
|
||||||
|
item
|
||||||
|
(gnc:employee-get-guid item)))
|
||||||
|
|
||||||
|
(define (convert-to-employee item)
|
||||||
|
(if (string? item)
|
||||||
|
(gnc:employee-lookup item (gnc:get-current-book))
|
||||||
|
item))
|
||||||
|
|
||||||
|
(let* ((option (convert-to-guid (default-getter)))
|
||||||
|
(option-set #f)
|
||||||
|
(getter (lambda () (convert-to-employee
|
||||||
|
(if option-set
|
||||||
|
option
|
||||||
|
(default-getter)))))
|
||||||
|
(value->string (lambda ()
|
||||||
|
(string-append
|
||||||
|
"'" (gnc:value->string (if option-set option #f)))))
|
||||||
|
(validator
|
||||||
|
(if (not value-validator)
|
||||||
|
(lambda (employee) (list #t employee))
|
||||||
|
(lambda (employee)
|
||||||
|
(value-validator (convert-to-employee employee))))))
|
||||||
|
(gnc:make-option
|
||||||
|
section name sort-tag 'employee documentation-string getter
|
||||||
|
(lambda (employee)
|
||||||
|
(if (not employee) (set! employee (default-getter)))
|
||||||
|
(set! employee (convert-to-employee employee))
|
||||||
|
(let* ((result (validator employee))
|
||||||
|
(valid (car result))
|
||||||
|
(value (cadr result)))
|
||||||
|
(if valid
|
||||||
|
(begin
|
||||||
|
(set! option (convert-to-guid value))
|
||||||
|
(set! option-set #t))
|
||||||
|
(gnc:error "Illegal employee value set"))))
|
||||||
|
(lambda () (convert-to-employee (default-getter)))
|
||||||
|
(gnc:restore-form-generator value->string)
|
||||||
|
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||||
|
(lambda (f p)
|
||||||
|
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||||
|
(if (and v (string? v))
|
||||||
|
(begin
|
||||||
|
(set! option v)
|
||||||
|
(set! option-set #t)))))
|
||||||
|
validator
|
||||||
|
#f #f #f #f)))
|
||||||
|
|
||||||
;; Internally, values are always a type/guid pair. Externally, both
|
;; Internally, values are always a type/guid pair. Externally, both
|
||||||
;; type/guid pairs and owner pointers may be used to set the value of
|
;; type/guid pairs and owner pointers may be used to set the value of
|
||||||
;; the option. The option always returns a single owner pointer.
|
;; the option. The option always returns a single owner pointer.
|
||||||
@ -241,6 +302,12 @@
|
|||||||
(gnc:vendor-lookup (cdr pair) (gnc:get-current-book)))
|
(gnc:vendor-lookup (cdr pair) (gnc:get-current-book)))
|
||||||
option-value)
|
option-value)
|
||||||
|
|
||||||
|
((gnc-owner-employee)
|
||||||
|
(gnc:owner-init-employee
|
||||||
|
option-value
|
||||||
|
(gnc:employee-lookup (cdr pair) (gnc:get-current-book)))
|
||||||
|
option-value)
|
||||||
|
|
||||||
((gnc-owner-job)
|
((gnc-owner-job)
|
||||||
(gnc:owner-init-job
|
(gnc:owner-init-job
|
||||||
option-value
|
option-value
|
||||||
@ -368,5 +435,6 @@
|
|||||||
(export gnc:make-invoice-option)
|
(export gnc:make-invoice-option)
|
||||||
(export gnc:make-customer-option)
|
(export gnc:make-customer-option)
|
||||||
(export gnc:make-vendor-option)
|
(export gnc:make-vendor-option)
|
||||||
|
(export gnc:make-employee-option)
|
||||||
(export gnc:make-owner-option)
|
(export gnc:make-owner-option)
|
||||||
(export gnc:make-taxtable-option)
|
(export gnc:make-taxtable-option)
|
||||||
|
Loading…
Reference in New Issue
Block a user