WIP Contract 2024-06-06

This commit is contained in:
Frank Schubert
2024-06-11 13:19:40 +02:00
parent aca45c1064
commit 7181dd0b23
6 changed files with 107 additions and 15 deletions
@@ -91,7 +91,7 @@ class Admin_IvtContractImport {
$last_cid = 0;
$i = 0;
foreach(IvtCustomerProductModel::search(["lastdate>", "2023-04-01"]) as $ivt_contract) {
foreach(IvtCustomerProductModel::getAll() as $ivt_contract) {
//if($ivt_contract->cid < 104200) continue;
//if($i > 1000 && $ivt_contract->cid != $last_cid) break; // only break after the last ivtcontract of this customer
$last_cid = $ivt_contract->cid;
@@ -173,7 +173,7 @@ class Admin_IvtContractImport {
$contract_data['product_id'] = $product->id;
$contract_data['product_name'] = $ip->name;
$contract_data['amount'] = 1;
$contract_data['price'] = $ip->price;
$contract_data['price'] = $ivt_product->price;
$contract_data['price_setup'] = 0;
$contract_data['price_nne'] = 0;
$contract_data['price_nbe'] = 0;
@@ -760,6 +760,7 @@ class Admin_IvtContractImport {
}
$contract_new_numbers = [];
$contract_matchcode_numbers = [];
// update all numbers
foreach($all_numbers as $voicenumber) {
$voicenumber->contract_id = $voice_contract->id;
@@ -773,6 +774,7 @@ class Admin_IvtContractImport {
die("Fehler beim Speichern der neuen Nummer ".$voicenumber->number);
}
$contract_new_numbers[] = $voicenumber->number;
$contract_matchcode_numbers[] = preg_replace('/^\+?43 */', '0', $voicenumber->number);
}
@@ -786,6 +788,9 @@ class Admin_IvtContractImport {
$confitem->value->set($contract_new_numbers);
$confitem->save();
$voice_contract->matchcode = implode(", ", $contract_matchcode_numbers);
$voice_contract->save();
// return voicenumber object