44 lines
1.3 KiB
PHP
44 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);
|
|
|
|
foreach(ContractModel::searchActive([]) as $contract) {
|
|
$owner = $contract->owner;
|
|
$billingaddress = $contract->billingaddress;
|
|
|
|
if($billingaddress->billing_type != "sepa") continue;
|
|
if(!$billingaddress->fibu_account_number) continue;
|
|
|
|
if(!$billingaddress->sepa_date) {
|
|
$sepa_date = $contract->owner->sepa_date;
|
|
if($sepa_date) {
|
|
echo $billingaddress->id." sepa date $sepa_date\n";
|
|
$billingaddress->sepa_date = $sepa_date;
|
|
$billingaddress->save();
|
|
}
|
|
}
|
|
|
|
if(!$billingaddress->last_invoice_date) {
|
|
$last_bill = IvtBillModel::getLast(["cid" => $owner->customer_number]);
|
|
if(!$last_bill) continue;
|
|
|
|
$last_date = new DateTime($last_bill->date_outgoing);
|
|
$last_invoice_date = $last_date->getTimestamp();
|
|
|
|
echo $billingaddress->id." last_invoice: $last_invoice_date\n";
|
|
$billingaddress->last_invoice_date = $last_invoice_date;
|
|
$billingaddress->save();
|
|
}
|
|
|
|
} |