Added pipe-/linework enabled date and by

This commit is contained in:
Frank Schubert
2022-02-08 19:58:20 +01:00
parent 6128de17e1
commit de9588b85f
7 changed files with 58 additions and 8 deletions

View File

@@ -181,6 +181,13 @@
>
Baufreigabe
</label>
<?php if($term->linework_enabled): ?>
<div style="overflow-x:hidden">
<small class="text-info text-mono"
title="Geändert: <?=date("d.m.Y H:i",$term->linework_enabled_date)?> von <?=$term->linework_enabler->name?> (<?=$term->linework_enabler->address->getCompanyOrName(true)?>)"
><?=$term->linework_enabler->getAbbrName()?></small>
</div>
<?php endif; ?>
</div>
<div class="mt-3">
<button type="button" class="btn btn-primary" form="wf-termination-<?=$term->id?>" onclick="validateAndSubmit(<?=$term->id?>)">Speichern</button>

View File

@@ -156,6 +156,13 @@
</div>
<div class="mt-3">
<label <?=(!$building->pipeworker_id) ? "class='text-danger' title='Keine Tiefbaufirma ausgewählt'" : ""?>><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?> <?=(!$building->pipeworker_id || !$me->is(["Admin", "pipeplanner"])) ? "disabled='disabled'" : ""?>> Baufreigabe</label>
<?php if($building->pipework_enabled): ?>
<div style="overflow-x:hidden">
<small class="text-info text-mono"
title="Geändert: <?=date("d.m.Y H:i",$building->pipework_enabled_date)?> von <?=$building->pipework_enabler->name?> (<?=$building->pipework_enabler->address->getCompanyOrName(true)?>)"
><?=$building->pipework_enabler->getAbbrName()?></small>
</div>
<?php endif; ?>
</div>
<div class="mt-3">
<button type="button" class="btn btn-primary" form="wf-building-<?=$building->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>

View File

@@ -146,7 +146,7 @@ class AddressController extends mfBaseController {
if($r->billing_type == "sepa") {
foreach(['owner', 'iban', 'bic'] as $required) {
if(!$r->{"bank_account_$required"}) {
$this->layout()->setFlash("Bitte Bankdaten für SEPA ausfüllen.");
$this->layout()->setFlash("Bitte Bankdaten für SEPA ausfüllen.", "warn");
$this->layout()->set("address", $r);
return $this->add();
}

View File

@@ -12,6 +12,7 @@ class Building extends mfBaseModel {
private $terminations;
private $workflowitems;
private $files;
private $pipework_enabler;
public function getAddress($singelLine = false) {
if(!$this->id) {
@@ -161,6 +162,11 @@ class Building extends mfBaseModel {
return $this->files;
}
if($name == "pipework_enabler") {
$this->pipework_enabler = new User($this->pipework_enabled_by);
return $this->pipework_enabler;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);

View File

@@ -172,18 +172,24 @@ class LineworkController extends mfBaseController {
//var_dump($r->get());exit;
if($this->me->is(["Admin", "netowner","pipeplanner", "lineplanner"])) {
if($r->linework_enabled == 1) {
if($r->linework_enabled == 1 && $termination->linework_enabled != 1) {
$termination->linework_enabled = 1;
$termination->linework_enabled_date = date('U');
$termination->linework_enabled_by = $this->me->id;
if($termination->status_id < 3) {
$termination->status_id = 3;
}
} else {
$termination->save();
}
if($r->linework_enabled != 1 && $termination->linework_enabled == 1) {
$termination->linework_enabled = 0;
$termination->linework_enabled_date = 0;
if($termination->status_id == 3) {
$termination->status_id = 1;
}
$termination->save();
}
$termination->save();
}
if($termination->workflow_comment != $r->workflow_comment) {

View File

@@ -167,15 +167,22 @@ class PipeworkController extends mfBaseController {
//var_dump($r->get());exit;
if($this->me->is(["Admin", "netowner", "pipeplanner"])) {
if($r->pipework_enabled == 1) {
if($r->pipework_enabled == 1 && $building->pipework_enabled != 1) {
$building->pipework_enabled = 1;
$building->pipework_enabled_date = date('U');
$building->pipework_enabled_by = $this->me->id;
if($building->status_id < 3) {
$building->status_id = 3;
}
} else {
$building->pipework_enabled = 0;
$building->save();
}
$building->save();
if($r->pipework_enabled != 1 && $building->pipework_enabled == 1) {
$building->pipework_enabled = 0;
$building->pipework_enabled_date = 0;
$building->save();
}
}
if($building->workflow_comment != $r->workflow_comment) {

View File

@@ -10,10 +10,12 @@ class Termination extends mfBaseModel {
private $cpeprovisioning;
private $files;
private $patching;
private $linework_enabler;
private $creator;
private $editor;
public function getAddress($singelLine = false) {
if(!$this->id) {
return false;
@@ -195,6 +197,21 @@ class Termination extends mfBaseModel {
return $this->cpeprovisioning;
}
if($name == "linework_enabler") {
$this->linework_enabler = new User($this->linework_enabled_by);
return $this->linework_enabler;
}
if($name == "creator") {
$this->creator = new User($this->create_by);
return $this->creator;
}
if($name == "editor") {
$this->editor = new User($this->edit_by);
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);