From: Kevin Yeh Date: Fri, 3 May 2013 15:34:54 +0000 (-0400) Subject: Allow switch to simpler age display format for patients above certain age X-Git-Tag: whats-been-changed~325 X-Git-Url: https://repo.or.cz/w/openemr.git/commitdiff_plain/c1ffd4ca2ffaf028760f5ce84653e64592d86bf4 Allow switch to simpler age display format for patients above certain age --- diff --git a/library/globals.inc.php b/library/globals.inc.php index d0a12ecd1..752322033 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -454,7 +454,13 @@ $GLOBALS_METADATA = array( ), '0', xl('Format for age display') - ) + ), + 'age_display_limit' => array( + xl('Age in Years for Display Format Change'), + 'num', + '3', + xl('If YMD is selected for age display, switch to just Years when patients older than this value in years') + ), ), // Features Tab diff --git a/library/patient.inc b/library/patient.inc index ab38ea02f..732c4a72c 100644 --- a/library/patient.inc +++ b/library/patient.inc @@ -1397,7 +1397,14 @@ function getPatientAgeDisplay($dobYMD, $asOfYMD=null) if($GLOBALS['age_display_format']=='1') { $ageYMD=getPatientAgeYMD($dobYMD,$asOfYMD); - return $ageYMD['ageinYMD']; + if(isset($GLOBALS['age_display_limit']) && $ageYMD['age']<=$GLOBALS['age_display_limit']) + { + return $ageYMD['ageinYMD']; + } + else + { + return getPatientAge($dobYMD, $asOfYMD); + } } else {