r20627 - gnucash/trunk/src/engine - Always explicitly define an owner when converting from a qof entity

Geert Janssens gjanssens at code.gnucash.org
Wed May 11 17:52:12 EDT 2011


Author: gjanssens
Date: 2011-05-11 17:52:12 -0400 (Wed, 11 May 2011)
New Revision: 20627
Trac: http://svn.gnucash.org/trac/changeset/20627

Modified:
   gnucash/trunk/src/engine/gncOwner.c
Log:
Always explicitly define an owner when converting from a qof entity
This can be ownertype (none) if the entity to be converted is not a valid owner.

Modified: gnucash/trunk/src/engine/gncOwner.c
===================================================================
--- gnucash/trunk/src/engine/gncOwner.c	2011-05-11 21:52:03 UTC (rev 20626)
+++ gnucash/trunk/src/engine/gncOwner.c	2011-05-11 21:52:12 UTC (rev 20627)
@@ -298,21 +298,26 @@
         owner->type = GNC_OWNER_CUSTOMER;
         gncOwnerInitCustomer(owner, (GncCustomer*)ent);
     }
-    if (0 == safe_strcmp(ent->e_type, GNC_ID_JOB))
+    else if (0 == safe_strcmp(ent->e_type, GNC_ID_JOB))
     {
         owner->type = GNC_OWNER_JOB;
         gncOwnerInitJob(owner, (GncJob*)ent);
     }
-    if (0 == safe_strcmp(ent->e_type, GNC_ID_VENDOR))
+    else if (0 == safe_strcmp(ent->e_type, GNC_ID_VENDOR))
     {
         owner->type = GNC_OWNER_VENDOR;
         gncOwnerInitVendor(owner, (GncVendor*)ent);
     }
-    if (0 == safe_strcmp(ent->e_type, GNC_ID_EMPLOYEE))
+    else if (0 == safe_strcmp(ent->e_type, GNC_ID_EMPLOYEE))
     {
         owner->type = GNC_OWNER_EMPLOYEE;
         gncOwnerInitEmployee(owner, (GncEmployee*)ent);
     }
+    else
+    {
+        owner->type = GNC_OWNER_NONE;
+        owner->owner.undefined=NULL;
+    }
 }
 
 gpointer gncOwnerGetUndefined (const GncOwner *owner)



More information about the gnucash-changes mailing list