Exemple #1
0
PARSEDLLSPEC void ErrorListAll(void)
{
	int ik;
	int it;

	for(ik=0; ik<EHASH; ik++)
	{
		for(it=0; it<EH[ik].many; it++)
		{
			ErrorList(EH[ik].fptr[it]);
		}
	}
}
Exemple #2
0
PARSEDLLSPEC void ErrorListCode(int code)
{
	int ik;
	int it;

	for(ik=0; ik<EHASH; ik++)
	{
		for(it=0; it<EH[ik].many; it++)
		{
			if(EH[ik].fptr[it]->code==code)
			{
				ErrorList(EH[ik].fptr[it]);
			}
		}
	}
}
Exemple #3
0
PARSEDLLSPEC void ErrorListType(int type)
{
	int ik;
	int it;

	for(ik=0; ik<EHASH; ik++)
	{
		for(it=0; it<EH[ik].many; it++)
		{
			if(EH[ik].fptr[it]->type==type)
			{
				ErrorList(EH[ik].fptr[it]);
			}
		}
	}
}
Exemple #4
0
/* Check whether the chosen settings can successfully parse
 * the import data. This will check:
 * - there's at least one line selected for import
 * - the minimum number of columns is selected
 * - the values in the selected columns can be parsed meaningfully.
 * @return An empty string if all checks passed or the reason
 *         verification failed otherwise.
 */
std::string GncTxImport::verify ()
{
    auto newline = std::string();
    auto error_msg = ErrorList();

    /* Check if the import file did actually contain any information */
    if (m_parsed_lines.size() == 0)
    {
        error_msg.add_error(_("No valid data found in the selected file. It may be empty or the selected encoding is wrong."));
        return error_msg.str();
    }

    /* Check if at least one line is selected for importing */
    auto skip_alt_offset = m_settings.m_skip_alt_lines ? 1 : 0;
    if (m_settings.m_skip_start_lines + m_settings.m_skip_end_lines + skip_alt_offset >= m_parsed_lines.size())
    {
        error_msg.add_error(_("No lines are selected for importing. Please reduce the number of lines to skip."));
        return error_msg.str();
    }

    verify_column_selections (error_msg);

    update_skipped_lines (boost::none, boost::none, boost::none, boost::none);

    auto have_line_errors = false;
    for (auto line : m_parsed_lines)
    {
        if (!std::get<PL_SKIP>(line) && !std::get<PL_ERROR>(line).empty())
        {
            have_line_errors = true;
            break;
        }
    }

    if (have_line_errors)
        error_msg.add_error( _("Not all fields could be parsed. Please correct the issues reported for each line or adjust the lines to skip."));

    return error_msg.str();
}