Skip to content

Commit

Permalink
Merge pull request #335 from phoenixctms/int_visit_schedule
Browse files Browse the repository at this point in the history
internal visit schedule items, collision toggle switches, form scripting lib files support
  • Loading branch information
rkrenn authored Nov 19, 2024
2 parents 301a725 + 5ca4ace commit ddcd50e
Show file tree
Hide file tree
Showing 105 changed files with 10,714 additions and 9,652 deletions.
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,6 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=phoenixctms_ctsms&metric=alert_status)](https://sonarcloud.io/dashboard?id=phoenixctms_ctsms) -->
[![Build and Test](https://github.com/phoenixctms/ctsms/actions/workflows/test.yml/badge.svg)](https://github.com/phoenixctms/ctsms/actions/workflows/test.yml)

![ar translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ar&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ar%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![da translation](https://img.shields.io/badge/dynamic/json?color=blue&label=da&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27da%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![es-ES translation](https://img.shields.io/badge/dynamic/json?color=blue&label=es-ES&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27es-ES%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ff translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ff&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ff%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![fi translation](https://img.shields.io/badge/dynamic/json?color=blue&label=fi&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27fi%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![fr translation](https://img.shields.io/badge/dynamic/json?color=blue&label=fr&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27fr%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![hi translation](https://img.shields.io/badge/dynamic/json?color=blue&label=hi&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27hi%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![hr translation](https://img.shields.io/badge/dynamic/json?color=blue&label=hr&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27hr%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![hu translation](https://img.shields.io/badge/dynamic/json?color=blue&label=hu&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27hu%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ig translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ig&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ig%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![it translation](https://img.shields.io/badge/dynamic/json?color=blue&label=it&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27it%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ja translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ja&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ja%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![kg translation](https://img.shields.io/badge/dynamic/json?color=blue&label=kg&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27kg%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ko translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ko&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ko%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ln translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ln&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ln%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![nl translation](https://img.shields.io/badge/dynamic/json?color=blue&label=nl&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27nl%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![pt-PT translation](https://img.shields.io/badge/dynamic/json?color=blue&label=pt-PT&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27pt-PT%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ro translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ro&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ro%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![ru translation](https://img.shields.io/badge/dynamic/json?color=blue&label=ru&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27ru%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![sk translation](https://img.shields.io/badge/dynamic/json?color=blue&label=sk&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27sk%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![sl translation](https://img.shields.io/badge/dynamic/json?color=blue&label=sl&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27sl%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![sv-SE translation](https://img.shields.io/badge/dynamic/json?color=blue&label=sv-SE&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27sv-SE%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![sw translation](https://img.shields.io/badge/dynamic/json?color=blue&label=sw&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27sw%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![tr translation](https://img.shields.io/badge/dynamic/json?color=blue&label=tr&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27tr%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![uk translation](https://img.shields.io/badge/dynamic/json?color=blue&label=uk&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27uk%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![yo translation](https://img.shields.io/badge/dynamic/json?color=blue&label=yo&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27yo%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)
![zh-CN translation](https://img.shields.io/badge/dynamic/json?color=blue&label=zh-CN&style=flat&logo=crowdin&query=%24.progress[?(@.data.languageId==%27zh-CN%27)].data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-14663316-445508.json)

Phoenix CTMS
=====

Expand Down
2 changes: 2 additions & 0 deletions core/db/schema-create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,8 @@
NOTIFY BOOLEAN not null,
MODIFIED_TIMESTAMP TIMESTAMP WITHOUT TIME ZONE not null,
VERSION BIGINT not null,
INTERNAL BOOLEAN not null,
DESCRIPTION TEXT,
START_TAG_FK BIGINT,
STOP_TAG_FK BIGINT,
GROUP_FK BIGINT,
Expand Down
2 changes: 1 addition & 1 deletion core/db/schema-set-version.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ begin
end
$$ language plpgsql;

select set_database_version('010801070');
select set_database_version('010801080');
13 changes: 13 additions & 0 deletions core/db/schema-up-master.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,18 @@ if get_database_version() < '010801070' then

end if;

if get_database_version() < '010801080' then

ALTER TABLE visit_schedule_item ADD COLUMN internal BOOLEAN;
UPDATE visit_schedule_item SET internal = 'f';
ALTER TABLE visit_schedule_item ALTER internal SET NOT NULL;

ALTER TABLE visit_schedule_item ADD COLUMN description TEXT;
UPDATE visit_schedule_item SET description = '';

perform set_database_version('010801080');

end if;

end
$$;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Collection;

import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Junction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
Expand Down Expand Up @@ -212,13 +213,14 @@ protected Collection<ECRFField> handleFindAllSorted(String nameInfix, Integer li
if (!CommonUtil.isEmptyString(nameInfix)) {
org.hibernate.Criteria trialCriteria = ecrfFieldCriteria.createCriteria("trial", "trial0", CriteriaSpecification.INNER_JOIN);
org.hibernate.Criteria fieldCriteria = ecrfFieldCriteria.createCriteria("field", "inputField", CriteriaSpecification.INNER_JOIN);
ecrfFieldCriteria.add(Restrictions.or(
(new CategoryCriterion(nameInfix, "section", MatchMode.ANYWHERE)).getRestriction(),
Restrictions.or(
(new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction(),
Restrictions.or(
(new CategoryCriterion(nameInfix, "ecrf0.name", MatchMode.ANYWHERE)).getRestriction(),
(new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction()))));
Junction junction = Restrictions.disjunction();
junction.add((new CategoryCriterion(nameInfix, "section", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "inputField.titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "ecrf0.name", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
ecrfFieldCriteria.add(junction);
}
applySortOrders(ecrfFieldCriteria, ecrfCriteria);
CriteriaUtil.applyLimit(limit, Settings.getIntNullable(SettingCodes.ECRF_FIELD_FIELD_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Junction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
Expand Down Expand Up @@ -116,11 +117,11 @@ private static void applySortOrders(boolean sortByVisit, org.hibernate.Criteria
private void applyEcrfFieldSearchCriterions(org.hibernate.Criteria ecrfFieldCriteria, String fieldQuery) {
if (!CommonUtil.isEmptyString(fieldQuery)) {
ecrfFieldCriteria.createCriteria("field", "inputField0");
ecrfFieldCriteria.add(
Restrictions.or(Restrictions.or(
Restrictions.ilike("titleL10nKey", fieldQuery, MatchMode.ANYWHERE),
Restrictions.ilike("inputField0.titleL10nKey", fieldQuery, MatchMode.ANYWHERE)),
Restrictions.ilike("inputField0.nameL10nKey", fieldQuery, MatchMode.ANYWHERE)));
Junction junction = Restrictions.disjunction();
junction.add(Restrictions.ilike("titleL10nKey", fieldQuery, MatchMode.ANYWHERE));
junction.add(Restrictions.ilike("inputField0.nameL10nKey", fieldQuery, MatchMode.ANYWHERE));
junction.add(Restrictions.ilike("inputField0.titleL10nKey", fieldQuery, MatchMode.ANYWHERE));
ecrfFieldCriteria.add(junction);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Collection;

import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Junction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
Expand Down Expand Up @@ -100,11 +101,13 @@ protected Collection<Inquiry> handleFindAllSorted(String nameInfix, Integer limi
if (!CommonUtil.isEmptyString(nameInfix)) {
org.hibernate.Criteria trialCriteria = inquiryCriteria.createCriteria("trial", "trial0", CriteriaSpecification.INNER_JOIN);
org.hibernate.Criteria fieldCriteria = inquiryCriteria.createCriteria("field", "inputField", CriteriaSpecification.INNER_JOIN);
inquiryCriteria.add(Restrictions.or(
(new CategoryCriterion(nameInfix, "category", MatchMode.ANYWHERE)).getRestriction(),
Restrictions.or(
(new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction(),
(new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction())));
Junction junction = Restrictions.disjunction();
junction.add((new CategoryCriterion(nameInfix, "category", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "inputField.titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
inquiryCriteria.add(junction);
}
applySortOrders(inquiryCriteria);
CriteriaUtil.applyLimit(limit, Settings.getIntNullable(SettingCodes.INQUIRY_FIELD_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Collection;

import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Junction;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
Expand Down Expand Up @@ -91,9 +92,12 @@ protected Collection<ProbandListEntryTag> handleFindListEntryTags(Long trialId,
if (!CommonUtil.isEmptyString(nameInfix)) {
org.hibernate.Criteria trialCriteria = listEntryTagCriteria.createCriteria("trial", "trial0", CriteriaSpecification.INNER_JOIN);
org.hibernate.Criteria fieldCriteria = listEntryTagCriteria.createCriteria("field", "inputField", CriteriaSpecification.INNER_JOIN);
listEntryTagCriteria.add(Restrictions.or(
(new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction(),
(new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction()));
Junction junction = Restrictions.disjunction();
junction.add((new CategoryCriterion(nameInfix, "inputField.nameL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "inputField.titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "trial0.name", MatchMode.ANYWHERE)).getRestriction());
junction.add((new CategoryCriterion(nameInfix, "titleL10nKey", MatchMode.ANYWHERE)).getRestriction());
listEntryTagCriteria.add(junction);
}
applySortOrders(listEntryTagCriteria);
CriteriaUtil.applyLimit(limit, Settings.getIntNullable(SettingCodes.PROBAND_LIST_ENTRY_TAG_FIELD_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS,
Expand Down Expand Up @@ -206,11 +210,18 @@ protected Long handleFindMaxPosition(Long trialId) throws Exception {
}

@Override
protected long handleGetCount(Long trialId) throws Exception {
protected long handleGetCount(Long trialId, Boolean startDate) throws Exception {
org.hibernate.Criteria listEntryTagCriteria = createListEntryTagCriteria();
if (trialId != null) {
listEntryTagCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
}
if (startDate != null) {
if (startDate) {
listEntryTagCriteria.add(Restrictions.sizeGt("startDates", 0));
} else {
listEntryTagCriteria.add(Restrictions.sizeEq("startDates", 0));
}
}
return (Long) listEntryTagCriteria.setProjection(Projections.rowCount()).uniqueResult();
}

Expand Down
Loading

0 comments on commit ddcd50e

Please sign in to comment.