Added cancel_date filter in Contract/Index
This commit is contained in:
@@ -439,9 +439,8 @@
|
||||
function(success) {
|
||||
if(success.status != "OK") return;
|
||||
|
||||
|
||||
p = success.result.product;
|
||||
|
||||
|
||||
var sla_id;
|
||||
if(p.sla_id) {
|
||||
sla_id = p.sla_id;
|
||||
|
||||
@@ -60,7 +60,15 @@
|
||||
<label class="form-label" for="filter_matchcode">Matchcode</label>
|
||||
<input type="text" class="form-control" name="filter[matchcode]" id="filter_matchcode" value="<?=$filter['matchcode']?>" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_show_canceled">Kündigungsdatum</label>
|
||||
<select class="form-control" name="filter[cancel_date]" id="filter_cancel_date">
|
||||
<option></option>
|
||||
<option value="1" <?=(array_key_exists("cancel_date", $filter) && $filter['cancel_date'] == 1) ? "selected='selected'" : ""?>>Mit Kündigungsdatum</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_show_canceled">Gekündigte Produkte</label>
|
||||
<select class="form-control" name="filter[show_canceled]" id="filter_show_canceled">
|
||||
|
||||
@@ -71,6 +71,12 @@ class ContractController extends mfBaseController
|
||||
$new_filter['add-where'] = " AND (cancel_date IS NULL OR cancel_date > UNIX_TIMESTAMP())";
|
||||
}
|
||||
|
||||
if(array_key_exists("cancel_date", $filter)) {
|
||||
if($filter["cancel_date"]) {
|
||||
$new_filter["cancel_date"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("show_credit", $filter)) {
|
||||
if ($filter["show_credit"] == 0) {
|
||||
$new_filter["price>="] = 0;
|
||||
|
||||
@@ -597,6 +597,16 @@ class ContractModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("cancel_date", $filter)) {
|
||||
$cancel_date = $filter['cancel_date'];
|
||||
if($cancel_date == true) {
|
||||
$where .= " AND Contract.cancel_date > 0";
|
||||
} elseif($cancel_date === false || $cancel_date === null) {
|
||||
$where .= " AND (Contract.cancel_date = 0 OR Contract.cancel_date IS NULL)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists("cancel_date>", $filter)) {
|
||||
$cancel_date = $filter['cancel_date>'];
|
||||
if(is_numeric($cancel_date)) {
|
||||
|
||||
Reference in New Issue
Block a user