Commit ee4bdc6e authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Added Service::containsMandatoryUserFields().

parent 61fa9c20
......@@ -84,6 +84,30 @@ bool Gov::Service::haveAllMandatoryFields(void) const
return true;
}
bool Gov::Service::containsMandatoryUserFields(void) const
{
foreach (const FormField &ff, m_formFields) {
const FormFieldType::Properties props = ff.properties();
if ((props & FormFieldType::PROP_MANDATORY) &&
(props & FormFieldType::PROP_USER_INPUT)) {
return true;
}
}
return false;
}
bool Gov::Service::containsBoxOwnerDataFields(void) const
{
foreach (const FormField &ff, m_formFields) {
if (ff.properties() & FormFieldType::PROP_BOX_INPUT) {
return true;
}
}
return false;
}
Isds::Message Gov::Service::dataMessage(void) const
{
Isds::Message message;
......
......@@ -182,6 +182,24 @@ namespace Gov {
virtual
bool haveAllMandatoryFields(void) const;
/*!
* @brief Return true if service requires mandatory data that
* must be provided by the user.
*
* @return True if at least one such field exists.
*/
virtual
bool containsMandatoryUserFields(void) const;
/*!
* @brief Return true if service requires data that must be
* acquired from the data box.
*
* @return true if at least on such field is in the model.
*/
virtual
bool containsBoxOwnerDataFields(void) const;
/*!
* @brief Create ISDS message containing the request.
*
......
......@@ -196,29 +196,19 @@ bool GovFormListModel::haveAllMandatory(void) const
bool GovFormListModel::containsMandatoryUser(void) const
{
if (m_service != Q_NULLPTR) {
foreach (const Gov::FormField &ff, m_service->fields()) {
const Gov::FormFieldType::Properties props = ff.properties();
if ((props & Gov::FormFieldType::PROP_MANDATORY) &&
(props & Gov::FormFieldType::PROP_USER_INPUT)) {
return true;
}
}
return m_service->containsMandatoryUserFields();
} else {
return false;
}
return false;
}
bool GovFormListModel::containsBoxOwnerData(void) const
{
if (m_service != Q_NULLPTR) {
foreach (const Gov::FormField &ff, m_service->fields()) {
if (ff.properties() & Gov::FormFieldType::PROP_BOX_INPUT) {
return true;
}
}
return m_service->containsBoxOwnerDataFields();
} else {
return false;
}
return false;
}
GovFormListModel *GovFormListModel::fromVariant(const QVariant &modelVariant)
......
......@@ -169,7 +169,7 @@ public:
/*!
* @brief Return true if model contains data that have been acquired
* from the data box.
* from the data box.
*
* @return true if at least on such field is in the model.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment