public static function sendNumberNextSms($transaction_number, $diff) { $phone = PriorityQueue::phone($transaction_number); $name = PriorityQueue::name($transaction_number); if ($phone) { $pq = Helper::firstFromTable('priority_queue', 'transaction_number', $transaction_number); $terminal_id = TerminalTransaction::terminalId($transaction_number); $service_id = PriorityNumber::serviceId($pq->track_id); $priority_number = PriorityQueue::priorityNumber($transaction_number); $current_number = ProcessQueue::currentNumber($service_id); $terminal_name = $terminal_id != 0 ? Terminal::name($terminal_id) : ''; $business_name = $terminal_id != 0 ? Business::name(Business::getBusinessIdByTerminalId($terminal_id)) : ''; $name = $name == null ? null : ' ' . $name; $message = "Hello{$name}, Your number, ({$priority_number}), will be called soon. "; $message .= "Number ({$current_number}) has been called by {$terminal_name}. "; if ($diff >= 1) { $message .= $diff == 1 ? "There is currently " . $diff . " person ahead of you " : "There are currently " . $diff . " people ahead of you "; } $message .= "at the {$terminal_name} at {$business_name}."; Notifier::sendServiceSms($message, $phone, $service_id); } }