GnuCash  5.6-150-g038405b370+
Public Member Functions | Friends
GncPreTrans Class Reference

Public Member Functions

 GncPreTrans (int date_format, bool multi_split)
 
void set (GncTransPropType prop_type, const std::string &value)
 
void set_date_format (int date_format)
 
void set_multi_split (bool multi_split)
 
void reset (GncTransPropType prop_type)
 
StrVec verify_essentials (void)
 
std::shared_ptr< DraftTransactioncreate_trans (QofBook *book, gnc_commodity *currency)
 
bool is_part_of (std::shared_ptr< GncPreTrans > parent)
 Check whether the harvested transaction properties for this instance match those of another one (the "parent"). More...
 
std::optional< std::string > get_void_reason ()
 
ErrMap errors ()
 
void reset_cross_split_counters ()
 
bool is_multi_currency ()
 

Friends

class GncPreSplit
 

Detailed Description

Definition at line 154 of file gnc-imp-props-tx.hpp.

Member Function Documentation

◆ is_part_of()

bool GncPreTrans::is_part_of ( std::shared_ptr< GncPreTrans parent)

Check whether the harvested transaction properties for this instance match those of another one (the "parent").

Note this function is not symmetrical. This instance can have empty properties and still be considered part of the parent if the other properties match the parent's. A fully empty instance will equally be considered part of the parent.

This function is intended to discover multi-split transaction lines in an import file where the first line defines the transaction (with a first split) and subsequent lines add splits. These subsequent lines can either have all transaction related columns be empty or the same as the first line.

Parameters
parentthe parent transaction property object to test against
Returns
true if this object is considered to be part of the parent, false otherwise.

Definition at line 361 of file gnc-imp-props-tx.cpp.

362 {
363  if (!parent)
364  return false;
365 
366  return (!m_differ || m_differ == parent->m_differ) &&
367  (!m_date || m_date == parent->m_date) &&
368  (!m_num || m_num == parent->m_num) &&
369  (!m_desc || m_desc == parent->m_desc) &&
370  (!m_notes || m_notes == parent->m_notes) &&
371  (!m_currency || m_currency == parent->m_currency) &&
372  (!m_void_reason || m_void_reason == parent->m_void_reason) &&
373  parent->m_errors.empty(); // A GncPreTrans with errors can never be a parent
374 }

The documentation for this class was generated from the following files: