Add Account-list options.

This commit is contained in:
John Ralls
2019-11-17 11:15:56 -08:00
parent 7183e7c43a
commit b95ea2c4aa
8 changed files with 617 additions and 31 deletions

View File

@@ -29,6 +29,23 @@ extern "C"
#include "gnc-accounting-period.h"
}
bool
GncOptionAccountValue::validate(const GncOptionAccountList& values) const
{
if (values.empty())
return false;
if (get_ui_type() == GncOptionUIType::ACCOUNT_SEL && values.size() != 1)
return false;
if (m_allowed.empty())
return true;
for(auto account : values) {
if (std::find(m_allowed.begin(), m_allowed.end(),
xaccAccountGetType(account)) == m_allowed.end())
return false;
}
return true;
}
static constexpr int days_in_month[12]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static void