Updated vice versa updating of status flags / attributes
This commit is contained in:
@@ -1063,6 +1063,27 @@ class PreorderController extends mfBaseController {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($flag_id == 1) {
|
||||
$preorder = new Preorder($preorder_id);
|
||||
if(!$preorder->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$attribute = "inhouse_cabling_supplied";
|
||||
$attribs = $preorder->attribute;
|
||||
if(!$attribs) {
|
||||
$attribs = [];
|
||||
}
|
||||
|
||||
$attribs[$attribute] = $value ? 1 : 0;
|
||||
$preorder->attributes = json_encode($attribs);
|
||||
if($preorder->save()) {
|
||||
return ["id" => $preorder_id, "attribute" => $attribute, "update" => date("d.m.Y H:i", $preorder->edit)];
|
||||
} else {
|
||||
$this->returnJson(["status" => "error", "result" => ["id" => $preorder_id, "attribute" => $attribute]]);
|
||||
}
|
||||
}
|
||||
|
||||
$flagvalue = PreorderStatusflagValueModel::getFirst(["preorder_id" => $preorder_id, "flag_id" => $flag_id]);
|
||||
if(!$flagvalue) {
|
||||
$flagvalue = PreorderStatusflagValueModel::create([
|
||||
|
||||
@@ -25,6 +25,8 @@ class Helper {
|
||||
$sql .= " AND `$columnName` = " . $filterValue;
|
||||
} else if ($filterValue === null) {
|
||||
$sql .= " AND `$columnName` IS NULL";
|
||||
} else if ($filterValue === '!NULL') {
|
||||
$sql .= " AND `$columnName` IS NOT NULL";
|
||||
} else if (!empty($filterValue)) {
|
||||
if ($exactMatch) {
|
||||
$sql .= " AND `$columnName` = '" . $filterValue . "'";
|
||||
@@ -32,6 +34,8 @@ class Helper {
|
||||
$sql .= " AND `$columnName` LIKE '" . $filterValue . "'";
|
||||
} else if ($filterValue[strlen($filterValue) - 1] === "%") {
|
||||
$sql .= " AND `$columnName` LIKE '" . $filterValue . "'";
|
||||
} else if ($filterValue[0] === "!") {
|
||||
$sql .= " AND `$columnName` NOT LIKE '%" . substr($filterValue, 1) . "%'";
|
||||
} else {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
|
||||
Reference in New Issue
Block a user