auto generate fibu_num for billingaddresses

This commit is contained in:
Frank Schubert
2024-07-08 17:51:54 +02:00
parent 857a095f16
commit 8e9a9a2e1b
7 changed files with 91 additions and 9 deletions
+11 -1
View File
@@ -94,6 +94,13 @@ class BillingController extends mfBaseController {
protected function importContractsAction() {
$r = $this->request;
$last_run_ts = new mfConfig("voicecallhistory.contact-job.ts");
if($last_run_ts->value() < date("U") - 43200) {
$this->layout()->setFlash("Voicecall History Contract Job ist heute noch nicht gelaufen", "error");
$this->redirect("Billing");
}
$i = 0;
$v = 0;
@@ -114,6 +121,9 @@ class BillingController extends mfBaseController {
$del = 0;
// first delete all non-invoiced billing records
foreach(BillingModel::search(["invoice_id" => null]) as $bill) {
foreach(BillingVoicenumberModel::search(["billing_id" => $bill->id]) as $billingVoicenumber) {
$billingVoicenumber->delete();
}
$bill->delete();
$del++;
}
@@ -367,7 +377,7 @@ class BillingController extends mfBaseController {
$data["owner_id"] = $contract->owner_id;
$data["billingaddress_id"] = ($contract->billingaddress_id) ? $contract->billingaddress_id : $contract->owner_id;
$data["customer_number"] = $contract->owner->customer_number;
$data["fibu_account_number"] = $contract->owner->fibu_account_number;
$data["fibu_account_number"] = $contract->owner->fibu_account_number; // TODO: fibu_account_number von billingaddress
$data["company"] = $billingaddress->company;
$data["firstname"] = $billingaddress->firstname;
$data["lastname"] = $billingaddress->lastname;