WIP Voicenumber Billing 2024-07-05

This commit is contained in:
Frank Schubert
2024-07-06 18:37:40 +02:00
parent 92edb9c812
commit 200af4802a
16 changed files with 417 additions and 220 deletions
@@ -108,15 +108,23 @@ class VoiceCallHistoryController extends mfBaseController {
}
public function addContractIds() {
$ignore_numbers = [
"4331641220846",
"43623237705",
"4367761737195"
];
$unknown_numbers = [];
// get calls without contract id
foreach(VoiceCallHistoryModel::getVoiceCallHistoryAsEntity(["contract_id" => null, "billable" => "1", "duration" => ["from" => 1], "end" => "2024-06-01"]) as $call) {
foreach(VoiceCallHistoryModel::getVoiceCallHistoryAsEntity(["contract_id" => null, "billable" => "1", "duration" => ["from" => 1]]) as $call) {
//var_dump($call);exit;
//echo "\n";
$number = $call->voice_account;
if(!$number) continue;
// server side failed/disconnected calls
if($call->duration == 1 && $call->state == 38) continue;
if(in_array($number, $unknown_numbers)) continue;
$voicenumber = VoicenumberModel::getFirst(["number" => $number]);
@@ -132,12 +140,24 @@ class VoiceCallHistoryController extends mfBaseController {
continue;
}
$contract = new Contract($voicenumber->contract_id);
if(!$contract) {
$this->log->debug(__METHOD__.": No Contract with Contract_ID ".$voicenumber->contract_id." in Voicenumber ".$voicenumber->number);
continue;
}
if($contract->isCancelled()) {
// mail an office
$this->log->warning(__METHOD__.": Contract ".$voicenumber->contract_id." for Voicenumber ".$voicenumber->number." is cancelled!");
}
$calldate = new DateTime($call->start);
$calldate->setTimezone(new DateTimeZone("Europe/Vienna"));
$contract = $voicenumber->contract;
// calls from before first IVT Import must be right, we don't have historic contract data