Added Linework workflow
This commit is contained in:
307
application/Linework/LineworkController.php
Normal file
307
application/Linework/LineworkController.php
Normal file
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
class LineworkController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin", "netowner","pipeplanner","pipeworker", "lineplanner", "lineworker"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Linework/Index");
|
||||
$filter = [];
|
||||
|
||||
$this->layout->set("filter", $this->request->filter);
|
||||
|
||||
if($this->request->filter) {
|
||||
$filter = $this->getPreparedFilter($this->request->filter);
|
||||
}
|
||||
|
||||
$my_networks = [];
|
||||
|
||||
// get allowed networks
|
||||
if($this->me->is("Admin")) {
|
||||
if($filter['network_id']) {
|
||||
$my_networks[] = new Network($filter['network_id']);
|
||||
} else {
|
||||
$my_networks = NetworkModel::getAll();
|
||||
}
|
||||
$this->layout()->set("mynetworks", NetworkModel::getAll());
|
||||
} else {
|
||||
$use_filter_network = false;
|
||||
$my_networks = $this->me->my_networks;
|
||||
|
||||
foreach($my_networks as $mn) {
|
||||
if($mn->id == $filter['network_id']) {
|
||||
$use_filter_network = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if($use_filter_network) {
|
||||
$my_networks = [];
|
||||
$my_networks[] = new Network($filter['network_id']);
|
||||
}
|
||||
|
||||
$this->layout()->set("mynetworks", $this->me->my_networks);
|
||||
|
||||
}
|
||||
unset($filter['network_id']);
|
||||
|
||||
// get Buildings in networks
|
||||
$networks = [];
|
||||
foreach($my_networks as $network) {
|
||||
if(!array_key_exists($network->name, $networks)) {
|
||||
$networks[$network->name] = [];
|
||||
}
|
||||
|
||||
$termination_search = [
|
||||
"network_id" => $network->id,
|
||||
"workflow_finished" => 0
|
||||
];
|
||||
|
||||
if(is_array($filter) && count($filter)) {
|
||||
foreach($filter as $name => $value) {
|
||||
$termination_search[$name] = $value;
|
||||
}
|
||||
//$building_search = array_merge($building_search, $filter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if(!count($filter)) {
|
||||
$termination_search["status_id"] = 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach(TerminationModel::search($termination_search) as $b) {
|
||||
if(!array_key_exists($b->id, $networks[$network->name])) {
|
||||
$networks[$network->name][$b->id] = $b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$term = reset(reset($networks));
|
||||
$item_colspan = 0;
|
||||
$i = 0;
|
||||
|
||||
//var_dump($term);exit;
|
||||
|
||||
// get fields between delimiters for colspan
|
||||
if(is_array($term->workflowitems) && count($term->workflowitems)) {
|
||||
foreach($term->workflowitems as $wfitem) {
|
||||
if($i == 0 && $wfitem->type == "delimiter") continue;
|
||||
|
||||
if($wfitem->type == "delimiter") {
|
||||
$item_colspan = $i;
|
||||
break;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
//var_dump($item_colspan);exit;
|
||||
$this->layout()->set("termination_wf_colspan", $item_colspan);
|
||||
$this->layout()->set("networks", $networks);
|
||||
//var_dump(reset(reset($networks))->workflowitems);exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function getPreparedFilter($filter) {
|
||||
$new_filter = [];
|
||||
|
||||
if(is_numeric($filter['networksection_id']) && $filter['networksection_id']) {
|
||||
$section = new Networksection($filter['networksection_id']);
|
||||
if($section->id) {
|
||||
$filter['network_id'] = $section->network_id;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($filter as $name => $value) {
|
||||
/*if($name == 'network_id') {
|
||||
$new_filter['id'] = $value;
|
||||
continue;
|
||||
}*/
|
||||
|
||||
$new_filter[$name] = $value;
|
||||
}
|
||||
|
||||
return $new_filter;
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
//var_dump($r->get());exit;
|
||||
$termination_id = $r->id;
|
||||
if(!is_numeric($termination_id) || $termination_id < 1) {
|
||||
$this->layout()->setFlash("Objekt nicht gefunden", "error");
|
||||
$this->redirect("Linework");
|
||||
}
|
||||
|
||||
$termination = new Termination($termination_id);
|
||||
if(!$termination->id) {
|
||||
$this->layout()->setFlash("Objekt nicht gefunden", "error");
|
||||
$this->redirect("Linework");
|
||||
}
|
||||
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
if($this->me->is(["Admin", "netowner","pipeplanner", "lineplanner"])) {
|
||||
if($r->linework_enabled == 1) {
|
||||
$termination->linework_enabled = 1;
|
||||
if($termination->status_id < 3) {
|
||||
$termination->status_id = 3;
|
||||
}
|
||||
} else {
|
||||
$termination->linework_enabled = 0;
|
||||
}
|
||||
$termination->save();
|
||||
}
|
||||
|
||||
if($termination->workflow_comment != $r->workflow_comment) {
|
||||
$termination->workflow_comment = $r->workflow_comment;
|
||||
$termination->workflow_comment_changed = date('U');
|
||||
$termination->workflow_comment_changed_by = $this->me->id;
|
||||
$termination->save();
|
||||
}
|
||||
|
||||
$items = [];
|
||||
|
||||
// get workflow values from request
|
||||
foreach($r->get() as $field_name => $value) {
|
||||
$m = [];
|
||||
if(preg_match('/^wfitem_(.+)$/', $field_name, $m)) {
|
||||
if(!$m[1]) {
|
||||
continue;
|
||||
}
|
||||
$items[$m[1]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($items);exit;
|
||||
foreach($items as $name => $value) {
|
||||
$item = WorkflowitemModel::getFirst(["name" => $name, "object_type" => "termination"]);
|
||||
if(!$item) {
|
||||
var_dump("no item: $name");exit;
|
||||
}
|
||||
$item->setObjectId($termination_id);
|
||||
$item->value->setValue($value);
|
||||
if($item->value->is_changed) {
|
||||
$item->value->save();
|
||||
}
|
||||
|
||||
$termination->resetProperties();
|
||||
|
||||
// set linework finished flag in building
|
||||
/*
|
||||
if($name == TT_WORKFLOW_ITEM_LINEWORK_DONE) {
|
||||
if($value && $building->workflow_finished == 0) {
|
||||
$building->workflow_finished = 1;
|
||||
$building->save();
|
||||
} elseif(!$value && $building->workflow_finished == 1) {
|
||||
$building->workflow_finished = 0;
|
||||
$building->save();
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom checks
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
if($building->workflowitems['pipework_finished']->value->value_string) {
|
||||
// unset Tiefbau abgeschlossen if missing values
|
||||
if( (!$building->workflowitems['anschlusspunkt_typ']->value->value_string && !$building->workflowitems['ist_anschlusspunkt_typ']->value->value_string)
|
||||
|| (!$building->workflowitems['anschlusspunkt_name']->value->value_string && !$building->workflowitems['ist_anschlusspunkt_name']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrverband_name']->value->value_string && !$building->workflowitems['ist_rohrverband_name']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrtype']->value->value_string && !$building->workflowitems['ist_rohrtype']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrfarbe']->value->value_string && !$building->workflowitems['ist_rohrfarbe']->value->value_string)
|
||||
) {
|
||||
$building->workflowitems['pipework_finished']->value->value_string = "";
|
||||
$building->workflowitems['pipework_finished']->value->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
// set building status if Status field was set
|
||||
/*
|
||||
if(defined("TT_WORKFLOW_ITEM_STATUS_FIELD") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED")) {
|
||||
$status_value = $building->workflowitems[TT_WORKFLOW_ITEM_STATUS_FIELD]->value->value_string;
|
||||
//var_dump($status_value);exit;
|
||||
if($status_value == TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED && $building->status_id != 4) {
|
||||
$building->status_id = 4;
|
||||
$building->save();
|
||||
}
|
||||
if($status_value == TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED && $building->status_id != 5) {
|
||||
$building->status_id = 5;
|
||||
$building->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
// file upload
|
||||
//var_dump($_FILES);exit;
|
||||
if(array_key_exists("LineworkFileUpload", $_FILES) && !$_FILES['LineworkFileUpload']['error']) {
|
||||
|
||||
try {
|
||||
$upload = new mfUpload("LineworkFileUpload");
|
||||
$upload->setSavepath(MFUPLOAD_FILE_SAVE_PATH."/documents");
|
||||
$upload->save();
|
||||
|
||||
$file_data = [];
|
||||
$file_data['name'] = ($r->file_name) ? $r->file_name : $upload->getOriginalFilename();
|
||||
$file_data['filename'] = ($r->file_filename) ? $r->file_filename : $upload->getOriginalFilename();
|
||||
$file_data['store_filename'] = $upload->getFilename();
|
||||
$file_data['orig_filename'] = $upload->getOriginalFilename();
|
||||
|
||||
$file = FileModel::create($file_data);
|
||||
$file_id = $file->save();
|
||||
if(!$file_id) {
|
||||
$this->layout()->setFlash("Dateiupload fehlgeschlagen", "warn");
|
||||
unlink($upload->getSavepath()."/".$upload->getFilename());
|
||||
} else {
|
||||
$tf = [];
|
||||
$tf['termination_id'] = $termination_id;
|
||||
$tf['file_id'] = $file_id;
|
||||
$tf['type'] = $r->file_type;
|
||||
$tf['name'] = $file->name;
|
||||
|
||||
$termfile = TerminationFileModel::create($tf);
|
||||
if(!$termfile->save()) {
|
||||
$file->delete();
|
||||
unlink($upload->getSavepath()."/".$upload->getFilename());
|
||||
$this->layout()->setFlash("Dateiupload fehlgeschlagen", "warn");
|
||||
$this->redirect("Linework");
|
||||
}
|
||||
}
|
||||
} catch(Exception $ex) {
|
||||
$this->layout->setFlash("Fehler beim Dateiupload: ".$ex->getMessage(), "warn");
|
||||
$this->redirect("Linework");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->layout->setFlash("Workflow Eintrag erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Linework","Index", http_build_query(["filter" => $this->request->filter]), "object=".$termination_id);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -84,7 +84,6 @@ class NetworkAddressModel {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
mfLoghandler::singleton()->debug($where);
|
||||
$res = $db->select("NetworkAddress", "*", "$where ORDER BY `type`");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
|
||||
@@ -150,8 +150,7 @@ class OrderModel {
|
||||
LEFT JOIN Building ON (Building.id = Termination.building_id)
|
||||
WHERE $where
|
||||
GROUP BY `Order`.id";
|
||||
//var_dump($sql);exit;
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
|
||||
@@ -6,6 +6,8 @@ class Termination extends mfBaseModel {
|
||||
private $building;
|
||||
private $status;
|
||||
private $lineworker;
|
||||
private $workflowitems;
|
||||
private $files;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
@@ -70,7 +72,15 @@ class Termination extends mfBaseModel {
|
||||
return $code;
|
||||
}
|
||||
|
||||
|
||||
public function resetProperties() {
|
||||
$this->building = null;
|
||||
$this->status = null;
|
||||
$this->lineworder = null;
|
||||
$this->workflowitems = null;
|
||||
$this->files = null;
|
||||
$this->creator = null;
|
||||
$this->editor = null;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
@@ -80,6 +90,20 @@ class Termination extends mfBaseModel {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
if($name == "workflowitems") {
|
||||
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
}
|
||||
//var_dump($this->workflowitems);exit;
|
||||
return $this->workflowitems;
|
||||
}
|
||||
|
||||
if($name == "files") {
|
||||
$this->files = TerminationFileModel::search(["termination_id" => $this->id]);
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
@@ -105,6 +105,14 @@ class TerminationModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("status_id", $filter)) {
|
||||
$status_id = $filter['status_id'];
|
||||
|
||||
if(is_numeric($status_id) && $status_id > 0) {
|
||||
$where .= " AND Termination.status_id = $status_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("network_id", $filter)) {
|
||||
$network_id = $filter['network_id'];
|
||||
if(is_numeric($network_id)) {
|
||||
@@ -114,6 +122,36 @@ class TerminationModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("networksection_id", $filter)) {
|
||||
$networksection_id = $filter['networksection_id'];
|
||||
if(is_numeric($networksection_id)) {
|
||||
$where .= " AND Building.networksection_id=$networksection_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("code", $filter)) {
|
||||
$code = FronkDB::singleton()->escape($filter['code']);
|
||||
if($code) {
|
||||
$where .= " AND Termination.code LIKE '%$code%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("building_code", $filter)) {
|
||||
$building_code = FronkDB::singleton()->escape($filter['building_code']);
|
||||
if($building_code) {
|
||||
$where .= " AND Building.code LIKE '%$building_code%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("building_street", $filter)) {
|
||||
$building_street = FronkDB::singleton()->escape($filter['building_street']);
|
||||
if($building_street) {
|
||||
$where .= " AND Building.street LIKE '%$building_street%'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("status", $filter)) {
|
||||
if(in_array(substr($filter['status'], 1, 2), ["<=", ">="])) {
|
||||
$op = substr($filter['status'], 1, 2);
|
||||
|
||||
40
application/TerminationFile/TerminationFile.php
Normal file
40
application/TerminationFile/TerminationFile.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class TerminationFile extends mfBaseModel {
|
||||
private $file;
|
||||
private $termination;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
42
application/TerminationFile/TerminationFileController.php
Normal file
42
application/TerminationFile/TerminationFileController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class TerminationFileController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->isAdmin()) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
// internal redirect to File::editAction
|
||||
}
|
||||
|
||||
protected function deleteAction() {
|
||||
$id = $this->request->id;
|
||||
|
||||
$termfile = new TerminationFile($id);
|
||||
if(!$termfile->id || $termfile->id != $id) {
|
||||
$this->layout()->setFlash("Datei nicht gefunden.", "error");
|
||||
$this->redirect("Termination");
|
||||
}
|
||||
|
||||
$term_id = $termfile->termination_id;
|
||||
$building_id = $termfile->termination->building_id;
|
||||
|
||||
$termfile->file->delete();
|
||||
$termfile->delete();
|
||||
|
||||
if($this->request->from == "linework") {
|
||||
$this->redirect("Linework", "Index", false, "object=".$termination_id);
|
||||
}
|
||||
|
||||
$this->redirect("building", "edit", ["id" => $building_id]);
|
||||
}
|
||||
}
|
||||
156
application/TerminationFile/TerminationFileModel.php
Normal file
156
application/TerminationFile/TerminationFileModel.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
class TerminationFileModel {
|
||||
public $termination_id;
|
||||
public $file_id;
|
||||
public $type;
|
||||
public $name;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new TerminationFile();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id) {
|
||||
if(!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TerminationFile", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TerminationFile($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TerminationFile", "*", "1=1 ORDER BY name, filename");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new TerminationFile($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TerminationFile", "*", "$where ORDER BY name, filename");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TerminationFile($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
|
||||
$sql = "SELECT TerminationFile.* FROM TerminationFile
|
||||
LEFT JOIN File ON (TerminationFile.file_id = File.id)
|
||||
WHERE $where
|
||||
ORDER BY termination_id, name";
|
||||
|
||||
$res = $db->query($sql);
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new BuildingFile($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
|
||||
if(array_key_exists("file_id", $filter)) {
|
||||
$file_id = $filter['file_id'];
|
||||
if(is_numeric($file_id)) {
|
||||
$where .= " AND file_id=$file_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("termination_id", $filter)) {
|
||||
$termination_id = $filter['termination_id'];
|
||||
if(is_numeric($termination_id)) {
|
||||
$where .= " AND termination_id=$termination_id";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if(array_key_exists("name", $filter)) {
|
||||
$name = FronkDB::singleton()->escape($filter['name']);
|
||||
if($name) {
|
||||
$where .= " AND name='$name'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("type", $filter)) {
|
||||
$type = FronkDB::singleton()->escape($filter['type']);
|
||||
if($type) {
|
||||
$where .= " AND type='$type'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("filename", $filter)) {
|
||||
$filename = FronkDB::singleton()->escape($filter['filename']);
|
||||
if($filename) {
|
||||
$where .= " AND File.filename='$filename'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("subfolder", $filter)) {
|
||||
$subfolder = FronkDB::singleton()->escape($filter['subfolder']);
|
||||
if($subfolder) {
|
||||
$where .= " AND File.subfolder='$subfolder'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,9 @@
|
||||
class Workflowvalue extends mfBaseModel {
|
||||
private $item;
|
||||
private $changer;
|
||||
public $is_changed = false;
|
||||
|
||||
public function setValue($value, $items) {
|
||||
public function setValue($value) {
|
||||
$this->item = $this->getProperty("item");
|
||||
|
||||
if($this->item->type == "delimiter" || $this->item->type == "empty") {
|
||||
@@ -58,6 +59,13 @@ class Workflowvalue extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
if($value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($value_type == "int" && !$value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->item->type == "bool" && $this->{"value_".$value_type} = null && $value == 0) {
|
||||
return true;
|
||||
@@ -67,11 +75,11 @@ class Workflowvalue extends mfBaseModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->is_changed = true;
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
|
||||
|
||||
if($this->{"value_".$value_type} != $value) {
|
||||
$this->{"value_".$value_type} = $value;
|
||||
$this->changed = date('U');
|
||||
|
||||
Reference in New Issue
Block a user