WIP Contract/Billing/Invoice 2024-06-28

This commit is contained in:
Frank Schubert
2024-07-01 11:44:19 +02:00
parent 4589e61ab8
commit ae298a0665
30 changed files with 1898 additions and 212 deletions
@@ -199,11 +199,11 @@ class Admin_IvtContractImport {
switch($ip->interval) {
case 0:
$contract_data['billing_period'] = 1;
$finish_date->modify("+1 month");
//$finish_date->modify("+1 month");
break;
case 1:
$contract_data['billing_period'] = 12;
$finish_date->modify("+1 year");
//$finish_date->modify("+1 year");
break;
}
@@ -276,7 +276,7 @@ class Admin_IvtContractImport {
$contract = ContractModel::create($contract_data);
if(trim($ivt_contract->comment)) {
$contract->matchcode = trim($ivt_contract->comment);
} else {
} elseif(!in_array($ivt_contract->id, $this->no_matchcode)) {
$contract->matchcode = $contract->generateMatchcode();
}
/*if($ivt_contract->id == 3035) {
@@ -336,8 +336,6 @@ class Admin_IvtContractImport {
foreach($new_contracts as $ivt_customer_id => $contracts) {
$this->addVoipData($ivt_customer_id, $contracts);
if(in_array($ivt_contract->id, $this->no_matchcode)) break;
if(count($contracts) < 2) continue;
$prev_contracts = [];
$primary_matchcode = false;
@@ -347,10 +345,12 @@ class Admin_IvtContractImport {
foreach($contracts as $contract) {
if($contract->matchcode && !$primary_matchcode && !preg_match($primary_matchcode_no_productgroups_pattern, $contract->product->productgroup->name)) {
if(in_array($ivt_contract->id, $this->no_matchcode)) continue;
$primary_matchcode = $contract->matchcode;
$primary_matchcode_source_product_group = $contract->product->productgroup->name;
}
if($primary_matchcode && !$contract->matchcode && !preg_match($primary_matchcode_no_productgroups_pattern, $primary_matchcode_source_product_group)) {
if(in_array($ivt_contract->id, $this->no_matchcode)) continue;
$contract->matchcode = $primary_matchcode;
$contract->save();
}