Added linwork_doku_delay

This commit is contained in:
Frank Schubert
2022-03-08 21:22:09 +01:00
parent 80e98d4a89
commit 8e1fb1243a
4 changed files with 46 additions and 6 deletions

View File

@@ -73,7 +73,17 @@
<?php endforeach; ?>
</select>
</div>
<?php if($me->is(["Admin", "netowner"])): ?>
<div class="col-2">
<label class="form-label" for="filter_linework_doku_delay">Dokuaufschub</label>
<select name="filter[linework_doku_delay]" id="filter_linework_doku_delay" class="form-control">
<option value="0">Ausblenden</option>
<option value="1" <?=($filter['linework_doku_delay'] == 1) ? "selected='selected'" : ""?>>Anzeigen</option>
</select>
</div>
<?php endif; ?>
<div class="col-1">
<label class="form-label" for="filter_code">Objekt ID</label>
<input type="text" class="form-control" name="filter[code]" id="filter_code" value="<?=$filter['code']?>" />
@@ -235,6 +245,17 @@
<strong><?=$term->phone?></strong><br />
<?=$term->email?>
</div>
<?php if($me->is("Admin", "netowner")): ?>
<div class="mt-3">
<label <?=(!$term->building->lineworker_id) ? "class='text-danger' title='Keine Leitungsbaufirma ausgewählt'" : ""?>>
<input type="checkbox" form="wf-termination-<?=$term->id?>" name="linework_doku_delay" value="1"
<?=($term->linework_doku_delay == 1) ? "checked='checked'" : ""?>
>
Doku-Aufschub
</label>
</div>
<?php endif; ?>
<div class="mt-3">
<label <?=(!$term->building->lineworker_id) ? "class='text-danger' title='Keine Leitungsbaufirma ausgewählt'" : ""?>>
<input type="checkbox" form="wf-termination-<?=$term->id?>" name="linework_enabled" value="1"

View File

@@ -107,7 +107,7 @@ class Building extends mfBaseModel {
$values = WorkflowvalueModel::search(["object_id" => $this->id, "object_type" => "building"]);
foreach($values as $value) {
$this->log->debug(print_r($value->item, true));
//$this->log->debug(print_r($value->item, true));
$this->workflowitems[$value->item->name]->setValue($value);
mfValuecache::singleton()->set("wfItemvalue-item-".$value->item_id."-object-".$this->id, $value);
}

View File

@@ -77,17 +77,16 @@ class LineworkController extends mfBaseController {
$termination_search = [
"network_id" => $my_network_ids,
"workflow_finished" => 0
"workflow_finished" => 0,
"linework_doku_delay" => 0
];
if(is_array($filter) && count($filter)) {
foreach($filter as $name => $value) {
$termination_search[$name] = $value;
}
}
if($this->me->is("lineworker") && !$this->me->is(["Admin","pipeplanner", "lineplanner","netowner"])) {
$this->log->debug("is lineworker");
$termination_search["lineworker_id"] = ($this->me->address->parent_id) ? $this->me->address->parent_id : $this->me->address_id;
@@ -196,6 +195,18 @@ class LineworkController extends mfBaseController {
}
}
if($this->me->is(["Admin", "netowner"])) {
if($r->linework_doku_delay == 1 && $termination->linework_doku_delay != 1) {
$termination->linework_doku_delay = 1;
$termination->save();
}
if(!$r->linework_doku_delay && $termination->linework_doku_delay == 1) {
$termination->linework_doku_delay = 0;
$termination->save();
}
}
if($termination->workflow_comment != $r->workflow_comment) {
$termination->workflow_comment = $r->workflow_comment;
$termination->workflow_comment_changed = date('U');

View File

@@ -143,6 +143,14 @@ class TerminationModel {
}
}
if(array_key_exists("linework_doku_delay", $filter)) {
if($filter['linework_doku_delay'] == 1) {
$where .= " AND Termination.linework_doku_delay = 1";
} else {
$where .= " AND Termination.linework_doku_delay = 0";
}
}
if(array_key_exists("network_id", $filter)) {
$network_id = $filter['network_id'];
if(is_numeric($network_id)) {