Fixed Showing Orders of users of same company
This commit is contained in:
@@ -35,7 +35,18 @@
|
||||
<select class="select2 form-control " name="network_id" id="network_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=($building->network_id == $network->id) ? "selected='selected'" : ""?>><?=($network->name)?></option>
|
||||
<option value="<?=$network->id?>" <?php
|
||||
if($building):
|
||||
if($building->network_id == $network->id):
|
||||
echo "selected='selected'";
|
||||
endif;
|
||||
else:
|
||||
if($request_network_id == $network->id):
|
||||
echo "selected='selected'";
|
||||
endif;
|
||||
endif;
|
||||
?>><?=($network->name)?></option>
|
||||
endif;
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_partner_number">Partnernummer</label>
|
||||
<input type="text" class="form-control" name="filter[partner_number]" id="filter_partner_number" value="<?=$filter['partner_number']?>" />
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Building")?>">Vorbestellkampagne</a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Building")?>">Vorbestellung</a></li>
|
||||
<li class="breadcrumb-item active"><?=($campaign->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Objekte</h4>
|
||||
<h4 class="page-title">Vorbestellung</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,27 +21,31 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?=($campaign->id) ? "Vorbestellkampagne bearbeiten" : "Neue Vorbestellkampagne"?></h4>
|
||||
<h4 class="header-title mb-2"><?=($preorder->id) ? "Vorbestellung bearbeiten" : "Neue Vorbestellung"?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preordercampaign", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$campaign->id?>" />
|
||||
<input type="hidden" name="id" value="<?=$preorder->id?>" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label>
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Vorbestellkampagne</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="network_id" id="network_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=($campaign->network_id == $network->id) ? "selected='selected'" : ""?>><?=($network->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type="hidden" name="campaign_id" id="campaign_id" value="<?=$campaign->id?>" />
|
||||
<input type="text" class="form-control" value="<?=$campaign->name?>" readonly="readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="building-search" class="hidden">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="hidden" name="network_id" id="network_id" value="<?=$campaign->network_id?>" />
|
||||
<input type="text" class="form-control" value="<?=$campaign->network->name?>" readonly="readonly" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="building-search">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Gebäude suchen *</label>
|
||||
@@ -50,10 +54,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row" id="building-search-results-section">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Gebäude auswählen *</label>
|
||||
<div class="col-lg-10">
|
||||
<table class="table table-striped table-hover" id="building-search-results">
|
||||
<a href="#" class="text-success" onclick="refreshBuildingSearch()"><i class="fas fa-refresh"></i> Aktualisieren</a>
|
||||
<table class="table table-striped table-hover mb-0" id="building-search-results">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Straße</th>
|
||||
@@ -63,6 +69,8 @@
|
||||
<th>OAN ID</th>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="#" class="text-success" onclick="refreshBuildingSearch()"><i class="fas fa-refresh"></i> Aktualisieren</a>
|
||||
<p class="mt-2"><a class="btn btn-sm btn-outline-primary" href="<?=self::getUrl("Building", "add", ["network_id" => $campaign->network_id])?>" target="_blank"><i class="fas fa-plus"></i> Neues Gebäude anlegen</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,22 +89,39 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row hidden" id="termination-search-results-section">
|
||||
<label class="col-lg-2 col-form-label" for="">Anschluss auswählen *</label>
|
||||
<div id="preorder-form">
|
||||
<h4>Vorbestellung</h4>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Vorbestelltyp *</label>
|
||||
<div class="col-lg-10">
|
||||
<table class="table table-striped table-hover" id="termination-search-results">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Bezeichung</th>
|
||||
<th>Kontakt</th>
|
||||
<th>Status</th>
|
||||
<th>Anschluss ID</th>
|
||||
</tr>
|
||||
</table>
|
||||
<select class="form-control" name="type" id="type">
|
||||
<option value="interest">Interessensbekundung</option>
|
||||
<option value="preorder">Vorsorgeanschluss</option>
|
||||
<option value="order">Vollanschluss</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Preis Netto *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="building_id_search" id="building_id_search" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Kundendaten</h4>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Vorname *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="building_id_search" id="building_id_search" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -184,17 +209,15 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#building-search-results-section').show();
|
||||
|
||||
data.buildings.forEach(function(b) {
|
||||
var line = '<tr class="result result-' + b.id + ' pointer" onclick="selectBuilding(' + b.id + ')">';
|
||||
line += '<td><input type="checkbox" readonly="readonly" onclick="selectBuilding(' + b.id + ')" name="building_id" value="' + b.id + '" data-zip="' + b.zip + '" data-city="' + b.city + '" data-street="' + b.street + '" data-code="' + b.code + '" data-oanid="' + b.oan_id + '" /></td>';
|
||||
line += '<td><input type="checkbox" readonly="readonly" onclick="selectBuilding(' + b.id + ')" name="building_id" value="' + b.id + '" data-zip="' + b.zip + '" data-city="' + b.city + '" data-street="' + b.street + '" data-code="' + b.code + '" data-oanid="' + b.oan_id + '" data-units="' + b.units + '" /></td>';
|
||||
line += "<td>" + b.street + "</td>";
|
||||
line += "<td>" + b.zip + "</td>";
|
||||
line += "<td>" + b.city + "</td>";
|
||||
line += "<td>" + b.units + "</td>";
|
||||
line += "<td>" + b.code + "</td>";
|
||||
line += "<td>" + b.oan_id + "</td>";
|
||||
|
||||
@@ -237,28 +260,33 @@
|
||||
var city = $('input[name=building_id][value=' + id + ']').data("city");
|
||||
var code = $('input[name=building_id][value=' + id + ']').data("code");
|
||||
var oan_id = $('input[name=building_id][value=' + id + ']').data("oanid");
|
||||
var units = $('input[name=building_id][value=' + id + ']').data("units");
|
||||
|
||||
var label = street + "<br />" + zip + " " + city;
|
||||
label += "<br /><div style='font-weight: normal;'>Wohneinheiten: " + units;
|
||||
if(code || oan_id) {
|
||||
label += "<br /><div style='font-weight: normal;'>";
|
||||
if(code) {
|
||||
label += "<br />Code: " + code;
|
||||
}
|
||||
if(oan_id) {
|
||||
label += "<br />OAN ID: " + oan_id;
|
||||
}
|
||||
label += "</div>";
|
||||
}
|
||||
label += "</div>";
|
||||
$('#building-search-selected .label').addClass("font-weight-bold").html(label);
|
||||
$('#building-search-selected .check-mark i').removeClass().addClass("fas fa-check text-success");
|
||||
|
||||
$('#building-search-selected').show();
|
||||
|
||||
// get terminatiions
|
||||
showPreorderForm();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function showPreorderForm() {
|
||||
|
||||
}
|
||||
|
||||
function showTerminationSearch() {
|
||||
|
||||
}
|
||||
@@ -270,6 +298,11 @@
|
||||
$('#building-search-selected .check-mark i').removeClass().addClass("fas fa-question text-warning");
|
||||
}
|
||||
|
||||
function refreshBuildingSearch() {
|
||||
resetBuildingSearch();
|
||||
$('#building_id_search').keyup();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
275
Layout/default/Preorder/Form_old.php
Normal file
275
Layout/default/Preorder/Form_old.php
Normal file
@@ -0,0 +1,275 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Building")?>">Vorbestellung</a></li>
|
||||
<li class="breadcrumb-item active"><?=($campaign->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Vorbestellung</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?=($preorder->id) ? "Vorbestellung bearbeiten" : "Neue Vorbestellung"?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preordercampaign", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$preorder->id?>" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="network_id" id="network_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=($campaign->network_id == $network->id) ? "selected='selected'" : ""?>><?=($network->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="building-search" class="hidden">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Gebäude suchen *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="building_id_search" id="building_id_search" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row" id="building-search-results-section">
|
||||
<label class="col-lg-2 col-form-label" for="building_units">Gebäude auswählen *</label>
|
||||
<div class="col-lg-10">
|
||||
<table class="table table-striped table-hover" id="building-search-results">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Straße</th>
|
||||
<th>PLZ</th>
|
||||
<th>Ort</th>
|
||||
<th>Code</th>
|
||||
<th>OAN ID</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row" id="building-search-selected">
|
||||
<label class="col-lg-2 col-form-label" for="">Ausgewähltes Gebäude</label>
|
||||
<div class="col-lg-10">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="check-mark align-top" style="font-size: 2.5em; width:40px;"><i class="fas fa-question text-warning"></i></td>
|
||||
<td class="label">Bitte auswählen...</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row hidden" id="termination-search-results-section">
|
||||
<label class="col-lg-2 col-form-label" for="">Anschluss auswählen *</label>
|
||||
<div class="col-lg-10">
|
||||
<table class="table table-striped table-hover" id="termination-search-results">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Bezeichung</th>
|
||||
<th>Kontakt</th>
|
||||
<th>Status</th>
|
||||
<th>Anschluss ID</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#building-search-results-section').hide();
|
||||
$('#building-search-selected').hide();
|
||||
|
||||
/**********************
|
||||
* Event handler
|
||||
**********************/
|
||||
// show Building Search when selecting Network
|
||||
$('#network_id').change(function() {
|
||||
var network_id = $('#network_id').val();
|
||||
if(network_id) {
|
||||
$('#building-search').show();
|
||||
$('#building_id_search').focus();
|
||||
} else {
|
||||
$('#building-search').hide();
|
||||
resetBuildingSearch();
|
||||
}
|
||||
});
|
||||
|
||||
$('#building_id_search').keyup(function() {
|
||||
var search = $('#building_id_search').val();
|
||||
var network_id = $('#network_id').val();
|
||||
|
||||
if(!network_id || search.length < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.post('<?=self::getUrl('Building','api')?>',
|
||||
{
|
||||
do: 'findBuildings',
|
||||
network_id: network_id,
|
||||
search: search
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
listSearchresults(success.result);
|
||||
}
|
||||
},
|
||||
'json');
|
||||
});
|
||||
|
||||
$('#building_id_search').keydown(function() {
|
||||
if(event.keyCode == 9 || event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
function listSearchresults(data) {
|
||||
resetSearchresults();
|
||||
var count = data.buildings.length;
|
||||
var count_total = data.count;
|
||||
|
||||
if(!("buildings" in data) || !count) {
|
||||
$('#building-search-results-section').hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#building-search-results-section').show();
|
||||
|
||||
data.buildings.forEach(function(b) {
|
||||
var line = '<tr class="result result-' + b.id + ' pointer" onclick="selectBuilding(' + b.id + ')">';
|
||||
line += '<td><input type="checkbox" readonly="readonly" onclick="selectBuilding(' + b.id + ')" name="building_id" value="' + b.id + '" data-zip="' + b.zip + '" data-city="' + b.city + '" data-street="' + b.street + '" data-code="' + b.code + '" data-oanid="' + b.oan_id + '" /></td>';
|
||||
line += "<td>" + b.street + "</td>";
|
||||
line += "<td>" + b.zip + "</td>";
|
||||
line += "<td>" + b.city + "</td>";
|
||||
line += "<td>" + b.code + "</td>";
|
||||
line += "<td>" + b.oan_id + "</td>";
|
||||
|
||||
$('#building-search-results').append(line);
|
||||
});
|
||||
console.log(count);
|
||||
console.log(count_total);
|
||||
if(count < count_total) {
|
||||
$('#building-search-results').append('<tr class="results-more bg-warning"><td><i class="fas fa-warning"></i></td><td colspan="5">Es wurden ' + (count_total - count) + ' weitere Suchergebnisse gefunden. Bitte verfeinern Sie die Suche!</td></tr>');
|
||||
} else {
|
||||
$('#building-search-results .results-more').remove();
|
||||
}
|
||||
}
|
||||
|
||||
function resetSearchresults() {
|
||||
$('#building-search-results .result').each(function() {
|
||||
this.remove();
|
||||
});
|
||||
$('#building-search-results .results-more').remove();
|
||||
}
|
||||
|
||||
function selectBuilding(id) {
|
||||
if($('input[name=building_id][value=' + id + ']').prop('checked')) {
|
||||
$('input[name=building_id][value=' + id + ']').prop('checked', false);
|
||||
|
||||
$('#building-search-selected .label').removeClass("font-weight-bold").text("Bitte auswählen...");
|
||||
$('#building-search-selected .check-mark i').removeClass().addClass("fas fa-question text-warning");
|
||||
} else {
|
||||
// check selected checkbox and uncheck all others
|
||||
$('input[name=building_id][value=' + id + ']').prop('checked', true);
|
||||
$('input[name=building_id]').each(function() {
|
||||
if($(this).val() != id) {
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
// write selected buildings address
|
||||
var street = $('input[name=building_id][value=' + id + ']').data("street");
|
||||
var zip = $('input[name=building_id][value=' + id + ']').data("zip");
|
||||
var city = $('input[name=building_id][value=' + id + ']').data("city");
|
||||
var code = $('input[name=building_id][value=' + id + ']').data("code");
|
||||
var oan_id = $('input[name=building_id][value=' + id + ']').data("oanid");
|
||||
|
||||
var label = street + "<br />" + zip + " " + city;
|
||||
if(code || oan_id) {
|
||||
label += "<br /><div style='font-weight: normal;'>";
|
||||
if(code) {
|
||||
label += "<br />Code: " + code;
|
||||
}
|
||||
if(oan_id) {
|
||||
label += "<br />OAN ID: " + oan_id;
|
||||
}
|
||||
label += "</div>";
|
||||
}
|
||||
$('#building-search-selected .label').addClass("font-weight-bold").html(label);
|
||||
$('#building-search-selected .check-mark i').removeClass().addClass("fas fa-check text-success");
|
||||
|
||||
$('#building-search-selected').show();
|
||||
|
||||
// get terminatiions
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function showTerminationSearch() {
|
||||
|
||||
}
|
||||
|
||||
function resetBuildingSearch() {
|
||||
resetSearchresults();
|
||||
$('#building-search-selected').hide();
|
||||
$('#building-search-selected .label').removeClass("font-weight-bold").text("Bitte auswählen...");
|
||||
$('#building-search-selected .check-mark i').removeClass().addClass("fas fa-question text-warning");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -70,7 +70,23 @@ class Address extends mfBaseModel {
|
||||
return $this->getFullName();
|
||||
}
|
||||
|
||||
public function getUserIds($childs = true) {
|
||||
$userIds = [];
|
||||
foreach(UserModel::search(['address_id' => $this->id]) as $user) {
|
||||
$userIds[] = $user->id;
|
||||
}
|
||||
|
||||
if($childs) {
|
||||
foreach(AddressModel::search(['parent_id' => $this->id]) as $child) {
|
||||
foreach(UserModel::search(['address_id' => $child->id]) as $user) {
|
||||
$userIds[] = $user->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$userIds = array_unique($userIds);
|
||||
return $userIds;
|
||||
}
|
||||
|
||||
public function loadAddresstypes() {
|
||||
if(!$this->id) {
|
||||
|
||||
@@ -148,7 +148,9 @@ class BuildingController extends mfBaseController {
|
||||
|
||||
$this->layout()->set("networksections", NetworksectionModel::getAll());
|
||||
|
||||
|
||||
if($this->request->network_id) {
|
||||
$this->layout()->set("request_network_id", $this->request->network_id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
@@ -415,6 +417,7 @@ class BuildingController extends mfBaseController {
|
||||
$u['city'] = $building->city;
|
||||
$u['oan_id'] = $building->oan_id;
|
||||
$u['code'] = $building->code;
|
||||
$u['units'] = ($building->units) ? $building->units : 1;
|
||||
$u['status'] = $building->status->name;
|
||||
$unsorted[$building->street."-".$building->id] = $u;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ class NetworkAddressController extends mfBaseController {
|
||||
foreach(TT_NETWORK_ROLES as $rolestring) {
|
||||
if(in_array($rolestring, $new_roles)) {
|
||||
// check if role exists
|
||||
if(NetworkAddressModel::search(['network_id' => $network, 'address_id' => $address_id, 'addresstype' => [$rolestring]])) {
|
||||
$existing_role = NetworkAddressModel::search(['network_id' => $network_id, 'address_id' => $address_id, 'addresstype' => [$rolestring]]);
|
||||
if($existing_role) {
|
||||
continue; // role exists
|
||||
} else {
|
||||
$na = NetworkAddressModel::create(['network_id' => $network_id, 'address_id' => $address_id, 'type' => $rolestring]);
|
||||
@@ -51,12 +52,11 @@ class NetworkAddressController extends mfBaseController {
|
||||
// role does not exist, create it
|
||||
} else {
|
||||
// not in new_roles, delete (if exists)
|
||||
$na = NetworkAddressModel::getFirst(['network_id' => $network, 'address_id' => $address_id, 'addresstype' => [$rolestring]]);
|
||||
$na = NetworkAddressModel::getFirst(['network_id' => $network_id, 'address_id' => $address_id, 'addresstype' => [$rolestring]]);
|
||||
if($na) {
|
||||
$na->delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$this->redirect("Network", "Index", [],"view=roles&net=$network_id");
|
||||
|
||||
@@ -83,10 +83,11 @@ class OrderController extends mfBaseController {
|
||||
}
|
||||
$this->layout()->set("mynetworks", $this->me->my_networks);
|
||||
}
|
||||
|
||||
unset($filter['network_id']);
|
||||
|
||||
// get Orders in my networks
|
||||
|
||||
//var_dump($my_networks);exit;
|
||||
$my_network_ids = [];
|
||||
$orders = [];
|
||||
//var_dump($this->me->my_networks);exit;
|
||||
@@ -111,6 +112,8 @@ class OrderController extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
$userIds = $this->me->getAddressOrParent()->getUserIds();
|
||||
//var_dump($userIds);exit;
|
||||
if(!array_key_exists("network_linked_status", $order_search)) {
|
||||
$lonelyOrders = [];
|
||||
unset($order_search["network_id"]);
|
||||
@@ -121,7 +124,8 @@ class OrderController extends mfBaseController {
|
||||
$lonelies = OrderModel::search($order_search);
|
||||
}
|
||||
} else {
|
||||
$order_search['create_by'] = $this->me->id;
|
||||
$order_search['create_by'] = $userIds;
|
||||
//var_dump($order_search);exit;
|
||||
$lonelies = OrderModel::search($order_search);
|
||||
}
|
||||
foreach($lonelies as $order) {
|
||||
@@ -138,7 +142,7 @@ class OrderController extends mfBaseController {
|
||||
$lonelies = OrderModel::search($order_search);
|
||||
}
|
||||
} else {
|
||||
$order_search['create_by'] = $this->me->id;
|
||||
$order_search['create_by'] = $userIds;
|
||||
$lonelies = OrderModel::search($order_search);
|
||||
}
|
||||
foreach($lonelies as $order) {
|
||||
|
||||
@@ -265,7 +265,9 @@ class OrderModel {
|
||||
|
||||
if(array_key_exists("create_by", $filter)) {
|
||||
$create_by = $filter['create_by'];
|
||||
if(is_numeric($create_by)) {
|
||||
if(is_array($create_by)) {
|
||||
$where .= " AND `Order`.create_by IN (".implode(",",$create_by).")";
|
||||
} elseif(is_numeric($create_by)) {
|
||||
$where .= " AND `Order`.create_by=$create_by";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,15 @@ class PreorderController extends mfBaseController {
|
||||
$this->layout()->set("networks", $this->me->my_networks);
|
||||
}
|
||||
|
||||
$this->layout()->set("types", BuildingtypeModel::getAll());
|
||||
$this->layout()->set("statuses", BuildingstatusModel::getAll());
|
||||
if(!$this->request->preordercampaign_id) {
|
||||
$this->layout()->setFlash("Keine Kampagne ausgewählt!", "warn");
|
||||
}
|
||||
|
||||
$campaign_id = $this->request->preordercampaign_id;
|
||||
$campaign = new Preordercampaign($campaign_id);
|
||||
$this->layout()->set("campaign", $campaign);
|
||||
|
||||
|
||||
$this->layout()->set("networksections", NetworksectionModel::getAll());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ class User extends mfBaseModel {
|
||||
foreach($my_networks as $net) {
|
||||
//var_dump($net);exit;
|
||||
$address_id = $this->address_id;
|
||||
if($this->getProperty("address")->parent_id) {
|
||||
$address_id = $this->getProperty("address")->parent_id;
|
||||
if($this->address->parent_id) {
|
||||
$address_id = $this->address->parent_id;
|
||||
}
|
||||
$found = NetworkaddressModel::search(['network_id' => $net->id, "addresstype" => [$type], 'address_id' => $address_id]);
|
||||
//var_dump($found);exit;
|
||||
@@ -217,4 +217,26 @@ class User extends mfBaseModel {
|
||||
|
||||
return $my_networks;
|
||||
}
|
||||
|
||||
public function getAddressOrParent() {
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!$this->address->parent_id) {
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
$parent = $this->address->parent;
|
||||
$p = $parent;
|
||||
while($p) {
|
||||
if(!$p->parent_id) {
|
||||
break;
|
||||
}
|
||||
$parent = $p->parent;
|
||||
}
|
||||
|
||||
return $parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user