From 074443c0eaa3b300200ae8c26efb6c965d164af2 Mon Sep 17 00:00:00 2001 From: tbar0970 Date: Wed, 24 Aug 2016 21:03:07 +1000 Subject: [PATCH] Ability to configure person/family notes to show in descending or ascending order of time --- conf.php.sample.au | 3 +++ conf.php.sample.in | 3 +++ conf.php.sample.uk | 3 +++ conf.php.sample.usa | 3 +++ db_objects/person.class.php | 7 +++++-- templates/view_family.template.php | 3 ++- 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/conf.php.sample.au b/conf.php.sample.au index 3a2ce058..6d18d1c3 100644 --- a/conf.php.sample.au +++ b/conf.php.sample.au @@ -76,6 +76,9 @@ define('REQUIRE_INITIAL_NOTE', true); // Whether users restricted by congregation or group can add persons and families define('RESTRICTED_USERS_CAN_ADD', true); +// Order to show person/family notes. ASC for oldest notes first; DESC for newest notes first. +define('NOTES_ORDER', 'ASC'); + // The order in which persons are listed when marking or reporting attendance for congregations or groups. // "status" means person status for congregational attendance, and group membership status for groups. // "person.status" means person status, even when marking attendance for a group. diff --git a/conf.php.sample.in b/conf.php.sample.in index 2dc45978..9f7156cc 100644 --- a/conf.php.sample.in +++ b/conf.php.sample.in @@ -76,6 +76,9 @@ define('REQUIRE_INITIAL_NOTE', true); // Whether users restricted by congregation or group can add persons and families define('RESTRICTED_USERS_CAN_ADD', true); +// Order to show person/family notes. ASC for oldest notes first; DESC for newest notes first. +define('NOTES_ORDER', 'ASC'); + // The order in which persons are listed when marking or reporting attendance for congregations or groups. // "status" means person status for congregational attendance, and group membership status for groups. // "person.status" means person status, even when marking attendance for a group. diff --git a/conf.php.sample.uk b/conf.php.sample.uk index 20447f37..6ceeb9ca 100644 --- a/conf.php.sample.uk +++ b/conf.php.sample.uk @@ -76,6 +76,9 @@ define('REQUIRE_INITIAL_NOTE', true); // Whether users restricted by congregation or group can add persons and families define('RESTRICTED_USERS_CAN_ADD', true); +// Order to show person/family notes. ASC for oldest notes first; DESC for newest notes first. +define('NOTES_ORDER', 'ASC'); + // The order in which persons are listed when marking or reporting attendance for congregations or groups. // "status" means person status for congregational attendance, and group membership status for groups. // "person.status" means person status, even when marking attendance for a group. diff --git a/conf.php.sample.usa b/conf.php.sample.usa index 7773c8e5..2088a2fc 100644 --- a/conf.php.sample.usa +++ b/conf.php.sample.usa @@ -76,6 +76,9 @@ define('REQUIRE_INITIAL_NOTE', true); // Whether users restricted by congregation or group can add persons and families define('RESTRICTED_USERS_CAN_ADD', true); +// Order to show person/family notes. ASC for oldest notes first; DESC for newest notes first. +define('NOTES_ORDER', 'ASC'); + // The order in which persons are listed when marking or reporting attendance for congregations or groups. // "status" means person status for congregational attendance, and group membership status for groups. // "person.status" means person status, even when marking attendance for a group. diff --git a/db_objects/person.class.php b/db_objects/person.class.php index 5128f001..2794df5d 100644 --- a/db_objects/person.class.php +++ b/db_objects/person.class.php @@ -334,8 +334,11 @@ function getNotesHistory() function _compareCreatedDates($a, $b) { - return $a['created'] > $b['created']; - + if (ifdef('NOTES_ORDER', 'ASC') == 'ASC') { + return $a['created'] > $b['created']; + } else { + return $a['created'] < $b['created']; + } } function validateFields() diff --git a/templates/view_family.template.php b/templates/view_family.template.php index f1fca70c..f8459638 100644 --- a/templates/view_family.template.php +++ b/templates/view_family.template.php @@ -14,7 +14,8 @@
  • havePerm(PERM_VIEWNOTE)) { - $notes = $GLOBALS['system']->getDBObjectData('family_note', Array('familyid' => $family->id), 'OR', 'created'); + $order =(ifdef('NOTES_ORDER', 'ASC') == 'ASC') ? 'ASC' : 'DESC'; + $notes = $GLOBALS['system']->getDBObjectData('family_note', Array('familyid' => $family->id), 'OR', 'created '.$order); ?>
  • ()