Permalink
Browse files

Enabled SubjectAppointmentFilter to filter on no subject and updated …

…test #378
  • Loading branch information...
mddejong committed Oct 26, 2018
1 parent b275eae commit 755b02b7342fc6dd7fb03654a135750de6e2e016
@@ -36,7 +36,7 @@ public function getSqlAppointmentsWhere()
if ($text) {
return "gap_subject LIKE '$text'";
} else {
return parent::NO_MATCH_SQL;
return "(gap_subject IS NULL OR gap_subject = '')";
}
}
@@ -48,6 +48,10 @@ public function getSqlAppointmentsWhere()
*/
public function matchAppointment(\Gems_Agenda_Appointment $appointment)
{
if (! $this->_data['gaf_filter_text1']) {
return ! $appointment->getSubject();
}
$regex = '/' . str_replace(array('%', '_'), array('.*', '.{1,1}'),$this->_data['gaf_filter_text1']) . '/i';
return (boolean) preg_match($regex, $appointment->getSubject());
@@ -41,7 +41,7 @@ public function calcultateName($value, $isNew = false, $name = null, array $cont
if (isset($context['gaf_filter_text1'])) {
return sprintf($this->_('Appointment subject contains %s'), $context['gaf_filter_text1']);
} else {
return $this->_('empty filter');
return $this->_('Missing appointment subject filter');
}
}
@@ -76,13 +76,14 @@ public function getTextSettings()
{
$description = $this->_(
"Use the %%-sign to search for zero or more random characters and an _ for a single random character."
);
) . "\n" .
$this->_("Leave empty to filter for missing content.");
return array(
'gaf_filter_text1' => array(
'label' => $this->_('Appointment subject'),
'description' => $description,
'required' => true,
'required' => false,
),
);
}
BIN +102 Bytes (100%) languages/default-en.mo
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: GemsTracker EN\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 16:09+0200\n"
"POT-Creation-Date: 2018-10-26 16:31+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Menno Dekker <menno.dekker@erasmusmc.nl>\n"
"Language-Team: Erasmus MGZ <matijs.de.jong@magnafacta.nl>\n"
@@ -346,7 +346,6 @@ msgstr "The use of this filter in other filters."
#: classes/Gems/Agenda/Filter/LocationModelDependency.php:45
#: classes/Gems/Agenda/Filter/NotAnyModelDependency.php:51
#: classes/Gems/Agenda/Filter/SqlLikeModelDependency.php:56
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:44
msgid "empty filter"
msgstr "empty filter"
@@ -411,6 +410,7 @@ msgstr ""
"single random character."
#: classes/Gems/Agenda/Filter/DiagnosisEpisodeModelDependency.php:80
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:80
#: classes/Gems/Agenda/Filter/SubjectEpisodeModelDependency.php:80
msgid "Leave empty to filter for missing content."
msgstr "Leave empty to filter for missing content."
@@ -519,11 +519,16 @@ msgstr "But skip when this text is found - use %%-sign as well."
msgid "Appointment subject contains %s"
msgstr "Appointment subject contains %s"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:44
#| msgid "Missing episode subject filter"
msgid "Missing appointment subject filter"
msgstr "Missing appointment subject filter"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:65
msgid "Appointment subject match"
msgstr "Appointment subject match"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:83
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:84
msgid "Appointment subject"
msgstr "Appointment subject"
@@ -623,9 +628,6 @@ msgid "Between"
msgstr "Between"
#: classes/Gems/Condition/Round/TrackFieldCondition.php:59
#| msgid ""
#| "First pick a trackfield that has a code. Then choose your comparison "
#| "operator and specify the needed parameters"
msgid ""
"First pick a trackfield that has a code. Then choose your comparison "
"operator and specify the needed parameters."
BIN +96 Bytes (100%) languages/default-nl.mo
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: GemsTracker NL\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 16:08+0200\n"
"POT-Creation-Date: 2018-10-26 16:32+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Menno Dekker <menno.dekker@erasmusmc.nl>\n"
"Language-Team: Erasmus MGZ <matijs.de.jong@magnafacta.nl>\n"
@@ -349,7 +349,6 @@ msgstr "Gebruik van dit filter in andere filters."
#: classes/Gems/Agenda/Filter/LocationModelDependency.php:45
#: classes/Gems/Agenda/Filter/NotAnyModelDependency.php:51
#: classes/Gems/Agenda/Filter/SqlLikeModelDependency.php:56
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:44
msgid "empty filter"
msgstr "leeg filter"
@@ -414,6 +413,7 @@ msgstr ""
"voor een enkel willekeurig teken."
#: classes/Gems/Agenda/Filter/DiagnosisEpisodeModelDependency.php:80
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:80
#: classes/Gems/Agenda/Filter/SubjectEpisodeModelDependency.php:80
msgid "Leave empty to filter for missing content."
msgstr "Leeglaten om te filteren op het ontbreken van inhoud."
@@ -524,11 +524,15 @@ msgstr ""
msgid "Appointment subject contains %s"
msgstr "Afspraak onderwerp bevat %s"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:44
msgid "Missing appointment subject filter"
msgstr "Afspraak onderwerp ontbreekt"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:65
msgid "Appointment subject match"
msgstr "Filter op afspraak onderwerp"
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:83
#: classes/Gems/Agenda/Filter/SubjectAppointmentModelDependency.php:84
msgid "Appointment subject"
msgstr "Afspraak onderwerp"
@@ -163,6 +163,21 @@ protected function setUp()
));
}
/**
* Test subject filters
*/
public function testAppSubjectFilters()
{
$this->performFilterTests(
[
1 => [1],
2 => [2],
3 => [1, 2],
4 => [],
5 => [4],
], 'Appointment Subject');
}
/**
* General test database is loaded
*/
@@ -255,18 +270,4 @@ public function testSqlLikeFilters()
25 => [],
], 'SQL Like');
}
/**
* Test subject filters
*/
public function testSubjectFilters()
{
$this->performFilterTests(
[
1 => [1],
2 => [2],
3 => [1, 2],
4 => [],
], 'Subject');
}
}
@@ -75,21 +75,31 @@ gems__appointment_filters:
-
gaf_id: 4
gaf_class: 'SubjectAppointmentFilter'
gaf_calc_name: 'Missing appointment subject filter'
gaf_id_order: 40
gaf_active: 1
gaf_changed: '2017-08-09'
gaf_changed_by: '1'
gaf_created: '2017-08-09'
gaf_created_by: '1'
-
gaf_id: 5
gaf_class: 'SubjectAppointmentFilter'
gaf_manual_name: 'Inactive test'
gaf_calc_name: 'Subject contains %sub%'
gaf_id_order: 40
gaf_id_order: 50
gaf_filter_text1: '%Sub%'
gaf_active: 0
gaf_changed: '2017-08-09'
gaf_changed_by: '1'
gaf_created: '2017-08-09'
gaf_created_by: '1'
-
gaf_id: 5
gaf_id: 6
gaf_class: 'SubjectAppointmentFilter'
gaf_manual_name: 'Active but no field set'
gaf_calc_name: 'Subject contains %sub%'
gaf_id_order: 50
gaf_id_order: 60
gaf_filter_text1: '%Sub%'
gaf_active: 1
gaf_changed: '2017-08-09'
@@ -185,6 +195,27 @@ gems__appointments:
gap_changed_by: '1'
gap_created: '2017-08-09'
gap_created_by: '1'
-
gap_id_appointment: 5
gap_id_user: '1'
gap_id_organization: 1
gap_id_episode:
gap_manual_edit: 1
gap_code: A
gap_status: AC
gap_admission_time: '2017-10-01 09:00:00'
gap_discharge_time: '2017-10-01 09:30:00'
gap_id_attended_by: 1
gap_id_referred_by: 1
gap_id_activity: 1
gap_id_procedure: 1
gap_id_location: 1
gap_diagnosis_code:
gap_comment: 'No subject'
gap_changed: '2017-08-09'
gap_changed_by: '1'
gap_created: '2017-08-09'
gap_created_by: '1'
gems__locations:
-
glo_id_location: 1
@@ -198,42 +229,6 @@ gems__locations:
glo_changed_by: '1'
glo_created: '2017-08-09'
glo_created_by: '1'
-
glo_id_location: 2
glo_name: 'Location 2 yyy '
glo_organizations: '1'
glo_match_to:
glo_code:
glo_active: 1
glo_filter: 0
glo_changed: '2017-08-09'
glo_changed_by: '1'
glo_created: '2017-08-09'
glo_created_by: '1'
-
glo_id_location: 3
glo_name: 'Location 3 xxx yyy '
glo_organizations: '1'
glo_match_to:
glo_code:
glo_active: 1
glo_filter: 0
glo_changed: '2017-08-09'
glo_changed_by: '1'
glo_created: '2017-08-09'
glo_created_by: '1'
-
glo_id_location: 4
glo_name: 'Location 4 zzz '
glo_organizations: '1'
glo_match_to:
glo_code:
glo_active: 1
glo_filter: 0
glo_changed: '2017-08-09'
glo_changed_by: '1'
glo_created: '2017-08-09'
glo_created_by: '1'
gems__organizations:
-
gor_id_organization: '1'
@@ -376,3 +371,25 @@ gems__track_appointments:
gtap_changed_by: '1'
gtap_created: '2012-09-07'
gtap_created_by: '1'
-
gtap_id_app_field: 5
gtap_id_track: '1'
gtap_id_order: 30
gtap_field_name: 'Test 5'
gtap_to_track_info: 1
gtap_track_info_label: 0
gtap_required: 0
gtap_readonly: 0
gtap_filter_id: 5
gtap_min_diff_length: 1
gtap_min_diff_unit: 'D'
gtap_max_diff_exists: 0
gtap_max_diff_length: 0
gtap_max_diff_unit: 'D'
gtap_uniqueness: 1
gtap_create_track: 1
gtap_create_wait_days: 182
gtap_changed: '2012-09-07'
gtap_changed_by: '1'
gtap_created: '2012-09-07'
gtap_created_by: '1'

0 comments on commit 755b02b

Please sign in to comment.