mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix gnc_owner_get_owner so that it sets the owner type.
Using the instance's QofIdType.
This commit is contained in:
parent
a44b3664e2
commit
5de35f97c8
@ -23,6 +23,7 @@
|
|||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -55,6 +56,10 @@
|
|||||||
#include "gnc-prefs.h"
|
#include "gnc-prefs.h"
|
||||||
#include "gnc-commodity.h"
|
#include "gnc-commodity.h"
|
||||||
#include "gnc-report-combo.h"
|
#include "gnc-report-combo.h"
|
||||||
|
#include "qofinstance.h"
|
||||||
|
#include "qoflog.h"
|
||||||
|
|
||||||
|
static const QofLogModule log_module = G_LOG_DOMAIN;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -277,14 +282,21 @@ void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner)
|
|||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (owner != NULL);
|
g_return_if_fail (owner != NULL);
|
||||||
|
|
||||||
/* We'll assume that the owner has the proper 'type' because we
|
QofInstance *instance =
|
||||||
* can't change it here. Hopefully the caller has it set properly
|
|
||||||
*/
|
|
||||||
owner->owner.undefined =
|
|
||||||
gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
|
gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
|
||||||
|
|
||||||
|
if (owner->type == GNC_OWNER_NONE ||
|
||||||
|
g_strcmp0(instance->e_type, qofOwnerGetType(owner)) == 0)
|
||||||
|
qofOwnerSetEntity(owner, instance);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PWARN("Owner type mismatch: Instance %s, Owner %s",
|
||||||
|
instance->e_type, qofOwnerGetType(owner));
|
||||||
|
owner->owner.undefined = instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner)
|
void gnc_owner_set_owner (GtkWidget *widget, const GncOwner *owner)
|
||||||
{
|
{
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (owner != NULL);
|
g_return_if_fail (owner != NULL);
|
||||||
|
@ -78,7 +78,7 @@ GtkWidget * gnc_owner_edit_create (GtkWidget *label, GtkWidget *hbox,
|
|||||||
QofBook *book, GncOwner *owner);
|
QofBook *book, GncOwner *owner);
|
||||||
|
|
||||||
void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner);
|
void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner);
|
||||||
void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner);
|
void gnc_owner_set_owner (GtkWidget *widget, const GncOwner *owner);
|
||||||
|
|
||||||
|
|
||||||
/* An invoice select widget..
|
/* An invoice select widget..
|
||||||
|
Loading…
Reference in New Issue
Block a user