Fixes #7497 datetimepicker invalid date format (#7499)
[openemr.git] / interface / de_identification_forms / find_immunization_popup.php
blobcf21522c82856ee11afce777f1da3deb4afa572c
1 <?php
3 /**
4 * find_immunization_popup.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Visolve <vicareplus_engg@visolve.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2010 ViCarePlus, Visolve <vicareplus_engg@visolve.com>
11 * @copyright Copyright (c) 2018-2019 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc.php");
17 require_once("../../custom/code_types.inc.php");
19 use OpenEMR\Common\Csrf\CsrfUtils;
20 use OpenEMR\Core\Header;
22 $info_msg = "";
23 $codetype = $_REQUEST['codetype'];
24 $form_code_type = $_POST['form_code_type'];
26 <html>
27 <head>
28 <title><?php echo xlt('Immunization'); ?></title>
29 <?php Header::setupHeader(); ?>
30 <style>
31 td {
32 font-size: 0.8125rem;
34 </style>
35 <script>
36 //pass value selected to the parent window
37 function window_submit(chk)
39 var str;
40 var len=chk.length;
41 if (len==undefined && chk.checked==1)
43 if(!str)
44 str = chk.value;
45 else
46 str = "#"+chk.value;
48 else
50 for (pr = 0; pr < chk.length; pr++)
52 if(chk[pr].checked == 1)
54 if(!str)
55 str = chk[pr].value;
56 else
57 str = str+"#"+chk[pr].value;
61 if(!str)
62 alert(<?php echo xlj("Select Immunizations"); ?>);
63 if (opener.closed || ! opener.set_related)
64 alert(<?php echo xlj('The destination form was closed'); ?>);
65 else
66 opener.set_related(str,"immunizations");
68 window.close();
72 function window_close(chk)
74 window.close();
77 function chkbox_select_none(chk)
79 var len=chk.length;
80 if (len==undefined) {chk.checked=false;}
81 else
83 for (pr = 0; pr < chk.length; pr++)
85 chk[pr].checked=false;
90 function chkbox_select_all(chk)
92 var len=chk.length;
93 if (len==undefined) {chk.checked=true;}
94 else
96 for (pr = 0; pr < chk.length; pr++)
98 chk[pr].checked=true;
103 function check_search_str()
105 var search_str = document.getElementById('search_term').value;
106 if(search_str.length < 3)
108 alert(<?php echo xlj("Search string should have at least three characters"); ?>);
109 return false;
111 top.restoreSession();
112 return true;
114 </script>
115 </head>
116 <body class="body_top">
117 <form method='post' name='theform' action='find_immunization_popup.php' onsubmit="return check_search_str();">
118 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
120 <center>
121 <table class="border-0" cellpadding='5' cellspacing='0'>
122 <tr>
123 <td height="1">
124 </td>
125 </tr>
126 <tr>
127 <td>
129 <?php echo xlt('Search for'); ?>
130 <input type='text' name='search_term' id='search_term' size='12' value='<?php echo attr($_REQUEST['search_term']); ?>'
131 title='<?php echo xla('Any part of the immunization id or immunization name'); ?>' />
132 &nbsp;
133 <input type='submit' class="btn btn-primary btn-sm" name='bn_search' value='<?php echo xla('Search'); ?>' />
134 </b>
135 </td>
136 </tr>
137 <tr>
138 <td height="1">
139 </td>
140 </tr>
141 </table>
142 </center>
143 </form>
144 <form method='post' name='select_immunization'>
145 <?php if ($_REQUEST['bn_search']) { ?>
146 <?php
147 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
148 CsrfUtils::csrfNotVerified();
152 <table class="border-0">
153 <tr>
154 <td colspan="4">
155 <?php
156 $search_term = $_REQUEST['search_term'];
158 $query = "SELECT count(*) as count FROM list_options " .
159 "WHERE (list_id = 'immunizations' and title LIKE ? AND activity = 1) " ;
160 $res = sqlStatement($query, array('%' . $search_term . '%'));
161 if ($row = sqlFetchArray($res)) {
162 $no_of_items = $row['count'];
163 if ($no_of_items < 1) {
165 <script>
166 alert(<?php echo xlj('Search string does not match with list in database'); ?> + '\n' + <?php echo xlj('Please enter new search string'); ?>);
167 document.theform.search_term.value=" ";
168 document.theform.search_term.focus();
169 </script>
170 <?php
173 $query = "SELECT option_id,title FROM list_options " .
174 "WHERE (list_id = 'immunizations' and title LIKE ? AND activity = 1) " .
175 "ORDER BY title";
176 $res = sqlStatement($query, array('%' . $search_term . '%'));
177 $row_count = 0;
178 while ($row = sqlFetchArray($res)) {
179 $row_count = $row_count + 1;
180 $itercode = $row['option_id'];
181 $itertext = ucfirst(strtolower(trim($row['title'])));
183 <input type="checkbox" id="chkbox" value= "<?php echo attr($itercode) . "-" . attr($itertext); ?>" > <?php echo text($itercode) . " " . text($itertext) . "<br />";
189 </td>
190 </tr>
191 </table>
192 <center>
193 <div class="btn-group">
194 <input type='button' class="btn btn-primary" name='select_all' value='<?php echo xla('Select All'); ?>' onclick="chkbox_select_all(document.select_immunization.chkbox);"/>
196 <input type='button' class="btn btn-primary" name='select_none' value='<?php echo xla('Unselect All'); ?>' onclick="chkbox_select_none(document.select_immunization.chkbox);"/>
198 <input type='button' class="btn btn-primary" name='submit' value='<?php echo xla('Submit'); ?>' onclick="window_submit(document.select_immunization.chkbox);"/>
200 <input type='button' class="btn btn-primary" name='cancel' value='<?php echo xla('Cancel'); ?>' onclick="window_close();"/>
201 </div>
202 </center>
203 <?php } ?>
204 </form>
205 </body>
206 </html>