Added Sepa Mandats stuff
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#!/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->last_invcice_date) continue;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user