Clear display on session timeout even when unsaved changes are pending.
[openemr.git] / myportal / soap_service / server_mail.php
blob80be926693116d55afa8933dbadf85bbb77df075
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 //
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
25 // Ajil P.M <ajilpm@zhservices.com>
27 // +------------------------------------------------------------------------------+
29 //SANITIZE ALL ESCAPES
30 $sanitize_all_escapes=true;
33 //STOP FAKE REGISTER GLOBALS
34 $fake_register_globals=false;
37 class UserMail {
40 public function getMails($data){
41 global $pid;
42 if(UserService::valid($data[0])=='existingpatient'){
43 require_once("../../library/pnotes.inc");
44 if($data[2] == "inbox"){
45 if($data[3] && $data[4]){
46 $result_notes = getPatientNotes($pid,'','0',$data[3]);
47 $result_notifications = getPatientNotifications($pid,'','0',$data[4]);
48 $result = array_merge((array)$result_notes,(array)$result_notifications);
49 }else{
50 $result_notes = getPatientNotes($pid);
51 $result_notifications = getPatientNotifications($pid);
52 $result = array_merge((array)$result_notes,(array)$result_notifications);
54 return $result;
55 }elseif($data[2] == "sent"){
56 if($data[3]){
57 $result_sent_notes = getPatientSentNotes($pid,'','0',$data[3]);
58 }else{
59 $result_sent_notes = getPatientSentNotes($pid);
61 return $result_sent_notes;
63 }else{
64 throw new SoapFault("Server", "credentials failed");
72 public function getMailDetails($data){
73 if(UserService::valid($data[0])=='existingpatient'){
74 require_once("../../library/pnotes.inc");
75 $result = getPnoteById($data[1]);
76 if($result['assigned_to'] == '-patient-' && $result['message_status'] == 'New'){
77 updatePnoteMessageStatus($data[1],'Read');
79 return $result;
80 }else{
81 throw new SoapFault("Server", "credentials failed");
89 public function sendMail($data){
90 global $pid;
91 if(UserService::valid($data[0])=='existingpatient'){
92 require_once("../../library/pnotes.inc");
93 $to_list = explode(';',$data[2]);
94 foreach($to_list as $to){
95 addMailboxPnote($pid,$data[4],'1','1',$data[3],$to);
97 return 1;
98 }else{
99 throw new SoapFault("Server", "credentials failed");
107 public function updateStatus($data){
108 if(UserService::valid($data[0])=='existingpatient'){
109 require_once("../../library/pnotes.inc");
110 foreach($data[1] as $id){
111 updatePnoteMessageStatus($id,$data[2]);
113 }else{
114 throw new SoapFault("Server", "credentials failed");