Skip to content

Commit

Permalink
Merge pull request openemr#2647 for clear billing log feature
Browse files Browse the repository at this point in the history
Clear billing log feature
  • Loading branch information
bradymiller committed Sep 4, 2019
2 parents b4e67cb + 00aab6a commit d09441e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions interface/billing/billing_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
* @author Terry Hill <[email protected]>
* @author Brady Miller <[email protected]>
* @author Jerry Padgett <[email protected]>
* @author Sherwin Gaddis <[email protected]>
* @copyright Copyright (c) 2016 Terry Hill <[email protected]>
* @copyright Copyright (c) 2017-2019 Brady Miller <[email protected]>
* @copyright Copyright (c) 2018-2019 Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2019 Sherwin Gaddis <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

Expand Down Expand Up @@ -520,6 +522,9 @@ function divtoggle(spanid, divid) { //Called in the Expand, Collapse links(This
ul > li {
line-height: 1.86em;
}
ul {
list-style-type: none;
}
a, a:visited, a:hover {
text-decoration: none;
color: #000000;
Expand Down Expand Up @@ -720,9 +725,13 @@ function divtoggle(spanid, divid) { //Called in the Expand, Collapse links(This
title='<?php echo xla('See messages from the last set of generated claims'); ?>'><strong><?php echo xlt('View Log'); ?></strong></a>
</li>
<?php } ?>
<li><a href="<?php echo $webroot ?>/interface/billing/customize_log.php" rel="noopener" target="_blank" onclick="top.restoreSession()"><strong><?php echo xlt('Tab Log') ?></strong></a>
</li>
<li><a class="link_submit"
href="JavaScript:void(0);" onclick="select_all(); return false;"><strong><?php echo xlt('Select All'); ?></strong></a>
</li>
<li><a id="clear-log" href="#" title='<?php xla('Clear the log'); ?>'><strong><?php echo xlt('Clear Log') ?></strong></a>
</li>
</ul>
<ul>
</div>
Expand Down Expand Up @@ -1459,6 +1468,15 @@ function divtoggle(spanid, divid) { //Called in the Expand, Collapse links(This
top.restoreSession();
dlgopen('customize_log.php', '_blank', 750, 400);
});
$("#clear-log").click( function(){
var checkstr = confirm(<?php echo xlj("Do you really want to clear the log?"); ?>);
if(checkstr == true){
top.restoreSession();
dlgopen("clear_log.php?csrf_token_form=" + <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>, '_blank', 500, 400);
}else{
return false;
}
});

$('button[type="submit"]').click(function () {
top.restoreSession();
Expand Down
30 changes: 30 additions & 0 deletions interface/billing/clear_log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* interface/billing/clear_log.php - backup, then clear billing log
*
* @package OpenEMR
* @link http:https://www.open-emr.org
* @author Brady Miller <[email protected]>
* @author Sherwin Gaddis <[email protected]>
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
* @copyright Copyright (c) 2019 Sherwin Gaddis <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/


require_once("../globals.php");

use OpenEMR\Common\Csrf\CsrfUtils;

if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) {
CsrfUtils::csrfNotVerified();
}

$filename = $GLOBALS['OE_SITE_DIR'] . '/documents/edi/process_bills.log';
if (file_exists($filename)) {
$newlog = $GLOBALS['OE_SITE_DIR'] . '/documents/edi/' . date("Y-m-d-His") . '_process_bills.log';
rename($filename, $newlog);
echo xlt("Log is cleared. Please close window.");
} else {
echo xlt("Log was already empty. Please close window.");
}

0 comments on commit d09441e

Please sign in to comment.