mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
split register - drop scm copy interface
This commit is contained in:
parent
cb273b13a1
commit
f5e28c3d0f
@ -8,7 +8,6 @@ set (ledger_core_SOURCES
|
||||
split-register.c
|
||||
split-register-control.c
|
||||
split-register-copy-ops.c
|
||||
split-register-copy-ops-internals.c
|
||||
split-register-layout.c
|
||||
split-register-load.c
|
||||
split-register-model.c
|
||||
@ -29,7 +28,6 @@ set (ledger_core_HEADERS
|
||||
split-register.h
|
||||
split-register-control.h
|
||||
split-register-copy-ops.h
|
||||
split-register-copy-ops-internals.h
|
||||
split-register-layout.h
|
||||
split-register-model.h
|
||||
split-register-model-save.h
|
||||
|
@ -1,429 +0,0 @@
|
||||
/********************************************************************\
|
||||
* split-register-copy-ops-internals.c -- internal details of *
|
||||
* copy/paste semantics for transactions and splits *
|
||||
* Port to C of engine-interface *
|
||||
* originally written by Dave Peticolas <dave@krondo.com> *
|
||||
* © 2019 Geert Janssens
|
||||
* *
|
||||
* 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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "split-register-copy-ops-internals.h"
|
||||
|
||||
/* accessors */
|
||||
Split *gnc_float_split_get_split (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, NULL);
|
||||
return fs->m_split;
|
||||
}
|
||||
|
||||
Account *gnc_float_split_get_account (const FloatingSplit *fs) /* direct account pointer rather than account guid */
|
||||
{
|
||||
g_return_val_if_fail (fs, NULL);
|
||||
return fs->m_account;
|
||||
}
|
||||
|
||||
Transaction *gnc_float_split_get_transaction (const FloatingSplit *fs) /* direct transaction pointer rather than transaction guid */
|
||||
{
|
||||
g_return_val_if_fail (fs, NULL);
|
||||
return fs->m_transaction;
|
||||
}
|
||||
|
||||
const char *gnc_float_split_get_memo (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, NULL);
|
||||
return fs->m_memo;
|
||||
}
|
||||
|
||||
const char *gnc_float_split_get_action (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, NULL);
|
||||
return fs->m_action;
|
||||
}
|
||||
|
||||
char gnc_float_split_get_reconcile_state (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, '\0');
|
||||
return fs->m_reconcile_state;
|
||||
}
|
||||
|
||||
time64 gnc_float_split_get_reconcile_date (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, G_MAXINT64);
|
||||
return fs->m_reconcile_date;
|
||||
}
|
||||
|
||||
gnc_numeric gnc_float_split_get_amount (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, gnc_numeric_zero());
|
||||
return fs->m_amount;
|
||||
}
|
||||
|
||||
gnc_numeric gnc_float_split_get_value (const FloatingSplit *fs)
|
||||
{
|
||||
g_return_val_if_fail (fs, gnc_numeric_zero());
|
||||
return fs->m_value;
|
||||
}
|
||||
|
||||
|
||||
/* modifiers */
|
||||
void gnc_float_split_set_split(FloatingSplit *fs, Split *split)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_split = split;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_account (FloatingSplit *fs, Account *account) /* direct account pointer rather than account guid */
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_account = account;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_transaction (FloatingSplit *fs, Transaction *transaction) /* direct transaction pointer rather than transaction guid */
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_transaction = transaction;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_memo (FloatingSplit *fs, const char *memo)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_memo = memo;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_action (FloatingSplit *fs, const char *action)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_action = action;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_reconcile_state (FloatingSplit *fs, char reconcile_state)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_reconcile_state = reconcile_state;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_reconcile_date (FloatingSplit *fs, time64 reconcile_date)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
fs->m_reconcile_date = reconcile_date;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_amount (FloatingSplit *fs, const gnc_numeric amount)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
|
||||
fs->m_amount = amount;
|
||||
};
|
||||
|
||||
void gnc_float_split_set_value (FloatingSplit *fs, const gnc_numeric value)
|
||||
{
|
||||
g_return_if_fail (fs);
|
||||
|
||||
fs->m_value = value;
|
||||
};
|
||||
|
||||
/* This function takes a split and returns a representation
|
||||
of it as a floating_split structure. Assumes the transaction is open
|
||||
for editing.
|
||||
*/
|
||||
FloatingSplit *gnc_split_to_float_split (Split *split)
|
||||
{
|
||||
FloatingSplit *fs;
|
||||
|
||||
g_return_val_if_fail (split, NULL);
|
||||
|
||||
fs = g_new0 (FloatingSplit, 1);
|
||||
fs->m_split = split;
|
||||
fs->m_account = xaccSplitGetAccount (split);
|
||||
fs->m_transaction = xaccSplitGetParent (split);
|
||||
fs->m_memo = xaccSplitGetMemo (split);
|
||||
fs->m_action = xaccSplitGetAction (split);
|
||||
fs->m_reconcile_state = xaccSplitGetReconcile (split);
|
||||
fs->m_reconcile_date = xaccSplitGetDateReconciled (split);
|
||||
fs->m_amount = xaccSplitGetAmount (split);
|
||||
fs->m_value = xaccSplitGetValue (split);
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
/* Copy a temporary split representation onto a real split.
|
||||
If possible, insert the split into the account of the
|
||||
split representation. Not all values are copied. The reconcile
|
||||
status and date are not copied. The split's guid is,
|
||||
of course, unchanged.
|
||||
*/
|
||||
void gnc_float_split_to_split (const FloatingSplit *fs, Split *split)
|
||||
{
|
||||
g_return_if_fail(split);
|
||||
|
||||
if (fs->m_memo)
|
||||
xaccSplitSetMemo (split, fs->m_memo);
|
||||
if (fs->m_action)
|
||||
xaccSplitSetAction (split, fs->m_action);
|
||||
xaccSplitSetAmount (split, fs->m_amount);
|
||||
xaccSplitSetValue (split, fs->m_value);
|
||||
if (fs->m_account)
|
||||
{
|
||||
xaccAccountBeginEdit (fs->m_account);
|
||||
xaccSplitSetAccount (split, fs->m_account);
|
||||
xaccAccountCommitEdit (fs->m_account);
|
||||
}
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
Transaction *gnc_float_txn_get_txn (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_txn;
|
||||
}
|
||||
|
||||
gnc_commodity *gnc_float_txn_get_currency (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_currency;
|
||||
}
|
||||
|
||||
time64 gnc_float_txn_get_date_entered (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, G_MAXINT64);
|
||||
return ft->m_date_entered;
|
||||
}
|
||||
|
||||
time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, G_MAXINT64);
|
||||
return ft->m_date_posted;
|
||||
}
|
||||
|
||||
const char *gnc_float_txn_get_num (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_num;
|
||||
}
|
||||
|
||||
const char *gnc_float_txn_get_description (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_description;
|
||||
}
|
||||
|
||||
const char *gnc_float_txn_get_notes (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_notes;
|
||||
}
|
||||
|
||||
const char *gnc_float_txn_get_association (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_association;
|
||||
}
|
||||
|
||||
SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft)
|
||||
{
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
return ft->m_splits;
|
||||
}
|
||||
|
||||
FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index)
|
||||
{
|
||||
FloatingSplit *fs = NULL;
|
||||
guint size = 0;
|
||||
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
g_return_val_if_fail (ft->m_splits, NULL);
|
||||
g_return_val_if_fail (index < g_list_length (ft->m_splits) , NULL);
|
||||
return g_list_nth_data (ft->m_splits, index);
|
||||
}
|
||||
|
||||
FloatingSplit *gnc_float_txn_get_other_float_split (const FloatingTxn *ft, FloatingSplit *fs)
|
||||
{
|
||||
guint size = 0, other = 0;
|
||||
|
||||
g_return_val_if_fail (ft, NULL);
|
||||
g_return_val_if_fail (ft->m_splits, NULL);
|
||||
g_return_val_if_fail (g_list_length (ft->m_splits) == 2 , NULL);
|
||||
|
||||
if (g_list_nth_data (ft->m_splits, 0) == fs)
|
||||
other = 1;
|
||||
|
||||
return g_list_nth_data (ft->m_splits, other);
|
||||
}
|
||||
|
||||
/* modifiers */
|
||||
void gnc_float_txn_set_txn (FloatingTxn *ft, Transaction *txn)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_txn = txn;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_currency (FloatingTxn *ft, gnc_commodity *currency)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_currency = currency;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_date_entered (FloatingTxn *ft, time64 date_entered)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_date_entered = date_entered;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_date_posted = date_posted;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_num (FloatingTxn *ft, const char *num)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_num = num;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_description (FloatingTxn *ft, const char *description)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_description = description;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_notes = notes;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_association = association;
|
||||
};
|
||||
|
||||
void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
ft->m_splits = splits;
|
||||
};
|
||||
|
||||
void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs)
|
||||
{
|
||||
g_return_if_fail (ft);
|
||||
g_return_if_fail (fs);
|
||||
ft->m_splits = g_list_append (ft->m_splits, fs);
|
||||
}
|
||||
|
||||
/* This function takes a C transaction and returns
|
||||
a representation of it as a floating_txn. */
|
||||
FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
FloatingTxn *ft = g_new0 (FloatingTxn, 1);
|
||||
|
||||
ft->m_txn = txn;
|
||||
ft->m_currency = xaccTransGetCurrency (txn);
|
||||
ft->m_date_entered = xaccTransGetDateEntered (txn);
|
||||
if (use_cut_semantics)
|
||||
{
|
||||
ft->m_date_posted = xaccTransGetDate (txn);
|
||||
ft->m_num = xaccTransGetNum (txn);
|
||||
}
|
||||
ft->m_description = xaccTransGetDescription (txn);
|
||||
ft->m_notes = xaccTransGetNotes (txn);
|
||||
ft->m_association = xaccTransGetAssociation (txn);
|
||||
|
||||
for (iter = xaccTransGetSplitList (txn); iter ; iter = iter->next)
|
||||
{
|
||||
Split *split = iter->data;
|
||||
if (split)
|
||||
{
|
||||
FloatingSplit *fs = gnc_split_to_float_split (split);
|
||||
ft->m_splits = g_list_prepend (ft->m_splits, fs);
|
||||
}
|
||||
}
|
||||
ft->m_splits = g_list_reverse (ft->m_splits);
|
||||
|
||||
return ft;
|
||||
}
|
||||
|
||||
void gnc_float_txn_to_txn (const FloatingTxn *ft, Transaction *txn, gboolean do_commit)
|
||||
{
|
||||
gnc_float_txn_to_txn_swap_accounts (ft, txn, NULL, NULL, do_commit);
|
||||
}
|
||||
|
||||
/* Copy a temporary representation of a transaction onto a real transaction.
|
||||
I f they exist the two account*s (acct1 and acct2) are used to swap accounts
|
||||
when when creating splits. */
|
||||
void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn, Account *acct1, Account *acct2, gboolean do_commit)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
g_return_if_fail (ft);
|
||||
g_return_if_fail (txn);
|
||||
|
||||
if (!xaccTransIsOpen (txn))
|
||||
xaccTransBeginEdit (txn);
|
||||
|
||||
if (ft->m_currency)
|
||||
xaccTransSetCurrency (txn, ft->m_currency);
|
||||
if (ft->m_description)
|
||||
xaccTransSetDescription (txn, ft->m_description);
|
||||
if (ft->m_num)
|
||||
xaccTransSetNum (txn, ft->m_num);
|
||||
if (ft->m_notes)
|
||||
xaccTransSetNotes (txn, ft->m_notes);
|
||||
if (ft->m_association)
|
||||
xaccTransSetAssociation (txn, ft->m_association);
|
||||
if (ft->m_date_posted)
|
||||
xaccTransSetDatePostedSecs (txn, ft->m_date_posted);
|
||||
|
||||
/* strip off the old splits */
|
||||
while (xaccTransCountSplits (txn))
|
||||
xaccSplitDestroy (xaccTransGetSplit (txn, 0));
|
||||
|
||||
/* and put on the new ones! Please note they go in the *same*
|
||||
order as in the original transaction. This is important. */
|
||||
for (iter = ft->m_splits; iter; iter = iter->next)
|
||||
{
|
||||
Account *old_acc, *new_acc;
|
||||
Split *split;
|
||||
FloatingSplit *fs = iter->data;
|
||||
if (!fs)
|
||||
continue;
|
||||
|
||||
split = xaccMallocSplit (xaccTransGetBook (txn));
|
||||
|
||||
old_acc = fs->m_account;
|
||||
if (fs->m_account == acct1)
|
||||
new_acc = acct2;
|
||||
else if (fs->m_account == acct2)
|
||||
new_acc = acct1;
|
||||
else
|
||||
new_acc = fs->m_account;
|
||||
|
||||
fs->m_account = new_acc;
|
||||
gnc_float_split_to_split (fs, split);
|
||||
fs->m_account = old_acc;
|
||||
xaccSplitSetParent (split, txn);
|
||||
}
|
||||
|
||||
/* close the transaction */
|
||||
if (do_commit)
|
||||
xaccTransCommitEdit (txn);
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
/********************************************************************\
|
||||
* split-register-copy-ops-internals.c -- internal details of *
|
||||
* copy/paste semantics for transactions and splits *
|
||||
* Port to C of engine-interface *
|
||||
* originally written by Dave Peticolas <dave@krondo.com> *
|
||||
* © 2019 Geert Janssens
|
||||
* *
|
||||
* 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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* \********************************************************************/
|
||||
|
||||
#ifndef SPLIT_REGISTER_COPY_OPS_INTERNAL_H
|
||||
#define SPLIT_REGISTER_COPY_OPS_INTERNAL_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "gnc-engine.h" /* for typedefs */
|
||||
#include "qof.h"
|
||||
|
||||
#include "guid.h"
|
||||
#include "Split.h"
|
||||
#include "Account.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Split *m_split;
|
||||
Account *m_account;
|
||||
Transaction *m_transaction;
|
||||
const char *m_memo;
|
||||
const char *m_action;
|
||||
time64 m_reconcile_date;
|
||||
char m_reconcile_state;
|
||||
gnc_numeric m_value;
|
||||
gnc_numeric m_amount;
|
||||
} FloatingSplit;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Transaction *m_txn;
|
||||
gnc_commodity *m_currency;
|
||||
time64 m_date_entered;
|
||||
time64 m_date_posted;
|
||||
const char *m_num;
|
||||
const char *m_description;
|
||||
const char *m_notes;
|
||||
const char *m_association;
|
||||
SplitList *m_splits;
|
||||
} FloatingTxn;
|
||||
|
||||
/* accessors */
|
||||
Split *gnc_float_split_get_split(const FloatingSplit* fs);
|
||||
Account *gnc_float_split_get_account (const FloatingSplit *fs); /* direct account pointer rather than account guid */
|
||||
Transaction *gnc_float_split_get_transaction (const FloatingSplit *fs); /* direct transaction pointer rather than transaction guid */
|
||||
const char *gnc_float_split_get_memo (const FloatingSplit *fs);
|
||||
const char *gnc_float_split_get_action (const FloatingSplit *fs);
|
||||
char gnc_float_split_get_reconcile_state (const FloatingSplit *fs);
|
||||
time64 gnc_float_split_get_reconcile_date (const FloatingSplit *fs);
|
||||
gnc_numeric gnc_float_split_get_amount (const FloatingSplit *fs);
|
||||
gnc_numeric gnc_float_split_get_value (const FloatingSplit *fs);
|
||||
|
||||
/* modifiers */
|
||||
void gnc_float_split_set_split (FloatingSplit *fs, Split *split);
|
||||
void gnc_float_split_set_account (FloatingSplit *fs, Account *account); /* direct account pointer rather than account guid */
|
||||
void gnc_float_split_set_transaction (FloatingSplit *fs, Transaction *transaction); /* direct transaction pointer rather than transaction guid */
|
||||
void gnc_float_split_set_memo (FloatingSplit *fs, const char *memo);
|
||||
void gnc_float_split_set_action (FloatingSplit *fs, const char *action);
|
||||
void gnc_float_split_set_reconcile_state (FloatingSplit *fs, char reconcile_state);
|
||||
void gnc_float_split_set_reconcile_date (FloatingSplit *fs, time64 reconcile_date);
|
||||
void gnc_float_split_set_amount (FloatingSplit *fs, gnc_numeric amount);
|
||||
void gnc_float_split_set_value (FloatingSplit *fs, gnc_numeric value);
|
||||
|
||||
FloatingSplit *gnc_split_to_float_split (Split *split);
|
||||
void gnc_float_split_to_split (const FloatingSplit *fs, Split *split);
|
||||
|
||||
/* accessors */
|
||||
Transaction *gnc_float_txn_get_txn (const FloatingTxn *ft);
|
||||
gnc_commodity *gnc_float_txn_get_currency (const FloatingTxn *ft);
|
||||
time64 gnc_float_txn_get_date_entered (const FloatingTxn *ft);
|
||||
time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_num (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_description (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_notes (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_association (const FloatingTxn *ft);
|
||||
SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft);
|
||||
|
||||
FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index);
|
||||
FloatingSplit *gnc_float_txn_get_other_float_split (const FloatingTxn *ft, FloatingSplit *fs);
|
||||
|
||||
/* modifiers */
|
||||
void gnc_float_txn_set_txn (FloatingTxn *ft, Transaction *txn);
|
||||
void gnc_float_txn_set_currency (FloatingTxn *ft, gnc_commodity *currency);
|
||||
void gnc_float_txn_set_date_entered (FloatingTxn *ft, time64 date_entered);
|
||||
void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted);
|
||||
void gnc_float_txn_set_num (FloatingTxn *ft, const char *num);
|
||||
void gnc_float_txn_set_description (FloatingTxn *ft, const char *description);
|
||||
void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes);
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association);
|
||||
void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits);
|
||||
|
||||
void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs);
|
||||
|
||||
FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics);
|
||||
|
||||
void gnc_float_txn_to_txn (const FloatingTxn *ft, Transaction *txn, gboolean do_commit);
|
||||
void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn, Account *acct1, Account *acct2, gboolean do_commit);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,9 @@
|
||||
/********************************************************************\
|
||||
* split-register-copy-ops.h -- implement copy/paste semantics for *
|
||||
* transactions and splits *
|
||||
* Copyright (C) 1999 Linas Vepstas *
|
||||
* Copyright (C) 2017 Aaron Laws *
|
||||
* split-register-copy-ops.c -- copy/paste semantics for *
|
||||
* transactions and splits *
|
||||
* Port to C of engine-interface *
|
||||
* originally written by Dave Peticolas <dave@krondo.com> *
|
||||
* © 2019 Geert Janssens
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -15,55 +16,104 @@
|
||||
* 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 *
|
||||
* *
|
||||
\********************************************************************/
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* \********************************************************************/
|
||||
|
||||
#ifndef SPLIT_REGISTER_COPY_OPS_H
|
||||
#define SPLIT_REGISTER_COPY_OPS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#include "gnc-engine.h" /* for typedefs */
|
||||
#include "qof.h"
|
||||
|
||||
#include "guid.h"
|
||||
#include "Split.h"
|
||||
#include "Account.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
/* The next set of functions is for manipulating scheme
|
||||
* representations of splits and transactions. */
|
||||
typedef struct
|
||||
{
|
||||
Split *m_split;
|
||||
Account *m_account;
|
||||
Transaction *m_transaction;
|
||||
const char *m_memo;
|
||||
const char *m_action;
|
||||
time64 m_reconcile_date;
|
||||
char m_reconcile_state;
|
||||
gnc_numeric m_value;
|
||||
gnc_numeric m_amount;
|
||||
} FloatingSplit;
|
||||
|
||||
SCM gnc_copy_split(Split *split, gboolean use_cut_semantics);
|
||||
void gnc_copy_split_scm_onto_split(SCM split_scm, Split *split,
|
||||
QofBook *book);
|
||||
typedef struct
|
||||
{
|
||||
Transaction *m_txn;
|
||||
gnc_commodity *m_currency;
|
||||
time64 m_date_entered;
|
||||
time64 m_date_posted;
|
||||
const char *m_num;
|
||||
const char *m_description;
|
||||
const char *m_notes;
|
||||
const char *m_association;
|
||||
SplitList *m_splits;
|
||||
} FloatingTxn;
|
||||
|
||||
void gnc_split_scm_set_account(SCM split_scm, Account *account);
|
||||
void gnc_split_scm_set_memo(SCM split_scm, const char *memo);
|
||||
void gnc_split_scm_set_action(SCM split_scm, const char *action);
|
||||
void gnc_split_scm_set_reconcile_state(SCM split_scm, char reconcile_state);
|
||||
void gnc_split_scm_set_amount(SCM split_scm, gnc_numeric amount);
|
||||
void gnc_split_scm_set_value(SCM split_scm, gnc_numeric value);
|
||||
/* accessors */
|
||||
Split *gnc_float_split_get_split(const FloatingSplit* fs);
|
||||
Account *gnc_float_split_get_account (const FloatingSplit *fs); /* direct account pointer rather than account guid */
|
||||
Transaction *gnc_float_split_get_transaction (const FloatingSplit *fs); /* direct transaction pointer rather than transaction guid */
|
||||
const char *gnc_float_split_get_memo (const FloatingSplit *fs);
|
||||
const char *gnc_float_split_get_action (const FloatingSplit *fs);
|
||||
char gnc_float_split_get_reconcile_state (const FloatingSplit *fs);
|
||||
time64 gnc_float_split_get_reconcile_date (const FloatingSplit *fs);
|
||||
gnc_numeric gnc_float_split_get_amount (const FloatingSplit *fs);
|
||||
gnc_numeric gnc_float_split_get_value (const FloatingSplit *fs);
|
||||
|
||||
gnc_numeric gnc_split_scm_get_amount(SCM split_scm);
|
||||
gnc_numeric gnc_split_scm_get_value(SCM split_scm);
|
||||
/* modifiers */
|
||||
void gnc_float_split_set_split (FloatingSplit *fs, Split *split);
|
||||
void gnc_float_split_set_account (FloatingSplit *fs, Account *account); /* direct account pointer rather than account guid */
|
||||
void gnc_float_split_set_transaction (FloatingSplit *fs, Transaction *transaction); /* direct transaction pointer rather than transaction guid */
|
||||
void gnc_float_split_set_memo (FloatingSplit *fs, const char *memo);
|
||||
void gnc_float_split_set_action (FloatingSplit *fs, const char *action);
|
||||
void gnc_float_split_set_reconcile_state (FloatingSplit *fs, char reconcile_state);
|
||||
void gnc_float_split_set_reconcile_date (FloatingSplit *fs, time64 reconcile_date);
|
||||
void gnc_float_split_set_amount (FloatingSplit *fs, gnc_numeric amount);
|
||||
void gnc_float_split_set_value (FloatingSplit *fs, gnc_numeric value);
|
||||
|
||||
SCM gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics);
|
||||
void gnc_copy_trans_scm_onto_trans(SCM trans_scm, Transaction *trans,
|
||||
gboolean do_commit, QofBook *book);
|
||||
void gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
|
||||
Transaction *trans,
|
||||
const GncGUID *guid_1,
|
||||
const GncGUID *guid_2,
|
||||
gboolean do_commit,
|
||||
QofBook *book);
|
||||
FloatingSplit *gnc_split_to_float_split (Split *split);
|
||||
void gnc_float_split_to_split (const FloatingSplit *fs, Split *split);
|
||||
|
||||
void gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm);
|
||||
/* accessors */
|
||||
Transaction *gnc_float_txn_get_txn (const FloatingTxn *ft);
|
||||
gnc_commodity *gnc_float_txn_get_currency (const FloatingTxn *ft);
|
||||
time64 gnc_float_txn_get_date_entered (const FloatingTxn *ft);
|
||||
time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_num (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_description (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_notes (const FloatingTxn *ft);
|
||||
const char *gnc_float_txn_get_association (const FloatingTxn *ft);
|
||||
SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft);
|
||||
|
||||
SCM gnc_trans_scm_get_split_scm(SCM trans_scm, int index);
|
||||
SCM gnc_trans_scm_get_other_split_scm(SCM trans_scm, SCM split_scm);
|
||||
int gnc_trans_scm_get_num_splits(SCM trans_scm);
|
||||
FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index);
|
||||
FloatingSplit *gnc_float_txn_get_other_float_split (const FloatingTxn *ft, FloatingSplit *fs);
|
||||
|
||||
/* modifiers */
|
||||
void gnc_float_txn_set_txn (FloatingTxn *ft, Transaction *txn);
|
||||
void gnc_float_txn_set_currency (FloatingTxn *ft, gnc_commodity *currency);
|
||||
void gnc_float_txn_set_date_entered (FloatingTxn *ft, time64 date_entered);
|
||||
void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted);
|
||||
void gnc_float_txn_set_num (FloatingTxn *ft, const char *num);
|
||||
void gnc_float_txn_set_description (FloatingTxn *ft, const char *description);
|
||||
void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes);
|
||||
void gnc_float_txn_set_association (FloatingTxn *ft, const char *association);
|
||||
void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits);
|
||||
|
||||
void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs);
|
||||
|
||||
FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics);
|
||||
|
||||
void gnc_float_txn_to_txn (const FloatingTxn *ft, Transaction *txn, gboolean do_commit);
|
||||
void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn, Account *acct1, Account *acct2, gboolean do_commit);
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-warnings.h"
|
||||
#include "guile-util.h"
|
||||
#include "split-register-copy-ops-internals.h"
|
||||
#include "split-register-copy-ops.h"
|
||||
#include "numcell.h"
|
||||
#include "pricecell.h"
|
||||
#include "quickfillcell.h"
|
||||
|
@ -273,7 +273,6 @@ set (engine_SCHEME_0
|
||||
|
||||
set (engine_SCHEME_1
|
||||
commodity-table.scm
|
||||
engine-interface.scm
|
||||
engine-utilities.scm
|
||||
gnc-numeric.scm
|
||||
)
|
||||
|
@ -1,295 +0,0 @@
|
||||
;; engine-interface.scm -- support for working with the GnuCash
|
||||
;; engine data structures
|
||||
;; Copyright (C) 2000 Dave Peticolas <dave@krondo.com>
|
||||
;;
|
||||
;; 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
|
||||
|
||||
;; This defines a scheme representation of splits.
|
||||
(define gnc:split-structure
|
||||
(make-record-type
|
||||
"gnc:split-structure"
|
||||
'(split-guid account-guid transaction-guid memo action
|
||||
reconcile-state reconciled-date amount value)))
|
||||
|
||||
;; constructor
|
||||
(define gnc:make-split-scm
|
||||
(record-constructor gnc:split-structure))
|
||||
|
||||
;; type predicate
|
||||
(define gnc:split-scm?
|
||||
(record-predicate gnc:split-structure))
|
||||
|
||||
;; accessors
|
||||
(define gnc:split-scm-get-split-guid
|
||||
(record-accessor gnc:split-structure 'split-guid))
|
||||
|
||||
(define gnc:split-scm-get-account-guid
|
||||
(record-accessor gnc:split-structure 'account-guid))
|
||||
|
||||
(define gnc:split-scm-get-transaction-guid
|
||||
(record-accessor gnc:split-structure 'transaction-guid))
|
||||
|
||||
(define gnc:split-scm-get-memo
|
||||
(record-accessor gnc:split-structure 'memo))
|
||||
|
||||
(define gnc:split-scm-get-action
|
||||
(record-accessor gnc:split-structure 'action))
|
||||
|
||||
(define gnc:split-scm-get-reconcile-state
|
||||
(record-accessor gnc:split-structure 'reconcile-state))
|
||||
|
||||
(define gnc:split-scm-get-reconciled-date
|
||||
(record-accessor gnc:split-structure 'reconciled-date))
|
||||
|
||||
(define gnc:split-scm-get-amount
|
||||
(record-accessor gnc:split-structure 'amount))
|
||||
|
||||
(define gnc:split-scm-get-value
|
||||
(record-accessor gnc:split-structure 'value))
|
||||
|
||||
;; modifiers
|
||||
(define gnc:split-scm-set-split-guid
|
||||
(record-modifier gnc:split-structure 'split-guid))
|
||||
|
||||
(define gnc:split-scm-set-account-guid
|
||||
(record-modifier gnc:split-structure 'account-guid))
|
||||
|
||||
(define gnc:split-scm-set-transaction-guid
|
||||
(record-modifier gnc:split-structure 'transaction-guid))
|
||||
|
||||
(define gnc:split-scm-set-memo
|
||||
(record-modifier gnc:split-structure 'memo))
|
||||
|
||||
(define gnc:split-scm-set-action
|
||||
(record-modifier gnc:split-structure 'action))
|
||||
|
||||
(define gnc:split-scm-set-reconcile-state
|
||||
(record-modifier gnc:split-structure 'reconcile-state))
|
||||
|
||||
(define gnc:split-scm-set-reconciled-date
|
||||
(record-modifier gnc:split-structure 'reconciled-date))
|
||||
|
||||
(define gnc:split-scm-set-amount
|
||||
(record-modifier gnc:split-structure 'amount))
|
||||
|
||||
(define gnc:split-scm-set-value
|
||||
(record-modifier gnc:split-structure 'value))
|
||||
|
||||
;; This function take a C split and returns a representation
|
||||
;; of it as a split-structure. Assumes the transaction is open
|
||||
;; for editing.
|
||||
(define (gnc:split->split-scm split use-cut-semantics?)
|
||||
(gnc:make-split-scm
|
||||
(gncSplitGetGUID split)
|
||||
(gncAccountGetGUID (xaccSplitGetAccount split))
|
||||
(gncTransGetGUID (xaccSplitGetParent split))
|
||||
(xaccSplitGetMemo split)
|
||||
(xaccSplitGetAction split)
|
||||
(xaccSplitGetReconcile split)
|
||||
(xaccSplitGetDateReconciled split)
|
||||
(xaccSplitGetAmount split)
|
||||
(xaccSplitGetValue split)))
|
||||
|
||||
;; Copy a scheme representation of a split onto a C split.
|
||||
;; If possible, insert the C split into the account of the
|
||||
;; scheme split. Not all values are copied. The reconcile
|
||||
;; status and date are not copied. The C split's guid is,
|
||||
;; of course, unchanged.
|
||||
(define (gnc:split-scm-onto-split split-scm split book)
|
||||
(if (null? split)
|
||||
#f
|
||||
(begin
|
||||
(let ((memo (gnc:split-scm-get-memo split-scm))
|
||||
(action (gnc:split-scm-get-action split-scm))
|
||||
(amount (gnc:split-scm-get-amount split-scm))
|
||||
(value (gnc:split-scm-get-value split-scm)))
|
||||
(if memo (xaccSplitSetMemo split memo))
|
||||
(if action (xaccSplitSetAction split action))
|
||||
(if amount (xaccSplitSetAmount split amount))
|
||||
(if value (xaccSplitSetValue split value)))
|
||||
(let ((account (xaccAccountLookup
|
||||
(gnc:split-scm-get-account-guid split-scm)
|
||||
book)))
|
||||
(if (not (null? account))
|
||||
(begin
|
||||
(xaccAccountBeginEdit account)
|
||||
(xaccSplitSetAccount split account)
|
||||
(xaccAccountCommitEdit account)))))))
|
||||
|
||||
;; Defines a scheme representation of a transaction.
|
||||
(define gnc:transaction-structure
|
||||
(make-record-type
|
||||
"gnc:transaction-structure"
|
||||
'(transaction-guid currency date-entered date-posted
|
||||
num description notes association split-scms)))
|
||||
|
||||
;; constructor
|
||||
(define gnc:make-transaction-scm
|
||||
(record-constructor gnc:transaction-structure))
|
||||
|
||||
;; type predicate
|
||||
(define gnc:transaction-scm?
|
||||
(record-predicate gnc:transaction-structure))
|
||||
|
||||
;; accessors
|
||||
(define gnc:transaction-scm-get-transaction-guid
|
||||
(record-accessor gnc:transaction-structure 'transaction-guid))
|
||||
|
||||
(define gnc:transaction-scm-get-currency
|
||||
(record-accessor gnc:transaction-structure 'currency))
|
||||
|
||||
(define gnc:transaction-scm-get-date-entered
|
||||
(record-accessor gnc:transaction-structure 'date-entered))
|
||||
|
||||
(define gnc:transaction-scm-get-date-posted
|
||||
(record-accessor gnc:transaction-structure 'date-posted))
|
||||
|
||||
(define gnc:transaction-scm-get-num
|
||||
(record-accessor gnc:transaction-structure 'num))
|
||||
|
||||
(define gnc:transaction-scm-get-description
|
||||
(record-accessor gnc:transaction-structure 'description))
|
||||
|
||||
(define gnc:transaction-scm-get-notes
|
||||
(record-accessor gnc:transaction-structure 'notes))
|
||||
|
||||
(define gnc:transaction-scm-get-association
|
||||
(record-accessor gnc:transaction-structure 'association))
|
||||
|
||||
(define gnc:transaction-scm-get-split-scms
|
||||
(record-accessor gnc:transaction-structure 'split-scms))
|
||||
|
||||
(define (gnc:transaction-scm-get-split-scm trans-scm index)
|
||||
(let ((split-scms (gnc:transaction-scm-get-split-scms trans-scm)))
|
||||
(cond ((< index 0) #f)
|
||||
((not (pair? split-scms)) #f)
|
||||
((>= index (length split-scms)) #f)
|
||||
(else (list-ref split-scms index)))))
|
||||
|
||||
(define (gnc:transaction-scm-get-other-split-scm trans-scm split-scm)
|
||||
(let ((split-scms (gnc:transaction-scm-get-split-scms trans-scm)))
|
||||
(cond ((not (= (length split-scms) 2)) #f)
|
||||
((eq? split-scm (car split-scms)) (cadr split-scms))
|
||||
(else (car split-scms)))))
|
||||
|
||||
;; modifiers
|
||||
(define gnc:transaction-scm-set-transaction-guid
|
||||
(record-modifier gnc:transaction-structure 'transaction-guid))
|
||||
|
||||
(define gnc:transaction-scm-set-currency
|
||||
(record-modifier gnc:transaction-structure 'currency))
|
||||
|
||||
(define gnc:transaction-scm-set-date-entered
|
||||
(record-modifier gnc:transaction-structure 'date-entered))
|
||||
|
||||
(define gnc:transaction-scm-set-date-posted
|
||||
(record-modifier gnc:transaction-structure 'date-posted))
|
||||
|
||||
(define gnc:transaction-scm-set-num
|
||||
(record-modifier gnc:transaction-structure 'num))
|
||||
|
||||
(define gnc:transaction-scm-set-description
|
||||
(record-modifier gnc:transaction-structure 'description))
|
||||
|
||||
(define gnc:transaction-scm-set-notes
|
||||
(record-modifier gnc:transaction-structure 'notes))
|
||||
|
||||
(define gnc:transaction-scm-set-association
|
||||
(record-modifier gnc:transaction-structure 'association))
|
||||
|
||||
(define gnc:transaction-scm-set-split-scms
|
||||
(record-modifier gnc:transaction-structure 'split-scms))
|
||||
|
||||
(define (gnc:transaction-scm-append-split-scm trans-scm split-scm)
|
||||
(let ((split-scms (gnc:transaction-scm-get-split-scms trans-scm)))
|
||||
(gnc:transaction-scm-set-split-scms
|
||||
trans-scm (append split-scms (list split-scm)))))
|
||||
|
||||
;; This function takes a C transaction and returns
|
||||
;; a representation of it as a transaction-structure.
|
||||
(define (gnc:transaction->transaction-scm trans use-cut-semantics?)
|
||||
(define (trans-splits i)
|
||||
(let ((split (xaccTransGetSplit trans i)))
|
||||
(if (null? split)
|
||||
'()
|
||||
(cons (gnc:split->split-scm split use-cut-semantics?)
|
||||
(trans-splits (+ i 1))))))
|
||||
(gnc:make-transaction-scm
|
||||
(gncTransGetGUID trans)
|
||||
(xaccTransGetCurrency trans)
|
||||
(xaccTransGetDateEntered trans)
|
||||
(if use-cut-semantics?
|
||||
(xaccTransGetDate trans)
|
||||
#f)
|
||||
(if use-cut-semantics?
|
||||
(xaccTransGetNum trans)
|
||||
#f)
|
||||
(xaccTransGetDescription trans)
|
||||
(xaccTransGetNotes trans)
|
||||
(xaccTransGetAssociation trans)
|
||||
(trans-splits 0)))
|
||||
|
||||
;; Copy a scheme representation of a transaction onto a C transaction.
|
||||
;; guid-mapping must be an alist, mapping guids to guids. This list is
|
||||
;; used to use alternate account guids when creating splits.
|
||||
(define (gnc:transaction-scm-onto-transaction trans-scm trans guid-mapping
|
||||
commit? book)
|
||||
(if (null? trans)
|
||||
#f
|
||||
(begin
|
||||
;; open the transaction for editing
|
||||
(if (not (xaccTransIsOpen trans))
|
||||
(xaccTransBeginEdit trans))
|
||||
|
||||
;; copy in the transaction values
|
||||
(let ((currency (gnc:transaction-scm-get-currency trans-scm))
|
||||
(description (gnc:transaction-scm-get-description trans-scm))
|
||||
(num (gnc:transaction-scm-get-num trans-scm))
|
||||
(notes (gnc:transaction-scm-get-notes trans-scm))
|
||||
(association (gnc:transaction-scm-get-association trans-scm))
|
||||
(date-posted (gnc:transaction-scm-get-date-posted trans-scm)))
|
||||
(if currency (xaccTransSetCurrency trans currency))
|
||||
(if description (xaccTransSetDescription trans description))
|
||||
(if num (xaccTransSetNum trans num))
|
||||
(if notes (xaccTransSetNotes trans notes))
|
||||
(if association (xaccTransSetAssociation trans association))
|
||||
(if date-posted (xaccTransSetDatePostedSecs trans date-posted)))
|
||||
|
||||
;; strip off the old splits
|
||||
(for-each (lambda (split)
|
||||
(xaccSplitDestroy split))
|
||||
(xaccTransGetSplitList trans))
|
||||
|
||||
;; and put on the new ones! Please note they go in the *same*
|
||||
;; order as in the original transaction. This is important.
|
||||
(for-each
|
||||
(lambda (split-scm)
|
||||
(let* ((new-split (xaccMallocSplit book))
|
||||
(old-guid (gnc:split-scm-get-account-guid split-scm))
|
||||
(new-guid (assoc-ref guid-mapping old-guid)))
|
||||
(if (not new-guid)
|
||||
(set! new-guid old-guid))
|
||||
(gnc:split-scm-set-account-guid split-scm new-guid)
|
||||
(gnc:split-scm-onto-split split-scm new-split book)
|
||||
(gnc:split-scm-set-account-guid split-scm old-guid)
|
||||
(xaccSplitSetParent new-split trans)))
|
||||
(gnc:transaction-scm-get-split-scms trans-scm))
|
||||
|
||||
;; close the transaction
|
||||
(if commit?
|
||||
(xaccTransCommitEdit trans)))))
|
@ -66,56 +66,6 @@
|
||||
(export account-full-name<?)
|
||||
(export accounts-get-children-depth)
|
||||
|
||||
(export gnc:split-structure)
|
||||
(export gnc:make-split-scm)
|
||||
(export gnc:split-scm?)
|
||||
(export gnc:split-scm-get-split-guid)
|
||||
(export gnc:split-scm-get-account-guid)
|
||||
(export gnc:split-scm-get-transaction-guid)
|
||||
(export gnc:split-scm-get-memo)
|
||||
(export gnc:split-scm-get-action)
|
||||
(export gnc:split-scm-get-reconcile-state)
|
||||
(export gnc:split-scm-get-reconciled-date)
|
||||
(export gnc:split-scm-get-amount)
|
||||
(export gnc:split-scm-get-value)
|
||||
(export gnc:split-scm-set-split-guid)
|
||||
(export gnc:split-scm-set-account-guid)
|
||||
(export gnc:split-scm-set-transaction-guid)
|
||||
(export gnc:split-scm-set-memo)
|
||||
(export gnc:split-scm-set-action)
|
||||
(export gnc:split-scm-set-reconcile-state)
|
||||
(export gnc:split-scm-set-reconciled-date)
|
||||
(export gnc:split-scm-set-amount)
|
||||
(export gnc:split-scm-set-value)
|
||||
(export gnc:split->split-scm)
|
||||
(export gnc:split-scm-onto-split)
|
||||
(export gnc:transaction-structure)
|
||||
(export gnc:make-transaction-scm)
|
||||
(export gnc:transaction-scm?)
|
||||
(export gnc:transaction-scm-get-transaction-guid)
|
||||
(export gnc:transaction-scm-get-currency)
|
||||
(export gnc:transaction-scm-get-date-entered)
|
||||
(export gnc:transaction-scm-get-date-posted)
|
||||
(export gnc:transaction-scm-get-num)
|
||||
(export gnc:transaction-scm-get-description)
|
||||
(export gnc:transaction-scm-get-notes)
|
||||
(export gnc:transaction-scm-get-split-scms)
|
||||
(export gnc:transaction-scm-get-split-scm)
|
||||
(export gnc:transaction-scm-get-other-split-scm)
|
||||
(export gnc:transaction-scm-set-transaction-guid)
|
||||
(export gnc:transaction-scm-set-currency)
|
||||
(export gnc:transaction-scm-set-date-entered)
|
||||
(export gnc:transaction-scm-set-date-posted)
|
||||
(export gnc:transaction-scm-set-num)
|
||||
(export gnc:transaction-scm-set-description)
|
||||
(export gnc:transaction-scm-set-notes)
|
||||
(export gnc:transaction-scm-set-split-scms)
|
||||
(export gnc:transaction-scm-append-split-scm)
|
||||
(export gnc:transaction->transaction-scm)
|
||||
(export trans-splits)
|
||||
(export gnc:transaction-scm-onto-transaction)
|
||||
|
||||
(load-from-path "gnucash/engine/gnc-numeric")
|
||||
(load-from-path "gnucash/engine/commodity-table")
|
||||
(load-from-path "gnucash/engine/engine-interface")
|
||||
(load-from-path "gnucash/engine/engine-utilities")
|
||||
|
@ -381,7 +381,6 @@ gnucash/register/ledger-core/gncmod-ledger-core.c
|
||||
gnucash/register/ledger-core/split-register.c
|
||||
gnucash/register/ledger-core/split-register-control.c
|
||||
gnucash/register/ledger-core/split-register-copy-ops.c
|
||||
gnucash/register/ledger-core/split-register-copy-ops-internals.c
|
||||
gnucash/register/ledger-core/split-register-layout.c
|
||||
gnucash/register/ledger-core/split-register-load.c
|
||||
gnucash/register/ledger-core/split-register-model.c
|
||||
|
Loading…
Reference in New Issue
Block a user