Пример #1
0
    $strMsg = "\n========================" . $TYPE . " || " . date("Y-m-d H:i:s") . "=========================";
    $strMsg .= "\nSEND NOTIFICATION BEFORE:" . $SMS_NOTIFICATION_HOUR . " || CRONJOB RUN EVERY:" . $CRON_TIME . " || APPDATETIME:" . $app_date . " || REMAINING APP HOUR:" . $remaining_app_hour . " || SEND ALERT AFTER:" . $remain_hour;
    // check in the interval
    if ($remain_hour >= -$CRON_TIME && $remain_hour <= $CRON_TIME) {
        // insert entry in notification_log table
        cron_InsertNotificationLogEntry($TYPE, $prow, $db_email_msg);
        //set message
        $db_email_msg['message'] = cron_setmessage($prow, $db_email_msg);
        // send sms to patinet - if not in test mode
        if ($bTestRun == 0) {
            cron_SendSMS($prow['phone_cell'], $db_email_msg['email_subject'], $db_email_msg['message'], $db_email_msg['email_sender']);
        }
        // larry :: debug
        echo "\nDEBUG :: sms was sent to= " . $prow['phone_cell'] . " \nsender= " . $db_email_msg['email_sender'] . " \nsbj= " . $db_email_msg['email_subject'] . " \nmsg= " . $db_email_msg['message'] . "\n";
        //update entry >> pc_sendalertsms='Yes'
        cron_updateentry($TYPE, $prow['pid'], $prow['pc_eid']);
        $strMsg .= " || ALERT SENT SUCCESSFULLY TO " . $prow['phone_cell'];
        $strMsg .= "\n" . $patient_info . "\n" . $smsgateway_info . "\n" . $data_info . "\n" . $db_email_msg['message'];
    }
    // write logs for every reminder sent
    WriteLog($strMsg);
    // larry :: update notification data again - todo :: fix change in cron_updateentry
    $db_email_msg = cron_getNotificationData($TYPE);
}
unset($mysms);
sqlClose();
?>

<html>
<head>
<title>Conrjob - SMS Notification</title>
        $greeting = $GLOBALS['phone_appt_message']['Default'];
    }
    //Set up the parameters for the call
    $data = array("firstName" => $prow['fname'], "lastName" => $prow['lname'], "phone" => $prow['phone_home'], "apptDate" => $appt_date, "apptTime" => $appt_time, "doctor" => $prow['pc_aid'], "greeting" => $greeting, "timeRange" => $phone_time_range, "type" => "appointment", "timeZone" => date('P'), "callerId" => $fac_phone_map[$prow['pc_facility']]);
    //Make the call
    $response = $client->sendRequest("appointment", "POST", $data);
    // check response for success or error
    if ($response->IsError) {
        $strMsg = "Error starting phone call for {$prow['fname']} | {$prow['lname']} | {$prow['phone_home']} | {$appt_date} | {$appt_time} | {$response->ErrorMessage}\n";
    } else {
        $strMsg = "\n========================" . $type . " || " . date("Y-m-d H:i:s") . "=========================";
        $strMsg .= "\nPhone reminder sent successfully: {$prow['fname']} | {$prow['lname']} |  | {$prow['phone_home']} | {$appt_date} | {$appt_time} ";
        // insert entry in notification_log table
        cron_InsertNotificationLogEntry($prow, $greeting, $phone_url);
        //update entry >> pc_sendalertsms='Yes'
        cron_updateentry($type, $prow['pid'], $prow['pc_eid']);
    }
    //echo $strMsg;
    WriteLog($strMsg);
}
sqlClose();
////////////////////////////////////////////////////////////////////
// Function:	cron_updateentry
// Purpose:	update status yes if alert send to patient
////////////////////////////////////////////////////////////////////
function cron_updateentry($type, $pid, $pc_eid)
{
    $query = "update openemr_postcalendar_events set ";
    // larry :: and here again same story - this time for sms pc_sendalertsms - no such field in the table
    if ($type == 'SMS') {
        $query .= " pc_sendalertsms='YES' ";