45 lines
1.2 KiB
PHP
Executable File
45 lines
1.2 KiB
PHP
Executable File
#!/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);
|
|
define("INTERNAL_USER_ID", $me->id);
|
|
define("INTERNAL_USER_USERNAME", $me->username);
|
|
|
|
$i = 0;
|
|
foreach(AddressModel::search(["customer_number" => true, "billing_type" => "sepa"]) as $address) {
|
|
if($address->sepa_date) continue;
|
|
|
|
$bill = IvtBillModel::getFirst(["cid" => $address->customer_number]);
|
|
if(!$bill) continue;
|
|
|
|
if(!trim($bill->IBAN) || !trim($bill->BIC)) continue;
|
|
|
|
if(!$bill->date_outgoing) {
|
|
echo "date outgoing fehlt im ivt: ".$address->customer_number."\n";
|
|
continue;
|
|
}
|
|
|
|
$out_date = new DateTime($bill->date_outgoing);
|
|
$sepa_date = $out_date->getTimestamp();
|
|
echo "$sepa_date - ".$bill->date_outgoing."\n";
|
|
|
|
if(!$sepa_date){
|
|
echo "Konnte Datum nicht umwandeln\n";
|
|
}
|
|
|
|
$address->sepa_date = $sepa_date;
|
|
$address->save();
|
|
$i++;
|
|
}
|
|
|
|
echo "Updated $i addresses\n\n"; |