diff --git a/application/VoiceCallHistory/VoiceCallHistoryController.php b/application/VoiceCallHistory/VoiceCallHistoryController.php index 3b2dc5c5d..c50bb02c9 100644 --- a/application/VoiceCallHistory/VoiceCallHistoryController.php +++ b/application/VoiceCallHistory/VoiceCallHistoryController.php @@ -119,6 +119,7 @@ class VoiceCallHistoryController extends mfBaseController { ]; $unknown_numbers = []; + $in_order = []; $missing_contracts = []; $update_job_error = false; @@ -157,7 +158,13 @@ class VoiceCallHistoryController extends mfBaseController { } if(!$voicenumber->contract_id) { - $missing_contracts[] = $number; + $op = OrderProductModel::getFirst(["voicenumber%" => $number]); + if($op) { + $in_order[] = $number." (order id ".$op->order_id.")"; + } else { + $missing_contracts[] = $number; + } + $this->log->debug(__METHOD__.": Missing Contract_ID in Voicenumber ".$voicenumber->number); continue; } @@ -217,13 +224,13 @@ class VoiceCallHistoryController extends mfBaseController { $ts->value(date("U")); $ts->save(); - if(count($missing_contracts) || count($unknown_numbers) || $update_job_error) { + if(count($missing_contracts) || count($unknown_numbers) || count($in_order) || $update_job_error) { $to = "backoffice@xinon.at"; $from = "noreply@xinon.at"; $subject = "Rufnummern nicht zuweisbar"; if($update_job_error) { - $body = "VoicecallHistory Update Job ist zuletze am ".date("Y-m-d H:i"). " gelaufen\n"; + $body = "VoicecallHistory Update Job ist zuletz am ".date("Y-m-d H:i"). " gelaufen\n"; } else { $body = "Für folgende Nummern konnte kein Contract gefunden werden:"; @@ -234,11 +241,17 @@ class VoiceCallHistoryController extends mfBaseController { } } if (count($missing_contracts)) { - $body .= "\n\nNummer in keinem Contract:\n"; + $body .= "\n\nNummern in keinem Contract:\n"; foreach ($missing_contracts as $number) { $body .= $number . "\n"; } } + if (count($in_order)) { + $body .= "\n\nNummern in Bestellung:\n"; + foreach ($in_order as $number) { + $body .= $number . "\n"; + } + } } $email = new Emailnotification(); $email->setFrom($from);