Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use getTimeFormat for encounter date of service datetime picker #7203

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions interface/forms/note/new.php
Expand Up @@ -36,8 +36,8 @@

$(function () {
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = true; ?>
<?php $datetimepicker_showseconds = true; ?>
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = true; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
Expand Down Expand Up @@ -83,9 +83,9 @@

<td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input class="datepicker form-control" type='text' size='10' class='datepicker' name='date_of_signature' id='date_of_signature'
value='<?php echo attr(date('Y-m-d', time())); ?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
<input class='datepicker form-control' type='text' size='16' name='date_of_signature' id='date_of_signature' autocomplete='off'
value='<?php echo attr(oeFormatShortDate(date('Y-m-d'))); ?>'
title='<?php echo xla('Date of Signature'); ?>' />
</td>
</tr>
</table>
Expand Down
7 changes: 1 addition & 6 deletions interface/forms/note/print.php
Expand Up @@ -29,11 +29,6 @@
$obj = formFetch("form_" . $form_name, $_GET["id"]);
}

/* remove the time-of-day from the date fields */
if ($obj['date_of_signature'] != "") {
$dateparts = explode(" ", $obj['date_of_signature']);
$obj['date_of_signature'] = $dateparts[0];
}
?>
<html><head>
<title><?php echo "Form: note"?></title>
Expand Down Expand Up @@ -67,7 +62,7 @@
</td><td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input type='text' size='10' name='date_of_signature' id='date_of_signature'
value='<?php echo attr($obj['date_of_signature']); ?>'
value='<?php echo attr(oeFormatShortDate($obj['date_of_signature'])); ?>'
/>
</td></tr>
</table>
Expand Down
2 changes: 2 additions & 0 deletions interface/forms/note/report.php
Expand Up @@ -47,6 +47,8 @@ function note_report($pid, $encounter, $cols, $id)
print("<tr>\n");
if ($key == "Note Type") {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . xlt($value) . "</span></td>";
} elseif ($key == "Date Of Signature") {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . oeFormatShortDate($value) . "</span></td>";
} else {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . text($value) . "</span></td>";
}
Expand Down
4 changes: 3 additions & 1 deletion interface/forms/note/save.php
Expand Up @@ -32,8 +32,10 @@
$encounter = date("Ymd");
}

$_POST['date_of_signature'] = DateToYYYYMMDD($_POST['date_of_signature']);

if ($_GET["mode"] == "new") {
$newid = formSubmit($table_name, $_POST, $_GET["id"], $userauthorized);
$newid = formSubmit($table_name, $_POST, $_GET["id"] ?? '', $userauthorized);
addForm($encounter, "Work/School Note", $newid, "note", $pid, $userauthorized);
} elseif ($_GET["mode"] == "update") {
$success = formUpdate($table_name, $_POST, $_GET["id"], $userauthorized);
Expand Down
27 changes: 12 additions & 15 deletions interface/forms/note/view.php
Expand Up @@ -32,11 +32,6 @@
$obj = formFetch("form_" . $form_name, $_GET["id"]);
}

/* remove the time-of-day from the date fields */
if ($obj['date_of_signature'] != "") {
$dateparts = explode(" ", $obj['date_of_signature']);
$obj['date_of_signature'] = $dateparts[0];
}
?>
<html><head>

Expand All @@ -46,6 +41,16 @@
// required for textbox date verification
var mypcc = <?php echo js_escape($GLOBALS['phone_country_code']); ?>;

$(function () {
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = true; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});

function PrintForm() {
newwin = window.open(<?php echo js_escape($rootdir . "/forms/" . $form_name . "/print.php?id=" . urlencode($_GET["id"])); ?>,"mywin");
}
Expand Down Expand Up @@ -86,8 +91,8 @@ function PrintForm() {
</td><td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input type='text' size='10' class='datepicker' name='date_of_signature' id='date_of_signature'
value='<?php echo attr($obj['date_of_signature']); ?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
value='<?php echo attr(oeFormatShortDate($obj['date_of_signature'])); ?>'
title='<?php echo xla('Date of Signature'); ?>' />
</td></tr>
</table>

Expand Down Expand Up @@ -116,14 +121,6 @@ function PrintForm() {
$("input").keydown(function() { $(".printform").attr("disabled","disabled"); });
$("select").change(function() { $(".printform").attr("disabled","disabled"); });
$("textarea").keydown(function() { $(".printform").attr("disabled","disabled"); });

$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = false; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});

</script>
Expand Down
6 changes: 3 additions & 3 deletions interface/reports/amc_full_report.php
Expand Up @@ -46,12 +46,12 @@ function formatPatientReportData($report_id, &$data, $type_report, $amc_report_t
$failed_items = $row['pass_filter'] - $row['pass_target'] - $row['excluded'];
}
$row['display_field_sub'] = ($displayFieldSubHeader != "") ? "($displayFieldSubHeader)" : null;
} else if (isset($row['is_sub'])) {
} elseif (isset($row['is_sub'])) {
$row['display_field'] = generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action_category'), $row['action_category'])
. ': ' . generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action'), $row['action_item']);
// Excluded is not part of denominator in standard rules so do not use in calculation
$failed_items = $main_pass_filter - $row['pass_target'];
} else if (isset($row['is_plan'])) {
} elseif (isset($row['is_plan'])) {
$row['display_field'] = generate_display_field(array('data_type' => '1', 'list_id' => 'clinical_plans'), $row['id']);
}

Expand Down Expand Up @@ -201,7 +201,7 @@ function getRuleObjectForId($ruleId)
$subTitle = '';
if ($report_view['provider'] == "group_calculation") {
$subTitle = xl("Group Calculation Method");
} else if (is_numeric($report_view['provider'])) {
} elseif (is_numeric($report_view['provider'])) {
// grab the provider
$userService = new \OpenEMR\Services\UserService();
$provider = $userService->getUser($report_view['provider']);
Expand Down
4 changes: 2 additions & 2 deletions interface/reports/amc_tracking.php
Expand Up @@ -202,7 +202,7 @@ function provide_sum_pat(patient_id,encounter_id) {
<?php echo xlt('Begin Date'); ?>:
</td>
<td>
<input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo attr(oeFormatDateTime($begin_date, 0, true)); ?>' class='datepicker form-control' />
<input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo attr(oeFormatDateTime($begin_date, "global", true)); ?>' class='datepicker form-control' />
</td>
</tr>

Expand All @@ -211,7 +211,7 @@ function provide_sum_pat(patient_id,encounter_id) {
<?php echo xlt('End Date'); ?>:
</td>
<td>
<input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo attr(oeFormatDateTime($end_date, 0, true)); ?>' class='datepicker form-control' />
<input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo attr(oeFormatDateTime($end_date, "global", true)); ?>' class='datepicker form-control' />
</td>
</tr>

Expand Down
4 changes: 2 additions & 2 deletions interface/reports/audit_log_tamper_report.php
Expand Up @@ -142,12 +142,12 @@ function setpatient(pid, lname, fname, dob) {
<tr><td>
<span class="text"><?php echo xlt('Start Date'); ?>: </span>
</td><td>
<input type="text" size="18" class="datetimepicker" name="start_date" id="start_date" value="<?php echo attr(oeFormatDateTime($start_date, 0, true)); ?>" title="<?php echo xla('Start date'); ?>" />
<input type="text" size="18" class="datetimepicker" name="start_date" id="start_date" value="<?php echo attr(oeFormatDateTime($start_date, 'global', true)); ?>" title="<?php echo xla('Start date'); ?>" />
</td>
<td>
<span class="text"><?php echo xlt('End Date'); ?>: </span>
</td><td>
<input type="text" size="18" class="datetimepicker" name="end_date" id="end_date" value="<?php echo attr(oeFormatDateTime($end_date, 0, true)); ?>" title="<?php echo xla('End date'); ?>" />
<input type="text" size="18" class="datetimepicker" name="end_date" id="end_date" value="<?php echo attr(oeFormatDateTime($end_date, 'global', true)); ?>" title="<?php echo xla('End date'); ?>" />
</td>

<td>
Expand Down
4 changes: 2 additions & 2 deletions interface/reports/cdr_log.php
Expand Up @@ -105,7 +105,7 @@
<?php echo xlt('Begin Date'); ?>:
</td>
<td>
<input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, 0, true)); ?>'
<input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, "global", true)); ?>'
class='datepicker form-control'>
</td>
</tr>
Expand All @@ -115,7 +115,7 @@ class='datepicker form-control'>
<?php echo xlt('End Date'); ?>:
</td>
<td>
<input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, 0, true)); ?>'
<input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, "global", true)); ?>'
class='datepicker form-control'>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions interface/reports/clinical_reports.php
Expand Up @@ -238,13 +238,13 @@ function submitForm() {
<td class='col-form-label' width="100"><?php echo xlt('Facility'); ?>: </td>
<td width="250"> <?php dropdown_facility($facility, 'facility', false); ?> </td>
<td class='col-form-label' width="100"><?php echo xlt('From'); ?>: </td>
<td><input type='text' class='datetimepicker form-control' name='date_from' id="date_from" size='18' value='<?php echo attr(oeFormatDateTime($sql_date_from, 0, true)); ?>'></td>
<td><input type='text' class='datetimepicker form-control' name='date_from' id="date_from" size='18' value='<?php echo attr(oeFormatDateTime($sql_date_from, "global", true)); ?>'></td>
</tr>
<tr>
<td class='col-form-label'><?php echo xlt('Patient ID'); ?>:</td>
<td><input name='patient_id' class="numeric_only form-control" type='text' id="patient_id" title='<?php echo xla('Optional numeric patient ID'); ?>' value='<?php echo attr($patient_id); ?>' size='10' maxlength='20' /></td>
<td class='col-form-label'><?php echo xlt('To{{Range}}'); ?>: </td>
<td><input type='text' class='datetimepicker form-control' name='date_to' id="date_to" size='18' value='<?php echo attr(oeFormatDateTime($sql_date_to, 0, true)); ?>'></td>
<td><input type='text' class='datetimepicker form-control' name='date_to' id="date_to" size='18' value='<?php echo attr(oeFormatDateTime($sql_date_to, "global", true)); ?>'></td>
</tr>
<tr>
<td class='col-form-label'><?php echo xlt('Age Range'); ?>:</td>
Expand Down
12 changes: 6 additions & 6 deletions interface/reports/cqm.php
Expand Up @@ -104,13 +104,13 @@
$show_help = false;
if ($type_report == "standard") {
$heading_title = xl('Standard Measures');
} else if ($type_report == "cqm") {
} elseif ($type_report == "cqm") {
$heading_title = xl('Clinical Quality Measures (CQM)');
} else if ($type_report == 'cqm_2011') {
} elseif ($type_report == 'cqm_2011') {
$heading_title = 'Clinical Quality Measures (CQM) - 2011';
} else if ($type_report == "cqm_2014") {
} elseif ($type_report == "cqm_2014") {
$heading_title = 'Clinical Quality Measures (CQM) - 2014';
} else if ($is_amc_report) {
} elseif ($is_amc_report) {
$heading_title = $amc_report_types[$type_report]['title'];
$show_help = true;
$help_file_name = "cqm_amc_help.php";
Expand Down Expand Up @@ -179,7 +179,7 @@
,['value' => 'cqm_2011', 'selected' => $plan_filter == 'cqm_2011', 'label' => xl('2011 Official Clinical Quality Measures (CQM) Measure Groups')]
,['value' => 'cqm_2014', 'selected' => $plan_filter == 'cqm_2014', 'label' => xl('2014 Official Clinical Quality Measures (CQM) Measure Groups')]
];
} else if ($is_amc_report) {
} elseif ($is_amc_report) {
// latest AMC doesn't have collate options
if (empty($report_id)) {
// truncate to just the first option
Expand All @@ -205,7 +205,7 @@
}
$formData['providerReportOptions'][] = ['value' => 'group_calculation', 'selected' => $provider == 'group_calculation'
, 'label' => xl('All EP/EC Group Calculation')];
} else if ($type_report == 'standard') {
} elseif ($type_report == 'standard') {
$formData['rule_filters'] = [
['value' => 'passive_alert', 'selected' => $type_report == 'passive_alert', 'label' => xl('Passive Alert Rules')]
,['value' => 'active_alert', 'selected' => $type_report == 'active_alert', 'label' => xl('Active Alert Rules')]
Expand Down
6 changes: 3 additions & 3 deletions interface/reports/inventory_list.php
Expand Up @@ -286,7 +286,7 @@ function write_report_line(&$row)
"s.sale_date > DATE_SUB(NOW(), INTERVAL " . escape_limit($form_days) . " DAY) " .
"AND s.pid != 0 $fwcond";
$srow = sqlQuery($query, array_merge(array($drug_id, $facility_id), $fwbind));
} else if ($form_details == 2) { // warehouse details
} elseif ($form_details == 2) { // warehouse details
$query = "SELECT " .
"SUM(s.quantity) AS sale_quantity " .
"FROM drug_sales AS s " .
Expand Down Expand Up @@ -428,7 +428,7 @@ function write_report_line(&$row)
$expdays = (int) ((strtotime($irow['expiration']) - time()) / (60 * 60 * 24));
if ($expdays <= 0) {
addWarning(xl('Lot') . " '$lotno' " . xl('has expired'));
} else if ($expdays <= $gbl_expired_lot_warning_days) {
} elseif ($expdays <= $gbl_expired_lot_warning_days) {
addWarning(xl('Lot') . " '$lotno' " . xl('expires in') . " $expdays " . xl('days'));
}
}
Expand Down Expand Up @@ -621,7 +621,7 @@ function write_report_line(&$row)
"pw.pw_warehouse = di.warehouse_id " .
"WHERE 1 = 1 $fwcond $actcond " .
"GROUP BY d.name, d.drug_id, lo.option_value ORDER BY $orderby, lo.option_value";
} else if ($form_details == 2) {
} elseif ($form_details == 2) {
// Query for the main loop if warehouse/lot details are wanted.
$query = "SELECT d.*, di.on_hand, di.inventory_id, di.lot_number, " .
"di.expiration, di.warehouse_id, lo.title, fac.name AS facname, " .
Expand Down
4 changes: 2 additions & 2 deletions interface/reports/report_results.php
Expand Up @@ -108,7 +108,7 @@
<?php echo xlt('Begin Date'); ?>:
</td>
<td>
<input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, 0, true)); ?>'
<input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, "global", true)); ?>'
class='datepicker form-control' />
</td>
</tr>
Expand All @@ -118,7 +118,7 @@ class='datepicker form-control' />
<?php echo xlt('End Date'); ?>:
</td>
<td>
<input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, 0, true)); ?>'
<input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, "global", true)); ?>'
class='datepicker form-control' />
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion library/forms.inc.php
Expand Up @@ -43,7 +43,7 @@ function addForm(
}

//print_r($_SESSION['therapy_group']);die;
$arraySqlBind = array();
$arraySqlBind = array();
$sql = "insert into forms (date, encounter, form_name, form_id, pid, " .
"user, groupname, authorized, formdir, therapy_group_id) values (";
if ($date == "NOW()") {
Expand Down
19 changes: 13 additions & 6 deletions library/js/xl/jquery-datetimepicker-2-5-4.js.php
Expand Up @@ -41,6 +41,8 @@
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will need to ensure the new library/js/xl/jquery-datetimepicker-2-5-4-translated.js has same logic for the fixed time stuff

*/

use OpenEMR\Services\Utils\DateFormatterUtils;

?>
i18n:{
en: {
Expand Down Expand Up @@ -85,22 +87,27 @@
<?php } ?>
<?php if ($datetimepicker_timepicker) { ?>
<?php if ($datetimepicker_showseconds) { ?>
<?php if ($datetimepicker_formatInput) { ?>
format: '<?php echo DateFormatRead("jquery-datetimepicker"); ?> H:i:s',
<?php if ($datetimepicker_formatInput) {
$time_format_with_secs = DateFormatterUtils::getTimeFormat(true); ?>
format: '<?php echo DateFormatRead("jquery-datetimepicker") . " " . $time_format_with_secs; ?>',
formatTime: '<?php echo $time_format_with_secs; ?>',
validateOnBlur: false,
<?php } else { ?>
format: 'Y-m-d H:i:s',
formatTime: 'H:i:s',
<?php } ?>
<?php } else { ?>
<?php if ($datetimepicker_formatInput) { ?>
format: '<?php echo DateFormatRead("jquery-datetimepicker"); ?> g:i a',
formatTime:'g:i a',
<?php if ($datetimepicker_formatInput) {
$time_format_without_secs = DateFormatterUtils::getTimeFormat(); ?>
format: '<?php echo DateFormatRead("jquery-datetimepicker") . " " . $time_format_without_secs; ?>',
formatTime: '<?php echo $time_format_without_secs; ?>',
validateOnBlur: false,
<?php } else { ?>
format: 'Y-m-d H:i',
<?php } ?>
<?php } ?>
timepicker:true,
step: '30'
step: 30
<?php } else { ?>
<?php if ($datetimepicker_formatInput) { ?>
format: '<?php echo DateFormatRead("jquery-datetimepicker"); ?>',
Expand Down