Keep filter after saving patching
This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
<tr class="table-bordered text-center">
|
||||
<th colspan="4">Standort</th>
|
||||
<th colspan="2">ODF</th>
|
||||
<th colspan="4">Abschluss/Device</th>
|
||||
<th colspan="5">Abschluss/Device</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr class="table-bordered">
|
||||
@@ -119,9 +119,10 @@
|
||||
<th>Patchposition ODF</th>
|
||||
<th>ODF Port</th>
|
||||
<th>Typ</th>
|
||||
<th>Gerät</th>
|
||||
<th>Splitte / Gerät</th>
|
||||
<th>Port</th>
|
||||
<th>Gepatched</th>
|
||||
<th>Von</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($terminations as $term): ?>
|
||||
@@ -156,11 +157,17 @@
|
||||
<option value="switch" <?=($term->patching->device_type == "switch") ? "selected='selected'" : ""?>>Switch</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" class="form-control" form="term-form-<?=$term->id?>" name="device_name" value="<?=$term->patching->device_name?>" placeholder="Gerät" /></td>
|
||||
<td><input type="text" class="form-control" form="term-form-<?=$term->id?>" name="device_name" value="<?=$term->patching->device_name?>" placeholder="Splitte / Gerät" /></td>
|
||||
<td><input type="text" class="form-control" form="term-form-<?=$term->id?>" name="device_port" value="<?=$term->patching->device_port?>" placeholder="Port" /></td>
|
||||
<td><input type="checkbox" class="form-control" form="term-form-<?=$term->id?>" name="patched" value="1" <?=($term->patching->patched == 1) ? "checked='checked'" : ""?> /></td>
|
||||
<td <?=($term->patching->patched == 1 && $term->patching->patched_by) ? "title='Gepatched: ".date("d.m.Y H:i",$term->patching->patched_date)." von ".$term->patching->patcher->name." (".$term->patching->patcher->address->getCompanyOrName(true).")'" : ""?>>
|
||||
|
||||
<?php if($term->patching->patched == 1 && $term->patching->patched_by): ?>
|
||||
<?=($term->patching->patcher) ? $term->patching->patcher->getAbbrName() : ""?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" id="term-form-<?=$term->id?>" action="<?=self::getUrl("Patching","save")?>">
|
||||
<form method="post" id="term-form-<?=$term->id?>" action="<?=self::getUrl("Patching","save", ["s" => $pagination['start'], "filter" => $filter])?>">
|
||||
<input type="hidden" name="termination_id" value="<?=$term->id?>" />
|
||||
<input type="submit" class="btn btn-primary" value="Speichern" />
|
||||
</form>
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
<?php
|
||||
|
||||
class Patching extends mfBaseModel {
|
||||
private $termination;
|
||||
private $patcher;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "patcher") {
|
||||
$this->patcher = new User($this->patched_by);
|
||||
return $this->patcher;
|
||||
}
|
||||
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
@@ -157,15 +157,28 @@ class PatchingController extends mfBaseController {
|
||||
|
||||
|
||||
$patch_data["linework_port"] = $r->linework_port;
|
||||
$patch_data["device_type"] = $r->device_type;
|
||||
$patch_data["device_name"] = $r->device_name;
|
||||
$patch_data["device_port"] = $r->device_port;
|
||||
$patch_data["patched"] = ($r->patched == "1") ? 1 : 0;
|
||||
|
||||
if(strlen($patch_data["device_type"])) {
|
||||
$patch_data["device_type"] = $r->device_type;
|
||||
} else {
|
||||
$patch_data["device_type"] = null;
|
||||
}
|
||||
|
||||
if($mode == "add") {
|
||||
$patch_data['create_by'] = 1;
|
||||
$patching = PatchingModel::create($patch_data);
|
||||
if($patch_data["patched"]) {
|
||||
$patch_data["patched_by"] = $this->me->id;
|
||||
$patch_data["patched_date"] = date("U");
|
||||
}
|
||||
} else {
|
||||
if($patch_data["patched"] && !$patchind->patched) {
|
||||
$patch_data["patched_by"] = $this->me->id;
|
||||
$patch_data["patched_date"] = date("U");
|
||||
}
|
||||
$patching->update($patch_data);
|
||||
}
|
||||
|
||||
@@ -175,8 +188,19 @@ class PatchingController extends mfBaseController {
|
||||
return $this->indexAction();
|
||||
}
|
||||
|
||||
$sq = "";
|
||||
$query = [];
|
||||
if(is_numeric($this->request->s) && $this->request->s > 0) {
|
||||
$query["s"] = $this->request->s;
|
||||
}
|
||||
if (is_array($this->request->filter)) {
|
||||
$query["filter"] = $this->request->filter;
|
||||
}
|
||||
|
||||
$qs = http_build_query($query);
|
||||
|
||||
$this->layout()->setFlash("Patchung erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Patching", "Index");
|
||||
$this->redirect("Patching","Index", $qs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class PatchingModel {
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
|
||||
$sql = "SELECT COUNT(Termination.id) as cnd FROM `Order`
|
||||
$sql = "SELECT COUNT(Termination.id) as cnt FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
LEFT JOIN Termination ON (Termination.id = OrderProduct.termination_id)
|
||||
@@ -106,7 +106,7 @@ class PatchingModel {
|
||||
GROUP BY Termination.id
|
||||
ORDER BY Termination.id ASC LIMIT 1";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
@@ -118,7 +118,7 @@ class PatchingModel {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function searchByTermination($filter = false) {
|
||||
public static function searchByTermination($filter = false, $limit = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
@@ -163,7 +163,7 @@ class PatchingModel {
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function search($filter = false) {
|
||||
public static function search($filter = false, $limit = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user