Billing Manager and Some Module fixes (#7747)
[openemr.git] / library / custom_template / delete_category.php
blob35ba02667dce1e0b1a12e033fad646dd7b946c8c
1 <?php
3 // +-----------------------------------------------------------------------------+
4 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
5 //
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
19 // A copy of the GNU General Public License is included along with this program:
20 // openemr/interface/login/GnuGPL.html
21 // For more information write to the Free Software
22 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 // Author: Eldho Chacko <eldho@zhservices.com>
25 // Jacob T Paul <jacob@zhservices.com>
27 // +------------------------------------------------------------------------------+
31 require_once("../../interface/globals.php");
33 use OpenEMR\Core\Header;
35 $res = sqlStatement("SELECT * FROM customlists as cl left outer join users as u on cl_creator=u.id WHERE cl_list_type=3 AND cl_deleted=0");
37 <html>
38 <head>
39 <title><!-- Insert your title here --></title>
40 <?php Header::setupHeader('opener'); ?>
41 <script src="<?php echo $GLOBALS['webroot'] ?>/library/js/ajax_functions_writer.js"></script>
43 <script>
44 function delete_full_category(id){
45 top.restoreSession();
46 $.ajax({
47 type: "POST",
48 url: "ajax_code.php",
49 dataType: "html",
50 data: {
51 templateid: id,
52 source: "delete_full_category"
54 success: function(thedata){
55 alert("<?php echo addslashes(xl('Deleted Successfully.'));?>");
56 document.location.reload();
58 error:function(){
60 });
61 return;
63 function delete_category(id){
64 top.restoreSession();
65 if(confirm("<?php echo addslashes(xl('Do you want to delete?'));?>")){
66 $.ajax({
67 type: "POST",
68 url: "ajax_code.php",
69 dataType: "html",
70 data: {
71 templateid: id,
72 source: "delete_category"
74 success: function(thedata){
75 if(thedata){
76 alert("<?php echo addslashes('There are currently other users of the category you are trying to delete. Please contact them and ask them to delete it. Categories may not be deleted while in use. This Categories are currently used by \n');?>"+thedata);
78 else{
79 delete_full_category(id);
82 error:function(){
84 });
86 return;
89 </script>
90 </head>
91 <body class="body_top">
92 <form name="myform">
93 <table align="center">
94 <tr class="text reportTableHeadRow">
95 <th><?php echo htmlspecialchars('Sl.No', ENT_QUOTES);?></th>
96 <th><?php echo htmlspecialchars(xl('Category'), ENT_QUOTES);?></th>
97 <th><?php echo htmlspecialchars(xl('Context'), ENT_QUOTES);?></th>
98 <th><?php echo htmlspecialchars(xl('Creator'), ENT_QUOTES);?></th>
99 <th><?php echo htmlspecialchars(xl('Delete'), ENT_QUOTES);?></th>
100 </tr>
101 <?php
102 $i = 0;
103 while ($row = sqlFetchArray($res)) {
104 $context = sqlQuery("SELECT * FROM customlists WHERE cl_list_slno=?", array($row['cl_list_id']));
105 $i++;
106 $class = (($class ?? '') == 'reportTableOddRow') ? 'reportTableEvenRow' : 'reportTableOddRow';
107 echo "<tr class='text " . htmlspecialchars($class, ENT_QUOTES) . "'>";
108 echo "<td>" . $i . "</td>";
109 echo "<td>" . htmlspecialchars($row['cl_list_item_long'], ENT_QUOTES) . "</td>";
110 echo "<td>" . htmlspecialchars($context['cl_list_item_long'], ENT_QUOTES) . "</td>";
111 echo "<td>" . htmlspecialchars($row['fname'] . " " . $row['mname'] . " " . $row['lname'], ENT_QUOTES) . "</td>";
112 echo "<td><a href=#>";
113 echo "<img src='../../interface/pic/Delete.gif' border=0 title='Delete This Row' onclick=delete_category('" . htmlspecialchars($row['cl_list_slno'], ENT_QUOTES) . "')>";
114 echo "</a></td>";
115 echo "</tr>";
117 echo "</table>";