Files
thetool/scripts/copmare-bankdata-with-ivt.php
2024-01-23 17:07:39 +01:00

37 lines
1.3 KiB
PHP

#!/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);
echo "thetool custnum;thetool name;ivt custnum;ivt name;thetool iban;thetool bic;ivt iban;ivt bic\n";
foreach(AddressModel::search(["customer_number" => true]) as $address) {
$icust = new IvtCustomer($address->customer_number);
if(!$icust->id) continue;
if(!$icust->IBAN && !$icust->BIC) continue;
$bank_iban = strtoupper(trim($address->bank_account_iban));
$bank_bic = strtoupper(trim($address->bank_account_bic));
$ivt_iban = strtoupper(trim($icust->IBAN));
$ivt_bic = strtoupper(trim($icust->BIC));
if($ivt_iban != $bank_iban || $ivt_bic != $bank_bic) {
echo $address->customer_number.";".$address->getCompanyOrName().";".$icust->id.";".($icust->company ? $icust->company : $icust->firstname." ".$icust->surname).";$bank_iban;$bank_bic;$ivt_iban;$ivt_bic\n";
$address->bank_account_iban = $ivt_iban;
$address->bank_account_bic = $ivt_bic;
//$address->save();
}
}