|
|
|
|
@ -1,6 +1,28 @@
|
|
|
|
|
/********************************************************************\
|
|
|
|
|
* gncOwner.c -- Business Interface: Object OWNERs *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
|
* *
|
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
|
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
|
|
|
|
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
|
|
|
|
* *
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* gncOwner.c -- Business Interface: Object OWNERs
|
|
|
|
|
* Copyright (C) 2001, 2002 Derek Atkins
|
|
|
|
|
* Copyright (C) 2003 Linas Vepstas <linas@linas.org>
|
|
|
|
|
* Author: Derek Atkins <warlord@MIT.EDU>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@ -9,11 +31,13 @@
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <string.h> /* for memcpy() */
|
|
|
|
|
|
|
|
|
|
#include "qofbook.h"
|
|
|
|
|
#include "qofclass.h"
|
|
|
|
|
#include "qofinstance.h"
|
|
|
|
|
#include "qofquerycore.h"
|
|
|
|
|
#include "qofquery.h"
|
|
|
|
|
|
|
|
|
|
#include "gncCustomerP.h"
|
|
|
|
|
#include "gncJobP.h"
|
|
|
|
|
#include "gncOwner.h"
|
|
|
|
|
#include "gncOwnerP.h"
|
|
|
|
|
|
|
|
|
|
@ -138,6 +162,36 @@ void gncOwnerCopy (const GncOwner *src, GncOwner *dest)
|
|
|
|
|
memcpy (dest, src, sizeof (*dest));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GncOwner
|
|
|
|
|
gncCloneOwner (const GncOwner *from, QofBook *book)
|
|
|
|
|
{
|
|
|
|
|
GncOwner owner = {GNC_OWNER_NONE};
|
|
|
|
|
if (!from) return owner;
|
|
|
|
|
owner.type = from->type;
|
|
|
|
|
switch (from->type)
|
|
|
|
|
{
|
|
|
|
|
case GNC_OWNER_NONE:
|
|
|
|
|
return owner;
|
|
|
|
|
case GNC_OWNER_UNDEFINED:
|
|
|
|
|
owner.owner.undefined = from->owner.undefined; /* XXX probably wrong ! */
|
|
|
|
|
return owner;
|
|
|
|
|
case GNC_OWNER_CUSTOMER:
|
|
|
|
|
owner.owner.customer = gncCustomerObtainTwin (from->owner.customer, book);
|
|
|
|
|
return owner;
|
|
|
|
|
case GNC_OWNER_JOB:
|
|
|
|
|
owner.owner.job = gncJobObtainTwin (from->owner.job, book);
|
|
|
|
|
return owner;
|
|
|
|
|
case GNC_OWNER_VENDOR:
|
|
|
|
|
/* XXX unfinished */
|
|
|
|
|
return owner;
|
|
|
|
|
case GNC_OWNER_EMPLOYEE:
|
|
|
|
|
/* XXX unfinished */
|
|
|
|
|
return owner;
|
|
|
|
|
default:
|
|
|
|
|
return owner;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b)
|
|
|
|
|
{
|
|
|
|
|
if (!a || !b) return FALSE;
|
|
|
|
|
|