Added pipework/linework comments to each page

This commit is contained in:
Frank Schubert
2022-05-03 17:09:14 +02:00
parent b5983b27f1
commit ed2dda4443
6 changed files with 48 additions and 19 deletions
+6 -1
View File
@@ -337,7 +337,12 @@
<tr> <tr>
<td colspan="3"> <td colspan="3">
<label class="form-label">Kommentar</label> <textarea class="form-control" style="height:100%" form="wf-termination-<?=$term->id?>" name="workflow_comment" id="workflow_comment_<?=$term->id?>"><?=$term->workflow_comment?></textarea> <label class="form-label">Kommentar Tiefbau (<?=$term->building->street?>)</label>
<textarea class="form-control" style="height:100%" form="wf-termination-<?=$term->id?>" name="workflow_comment_building" id="workflow_comment_building_<?=$term->id?>"><?=$term->building->workflow_comment?></textarea>
</td>
<td colspan="3">
<label class="form-label">Kommentar Anschluss (<?=$term->code?>)</label>
<textarea class="form-control" style="height:100%" form="wf-termination-<?=$term->id?>" name="workflow_comment" id="workflow_comment_<?=$term->id?>"><?=$term->workflow_comment?></textarea>
</td> </td>
<td colspan="<?=$wfColspan - 3?>"> <td colspan="<?=$wfColspan - 3?>">
<h5>Dokumente</h5> <h5>Dokumente</h5>
+6 -1
View File
@@ -170,8 +170,13 @@
<tr> <tr>
<td colspan="3"> <td colspan="3">
<label class="form-label">Kommentar</label> <textarea class="form-control" style="height:100%" form="wf-building-<?=$building->id?>" name="workflow_comment" id="workflow_comment_<?=$building->id?>"><?=$building->workflow_comment?></textarea> <label class="form-label">Kommentar Tiefbau</label> <textarea class="form-control" style="height:100%" form="wf-building-<?=$building->id?>" name="workflow_comment" id="workflow_comment_<?=$building->id?>"><?=$building->workflow_comment?></textarea>
</td> </td>
<?php if($building->termination_workflow_comments): ?>
<td colspan="3">
<label class="form-label">Kommentare Leitungsbau</label> <textarea class="form-control" style="height:100%" form="wf-building-<?=$building->id?>" name="workflow_comment_term" id="workflow_comment_term_<?=$building->id?>" readonly="readonly"><?=$building->termination_workflow_comments?></textarea>
</td>
<?php endif; ?>
<td colspan="<?=$wfColspan - 3?>"> <td colspan="<?=$wfColspan - 3?>">
<h5>Dokumente</h5> <h5>Dokumente</h5>
<table class="table-sm"> <table class="table-sm">
+12
View File
@@ -10,6 +10,7 @@ class Building extends mfBaseModel {
private $status; private $status;
private $pipeworker; private $pipeworker;
private $terminations; private $terminations;
private $termination_workflow_comments;
private $workflowitems; private $workflowitems;
private $files; private $files;
private $pipework_enabler; private $pipework_enabler;
@@ -223,6 +224,17 @@ class Building extends mfBaseModel {
return $this->terminations; return $this->terminations;
} }
if($name == "termination_workflow_comments") {
$comments = "";
foreach($this->getProperty("terminations") as $term) {
if($term->workflow_comment) {
$comment .= $term->code.": ".trim($term->workflow_comment)."\n\n";
}
}
$this->termination_workflow_comments = $comment;
return $this->termination_workflow_comments;
}
if($name == "workflowitems") { if($name == "workflowitems") {
$this->loadWorkflowItems(); $this->loadWorkflowItems();
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) { foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
@@ -214,6 +214,13 @@ class LineworkController extends mfBaseController {
$termination->save(); $termination->save();
} }
if($termination->building->workflow_comment != $r->workflow_comment_building) {
$termination->building->workflow_comment = $r->workflow_comment_building;
$termination->building->workflow_comment_changed = date('U');
$termination->building->workflow_comment_changed_by = $this->me->id;
$termination->building->save();
}
$items = []; $items = [];
// get workflow values from request // get workflow values from request
+6 -6
View File
@@ -69,23 +69,23 @@ class mfUpload {
return false; return false;
} }
$savepath=MFUPLOAD_FILE_SAVE_PATH; $savepath = MFUPLOAD_FILE_SAVE_PATH;
if(!MFUPLOAD_FILE_SAVE_PATH) { if(!MFUPLOAD_FILE_SAVE_PATH) {
$savepath="upload/"; $savepath = "upload/";
} }
$this->log->debug("dirmode: ".decoct($this->dirmode)); $this->log->debug("dirmode: ".decoct($this->dirmode));
if(!file_exists($savepath)) { if(!file_exists($savepath)) {
if(!mkdir($savepath,$this->dirmode,true)) { if(!mkdir($savepath, $this->dirmode,true)) {
throw new Exception("Error creating directory $savepath."); throw new Exception("Error creating directory $savepath.");
} }
chmod($savepath,$this->dirmode); chmod($savepath, $this->dirmode);
} }
if(!is_dir($savepath)) { if(!is_dir($savepath)) {
throw new Exception("Upload save path not a directory!"); throw new Exception("Upload save path not a directory!");
} }
$this->savepath=$savepath; $this->savepath = $savepath;
return true; return true;
} }
@@ -163,7 +163,7 @@ class mfUpload {
} }
public function setDirmode($mode) { public function setDirmode($mode) {
$this->dirmode=$mode; $this->dirmode = $mode;
} }
public function getFilemode() { public function getFilemode() {
+11 -11
View File
@@ -39,14 +39,14 @@ class mfUpload_TmpFile {
if(move_uploaded_file($this->tmp_name, $path)) { if(move_uploaded_file($this->tmp_name, $path)) {
return true; return true;
} else { } else {
$this->errormessage="Cannot move uploaded file to $path."; $this->errormessage = "Cannot move uploaded file to $path.";
} }
} }
return false; return false;
} }
public function getFileSize() { public function getFileSize() {
$stat=stat($this->tmp_name); $stat = stat($this->tmp_name);
if(is_array($stat) && count($stat)) { if(is_array($stat) && count($stat)) {
return $stat[7]; return $stat[7];
} }
@@ -54,33 +54,33 @@ class mfUpload_TmpFile {
} }
public function getFilename() { public function getFilename() {
$filename=$this->filename; $filename = $this->filename;
// assume filename contains whole path on users machine and cut it. // assume filename contains whole path on users machine and cut it.
if(preg_match('#([^/\\\]+$)#',$filename,$match)) { if(preg_match('#([^/\\\]+$)#',$filename,$match)) {
$filename=$match[1]; $filename = $match[1];
} else { } else {
$this->errormessage="No file selected."; $this->errormessage = "No file selected.";
return false; // if there is no filename return false; // if there is no filename
} }
// remove potentially dangerous characters // remove potentially dangerous characters
while(strstr($filename,'..')) { while(strstr($filename,'..')) {
$filename=str_replace('..',".",$filename); $filename = str_replace('..',".",$filename);
} }
if(!strlen($filename)) { if(!strlen($filename)) {
$this->errormessage="No file selected."; $this->errormessage = "No file selected.";
return false; return false;
} }
$filename=preg_replace('/[^a-z0-9$()+%äöüß._-]/i', '_', $filename); $filename = preg_replace('/[^a-z0-9$()+%äöüß._-]/i', '_', $filename);
$parts=explode(".",$filename); $parts = explode(".",$filename);
$ext=strtolower(array_pop($parts)); $ext = strtolower(array_pop($parts));
if(!preg_match('/^'.MFUPLOAD_ALLOWED_EXTENSIONS.'$/i',$ext)) { if(!preg_match('/^'.MFUPLOAD_ALLOWED_EXTENSIONS.'$/i',$ext)) {
$this->errormessage="File type not allowed. Supported file types are ".ALLOWED_EXTENSIONS_STR; $this->errormessage = "File type not allowed. Supported file types are ".ALLOWED_EXTENSIONS_STR;
return false; return false;
} }