Don't set transaction properties via scheme in C code.

This commit is contained in:
John Ralls 2018-07-23 12:00:12 -07:00
parent fa1b4c685f
commit 773b070345
3 changed files with 5 additions and 108 deletions

View File

@ -1386,7 +1386,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
time64 time;
cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
gnc_date_cell_get_date ((DateCell *) cell, &time);
gnc_trans_scm_set_date(trans_scm, time);
xaccTransSetDatePostedSecsNormalized(trans, time);
}
if (gnc_table_layout_get_cell_changed (reg->table->layout, NUM_CELL, TRUE))
@ -1395,7 +1395,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
value = gnc_table_layout_get_cell_value (reg->table->layout, NUM_CELL);
if (reg->use_tran_num_for_num_field)
gnc_trans_scm_set_num (trans_scm, value);
xaccTransSetNum (trans, value);
/* else this contains the same as ACTN_CELL which is already handled below *
* and the TNUM_CELL contains transaction number which is handled in next *
* if statement. */
@ -1407,7 +1407,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
value = gnc_table_layout_get_cell_value (reg->table->layout, TNUM_CELL);
if (!reg->use_tran_num_for_num_field)
gnc_trans_scm_set_num (trans_scm, value);
xaccTransSetNum (trans, value);
/* else this cell is not used */
}
@ -1416,7 +1416,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
const char *value;
value = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL);
gnc_trans_scm_set_description (trans_scm, value);
xaccTransSetDescription (trans, value);
}
if (gnc_table_layout_get_cell_changed (reg->table->layout, NOTES_CELL, TRUE))
@ -1424,7 +1424,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
const char *value;
value = gnc_table_layout_get_cell_value (reg->table->layout, NOTES_CELL);
gnc_trans_scm_set_notes (trans_scm, value);
xaccTransSetNotes (trans, value);
}
if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, TRUE))

View File

@ -699,105 +699,6 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
}
}
/********************************************************************\
* gnc_trans_scm_set_date *
* set the date of a scheme transaction. *
* *
* Args: trans_scm - the scheme transaction *
* ts - the time to set *
* Returns: Nothing *
\********************************************************************/
void
gnc_trans_scm_set_date(SCM trans_scm, time64 time)
{
SCM arg;
Timespec ts = {time, 0};
initialize_scm_functions();
if (!gnc_is_trans_scm(trans_scm))
return;
arg = gnc_timespec2timepair(ts);
scm_call_2(setters.trans_scm_date, trans_scm, arg);
}
/********************************************************************\
* gnc_trans_scm_set_num *
* set the num of a scheme transaction. *
* *
* Args: trans_scm - the scheme transaction *
* num - the num to set *
* Returns: Nothing *
\********************************************************************/
void
gnc_trans_scm_set_num(SCM trans_scm, const char *num)
{
SCM arg;
initialize_scm_functions();
if (!gnc_is_trans_scm(trans_scm))
return;
if (num == NULL)
return;
arg = scm_from_utf8_string(num);
scm_call_2(setters.trans_scm_num, trans_scm, arg);
}
/********************************************************************\
* gnc_trans_scm_set_description *
* set the description of a scheme transaction. *
* *
* Args: trans_scm - the scheme transaction *
* description - the description to set *
* Returns: Nothing *
\********************************************************************/
void
gnc_trans_scm_set_description(SCM trans_scm, const char *description)
{
SCM arg;
initialize_scm_functions();
if (!gnc_is_trans_scm(trans_scm))
return;
if (description == NULL)
return;
arg = scm_from_utf8_string(description);
scm_call_2(setters.trans_scm_description, trans_scm, arg);
}
/********************************************************************\
* gnc_trans_scm_set_notes *
* set the notes of a scheme transaction. *
* *
* Args: trans_scm - the scheme transaction *
* notes - the notes to set *
* Returns: Nothing *
\********************************************************************/
void
gnc_trans_scm_set_notes(SCM trans_scm, const char *notes)
{
SCM arg;
initialize_scm_functions();
if (!gnc_is_trans_scm(trans_scm))
return;
if (notes == NULL)
return;
arg = scm_from_utf8_string(notes);
scm_call_2(setters.trans_scm_notes, trans_scm, arg);
}
/********************************************************************\
* gnc_trans_scm_append_split_scm *
* append the scheme split onto the scheme transaction *

View File

@ -68,10 +68,6 @@ void gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
gboolean do_commit,
QofBook *book);
void gnc_trans_scm_set_date(SCM trans_scm, time64 time);
void gnc_trans_scm_set_num(SCM trans_scm, const char *num);
void gnc_trans_scm_set_description(SCM trans_scm, const char *description);
void gnc_trans_scm_set_notes(SCM trans_scm, const char *notes);
void gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm);
SCM gnc_trans_scm_get_split_scm(SCM trans_scm, int index);