Keep filter after saving patching
This commit is contained in:
@@ -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