6 * @link http://www.open-emr.org
7 * @author Jerry Padgett <sjpadgett@gmail.com>
8 * @copyright Copyright (c) 2016-2019 Jerry Padgett <sjpadgett@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../../../interface/globals.php");
15 $data = (array)(json_decode(file_get_contents("php://input")));
17 $user = $data['user'];
18 $type = $data['type'];
19 $signer = $data['signer'];
22 $lastmod = date('Y-m-d H:i:s');
25 if ($pid == 0 ||
empty($user)) {
26 if ($type != 'admin-signature' ||
empty($user)) {
32 if ($type == 'admin-signature') {
34 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE user=? && type=?", array($user, $type));
36 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE pid=?", array($pid));
39 if (!$row['pid'] && !$row['user']) {
41 $qstr = "INSERT INTO onsite_signatures (pid,lastmod,status,type,user,signator,created) VALUES (?,?,?,?,?,?,?)";
42 sqlStatement($qstr, array($pid, $lastmod, $status, $type, $user, $signer, $created));
45 if ($row['status'] == 'filed') {
46 echo js_escape($row['sig_image']);
47 } elseif ($row['status'] == 'waiting' ||
$status == 'waiting') {
48 echo js_escape('waiting');