2001-11-16 19:17:06 -06:00
|
|
|
/*
|
|
|
|
* gncEmployee.c -- the Core Employee Interface
|
2002-02-03 14:01:08 -06:00
|
|
|
* Copyright (C) 2001,2002 Derek Atkins
|
2001-11-16 19:17:06 -06:00
|
|
|
* Author: Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "guid.h"
|
|
|
|
#include "messages.h"
|
2003-06-24 18:48:58 -05:00
|
|
|
#include "gnc-book.h"
|
2003-06-11 11:22:26 -05:00
|
|
|
#include "gnc-commodity.h"
|
|
|
|
#include "gnc-engine-util.h"
|
2002-03-02 12:55:01 -06:00
|
|
|
#include "gnc-event-p.h"
|
2002-11-03 14:21:42 -06:00
|
|
|
#include "gnc-be-utils.h"
|
2003-10-14 16:20:55 -05:00
|
|
|
|
|
|
|
#include "qofclass.h"
|
|
|
|
#include "qofid.h"
|
2003-06-26 02:27:52 -05:00
|
|
|
#include "qofid-p.h"
|
2003-10-14 16:20:55 -05:00
|
|
|
#include "qofinstance.h"
|
2003-10-16 23:32:04 -05:00
|
|
|
#include "qofinstance-p.h"
|
2003-10-14 16:20:55 -05:00
|
|
|
#include "qofobject.h"
|
|
|
|
#include "qofquery.h"
|
|
|
|
#include "qofquerycore.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
#include "gncBusiness.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
#include "gncEmployee.h"
|
|
|
|
#include "gncEmployeeP.h"
|
|
|
|
#include "gncAddress.h"
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
struct _gncEmployee
|
|
|
|
{
|
|
|
|
QofInstance inst;
|
|
|
|
char * id;
|
|
|
|
char * username;
|
|
|
|
GncAddress * addr;
|
2003-01-12 16:53:02 -06:00
|
|
|
gnc_commodity * currency;
|
2003-10-14 16:20:55 -05:00
|
|
|
gboolean active;
|
|
|
|
|
|
|
|
char * language;
|
|
|
|
char * acl;
|
|
|
|
gnc_numeric workday;
|
|
|
|
gnc_numeric rate;
|
2003-03-09 16:51:04 -06:00
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
Account * ccard_acc;
|
2001-11-16 19:17:06 -06:00
|
|
|
};
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
static short module = MOD_BUSINESS;
|
2002-11-03 14:21:42 -06:00
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
#define _GNC_MOD_NAME GNC_EMPLOYEE_MODULE_NAME
|
2001-11-24 23:34:34 -06:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
#define CACHE_INSERT(str) g_cache_insert(gnc_engine_get_string_cache(), (gpointer)(str));
|
|
|
|
#define CACHE_REMOVE(str) g_cache_remove(gnc_engine_get_string_cache(), (str));
|
|
|
|
|
2002-03-02 12:55:01 -06:00
|
|
|
G_INLINE_FUNC void mark_employee (GncEmployee *employee);
|
|
|
|
G_INLINE_FUNC void
|
|
|
|
mark_employee (GncEmployee *employee)
|
|
|
|
{
|
2003-10-14 16:20:55 -05:00
|
|
|
employee->inst.dirty = TRUE;
|
|
|
|
gncBusinessSetDirtyFlag (employee->inst.book, _GNC_MOD_NAME, TRUE);
|
2002-03-02 12:55:01 -06:00
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
gnc_engine_gen_event (&employee->inst.entity, GNC_EVENT_MODIFY);
|
2002-03-02 12:55:01 -06:00
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncEmployee *gncEmployeeCreate (QofBook *book)
|
2001-11-16 19:17:06 -06:00
|
|
|
{
|
|
|
|
GncEmployee *employee;
|
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
if (!book) return NULL;
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
employee = g_new0 (GncEmployee, 1);
|
2003-10-14 16:20:55 -05:00
|
|
|
qof_instance_init (&employee->inst, _GNC_MOD_NAME, book);
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
employee->id = CACHE_INSERT ("");
|
|
|
|
employee->username = CACHE_INSERT ("");
|
|
|
|
employee->language = CACHE_INSERT ("");
|
|
|
|
employee->acl = CACHE_INSERT ("");
|
2003-10-14 16:20:55 -05:00
|
|
|
employee->addr = gncAddressCreate (book, &employee->inst.entity.guid, _GNC_MOD_NAME);
|
2001-11-16 19:17:06 -06:00
|
|
|
employee->workday = gnc_numeric_zero();
|
|
|
|
employee->rate = gnc_numeric_zero();
|
|
|
|
employee->active = TRUE;
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
gnc_engine_gen_event (&employee->inst.entity, GNC_EVENT_CREATE);
|
2002-03-02 12:55:01 -06:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
return employee;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeDestroy (GncEmployee *employee)
|
2002-11-03 14:21:42 -06:00
|
|
|
{
|
|
|
|
if (!employee) return;
|
2003-10-14 16:20:55 -05:00
|
|
|
employee->inst.do_free = TRUE;
|
2002-11-03 14:21:42 -06:00
|
|
|
gncEmployeeCommitEdit(employee);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gncEmployeeFree (GncEmployee *employee)
|
2001-11-16 19:17:06 -06:00
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
gnc_engine_gen_event (&employee->inst.entity, GNC_EVENT_DESTROY);
|
2002-03-02 12:55:01 -06:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
CACHE_REMOVE (employee->id);
|
|
|
|
CACHE_REMOVE (employee->username);
|
|
|
|
CACHE_REMOVE (employee->language);
|
|
|
|
CACHE_REMOVE (employee->acl);
|
|
|
|
gncAddressDestroy (employee->addr);
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
qof_instance_release (&employee->inst);
|
2001-11-16 19:17:06 -06:00
|
|
|
g_free (employee);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set Functions */
|
|
|
|
|
2002-11-03 18:41:01 -06:00
|
|
|
#define SET_STR(obj, member, str) { \
|
2003-10-14 16:20:55 -05:00
|
|
|
char * tmp; \
|
|
|
|
\
|
|
|
|
if (!safe_strcmp (member, str)) return; \
|
|
|
|
gncEmployeeBeginEdit (obj); \
|
|
|
|
tmp = CACHE_INSERT (str); \
|
|
|
|
CACHE_REMOVE (member); \
|
|
|
|
member = tmp; \
|
|
|
|
}
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
void gncEmployeeSetID (GncEmployee *employee, const char *id)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (!id) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
SET_STR(employee, employee->id, id);
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetUsername (GncEmployee *employee, const char *username)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (!username) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
SET_STR(employee, employee->username, username);
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetLanguage (GncEmployee *employee, const char *language)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (!language) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
SET_STR(employee, employee->language, language);
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetGUID (GncEmployee *employee, const GUID *guid)
|
|
|
|
{
|
|
|
|
if (!employee || !guid) return;
|
2003-10-14 16:20:55 -05:00
|
|
|
if (guid_equal (guid, &employee->inst.entity.guid)) return;
|
|
|
|
|
|
|
|
qof_entity_set_guid (&employee->inst.entity, guid);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetAcl (GncEmployee *employee, const char *acl)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (!acl) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
SET_STR(employee, employee->acl, acl);
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (gnc_numeric_equal (workday, employee->workday)) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeBeginEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
employee->workday = workday;
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (gnc_numeric_equal (rate, employee->rate)) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeBeginEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
employee->rate = rate;
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2003-01-12 16:53:02 -06:00
|
|
|
void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity *currency)
|
2002-03-04 13:34:52 -06:00
|
|
|
{
|
2003-01-12 16:53:02 -06:00
|
|
|
if (!employee || !currency) return;
|
|
|
|
if (employee->currency &&
|
|
|
|
gnc_commodity_equal (employee->currency, currency))
|
2002-06-21 14:00:34 -05:00
|
|
|
return;
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeBeginEdit (employee);
|
2003-01-12 16:53:02 -06:00
|
|
|
employee->currency = currency;
|
2002-03-04 13:34:52 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2002-03-04 13:34:52 -06:00
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncEmployeeSetActive (GncEmployee *employee, gboolean active)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (active == employee->active) return;
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeBeginEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
employee->active = active;
|
2002-03-02 12:55:01 -06:00
|
|
|
mark_employee (employee);
|
2002-11-03 18:41:01 -06:00
|
|
|
gncEmployeeCommitEdit (employee);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2003-03-09 16:51:04 -06:00
|
|
|
void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc)
|
|
|
|
{
|
|
|
|
if (!employee) return;
|
|
|
|
if (ccard_acc == employee->ccard_acc) return;
|
|
|
|
gncEmployeeBeginEdit (employee);
|
|
|
|
employee->ccard_acc = ccard_acc;
|
|
|
|
mark_employee (employee);
|
|
|
|
gncEmployeeCommitEdit (employee);
|
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/* Get Functions */
|
|
|
|
const char * gncEmployeeGetID (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * gncEmployeeGetUsername (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->username;
|
|
|
|
}
|
|
|
|
|
|
|
|
GncAddress * gncEmployeeGetAddr (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * gncEmployeeGetLanguage (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->language;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * gncEmployeeGetAcl (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->acl;
|
|
|
|
}
|
|
|
|
|
|
|
|
gnc_numeric gncEmployeeGetWorkday (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return gnc_numeric_zero();
|
|
|
|
return employee->workday;
|
|
|
|
}
|
|
|
|
|
|
|
|
gnc_numeric gncEmployeeGetRate (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return gnc_numeric_zero();
|
|
|
|
return employee->rate;
|
|
|
|
}
|
|
|
|
|
2003-01-12 16:53:02 -06:00
|
|
|
gnc_commodity * gncEmployeeGetCurrency (GncEmployee *employee)
|
2002-03-04 13:34:52 -06:00
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
2003-01-12 16:53:02 -06:00
|
|
|
return employee->currency;
|
2002-03-04 13:34:52 -06:00
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
gboolean gncEmployeeGetActive (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return FALSE;
|
|
|
|
return employee->active;
|
|
|
|
}
|
|
|
|
|
2003-03-09 16:51:04 -06:00
|
|
|
Account * gncEmployeeGetCCard (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return NULL;
|
|
|
|
return employee->ccard_acc;
|
|
|
|
}
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncEmployee * gncEmployeeLookup (QofBook *book, const GUID *guid)
|
2001-11-24 23:34:34 -06:00
|
|
|
{
|
2003-10-16 23:32:04 -05:00
|
|
|
ELOOKUP(GncEmployee);
|
2003-03-03 00:47:54 -06:00
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
gboolean gncEmployeeIsDirty (GncEmployee *employee)
|
|
|
|
{
|
|
|
|
if (!employee) return FALSE;
|
2003-10-14 16:20:55 -05:00
|
|
|
return (employee->inst.dirty || gncAddressIsDirty (employee->addr));
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncEmployeeBeginEdit (GncEmployee *employee)
|
2001-11-16 19:17:06 -06:00
|
|
|
{
|
2003-10-16 23:32:04 -05:00
|
|
|
GNC_BEGIN_EDIT (&employee->inst);
|
2002-11-03 14:21:42 -06:00
|
|
|
}
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
static inline void gncEmployeeOnError (QofInstance *employee, QofBackendError errcode)
|
2002-11-03 14:21:42 -06:00
|
|
|
{
|
2003-06-26 22:36:02 -05:00
|
|
|
PERR("Employee QofBackend Failure: %d", errcode);
|
2002-11-03 14:21:42 -06:00
|
|
|
}
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
static inline void gncEmployeeOnDone (QofInstance *inst)
|
2002-11-03 14:21:42 -06:00
|
|
|
{
|
2003-10-14 16:20:55 -05:00
|
|
|
GncEmployee *employee = (GncEmployee *) inst;
|
2002-03-04 13:34:52 -06:00
|
|
|
gncAddressClearDirty (employee->addr);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
static inline void emp_free (QofInstance *inst)
|
|
|
|
{
|
|
|
|
GncEmployee *employee = (GncEmployee *) inst;
|
|
|
|
gncEmployeeFree (employee);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncEmployeeCommitEdit (GncEmployee *employee)
|
|
|
|
{
|
2003-10-14 16:20:55 -05:00
|
|
|
GNC_COMMIT_EDIT_PART1 (&employee->inst);
|
2003-10-16 23:32:04 -05:00
|
|
|
GNC_COMMIT_EDIT_PART2 (&employee->inst, gncEmployeeOnError,
|
2003-10-14 16:20:55 -05:00
|
|
|
gncEmployeeOnDone, emp_free);
|
2002-11-03 14:21:42 -06:00
|
|
|
}
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/* Other functions */
|
|
|
|
|
2002-02-03 14:01:08 -06:00
|
|
|
int gncEmployeeCompare (GncEmployee *a, GncEmployee *b)
|
|
|
|
{
|
|
|
|
if (!a && !b) return 0;
|
|
|
|
if (!a && b) return 1;
|
|
|
|
if (a && !b) return -1;
|
|
|
|
|
|
|
|
return(strcmp(a->username, b->username));
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Package-Private functions */
|
2003-06-26 22:05:25 -05:00
|
|
|
static void _gncEmployeeCreate (QofBook *book)
|
2002-02-24 16:12:24 -06:00
|
|
|
{
|
|
|
|
gncBusinessCreate (book, _GNC_MOD_NAME);
|
2001-11-24 23:34:34 -06:00
|
|
|
}
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
static void _gncEmployeeDestroy (QofBook *book)
|
2001-11-24 23:34:34 -06:00
|
|
|
{
|
2002-02-24 16:12:24 -06:00
|
|
|
gncBusinessDestroy (book, _GNC_MOD_NAME);
|
|
|
|
}
|
2001-11-24 23:34:34 -06:00
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
static gboolean _gncEmployeeIsDirty (QofBook *book)
|
2002-02-24 16:12:24 -06:00
|
|
|
{
|
|
|
|
return gncBusinessIsDirty (book, _GNC_MOD_NAME);
|
2001-11-24 23:34:34 -06:00
|
|
|
}
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
static void _gncEmployeeMarkClean (QofBook *book)
|
2002-03-04 13:34:52 -06:00
|
|
|
{
|
|
|
|
gncBusinessSetDirtyFlag (book, _GNC_MOD_NAME, FALSE);
|
|
|
|
}
|
|
|
|
|
2003-10-16 23:32:04 -05:00
|
|
|
static void _gncEmployeeForeach (QofBook *book, QofForeachCB cb,
|
2003-10-14 16:20:55 -05:00
|
|
|
gpointer user_data)
|
2001-11-16 19:17:06 -06:00
|
|
|
{
|
2002-02-03 14:01:08 -06:00
|
|
|
gncBusinessForeach (book, _GNC_MOD_NAME, cb, user_data);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char * _gncEmployeePrintable (gpointer item)
|
|
|
|
{
|
|
|
|
GncEmployee *v;
|
|
|
|
|
|
|
|
if (!item) return NULL;
|
|
|
|
|
|
|
|
v = item;
|
2003-03-10 23:59:51 -06:00
|
|
|
return gncAddressGetName(v->addr);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2003-06-26 22:09:39 -05:00
|
|
|
static QofObject gncEmployeeDesc = {
|
2003-06-26 22:05:25 -05:00
|
|
|
QOF_OBJECT_VERSION,
|
2001-11-24 23:34:34 -06:00
|
|
|
_GNC_MOD_NAME,
|
2001-11-16 19:17:06 -06:00
|
|
|
"Employee",
|
2001-11-24 23:34:34 -06:00
|
|
|
_gncEmployeeCreate,
|
2001-11-16 19:17:06 -06:00
|
|
|
_gncEmployeeDestroy,
|
2002-02-24 16:12:24 -06:00
|
|
|
_gncEmployeeIsDirty,
|
2002-03-04 13:34:52 -06:00
|
|
|
_gncEmployeeMarkClean,
|
2002-02-03 14:01:08 -06:00
|
|
|
_gncEmployeeForeach,
|
2001-11-16 19:17:06 -06:00
|
|
|
_gncEmployeePrintable
|
|
|
|
};
|
|
|
|
|
|
|
|
gboolean gncEmployeeRegister (void)
|
|
|
|
{
|
2003-09-27 05:21:27 -05:00
|
|
|
static QofParam params[] = {
|
2003-09-27 11:33:06 -05:00
|
|
|
{ EMPLOYEE_ID, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetID, NULL },
|
|
|
|
{ EMPLOYEE_USERNAME, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetUsername, NULL },
|
|
|
|
{ EMPLOYEE_ADDR, GNC_ADDRESS_MODULE_NAME, (QofAccessFunc)gncEmployeeGetAddr, NULL },
|
|
|
|
{ QOF_QUERY_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEmployeeGetActive, NULL },
|
2003-10-14 16:20:55 -05:00
|
|
|
{ QOF_QUERY_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
|
|
|
|
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
|
2002-02-03 14:01:08 -06:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
2003-09-27 11:33:06 -05:00
|
|
|
qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncEmployeeCompare,params);
|
2002-02-03 14:01:08 -06:00
|
|
|
|
2003-06-26 22:09:39 -05:00
|
|
|
return qof_object_register (&gncEmployeeDesc);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
gint64 gncEmployeeNextID (QofBook *book)
|
2001-11-16 19:17:06 -06:00
|
|
|
{
|
2002-03-02 20:17:07 -06:00
|
|
|
return gnc_book_get_counter (book, _GNC_MOD_NAME);
|
2001-11-16 19:17:06 -06:00
|
|
|
}
|