@ -792,24 +792,41 @@ void GncTxImport::update_pre_split_props (uint32_t row, uint32_t col, GncTransPr
auto split_props = std : : get < PL_PRESPLIT > ( m_parsed_lines [ row ] ) ;
if ( col = = std : : get < PL_INPUT > ( m_parsed_lines [ row ] ) . size ( ) )
split_props - > reset ( prop_type ) ;
else
split_props - > reset ( prop_type ) ;
try
{
try
// Except for Deposit or Withdrawal lines there can only be
// one column with a given property type.
if ( ( prop_type ! = GncTransPropType : : DEPOSIT ) & &
( prop_type ! = GncTransPropType : : WITHDRAWAL ) )
{
auto value = std : : get < PL_INPUT > ( m_parsed_lines [ row ] ) . at ( col ) ;
split_props - > set ( prop_type , value ) ;
}
catch ( const std : : exception & e )
else
{
/* Do nothing, just prevent the exception from escalating up
* However log the error if it happens on a row that ' s not skipped
*/
if ( ! std : : get < PL_SKIP > ( m_parsed_lines [ row ] ) )
PINFO ( " User warning: %s " , e . what ( ) ) ;
// For Deposits and Withdrawal we have to sum all columns with this property
for ( auto col_it = m_settings . m_column_types . cbegin ( ) ;
col_it < m_settings . m_column_types . cend ( ) ;
col_it + + )
{
if ( * col_it = = prop_type )
{
auto col_num = col_it - m_settings . m_column_types . cbegin ( ) ;
auto value = std : : get < PL_INPUT > ( m_parsed_lines [ row ] ) . at ( col_num ) ;
split_props - > add ( prop_type , value ) ;
}
}
}
}
catch ( const std : : exception & e )
{
/* Do nothing, just prevent the exception from escalating up
* However log the error if it happens on a row that ' s not skipped
*/
if ( ! std : : get < PL_SKIP > ( m_parsed_lines [ row ] ) )
PINFO ( " User warning: %s " , e . what ( ) ) ;
}
}
@ -823,8 +840,11 @@ GncTxImport::set_column_type (uint32_t position, GncTransPropType type, bool for
if ( ( type = = old_type ) & & ! force )
return ; /* Nothing to do */
// Column types should be unique, so remove any previous occurrence of the new type
std : : replace ( m_settings . m_column_types . begin ( ) , m_settings . m_column_types . end ( ) ,
// Column types except deposit and withdrawal should be unique,
// so remove any previous occurrence of the new type
if ( ( type ! = GncTransPropType : : DEPOSIT ) & &
( type ! = GncTransPropType : : WITHDRAWAL ) )
std : : replace ( m_settings . m_column_types . begin ( ) , m_settings . m_column_types . end ( ) ,
type , GncTransPropType : : NONE ) ;
m_settings . m_column_types . at ( position ) = type ;