mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Affects all users of the generic import: OFX, HBCI and AqBanking. Suggested by <http://bugzilla.gnome.org/show_bug.cgi?id=139310>. " Assume you have a transaction that transfers money from account 1 to account 2. Import an OFX statement from account 1 that matches the transaction. Then import an OFX statement from account 2 that matches the same transaction. Because each transaction can only store one online_id, when you import from account 1 again it doesn't remember that it's already been imported. If online_id was stored in a split slot instead of a transaction slot, it would allow tracking the online_id of both accounts without being overwritten. " For backwards compatibility, we still check for online_id in transactions. This is more of a convenience than a critical feature, however. The compatibility code could be removed in future versions if desired. Patch by Alan Jenkins <alan-jenkins@tuffmail.co.uk> git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17889 57a11ea4-9604-0410-9ed3-97b8803252fd
103 lines
3.4 KiB
C
103 lines
3.4 KiB
C
/********************************************************************\
|
|
* 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 *
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
|
\********************************************************************/
|
|
/** @addtogroup Import_Export
|
|
@{ */
|
|
/** @internal
|
|
@file import-utilities.c
|
|
@brief Utility functions for writing import modules.
|
|
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
|
|
*/
|
|
#include "config.h"
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <stdlib.h>
|
|
#include "import-utilities.h"
|
|
#include "qof.h"
|
|
#include "Account.h"
|
|
#include "Transaction.h"
|
|
|
|
|
|
/********************************************************************\
|
|
* Setter and getter functions for the online_id kvp frame in
|
|
* Account, Transaction and Split
|
|
\********************************************************************/
|
|
|
|
const gchar * gnc_import_get_acc_online_id(Account * account)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccAccountGetSlots(account);
|
|
return kvp_frame_get_string(frame, "online_id");
|
|
}
|
|
|
|
void gnc_import_set_acc_online_id(Account * account,
|
|
const gchar * string_value)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccAccountGetSlots(account);
|
|
kvp_frame_set_str(frame, "online_id", string_value);
|
|
}
|
|
|
|
const gchar * gnc_import_get_trans_online_id(Transaction * transaction)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccTransGetSlots(transaction);
|
|
return kvp_frame_get_string(frame, "online_id");
|
|
}
|
|
|
|
void gnc_import_set_trans_online_id(Transaction * transaction,
|
|
const gchar * string_value)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccTransGetSlots(transaction);
|
|
kvp_frame_set_str (frame, "online_id", string_value);
|
|
}
|
|
|
|
gboolean gnc_import_trans_has_online_id(Transaction * transaction)
|
|
{
|
|
const gchar * online_id;
|
|
online_id = gnc_import_get_trans_online_id(transaction);
|
|
return (online_id != NULL && strlen(online_id) > 0);
|
|
}
|
|
|
|
const gchar * gnc_import_get_split_online_id(Split * split)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccSplitGetSlots(split);
|
|
return kvp_frame_get_string(frame, "online_id");
|
|
}
|
|
|
|
void gnc_import_set_split_online_id(Split * split,
|
|
const gchar * string_value)
|
|
{
|
|
kvp_frame * frame;
|
|
frame = xaccSplitGetSlots(split);
|
|
kvp_frame_set_str (frame, "online_id", string_value);
|
|
}
|
|
|
|
gboolean gnc_import_split_has_online_id(Split * split)
|
|
{
|
|
const gchar * online_id;
|
|
online_id = gnc_import_get_split_online_id(split);
|
|
return (online_id != NULL && strlen(online_id) > 0);
|
|
}
|
|
|
|
/* @} */
|