Added Bankdata check script

This commit is contained in:
Frank Schubert
2024-07-08 13:49:38 +02:00
parent 66d0a70481
commit 002e2bbfa2

View File

@@ -0,0 +1,73 @@
#!/usr/bin/php
<?php
//require 'vendor/autoload.php';
require("../../config/config.php");
define('FRONKDB_SQLDEBUG',false);
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
$me = new User(1);
foreach(ContractModel::searchActive([]) as $contract) {
if($contract->price < 0) continue;
$contract_id = $contract->id;
$customer_number = $contract->owner->customer_number;
$owner_id = $contract->owner_id;
$billingaddress_id = $contract->billingaddress_id;
if($billingaddress_id == $owner_id) {
$address = new Address($owner_id);
} else {
$address = new Address($billingaddress_id);
}
$ivt_customer = new IvtCustomer($customer_number);
if(!$ivt_customer) {
var_dump($contract);
die("Ivt Kunde nicht gefunden: $customer_number\n");
}
$ivt_bill_type = ($ivt_customer->payment == 1) ? "invoice" : "sepa";
$ivt_delivery = ($ivt_customer->paper_invoice == 1) ? "paper" : "email";
$ivt_iban = strtoupper(trim(str_replace(" ","", $ivt_customer->IBAN)));
$ivt_bic = strtoupper(trim(str_replace(" ","", $ivt_customer->BIC)));
$tool_iban = strtoupper(trim(str_replace(" ","", $address->bank_account_iban)));
$tool_bic = strtoupper(trim(str_replace(" ","", $address->bank_account_bic)));
$error = false;
if($address->billing_type != $ivt_bill_type) {
$error = true;
echo "Customer $customer_number contract_id $contract_id [ivt type: $ivt_bill_type | tool: ".$address->billing_type."\n";
}
if($address->billing_delivery != $ivt_delivery) {
$error = true;
echo "Customer $customer_number contract_id $contract_id [ivt delivery: $ivt_delivery | tool: ".($address->billing_delivery ? $address->billing_delivery : "paper")."\n";
}
if($address->billing_type == "sepa" || $ivt_bill_type == "sepa") {
if ($ivt_iban != $tool_iban) {
$error = true;
echo "Customer $customer_number contract_id $contract_id [ivt iban: $ivt_iban | tool: $tool_iban\n";
}
if ($ivt_bic != $tool_bic) {
$error = true;
echo "Customer $customer_number contract_id $contract_id [ivt iban: $ivt_bic | tool: $tool_bic\n";
}
}
/*if($error) {
var_dump($ivt_customer);exit;
}*/
}