Resolve "New invoice service" #1669

Merged
korina.cordero merged 105 commits from 744-new-invoice-service into master 2023-11-22 08:54:54 +00:00
Showing only changes of commit 8e53a3bb19 - Show all commits

View file

@ -35,6 +35,7 @@ class MQTTClient
public function sendEvent(JobOrder $job_order, $payload)
{
error_log("CUSTOMER ID: " . $job_order->getCustomer()->getID());
//error_log('sending mqtt event: ');
//error_log(print_r($payload, true));
@ -44,16 +45,19 @@ class MQTTClient
$new_sessions = [];
$cust_user = $job_order->getCustomer()->getCustomerUser();
if (!empty($cust_user)) {
error_log("CUSTOMER USER ID: " . $cust_user->getID());
$new_sessions = $cust_user->getMobileSessions();
}
// TODO: make this more elegant. looping through each instead of merging the two because doctrine returns PersistentCollection if empty, and array if not
$sessions = [];
foreach ($legacy_sessions as $sess) {
error_log("FOUND LEGACY SESSION: " . $sess->getID());
$sessions[] = $sess;
}
foreach ($new_sessions as $sess) {
error_log("FOUND NEW SESSION: " . $sess->getID());
$sessions[] = $sess;
}
@ -71,6 +75,8 @@ class MQTTClient
$phone_num = $sess->getPhoneNumber();
$channel = self::PREFIX . $phone_num;
error_log("SENDING TO CHANNEL: " . $channel);
// gather channels, so we only send once
$channels[$channel] = json_encode($payload);
}