Merge branch 'fronkdev' into 'master'
WIP PreorderProduct & hometrench in ConstructionConsent See merge request fronk/thetool!1048
This commit is contained in:
@@ -331,10 +331,16 @@
|
||||
if(!$("#plan_adb_hausnummer_id").val()) return;
|
||||
|
||||
var building_id = $('#plan_adb_hausnummer_id').val();
|
||||
var type = $("#object_type").val();
|
||||
// get plan image preview
|
||||
|
||||
try {
|
||||
var response = await fetch('<?=self::getUrl("ConstructionConsent", "Api", ["do" => "getRimoPlanPreview"])?>&building_id=' + building_id);
|
||||
var response;
|
||||
if(type == "building" ) {
|
||||
response = await fetch('<?=self::getUrl("ConstructionConsent", "Api", ["do" => "getRimoPlanPreview"])?>&building_id=' + building_id + '&include_home_trench=1');
|
||||
} else {
|
||||
response = await fetch('<?=self::getUrl("ConstructionConsent", "Api", ["do" => "getRimoPlanPreview"])?>&building_id=' + building_id);
|
||||
}
|
||||
if (!response.ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
192
Layout/default/PreorderProduct/Index.php
Normal file
192
Layout/default/PreorderProduct/Index.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?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("Preordercampaign")?>">Vorbestellkampagnen</a></li>
|
||||
<li class="breadcrumb-item active">Bepreisung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Kampagnenmanagement Preise</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3 bg-light">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="header-title">Kampagnenmanagement Preise</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<form class="form-inline" type="get" action="<?=self::getUrl("PreorderProduct")?>">
|
||||
<div class="form-group mx-sm-3 mb-2">
|
||||
<label for="view_date">Ansichtsdatum:</label>
|
||||
<input type="text" class="form-control datepicker-sys ml-2" name="view_date" placeholder="Datum..." value="<?=$today_date?>" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mb-2">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
<ul class="nav nav-tabs mb-0" id="netop-tabs" role="tablist">
|
||||
<?php $i = 0; foreach($netoperators as $netoperator): ?>
|
||||
<li class="nav-item" role="presentation">
|
||||
<!--a class="nav-link active" id="netop-<?=$netoperator->id?>-tab" data-toggle="tab" data-target="#netop-<?=$netoperator->id?>"><?=$netoperator->getCompanyOrName()?> (<?=$netoperator->id?>)</a-->
|
||||
<a href="#netop-<?=$netoperator->id?>" class="nav-link <?=($i === 0) ? "active" : ""?>" id="netop-<?=$netoperator->id?>-tab" data-toggle="pill" data-target="#netop-<?=$netoperator->id?>" type="button" role="tab" aria-controls="netop-<?=$netoperator->id?>" aria-selected="<?=($i === 0) ? "true" : "false"?>">
|
||||
<?=$netoperator->getCompanyOrName()?>
|
||||
</a>
|
||||
</li>
|
||||
<?php $i++; endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-0 pt-0" id="netop-tabs-content">
|
||||
<?php $i = 0; foreach($netoperators as $netoperator): ?>
|
||||
<div class="tab-pane fade <?=($i === 0) ? "show active" : ""?>" id="netop-<?=$netoperator->id?>" role="tabpanel">
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
|
||||
<h4>Produkte für Netzbetreiber <?=$netoperator->getCompanyOrName()?></h4>
|
||||
<?php foreach($products as $product): ?>
|
||||
<?php $product->setNetoperatorId($netoperator->id) ?>
|
||||
<?php $product->setTodayDate($today_date); ?>
|
||||
<?php //$prices = (array_key_exists($netoperator->id, $product->prices)) ? $product->prices[$netoperator->id] : false; ?>
|
||||
<div class="card mt-4">
|
||||
<div class="card-header" >
|
||||
<h4 class="pointer"
|
||||
data-toggle="collapse" data-target="#price-detail-<?=$netoperator->id?>-<?=$product->id?>"
|
||||
id="price-detail-<?=$netoperator->id?>-<?=$product->id?>-collapse" data-collapse-indicator="fa-chevron" onclick="toggleCollapseIndicator(this)"
|
||||
>
|
||||
<i class="fas fa-fw fa-chevron-right collapse-indicator"></i> <span class="text-pink"><?=$product->name?></span>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-body mb-3 collapse" id="price-detail-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<?php if($product->type == "operator_setup"): ?>
|
||||
<?php include(__DIR__."/include/prices-setup.php"); ?>
|
||||
<?php elseif($product->type == "enduser_setup"): ?>
|
||||
<?php include(__DIR__."/include/prices-setup.php"); ?>
|
||||
<?php elseif($product->type == "operator_usage"): ?>
|
||||
<?php include(__DIR__."/include/netoperator-prices-usage.php"); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.datepicker').datepicker({
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker-sys').datepicker({
|
||||
language: 'de',
|
||||
format: "yyyy-mm-dd",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$(".select2").select2({
|
||||
allowClear: true,
|
||||
placeholder: "",
|
||||
closeOnSelect: true
|
||||
});
|
||||
|
||||
$(".select2-nc").select2({
|
||||
allowClear: true,
|
||||
placeholder: "",
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
function toggleCollapseIndicator(elem) {
|
||||
var selector = "#" + $(elem).attr("id");
|
||||
var itype = $(elem).data("collapse-indicator");
|
||||
|
||||
//console.log("selector: " + selector);
|
||||
|
||||
if($(selector + " i.collapse-indicator").hasClass(itype + "-right")) {
|
||||
$(selector + " i.collapse-indicator").removeClass(itype + "-right").addClass(itype + "-down");
|
||||
} else {
|
||||
$(selector + " i.collapse-indicator").removeClass(itype + "-down").addClass(itype + "-right");
|
||||
}
|
||||
}
|
||||
|
||||
function priceToMarketshare(netop_id, product_id, type) {
|
||||
console.log(netop_id, product_id, type);
|
||||
|
||||
let price = $("#price-" + type + "-" + netop_id + "-" + product_id).val();
|
||||
console.log(price);
|
||||
if(!price.length) return;
|
||||
|
||||
$("#marketshare-0-" + netop_id + "-" + product_id + "-" + type).val(price);
|
||||
}
|
||||
|
||||
function marketshareToPrice(netop_id, product_id, type) {
|
||||
console.log(netop_id, product_id, type);
|
||||
|
||||
let price = $("#marketshare-0-" + netop_id + "-" + product_id + "-" + type).val();
|
||||
console.log(price);
|
||||
if(!price.length) return;
|
||||
|
||||
$("#price-" + type + "-" + netop_id + "-" + product_id).val(price);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var hash = window.location.hash.substring(1);
|
||||
var match = hash.match(/product-(\d+)(?:-(\d)+)?/);
|
||||
console.log(match);
|
||||
if(match && typeof match[1] !== 'undefined') {
|
||||
var netop = match[1];
|
||||
|
||||
console.log('$("#netop-' + netop + '-tab").tab("show");');
|
||||
$("#netop-" + netop + "-tab").tab('show');
|
||||
if(typeof match[2] !== 'undefined') {
|
||||
let prod_id = match[2];
|
||||
$("#price-detail-" + netop + "-" + prod_id).collapse('toggle');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* @var Address $netowner
|
||||
* @var Address $netoperator
|
||||
* @var PreorderProduct $product
|
||||
* @var Array $campaigns
|
||||
* @var string $today_date
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="row" id="netop-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<?php
|
||||
$current_price = $product->getCurrentPrice($today_date, true);
|
||||
$current_regular_price = $product->getCurrentRegularPrice($today_date, true);
|
||||
$first_price = $product->getFirstPrice($today_date);
|
||||
?>
|
||||
<div class="col-7">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4>Aktuelle Preise für <?=$product->getTodayDate()?></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>INET</th>
|
||||
<th>INET+TV</th>
|
||||
<th>CATV</th>
|
||||
<th>Passive</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Heute gültiger Preis</th>
|
||||
<td class="text-monospace">€ <?=number_format($current_price->price_inet, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_price->price_inet_tv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_price->price_catv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_price->price_passive, 2, ",", ".")?></td>
|
||||
<td>
|
||||
<?=$current_price->description?>
|
||||
<?php if($current_price->end_date): ?>
|
||||
bis <?=(new DateTime($current_price->end_date))->format("d.m.Y")?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Derzeit regulärer Preis</th>
|
||||
<td class="text-monospace">€ <?=number_format($current_regular_price->price_inet, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_regular_price->price_inet_tv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_regular_price->price_catv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($current_regular_price->price_passive, 2, ",", ".")?></td>
|
||||
<td><?=$current_regular_price->description?></td>
|
||||
</tr><tr>
|
||||
<td>Initialpreis</td>
|
||||
<td class="text-monospace">€ <?=number_format($first_price->price_inet, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($first_price->price_inet_tv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($first_price->price_catv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($first_price->price_passive, 2, ",", ".")?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4>Preise Netzdurchdringung</h4>
|
||||
|
||||
<h5>Heute gültige Preise</h5>
|
||||
Gültig von: <?=($current_price->start_date) ? (new DateTime($current_price->start_date))->format("d.m.Y") : ""?><br />
|
||||
Gültig bis: <?=($current_price->end_date) ? (new DateTime($current_price->end_date))->format("d.m.Y") : ""?>
|
||||
<table class="table table-sm table-striped table-hover">
|
||||
<tr>
|
||||
<th>Gruppe</th>
|
||||
<th>INET</th>
|
||||
<th>INET+TV</th>
|
||||
<th>CATV</th>
|
||||
<th>Passive</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>0 - 15%</td>
|
||||
<td><?=$current_price->price_inet?></td>
|
||||
<td><?=$current_price->price_inet_tv?></td>
|
||||
<td><?=$current_price->price_catv?></td>
|
||||
<td><?=$current_price->price_passive?></td>
|
||||
</tr>
|
||||
<?php foreach($current_price->marketsharediscounts as $bracket => $discount): ?>
|
||||
<tr>
|
||||
<td><?=$bracket?>% - <?=($bracket+5)?>%</td>
|
||||
<td><?=$discount->price_inet?></td>
|
||||
<td><?=$discount->price_inet_tv?></td>
|
||||
<td><?=$discount->price_catv?></td>
|
||||
<td><?=$discount->price_passive?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
<form method="post" action="<?=self::getUrl("PreorderProduct", "save")?>">
|
||||
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-outline-success" onclick='$("#pricehistory-<?=$netoperator->id?>-<?=$product->id?>").toggle()'><i class="fas fa-fw fa-list"></i> Preishistory anzeigen</button>
|
||||
</div>
|
||||
|
||||
<div class="row hidden" id="pricehistory-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<table class="table table-sm table-striped table-hover">
|
||||
<tr>
|
||||
<th>INET</th>
|
||||
<th>INET+TV</th>
|
||||
<th>CATV</th>
|
||||
<th>Passive</th>
|
||||
<th>Gültig von</th>
|
||||
<th>Gültig bis</th>
|
||||
<th>Kampagnen</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Erstellt von</th>
|
||||
</tr>
|
||||
<?php foreach(PreorderProductPrice::search(["netowner_id" => $netowner->id, "preorderproduct_id" => $product->id, "netoperator_id" => $netoperator->id]) as $line): ?>
|
||||
<tr>
|
||||
<td class="text-monospace">€ <?=number_format($line->price_inet, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($line->price_inet_tv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($line->price_catv, 2, ",", ".")?></td>
|
||||
<td class="text-monospace">€ <?=number_format($line->price_passive, 2, ",", ".")?></td>
|
||||
<td class="text-monospace"><?=($line->start_date) ? (new DateTime($line->start_date))->format("d.m.Y") : "-"?></td>
|
||||
<td class="text-monospace"><?=($line->end_date) ? (new DateTime($line->end_date))->format("d.m.Y") : "-"?></td>
|
||||
<td><?=(is_array($line->campaigns) && count($line->campaigns)) ? count($line->campaigns) : ""?></td>
|
||||
<td><?=$line->description?></td>
|
||||
<td title="Erstellt <?=date("d.m.Y", $line->create)?>"><?=$line->creator->name?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="pointer text-info" data-toggle="collapse" data-target="#new-price-<?=$netoperator->id?>-<?=$product->id?>"
|
||||
id="new-price-<?=$netoperator->id?>-<?=$product->id?>-collapse" data-collapse-indicator="fa-circle-chevron"
|
||||
onclick="toggleCollapseIndicator(this)">
|
||||
<i class="fas fa-fw fa-circle-chevron-right collapse-indicator"></i> Neuen Preis eingeben
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-body collapse" id="new-price-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Beschreibung</label>
|
||||
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][description]" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Preis Internet</label>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="price-inet-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'inet')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Preis Internet + TV</label>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="price-inet_tv-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_inet_tv]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'inet_tv')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Preis Cable-TV</label>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="price-catv-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_catv]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'catv')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Preis Passive Leitung</label>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="price-passive-<?=$netoperator->id?>-<?=$product->id?>" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_passive]" value="" onchange="priceToMarketshare(<?=$netoperator->id?>, <?=$product->id?>, 'passive')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gültigkeit</label>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Preis gültig von</span>
|
||||
</div>
|
||||
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][start_date]" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Preis gültig bis</span>
|
||||
</div>
|
||||
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][end_date]" value="" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<small>
|
||||
Ohne <strong>Gültig-Bis-Datum</strong> gilt der neue Preis für immer, bis ein neuer Preis eingetragen wird.<br />
|
||||
Mit <strong>Gültig-Bis-Datum</strong> gilt der neue Preis bis einschließlich dem <strong>Gültig-Bis-Datum</strong>, danach gilt der vorige Preis wieder.
|
||||
</small>
|
||||
|
||||
<!--div class="row mt-3">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Nur gültig in folgenden Kampagnen</label>
|
||||
<select class="select2-nc form-control select2-multiple" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][campaigns][]" multiple="multiple" data-placeholder="Kampagnen ...">
|
||||
<?php foreach ($campaigns as $campaign): ?>
|
||||
<option value="<?= $campaign->id ?>" <?= (is_array($product->campaigns) && array_key_exists($campaign->id, $product->campaigns)) ? "selected='selected'" : "" ?>><?= $campaign->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small>
|
||||
Wenn keine Kampagne ausgewählt wird, gilt der Preis für alle Kampagnen.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<h4 class="mt-3">Netzdurchdringung</h4>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Rabattierte Preise für das Erreichen on Netzdurchdringungszielen</p>
|
||||
<p>0 - 15% ist der Standardpreis </p>
|
||||
<table class="table table-sm table-bordered table-striped table-hover">
|
||||
<tr>
|
||||
<th>Ziel</th>
|
||||
<th>INET</th>
|
||||
<th>INET+TV</th>
|
||||
<th>CATV</th>
|
||||
<th>Passive</th>
|
||||
</tr><tr>
|
||||
<th>0 - 15%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][inet]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'inet')" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][inet_tv]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'inet_tv')" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][catv]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'catv')" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-0-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][0][passive]" onchange="marketshareToPrice(<?=$netoperator->id?>, <?=$product->id?>, 'passive')" /></th>
|
||||
</tr><tr>
|
||||
<th>15,01% - 20%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-15-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][15][passive]" /></th>
|
||||
</tr><tr>
|
||||
<th>20,01% - 25%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-20-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][20][passive]" /></th>
|
||||
</tr><tr>
|
||||
<th>25,01% - 30%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-25-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][25][passive]" /></th>
|
||||
</tr><tr>
|
||||
<th>30,01% - 35%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-30-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][30][passive]" /></th>
|
||||
</tr><tr>
|
||||
<th>35,01% - 40%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-35-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][35][passive]" /></th>
|
||||
</tr><tr>
|
||||
<th>40,01% - 45%</th>
|
||||
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-inet" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][inet]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-inet_tv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][inet_tv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-catv" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][catv]" /></th>
|
||||
<th><input type="text" class="form-control" id="marketshare-40-<?=$netoperator->id?>-<?=$product->id?>-passive" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][marketshareprice][40][passive]" /></th>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary mt-2" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
185
Layout/default/PreorderProduct/include/prices-setup.php
Normal file
185
Layout/default/PreorderProduct/include/prices-setup.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* @var Address $netowner
|
||||
* @var Address $netoperator
|
||||
* @var PreorderProduct $product
|
||||
* @var Array $campaigns
|
||||
* @var string $today_date
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="row" id="netop-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<?php
|
||||
$current_price = $product->getCurrentPrice($today_date, true);
|
||||
$current_regular_price = $product->getCurrentRegularPrice($today_date, true);
|
||||
$first_price = $product->getFirstPrice($today_date);
|
||||
?>
|
||||
<div class="col-7">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4>Aktuelle Preise für <?=$product->getTodayDate()?></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Heute gültiger Preis</th>
|
||||
<td class="text-monospace">€ <?=number_format($current_price->price_setup, 2, ",", ".")?></td>
|
||||
<td>
|
||||
<?=$current_price->description?>
|
||||
<?php if($current_price->end_date): ?>
|
||||
bis <?=(new DateTime($current_price->end_date))->format("d.m.Y")?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Derzeit regulärer Preis</th>
|
||||
<td class="text-monospace">€ <?=number_format($current_regular_price->price_setup, 2, ",", ".")?></td>
|
||||
<td><?=$current_regular_price->description?></td>
|
||||
</tr><tr>
|
||||
<td>Initialpreis <span class="text-monospace">€ <?=number_format($first_price->price_setup, 2, ",", ".")?></span></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4>Preis Pro Kampagne</h4>
|
||||
<table class="table table-sm table-striped table-hover">
|
||||
<tr>
|
||||
<th>Kampagne</th>
|
||||
<th>Preis</th>
|
||||
<th>Gültig von</th>
|
||||
<th>Gültig bis</th>
|
||||
<th>Beschreibung</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($campaigns as $campaign): ?>
|
||||
<?php $cprice = $product->getCampaignPrice($campaign->id, $today_date); ?>
|
||||
<tr>
|
||||
<td><?=$campaign->name?></td>
|
||||
<td class="text-monospace">€ <?=number_format($cprice->price_setup, 2, ",", ".")?></td>
|
||||
<td class="text-monospace"><?=($cprice->start_date) ? (new DateTime($cprice->start_date))->format("d.m.Y") : "-"?></td>
|
||||
<td class="text-monospace"><?=($cprice->end_date) ? (new DateTime($cprice->end_date))->format("d.m.Y") : "-"?></td>
|
||||
<td><?=$cprice->description?></td>
|
||||
<td><?=$product->getTodayDate()?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<form method="post" action="<?=self::getUrl("PreorderProduct", "save")?>">
|
||||
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-outline-success" onclick='$("#pricehistory-<?=$netoperator->id?>-<?=$product->id?>").toggle()'><i class="fas fa-fw fa-list"></i> Preishistory anzeigen</button>
|
||||
</div>
|
||||
|
||||
<div class="row hidden" id="pricehistory-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<table class="table table-sm table-striped table-hover">
|
||||
<tr>
|
||||
<th>Preis</th>
|
||||
<th>Gültig von</th>
|
||||
<th>Gültig bis</th>
|
||||
<th>Kampagnen</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Erstellt von</th>
|
||||
</tr>
|
||||
<?php foreach(PreorderProductPrice::search(["netowner_id" => $netowner->id, "preorderproduct_id" => $product->id, "netoperator_id" => $netoperator->id]) as $line): ?>
|
||||
<tr>
|
||||
<td class="text-monospace">€ <?=number_format($line->price_setup, 2, ",", ".")?></td>
|
||||
<td class="text-monospace"><?=($line->start_date) ? (new DateTime($line->start_date))->format("d.m.Y") : "-"?></td>
|
||||
<td class="text-monospace"><?=($line->end_date) ? (new DateTime($line->end_date))->format("d.m.Y") : "-"?></td>
|
||||
<td><?=(is_array($line->campaigns) && count($line->campaigns)) ? count($line->campaigns) : ""?></td>
|
||||
<td><?=$line->description?></td>
|
||||
<td title="Erstellt <?=date("d.m.Y H:i", $line->create)?>"><?=$line->creator->name?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="pointer text-info" data-toggle="collapse" data-target="#new-price-<?=$netoperator->id?>-<?=$product->id?>"
|
||||
id="new-price-<?=$netoperator->id?>-<?=$product->id?>-collapse" data-collapse-indicator="fa-circle-chevron"
|
||||
onclick="toggleCollapseIndicator(this)">
|
||||
<i class="fas fa-fw fa-circle-chevron-right collapse-indicator"></i> Neuen Preis eingeben
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-body collapse" id="new-price-<?=$netoperator->id?>-<?=$product->id?>">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Beschreibung</label>
|
||||
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][description]" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Preis</label>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">€</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][price_setup]" value="" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gültigkeit</label>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Preis gültig von</span>
|
||||
</div>
|
||||
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][start_date]" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Preis gültig bis</span>
|
||||
</div>
|
||||
<input type="text" class="form-control datepicker" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][end_date]" value="" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<small>
|
||||
Ohne <strong>Gültig-Bis-Datum</strong> gilt der neue Preis für immer, bis ein neuer Preis eingetragen wird.<br />
|
||||
Mit <strong>Gültig-Bis-Datum</strong> gilt der neue Preis bis einschließlich dem <strong>Gültig-Bis-Datum</strong>, danach gilt der vorige Preis wieder.
|
||||
</small>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Nur gültig in folgenden Kampagnen</label>
|
||||
<select class="select2-nc form-control select2-multiple" name="netoperators[<?=$netoperator->id?>][<?=$product->id?>][campaigns][]" multiple="multiple" data-placeholder="Kampagnen ...">
|
||||
<?php foreach ($campaigns as $campaign): ?>
|
||||
<option value="<?= $campaign->id ?>" <?= (is_array($product->campaigns) && array_key_exists($campaign->id, $product->campaigns)) ? "selected='selected'" : "" ?>><?= $campaign->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small>
|
||||
Wenn keine Kampagne ausgewählt wird, gilt der Preis für alle Kampagnen.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary mt-2" value="Speichern" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,377 +1,516 @@
|
||||
<?php
|
||||
$siteTitle = "Benutzer";
|
||||
$siteTitle = "Benutzer";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
<?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("User")?>">Benutzer</a></li>
|
||||
<li class="breadcrumb-item"><?=($action == "edit") ? "bearbeiten" : "neu"?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Benutzer</h4>
|
||||
<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("User")?>">Benutzer</a></li>
|
||||
<li class="breadcrumb-item"><?=($action == "edit") ? "bearbeiten" : "neu"?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Benutzer</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="row">
|
||||
<div class="col-lg">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-3">Benutzer bearbeiten</h4>
|
||||
<form method="post" action="<?=$this->getUrl("User", "save")?>">
|
||||
<!-- Main content -->
|
||||
<div class="row">
|
||||
<div class="col-lg">
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-3">Benutzer bearbeiten</h4>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<form method="post" action="<?=$this->getUrl("User","save")?>">
|
||||
<input type="hidden" name="id" value="<?=$user->id?>" />
|
||||
<div class="form-group">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" class="form-control" value="<?=$user->username?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" class="form-control" value="<?=$user->name?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" id="email" name="email" class="form-control" value="<?=$user->email?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobile">Handy Nr.:</label>
|
||||
<input type="text" id="mobile" placeholder="+436641234xxx" name="mobile" class="form-control" value="<?=$user->mobile?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="address_id">Firma/Person:</label>
|
||||
<select name="address_id" id="address_id" class="form-control">
|
||||
<option value=""></option>
|
||||
<?php foreach($addresses as $address): ?>
|
||||
<option value="<?=$address->id?>" <?=($address->id == $user->address_id || $address->id == $user->address_id) ? "selected='selected'" : ""?>><?=($address->company) ? $address->company : $address->getFullName()?><?=($address->customer_number) ? " (".$address->customer_number.")" : ""?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="admin">Admin:</label>
|
||||
<select name="admin" id="admin" class="form-control" <?=($user->id == 1) ? "disabled='disabled'" : ""?>>
|
||||
<option value="false" <?=(isset($user) && !$user->isAdmin()) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->isAdmin() || $user->id == 1) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="employee"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiter:</label>
|
||||
<select name="employee" id="employee" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("employee")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("employee")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>" id="employee-number-container">
|
||||
<label for="employee_number"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiternummer:</label>
|
||||
<input type="text" id="employee_number" name="employee_number" class="form-control" value="<?=(isset($user)) ? (new WorkerFlag($user->id, "employee_number"))->value() : ""?>" />
|
||||
</div>
|
||||
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>" id="project-api-key-container">
|
||||
<label for="project_api_key">OpenProject API Key:</label>
|
||||
<input type="text" id="project_api_key" name="project_api_key" class="form-control" value="<?=(isset($user)) ? (new WorkerFlag($user->id, "project_api_key"))->value() : ""?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="technician">Techniker:</label>
|
||||
<select name="technician" id="technician" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("technician")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("technician")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="preorderfront-container">
|
||||
<label for="preorderfront">Preorder Frontdesk (Semi-Readonly):</label>
|
||||
<select name="preorderfront" id="preorderfront" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderfront")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderfront")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorder-reporting-container">
|
||||
<label for="preorderaddressreporting">Preorder Address Reporting API User:</label>
|
||||
<select name="preorderaddressreporting" id="preorderaddressreporting" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
<small>z.B. Meridiam</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorderlogistics-container">
|
||||
<label for="preorderlogistics">Preorder Logistikpartner:</label>
|
||||
<select name="preorderlogistics" id="preorderlogistics" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderlogistics")) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderlogistics")) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" class="form-control" value="" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password2">Repeat Password:</label>
|
||||
<input type="password" id="password2" name="password2" class="form-control" value="" />
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="twofactorrequired">2FA erzwingen:</label>
|
||||
<select name="twofactorrequired" id="twofactorrequired" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->twofactorrequired) ? "selected='selected'" : ""?>>No</option>
|
||||
<option value="true" <?=( (!isset($user) || !$user->id) || (isset($user) && $user->twofactorrequired)) ? "selected='selected'" : ""?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<h4 class="card-title mb-3">Beschränkungen</h4>
|
||||
|
||||
<div class="form-group" id="preorder-network-container">
|
||||
<label for="preorder_networks">Preorder Netzgebiete:</label>
|
||||
<?php
|
||||
$pns = [];
|
||||
if($user->id) {
|
||||
$pns = json_decode((new WorkerFlag($user->id,"preorder_networks"))->value());
|
||||
if(!$pns) {
|
||||
$pns = [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<select name="preorder_networks[]" id="preorder_networks" class="form-control" multiple="multiple">
|
||||
<?php foreach(NetworkModel::getAll() as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=(in_array($network->id, $pns)) ? "selected='selected'" : ""?>><?=$network->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small>Beschränkt Benutzer auf Netzgebiete. Überschreibt Netzgebiete der Firma. Wenn leer werden Netzgebiete der Firma angezeigt</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorderreadonly-container">
|
||||
<label for="preorderreadonly">Preorder Readonly:</label>
|
||||
<select name="preorderreadonly" id="preorderreadonly" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderreadonly")) ? "selected='selected'" : ""?>>Read/Write</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderreadonly")) ? "selected='selected'" : ""?>>Readonly</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?=$user->id?>"/>
|
||||
<div class="form-group">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" class="form-control"
|
||||
value="<?=$user->username?>"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" class="form-control"
|
||||
value="<?=$user->name?>"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" id="email" name="email" class="form-control"
|
||||
value="<?=$user->email?>"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobile">Handy Nr.:</label>
|
||||
<input type="text" id="mobile" placeholder="+436641234xxx" name="mobile"
|
||||
class="form-control" value="<?=$user->mobile?>"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="address_id">Firma/Person:</label>
|
||||
<select name="address_id" id="address_id" class="form-control">
|
||||
<option value=""></option>
|
||||
<?php foreach($addresses as $address): ?>
|
||||
<option value="<?=$address->id?>" <?=($address->id == $user->address_id || $address->id == $user->address_id) ? "selected='selected'" : ""?>><?=($address->company) ? $address->company : $address->getFullName()?><?=($address->customer_number) ? " (" . $address->customer_number . ")" : ""?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="admin">Admin:</label>
|
||||
<select name="admin" id="admin"
|
||||
class="form-control" <?=($user->id == 1) ? "disabled='disabled'" : ""?>>
|
||||
<option value="false" <?=(isset($user) && !$user->isAdmin()) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->isAdmin() || $user->id == 1) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="technician">Techniker:</label>
|
||||
<select name="technician" id="technician" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("technician")) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("technician")) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="employee"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiter:</label>
|
||||
<select name="employee" id="employee" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("employee")) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("employee")) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>"
|
||||
id="employee-number-container">
|
||||
<label for="employee_number"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiternummer:</label>
|
||||
<input type="text" id="employee_number" name="employee_number" class="form-control"
|
||||
value="<?=(isset($user)) ? (new WorkerFlag($user->id, "employee_number"))->value() : ""?>"/>
|
||||
</div>
|
||||
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>"
|
||||
id="project-api-key-container">
|
||||
<label for="project_api_key">OpenProject API Key:</label>
|
||||
<input type="text" id="project_api_key" name="project_api_key" class="form-control"
|
||||
value="<?=(isset($user)) ? (new WorkerFlag($user->id, "project_api_key"))->value() : ""?>"/>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<h4 class="card-title mb-3">Modulberechtigungen</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Building]" id="can_building" value="1" <?=($user && $user->can("Building")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_building" class="form-check-label">Objekte & Anschlüsse (Gebäude)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Pipework]" id="can_pipework" value="1" <?=$user && $user->can("Pipework") ? "checked='checked'" : ""?> />
|
||||
<label for="can_pipework" class="form-check-label">Tiefbau</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Linework]" id="can_linework" value="1" <?=$user && $user->can("Linework") ? "checked='checked'" : ""?> />
|
||||
<label for="can_linework" class="form-check-label">Leitungsbau</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Patching]" id="can_patching" value="1" <?=$user && $user->can("Patching") ? "checked='checked'" : ""?> />
|
||||
<label for="can_patching" class="form-check-label">Patching</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Filestore]" id="can_filestore" value="1" <?=$user && $user->can("Filestore") ? "checked='checked'" : ""?> />
|
||||
<label for="can_filestore" class="form-check-label">Filestore (Netzbau)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Cpeprovisioning]" id="can_cpeprovisioning" value="1" <?=$user && $user->can("Cpeprovisioning") ? "checked='checked'" : ""?> />
|
||||
<label for="can_cpeprovisioning" class="form-check-label">CPE Provisioning</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Cpeshipping]" id="can_cpeshipping" value="1" <?=$user && $user->can("Cpeshipping") ? "checked='checked'" : ""?> />
|
||||
<label for="can_cpeshipping" class="form-check-label">CPE Versand</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Voipnumbering]" id="can_voipnumbering" value="1" <?=$user && $user->can("Voipnumbering") ? "checked='checked'" : ""?> />
|
||||
<label for="can_voipnumbering" class="form-check-label">VOIP Nummernverwaltung</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Preorder]" id="can_preorder" value="1" <?=$user && $user->can("Preorder") ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorder" class="form-check-label">Vorbestellung</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Order]" id="can_order" value="1" <?=$user && $user->can("Order") ? "checked='checked'" : ""?> />
|
||||
<label for="can_order" class="form-check-label">Bestellung</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Billing]" id="can_billing" value="1" <?=$user && $user->can("Billing") ? "checked='checked'" : ""?> />
|
||||
<label for="can_billing" class="form-check-label">Verrechnung</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="card-title mb-3 mt-3">Lager</h4>
|
||||
<div class="form-group">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" class="form-control" value=""/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password2">Repeat Password:</label>
|
||||
<input type="password" id="password2" name="password2" class="form-control"
|
||||
value=""/>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseAdmin]" id="can_warehouse_admin" value="1" <?=($user && $user->can("WarehouseAdmin")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_admin" class="form-check-label">Lager-Admin</label>
|
||||
<hr/>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="twofactorrequired">2FA erzwingen:</label>
|
||||
<select name="twofactorrequired" id="twofactorrequired" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->twofactorrequired) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=((!isset($user) || !$user->id) || (isset($user) && $user->twofactorrequired)) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseUser]" id="can_warehouse_user" value="1" <?=($user && $user->can("WarehouseUser")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_user" class="form-check-label">Lager-User</label>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<h4 class="card-title mb-3">Preorder</h4>
|
||||
|
||||
<div class="form-group" id="preorderfront-container">
|
||||
<label for="preorderfront">Preorder Frontdesk (Semi-Readonly):</label>
|
||||
<select name="preorderfront" id="preorderfront" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderfront")) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderfront")) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorder-reporting-container">
|
||||
<label for="preorderaddressreporting">Preorder Address Reporting API User:</label>
|
||||
<select name="preorderaddressreporting" id="preorderaddressreporting"
|
||||
class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
<small>z.B. Meridiam</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorderlogistics-container">
|
||||
<label for="preorderlogistics">Preorder Logistikpartner:</label>
|
||||
<select name="preorderlogistics" id="preorderlogistics" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderlogistics")) ? "selected='selected'" : ""?>>
|
||||
No
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderlogistics")) ? "selected='selected'" : ""?>>
|
||||
Yes
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorder-network-container">
|
||||
<label for="preorder_networks">Preorder Netzgebiete:</label>
|
||||
<?php
|
||||
$pns = [];
|
||||
if($user->id) {
|
||||
$pns = json_decode((new WorkerFlag($user->id, "preorder_networks"))->value());
|
||||
if(!$pns) {
|
||||
$pns = [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<select name="preorder_networks[]" id="preorder_networks" class="form-control"
|
||||
multiple="multiple">
|
||||
<?php foreach(NetworkModel::getAll() as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=(in_array($network->id, $pns)) ? "selected='selected'" : ""?>><?=$network->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small>Beschränkt Benutzer auf Netzgebiete. Überschreibt Netzgebiete der Firma. Wenn
|
||||
leer werden Netzgebiete der Firma angezeigt</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="preorderreadonly-container">
|
||||
<label for="preorderreadonly">Preorder Readonly:</label>
|
||||
<select name="preorderreadonly" id="preorderreadonly" class="form-control">
|
||||
<option value="false" <?=(isset($user) && !$user->is("preorderreadonly")) ? "selected='selected'" : ""?>>
|
||||
Read/Write
|
||||
</option>
|
||||
<option value="true" <?=(isset($user) && $user->is("preorderreadonly")) ? "selected='selected'" : ""?>>
|
||||
Readonly
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<h4 class="mt-2">Preorder Module</h4>
|
||||
<div class="row mt-3">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Preorderpricing]"
|
||||
id="can_preorderpricing"
|
||||
value="1" <?=($user && $user->can("Preorderpricing")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorderpricing" class="form-check-label">Preorder
|
||||
Bepreisung</label>
|
||||
</div>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input"
|
||||
name="can[PreorderpricingReadonly]" id="can_preorderpricingreadonly"
|
||||
value="1" <?=$user && $user->can("PreorderpricingReadonly") ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorderpricingreadonly" class="form-check-label">Preorder
|
||||
Bepreisung Readonly</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Preorderbilling]"
|
||||
id="can_preorderbilling"
|
||||
value="1" <?=($user && $user->can("Preorderbilling")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorderbilling" class="form-check-label">Preorder
|
||||
Verrechnung</label>
|
||||
</div>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input"
|
||||
name="can[PreorderbillingReadonly]" id="can_preorderbillingreadonly"
|
||||
value="1" <?=$user && $user->can("PreorderbillingReadonly") ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorderbillingreadonly" class="form-check-label">Preorder
|
||||
Verrechnung Readonly</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<h4 class="card-title mb-3">Modulberechtigungen</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Building]"
|
||||
id="can_building"
|
||||
value="1" <?=($user && $user->can("Building")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_building" class="form-check-label">Objekte & Anschlüsse
|
||||
(Gebäude)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Pipework]"
|
||||
id="can_pipework"
|
||||
value="1" <?=$user && $user->can("Pipework") ? "checked='checked'" : ""?> />
|
||||
<label for="can_pipework" class="form-check-label">Tiefbau</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Linework]"
|
||||
id="can_linework"
|
||||
value="1" <?=$user && $user->can("Linework") ? "checked='checked'" : ""?> />
|
||||
<label for="can_linework" class="form-check-label">Leitungsbau</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Patching]"
|
||||
id="can_patching"
|
||||
value="1" <?=$user && $user->can("Patching") ? "checked='checked'" : ""?> />
|
||||
<label for="can_patching" class="form-check-label">Patching</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Filestore]"
|
||||
id="can_filestore"
|
||||
value="1" <?=$user && $user->can("Filestore") ? "checked='checked'" : ""?> />
|
||||
<label for="can_filestore" class="form-check-label">Filestore
|
||||
(Netzbau)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Cpeprovisioning]"
|
||||
id="can_cpeprovisioning"
|
||||
value="1" <?=$user && $user->can("Cpeprovisioning") ? "checked='checked'" : ""?> />
|
||||
<label for="can_cpeprovisioning" class="form-check-label">CPE
|
||||
Provisioning</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Cpeshipping]"
|
||||
id="can_cpeshipping"
|
||||
value="1" <?=$user && $user->can("Cpeshipping") ? "checked='checked'" : ""?> />
|
||||
<label for="can_cpeshipping" class="form-check-label">CPE Versand</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Voipnumbering]"
|
||||
id="can_voipnumbering"
|
||||
value="1" <?=$user && $user->can("Voipnumbering") ? "checked='checked'" : ""?> />
|
||||
<label for="can_voipnumbering" class="form-check-label">VOIP
|
||||
Nummernverwaltung</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Preorder]"
|
||||
id="can_preorder"
|
||||
value="1" <?=$user && $user->can("Preorder") ? "checked='checked'" : ""?> />
|
||||
<label for="can_preorder" class="form-check-label">Vorbestellung</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Order]"
|
||||
id="can_order"
|
||||
value="1" <?=$user && $user->can("Order") ? "checked='checked'" : ""?> />
|
||||
<label for="can_order" class="form-check-label">Bestellung</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Billing]"
|
||||
id="can_billing"
|
||||
value="1" <?=$user && $user->can("Billing") ? "checked='checked'" : ""?> />
|
||||
<label for="can_billing" class="form-check-label">Verrechnung</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="card-title mb-3 mt-3">Lager</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseAdmin]"
|
||||
id="can_warehouse_admin"
|
||||
value="1" <?=($user && $user->can("WarehouseAdmin")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_admin"
|
||||
class="form-check-label">Lager-Admin</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseUser]"
|
||||
id="can_warehouse_user"
|
||||
value="1" <?=($user && $user->can("WarehouseUser")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_user" class="form-check-label">Lager-User</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseEShop]"
|
||||
id="can_warehouse_e_shop"
|
||||
value="1" <?=($user && $user->can("WarehouseEShop")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_e_shop" class="form-check-label">Energie
|
||||
Steiermark Shop</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="card-title mb-3 mt-3">Zusatzberechtigungen</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Fibu]"
|
||||
id="can_fibu"
|
||||
value="1" <?=($user && $user->can("Fibu")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_fibu" class="form-check-label">Buchhaltung</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Statistics]"
|
||||
id="can_statistics"
|
||||
value="1" <?=($user && $user->can("Statistics")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_statistics" class="form-check-label">Statistiken
|
||||
anzeigen</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" name="submit" value="Speichern" class="btn btn-primary"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[WarehouseEShop]" id="can_warehouse_e_shop" value="1" <?=($user && $user->can("WarehouseEShop")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_warehouse_e_shop" class="form-check-label">Energie Steiermark Shop</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="card-title mb-3 mt-3">Zusatzberechtigungen</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Fibu]" id="can_fibu" value="1" <?=($user && $user->can("Fibu")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_fibu" class="form-check-label">Buchhaltung</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="can[Statistics]" id="can_statistics" value="1" <?=($user && $user->can("Statistics")) ? "checked='checked'" : ""?> />
|
||||
<label for="can_statistics" class="form-check-label">Statistiken anzeigen</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" name="submit" value="Speichern" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($user->id): ?>
|
||||
</form>
|
||||
|
||||
<?php if($user->id): ?>
|
||||
<div class="row">
|
||||
<div class="col-lg">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">API Key</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" value="<?=$user->apikey?>" disabled="disabled" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<form method="post" action="<?=self::getUrl("User", "generateApikey")?>">
|
||||
<input type="hidden" name="id" value="<?=$user->id?>" />
|
||||
<?php if($user->apikey): ?>
|
||||
<button type="submit" class="btn btn-outline-primary" onclick="if(!confirm('Achtung: Dadurch wird der bisherige API Key ungültig. Wirklich neuen API Key generieren?')) return false;">Neuen API Key generieren</button>
|
||||
<?php else: ?>
|
||||
<button type="submit" class="btn btn-outline-primary">API Key generieren</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">API Key</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" value="<?=$user->apikey?>" disabled="disabled"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<form method="post" action="<?=self::getUrl("User", "generateApikey")?>">
|
||||
<input type="hidden" name="id" value="<?=$user->id?>"/>
|
||||
<?php if($user->apikey): ?>
|
||||
<button type="submit" class="btn btn-outline-primary"
|
||||
onclick="if(!confirm('Achtung: Dadurch wird der bisherige API Key ungültig. Wirklich neuen API Key generieren?')) return false;">
|
||||
Neuen API Key generieren
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button type="submit" class="btn btn-outline-primary">API Key generieren</button>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#address_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#preorder_networks").select2({
|
||||
allowClear: true,
|
||||
placeholder: "",
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
<?php if(!$user || (!$user->is("preorderfront") && !$user->is("preorderaddressreporting")) ): ?>
|
||||
//$("#preorder-network-container").hide();
|
||||
<?php endif; ?>
|
||||
<?php if($user && ($user->is("preorderfront")) ): ?>
|
||||
//$("#preorder-reporting-container").hide();
|
||||
<?php endif; ?>
|
||||
<?php if($user && ($user->is("preorderaddressreporting")) ): ?>
|
||||
//$("#preorderfront-container").hide();
|
||||
<?php endif; ?>
|
||||
|
||||
$("select[name=preorderfront]").change(function() {
|
||||
if($("select[name=preorderfront]").val() == "true") {
|
||||
$("#preorder-reporting-container").hide(500);
|
||||
} else {
|
||||
$("#preorder-reporting-container").show(500);
|
||||
}
|
||||
});
|
||||
|
||||
// preorder-reporting-container
|
||||
$("select[name=preorderaddressreporting]").change(function() {
|
||||
if($("select[name=preorderaddressreporting]").val() == "true") {
|
||||
$("#preorderfront-container").hide(400);
|
||||
} else {
|
||||
$("#preorderfront-container").show(400);
|
||||
}
|
||||
});
|
||||
|
||||
$("#employee").change(function() {
|
||||
if($("#employee").val() == "true") {
|
||||
$("#employee-number-container").show(400);
|
||||
} else {
|
||||
$("#employee-number-container").hide(400);
|
||||
}
|
||||
});
|
||||
});
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#address_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#preorder_networks").select2({
|
||||
allowClear: true,
|
||||
placeholder: "",
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
<?php if(!$user || (!$user->is("preorderfront") && !$user->is("preorderaddressreporting")) ): ?>
|
||||
//$("#preorder-network-container").hide();
|
||||
<?php endif; ?>
|
||||
<?php if($user && ($user->is("preorderfront")) ): ?>
|
||||
//$("#preorder-reporting-container").hide();
|
||||
<?php endif; ?>
|
||||
<?php if($user && ($user->is("preorderaddressreporting")) ): ?>
|
||||
//$("#preorderfront-container").hide();
|
||||
<?php endif; ?>
|
||||
|
||||
$("select[name=preorderfront]").change(function () {
|
||||
if ($("select[name=preorderfront]").val() == "true") {
|
||||
$("#preorder-reporting-container").hide(500);
|
||||
} else {
|
||||
$("#preorder-reporting-container").show(500);
|
||||
}
|
||||
});
|
||||
|
||||
// preorder-reporting-container
|
||||
$("select[name=preorderaddressreporting]").change(function () {
|
||||
if ($("select[name=preorderaddressreporting]").val() == "true") {
|
||||
$("#preorderfront-container").hide(400);
|
||||
} else {
|
||||
$("#preorderfront-container").show(400);
|
||||
}
|
||||
});
|
||||
|
||||
$("#employee").change(function () {
|
||||
if ($("#employee").val() == "true") {
|
||||
$("#employee-number-container").show(400);
|
||||
} else {
|
||||
$("#employee-number-container").hide(400);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -59,40 +59,40 @@
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="has-sub-submenu font-weight-bold"><a>Betriebsstammdaten</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Address")?>"><i class="fad fa-fw fa-user text-info"></i> Personen & Firmen</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Product")?>"><i class="far fa-fw fa-rectangle-list text-info"></i> Produkte</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Productgroup")?>"><i class="far fa-fw fa-list-tree text-info"></i> Produktgruppen</a></li>
|
||||
<li class="has-sub-submenu font-weight-bold"><a>Betriebsstammdaten</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Address")?>"><i class="fad fa-fw fa-user text-info"></i> Personen & Firmen</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Product")?>"><i class="far fa-fw fa-rectangle-list text-info"></i> Produkte</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Productgroup")?>"><i class="far fa-fw fa-list-tree text-info"></i> Produktgruppen</a></li>
|
||||
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Network")?>"><i class="fad fa-fw fa-network-wired text-info"></i> Netzgebiete</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Network")?>"><i class="fad fa-fw fa-network-wired text-info"></i> Netzgebiete</a></li>
|
||||
|
||||
<li class="" ><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-fw fa-house text-info"></i> Pops</a></li>
|
||||
<li class="" ><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-fw fa-house text-info"></i> Pops</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner","lineplanner","pipeplanner","pipeworker","lineworker","salespartner"))): ?>
|
||||
<li class=""><a href="<?=self::getUrl("Device")?>"><i class="fad fa-fw fa-router text-info "></i> Devices</a></li>
|
||||
<li class=""><a href="<?=self::getUrl("Device")?>"><i class="fad fa-fw fa-router text-info "></i> Devices</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-fw fa-users text-info"></i> Benutzer</a></li>
|
||||
<li class="has-sub-submenu font-weight-bold mt-1 mobile-hide"><a>Grundstammdaten</a></li>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-fw fa-users text-info"></i> Benutzer</a></li>
|
||||
<li class="has-sub-submenu font-weight-bold mt-1 mobile-hide"><a>Grundstammdaten</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("AddressDB")?>"><i class="fas fa-fw fa-city text-info "></i> GWR / AddressDB</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("AddressDB")?>"><i class="fas fa-fw fa-city text-info "></i> GWR / AddressDB</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("OpenAccessId")?>"><i class="fad fa-fw fa-link-simple text-info"></i> Open Access IDs</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
|
||||
<li class=""><a href="<?=self::getUrl("Mailtemplate")?>"><i class="fad fa-fw fa-mail-bulk text-info"></i> Emailtemplates</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("HistoricTicket")?>"><i class="fad fa-fw fa-headset text-info"></i> Historische Tickets</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("OpenAccessId")?>"><i class="fad fa-fw fa-link-simple text-info"></i> Open Access IDs</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
|
||||
<li class=""><a href="<?=self::getUrl("Mailtemplate")?>"><i class="fad fa-fw fa-mail-bulk text-info"></i> Emailtemplates</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("HistoricTicket")?>"><i class="fad fa-fw fa-headset text-info"></i> Historische Tickets</a></li>
|
||||
<?php if($me->can("Fibu")): ?><li class="mobile-hide"><a href="<?=self::getUrl("Vatgroup")?>"><i class="fas fa-fw fa-circle-dollar-to-slot text-info"></i> Steuersätze</a></li><?php endif; ?>
|
||||
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
|
||||
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<?php if($me->is(["Admin", "netowner", "salespartner"]) && ($me->is("employee") || $me->can(["Fibu", "Billing", "Preorderpricing", "Preorderbilling"]))): ?>
|
||||
<li class="has-submenu mobile-hide">
|
||||
<a href="#">
|
||||
<i class="fas fa-fw fa-money-from-bracket"></i> Backoffice <div class="arrow-down"></div>
|
||||
@@ -102,11 +102,21 @@
|
||||
<?php if ($me->can('Fibu')): ?><li><a href="<?= self::getUrl("Calendar") ?>"><i class="far fa-fw fa-calendar-circle-user text-info"></i> Kalender Verwaltung</a></li><?php endif; ?>
|
||||
<li><a href="<?=self::getUrl("Contract")?>"><i class="far fa-fw fa-id-card text-info"></i> Contracts</a></li>
|
||||
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Contractqueue")?>"><i class="far fa-fw fa-file-import text-info"></i> Contract Queue</a></li><?php endif; ?>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("Contract", "AdvancedSearch")?>"><i class="far fa-fw fa-question-circle text-info"></i> Erweiterte Suche</a></li>
|
||||
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("Billing")?>"><i class="far fa-fw fa-cash-register text-info"></i> Verrechnung</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("Invoice")?>"><i class="far fa-fw fa-file-invoice-dollar text-info"></i> Rechnungen</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("HistoricBill")?>"><i class="far fa-fw fa-file-invoice-dollar text-info"></i> Historische Rechnungen</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin"])): ?><li><a href="<?=self::getUrl("MailtemplateDispatch")?>"><i class="far fa-fw fa-envelope text-info"></i> Emailaussendung</a></li><?php endif; ?>
|
||||
<!--li class="has-sub-submenu"><a href="<?=self::getUrl("Contract", "AdvancedSearch")?>"><i class="far fa-fw fa-question-circle text-info"></i> Erweiterte Suche</a></li-->
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) && $me->can("Preorderpricing")): ?>
|
||||
<li class="border-top"><a href="<?=self::getUrl("PreorderProduct")?>"><i class="far fa-fw fa-euro-sign text-info"></i> Vorbestellkampagnen Bepreisung</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) && $me->can("Preorderbilling")): ?>
|
||||
<li><a href="<?=self::getUrl("PreorderBilling")?>"><i class="far fa-fw fa-cash-register text-info"></i> Vorbestellkampagnen Verrechnung</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187])): ?>
|
||||
<li><a href="<?=self::getUrl("ConstructionConsentProject")?>"><i class="far fa-fw fa-clipboard-question text-info"></i> Zustimmungserklärungen</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin"])): ?><li class="border-top"><a href="<?=self::getUrl("MailtemplateDispatch")?>"><i class="far fa-fw fa-envelope text-info"></i> Emailaussendungen</a></li><?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
@@ -196,14 +206,13 @@
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can("Preorder")): ?>
|
||||
<li><a href="<?=self::getUrl("Preordercampaign")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellung</a></li>
|
||||
<li><a href="<?=self::getUrl("Preordercampaign")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellungen / Kampagnen</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin","salespartner"]) && $me->can("Order")): ?>
|
||||
<li><a href="<?=self::getUrl("Order")?>"><i class="far fa-fw fa-file-signature text-info"></i> Bestellungen</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187])): ?>
|
||||
<li><a href="<?=self::getUrl("ConstructionConsentProject")?>"><i class="far fa-fw fa-clipboard-question text-info"></i> Zustimmungserklärungen</a></li>
|
||||
<li class="border-top"><a href="<?=self::getUrl("Order")?>"><i class="far fa-fw fa-file-signature text-info"></i> Bestellungen</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -411,8 +411,8 @@ class ConstructionConsent extends mfBaseModel {
|
||||
END AS status_light
|
||||
FROM ConstructionConsent
|
||||
LEFT JOIN ConstructionConsentOwner cwo ON ConstructionConsent.id = cwo.constructionconsent_id
|
||||
LEFT JOIN addressdb.view_hausnummer vh ON ConstructionConsent.adb_hausnummer_id = vh.hausnummer_id
|
||||
LEFT JOIN addressdb.Strasse vs ON ConstructionConsent.adb_strasse_id = vs.id
|
||||
LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer vh ON ConstructionConsent.adb_hausnummer_id = vh.hausnummer_id
|
||||
LEFT JOIN `".ADDRESSDB_DBNAME."`.Strasse vs ON ConstructionConsent.adb_strasse_id = vs.id
|
||||
WHERE $where
|
||||
GROUP BY ConstructionConsent.id
|
||||
$having
|
||||
|
||||
@@ -766,6 +766,7 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
private function getRimoPlanPreviewApi() {
|
||||
$adb_hausnummer_id = $this->request->building_id;
|
||||
$include_home_trench = $this->request->include_home_trench ? true : false;
|
||||
|
||||
$hausnummer = new ADBHausnummer($adb_hausnummer_id);
|
||||
if(!$hausnummer->id) {
|
||||
@@ -849,7 +850,18 @@ class ConstructionConsentController extends mfBaseController {
|
||||
];
|
||||
|
||||
if($hausnummer->trenches) {
|
||||
$trenches = json_decode($hausnummer->trenches);
|
||||
$trenches = [];
|
||||
if($include_home_trench && $hausnummer->home_trench) {
|
||||
$trenches = [json_decode($hausnummer->home_trench)];
|
||||
}
|
||||
|
||||
$street_trenches = json_decode($hausnummer->trenches);
|
||||
foreach($street_trenches as $t) {
|
||||
if(is_array($t) && count($t)) {
|
||||
$trenches[] = $t;
|
||||
}
|
||||
}
|
||||
$this->log->debug(print_r($trenches, true));
|
||||
|
||||
$params["paths"] = [
|
||||
"line_width" => 5,
|
||||
|
||||
@@ -107,7 +107,11 @@ class PreorderModel {
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createFromRimoWorkorder($workorder) {
|
||||
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
|
||||
734
application/PreorderProduct/PreorderProduct.php
Normal file
734
application/PreorderProduct/PreorderProduct.php
Normal file
@@ -0,0 +1,734 @@
|
||||
<?php
|
||||
|
||||
class PreorderProduct extends mfBaseModel {
|
||||
private $filter_netowner_id;
|
||||
private $filter_netoperator_id;
|
||||
private $filter_campaign_id;
|
||||
private $prices;
|
||||
private $first_price;
|
||||
private $current_price;
|
||||
private $current_regular_price;
|
||||
private $first_campaign_price;
|
||||
private $current_campaign_price;
|
||||
private $current_campaign_regular_price;
|
||||
private $creator;
|
||||
private $editor;
|
||||
private $today_date;
|
||||
|
||||
protected static $types = ["operator_setup", "enduser_setup", "operator_usage"];
|
||||
|
||||
|
||||
public function setNetownerId($netowner_id) {
|
||||
if(!$netowner_id) {
|
||||
$this->filter_netowner_id = null;
|
||||
return true;
|
||||
}
|
||||
$this->filter_netowner_id = $netowner_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setNetoperatorId($netoperator_id) {
|
||||
if(!$netoperator_id) {
|
||||
$this->filter_netoperator_id = null;
|
||||
return true;
|
||||
}
|
||||
$this->filter_netoperator_id = $netoperator_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setCampaignId($campaign_id) {
|
||||
if(!$campaign_id) {
|
||||
$this->filter_campaign_id = null;
|
||||
return true;
|
||||
}
|
||||
$this->filter_campaign_id = $campaign_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setTodayDate($date) {
|
||||
$this->today_date = date($date);
|
||||
}
|
||||
|
||||
public function getTodayDate() {
|
||||
return $this->today_date;
|
||||
}
|
||||
|
||||
public function getCampaignFirstPrice($campaign_id, $date = null) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date" => null,
|
||||
"end_date" => null,
|
||||
], "`create` DESC");
|
||||
if($price) {
|
||||
//$this->first_campaign_price = $price;
|
||||
return $price;
|
||||
//return $this->first_campaign_price;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCampaignCurrentRegularPrice($campaign_id, $date) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => $date,
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
|
||||
if($price) {
|
||||
//$this->current_campaign_regular_price = $price;
|
||||
return $price;
|
||||
//return $this->current_campaign_regular_price;
|
||||
} else {
|
||||
$this->log->debug(__METHOD__.": TRY FIRST PRICE");
|
||||
return $this->getCampaignFirstPrice($campaign_id, $date);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCampaignCurrentPrice($campaign_id, $date = null) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
// search for discounted price (with startdate and enddate
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => $date,
|
||||
"end_date>" => $date,
|
||||
], "start_date DESC, end_date ASC, `create` DESC");
|
||||
|
||||
if(!$price) {
|
||||
// search for current regular price (with startdate and no enddate)
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => $date,
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
}
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getCampaignPrice($campaign_id, $date = null) {
|
||||
$this->log->debug("=== in ".__METHOD__);
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$this->log->debug(__METHOD__.": TRY CURRENT PRICE");
|
||||
$price = $this->getCampaignCurrentPrice($campaign_id, $date);
|
||||
if(!$price) {
|
||||
$this->log->debug(__METHOD__.": TRY CURRENT REGULAR PRICE");
|
||||
$price = $this->getCampaignCurrentRegularPrice($campaign_id, $date);
|
||||
}
|
||||
if(!$price) {
|
||||
$this->log->debug(__METHOD__.": TRY FIRST PRICE");
|
||||
$price = $this->getCampaignFirstPrice($campaign_id, $date);
|
||||
}
|
||||
if(!$price) {
|
||||
$this->log->debug(__METHOD__.": No Campaign price found. GET NETOP CURRENT PRICE");
|
||||
$price = $this->getPrice();
|
||||
}
|
||||
|
||||
if($price) {
|
||||
$this->log->debug("=== done in ".__METHOD__);
|
||||
return $price;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public function getFirstPrice($date = null) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date" => null,
|
||||
"end_date" => null,
|
||||
], "`create` DESC");
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => null,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date" => null,
|
||||
"end_date" => null,
|
||||
], "`create` DESC");
|
||||
}
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
public function getCurrentRegularPrice($date = null, $allowCascading = false) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
|
||||
if(!$price && $allowCascading) {
|
||||
$this->log->debug(__METHOD__.": Cascading to getFirstPrice()");
|
||||
return $this->getFirstPrice($date, true);
|
||||
}
|
||||
return $price;
|
||||
}
|
||||
|
||||
public function getCurrentPrice($date = null, $allowCascading = false) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date>" => date($this->today_date),
|
||||
], "start_date DESC, end_date ASC, `create` DESC");
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
}
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date" => null,
|
||||
"end_date" => null,
|
||||
], "`create` DESC");
|
||||
}
|
||||
|
||||
if(!$price && $allowCascading) {
|
||||
$this->log->debug(__METHOD__.": Cascading to getCurrentRegularPrice()");
|
||||
return $this->getCurrentRegularPrice($date, true);
|
||||
}
|
||||
return $price;
|
||||
}
|
||||
|
||||
public function getPrice($date = null) {
|
||||
if(!$date) $date = date("Y-m-d");
|
||||
|
||||
$this->log->debug("=== in ".__METHOD__);
|
||||
$this->log->debug(__METHOD__.": TRY CURRENT PRICE");
|
||||
$price = $this->getCurrentPrice($date);
|
||||
if(!$price) {
|
||||
$this->log->debug(__METHOD__.": TRY CURRENT REGULAR PRICE");
|
||||
$price = $this->getCurrentRegularPrice($date);
|
||||
}
|
||||
if(!$price) {
|
||||
$this->log->debug(__METHOD__.": TRY FIRST PRICE");
|
||||
$price = $this->getFirstPrice($date);
|
||||
}
|
||||
|
||||
if(!$price) {
|
||||
$this->log->error(__METHOD__.": Unable to find price! netowner_id: ".$this->filter_netowner_id, " netoperator_id: ".$this->filter_netoperator_id." date: $date");
|
||||
return null;
|
||||
}
|
||||
$this->log->debug("=== done in ".__METHOD__);
|
||||
return $price;
|
||||
}
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "prices") {
|
||||
$prices = PreorderProductPrice::search(["netowner_id" => $this->filter_netowner_id, "preorderproduct_id" => $this->id]);
|
||||
if(count($prices)) {
|
||||
foreach($prices as $price) {
|
||||
$this->prices[$price->netoperator_id] = $price;
|
||||
}
|
||||
return $this->prices;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
if($name == "first_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($name == "current_regular_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($name == "current_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($name == "first_campaign_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $this->filter_campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date>=" => null,
|
||||
"end_date>" => null,
|
||||
], "`create` ASC");
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date>=" => null,
|
||||
"end_date>" => null,
|
||||
], "`create` ASC");
|
||||
}
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => null,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date>=" => null,
|
||||
"end_date>" => null,
|
||||
], "`create` ASC");
|
||||
}
|
||||
if($price) {
|
||||
//$this->first_campaign_price = $price;
|
||||
return $price;
|
||||
//return $this->first_campaign_price;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "current_campaign_regular_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $this->filter_campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date>" => null,
|
||||
], "`create` ASC");
|
||||
|
||||
if($price) {
|
||||
//$this->current_campaign_regular_price = $price;
|
||||
return $price;
|
||||
//return $this->current_campaign_regular_price;
|
||||
} else {
|
||||
return $this->getProperty("first_campaign_price");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "current_campaign_price") {
|
||||
if(!$this->today_date) $this->today_date = date("Y-m-d");
|
||||
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $this->filter_campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date>" => date($this->today_date),
|
||||
], "start_date DESC, end_date ASC, `create` DESC");
|
||||
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $this->filter_campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
}
|
||||
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => $this->filter_campaign_id,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date" => null,
|
||||
"end_date" => null,
|
||||
], "`create` DESC");
|
||||
}
|
||||
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date>" => date($this->today_date),
|
||||
], "start_date DESC, end_date ASC, `create` DESC");
|
||||
}
|
||||
|
||||
if(!$price) {
|
||||
$price = PreorderProductPrice::getFirst([
|
||||
"netowner_id" => $this->filter_netowner_id,
|
||||
"netoperator_id" => $this->filter_netoperator_id,
|
||||
"campaign_id" => null,
|
||||
"preorderproduct_id" => $this->id,
|
||||
"start_date<=" => date($this->today_date),
|
||||
"end_date" => null,
|
||||
], "start_date DESC, `create` DESC");
|
||||
}
|
||||
if($price) {
|
||||
return $price;
|
||||
} else {
|
||||
return $this->getProperty("current_campaign_regular_price");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($creator) {
|
||||
$this->creator = $creator;
|
||||
return $this->creator;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
|
||||
if(!$this->creator->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($editor) {
|
||||
$this->editor = $editor;
|
||||
return $this->editor;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
if(!$this->editor->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
$this->prices = null;
|
||||
|
||||
$this->first_price = null;
|
||||
$this->current_price = null;
|
||||
$this->current_regular_price = null;
|
||||
|
||||
$this->first_campaign_price = null;
|
||||
$this->current_campaign_price = null;
|
||||
$this->current_campaign_regular_price = null;
|
||||
|
||||
$this->creator = null;
|
||||
$this->editor = null;
|
||||
//$this->filter_netoperator_id = null;
|
||||
//$this->filter_netowner_id = null;
|
||||
//$this->filter_campaign_id = null;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new PreorderProduct();
|
||||
|
||||
$table_fields = [
|
||||
"type", "name", "vatgroup_id", "price_inet", "price_inet_tv", "price_catv", "price_passive",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$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 getWithTypes($netowner_id = false) {
|
||||
$types = [];
|
||||
|
||||
foreach(self::$types as $type) {
|
||||
$types[$type] = null;
|
||||
}
|
||||
|
||||
foreach(self::getAll() as $product) {
|
||||
if(array_key_exists($product->type, $types)) {
|
||||
if($netowner_id) {
|
||||
$product->setNetownerId($netowner_id);
|
||||
}
|
||||
$types[$product->type] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("PreorderProduct", "*", "1 = 1 ORDER BY type");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new PreorderProduct($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProduct
|
||||
WHERE $where
|
||||
ORDER BY type LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new PreorderProduct($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM PreorderProduct
|
||||
WHERE $where";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "type ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProduct
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new PreorderProduct($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
if(array_key_exists("project_id", $filter)) {
|
||||
$project_id = $filter['project_id'];
|
||||
if(is_numeric($project_id)) {
|
||||
$where .= " AND PreorderProduct.preorderProductproject_id=$project_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("preorderProductproject_id", $filter)) {
|
||||
$preorderProductproject_id = $filter['preorderProductproject_id'];
|
||||
if(is_numeric($preorderProductproject_id)) {
|
||||
$where .= " AND PreorderProduct.preorderProductproject_id=$preorderProductproject_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("adb_wohneinheit_id", $filter)) {
|
||||
$adb_wohneinheit_id = $filter['adb_wohneinheit_id'];
|
||||
if(is_numeric($adb_wohneinheit_id)) {
|
||||
$where .= " AND PreorderProduct.adb_wohneinheit_id=$adb_wohneinheit_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("termination_id", $filter)) {
|
||||
$termination_id = $filter['termination_id'];
|
||||
if(is_numeric($termination_id)) {
|
||||
$where .= " AND PreorderProduct.termination_id=$termination_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("object_type", $filter)) {
|
||||
$object_type = FronkDB::singleton()->escape($filter["object_type"]);
|
||||
if($object_type) {
|
||||
$where .= " AND object_type='$object_type'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("ez", $filter)) {
|
||||
$ez = FronkDB::singleton()->escape($filter["ez"]);
|
||||
if($ez) {
|
||||
$where .= " AND ez='$ez'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("status", $filter)) {
|
||||
$status = FronkDB::singleton()->escape($filter["status"]);
|
||||
if($status) {
|
||||
$where .= " AND status='$status'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("result", $filter)) {
|
||||
$result = FronkDB::singleton()->escape($filter["result"]);
|
||||
if($result) {
|
||||
$where .= " AND result='$result'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_name", $filter)) {
|
||||
$owner_name = FronkDB::singleton()->escape($filter["owner_name"]);
|
||||
if($owner_name) {
|
||||
$where .= " AND owner_name like '%$owner_name%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_street", $filter)) {
|
||||
$owner_street = FronkDB::singleton()->escape($filter["owner_street"]);
|
||||
if($owner_street) {
|
||||
$where .= " AND owner_street like '%$owner_street%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_zip", $filter)) {
|
||||
$owner_zip = FronkDB::singleton()->escape($filter["owner_zip"]);
|
||||
if($owner_zip) {
|
||||
$where .= " AND owner_zip like '%$owner_zip%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_city", $filter)) {
|
||||
$owner_city = FronkDB::singleton()->escape($filter["owner_city"]);
|
||||
if($owner_city) {
|
||||
$where .= " AND owner_city like '%$owner_city%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_country", $filter)) {
|
||||
$owner_country = FronkDB::singleton()->escape($filter["owner_country"]);
|
||||
if($owner_country) {
|
||||
$where .= " AND owner_country like '%$owner_country%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("network", $filter)) {
|
||||
$network = FronkDB::singleton()->escape($filter["network"]);
|
||||
if($network) {
|
||||
$where .= " AND view_hausnummer.netzgebiet_id=$network";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
166
application/PreorderProduct/PreorderProductController.php
Normal file
166
application/PreorderProduct/PreorderProductController.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
class PreorderProductController 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", "salespartner"]) && !$me->can("Preorder")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("PreorderProduct/Index");
|
||||
|
||||
$netowner_id = 4807; // $this->me->address_id;
|
||||
$netowner = new Address($netowner_id);
|
||||
|
||||
$products = PreorderProduct::getWithTypes($netowner_id);
|
||||
$this->layout()->set("products", $products);
|
||||
|
||||
$netoperators = [];
|
||||
foreach(PreordercampaignModel::search(["owner_id" => $netowner_id]) as $campaign) {
|
||||
foreach($campaign->active_operators as $op) {
|
||||
if(!array_key_exists($op->operator_id, $netoperators)) {
|
||||
$nop = new Address($op->operator_id);
|
||||
if($nop->id) {
|
||||
$netoperators[$nop->id] = $nop;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
foreach($campaign->passive_operators as $op) {
|
||||
if(!array_key_exists($op->operator_id, $netoperators)) {
|
||||
$nop = new Address($op->operator_id);
|
||||
if($nop->id) {
|
||||
$netoperators[$nop->id] = $nop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$campaigns = PreordercampaignModel::search(["owner_id" => $netowner_id]);
|
||||
|
||||
$today_date = date("Y-m-d");
|
||||
|
||||
if($this->request->view_date) {
|
||||
$today_date = $this->request->view_date;
|
||||
}
|
||||
|
||||
$this->layout()->set("today_date", $today_date);
|
||||
$this->layout()->set("campaigns", $campaigns);
|
||||
$this->layout()->set("netoperators", $netoperators);
|
||||
$this->layout()->set("netowner", $netowner);
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
$netowner_id = 4807; // $this->me->address_id;
|
||||
|
||||
foreach($r->netoperators as $netoperator_id => $product_data) {
|
||||
$netoperator = new Address($netoperator_id);
|
||||
if(!$netoperator->id) {
|
||||
$this->layout()->setFlash("Netzbetreiber nicht gefunden", "error");
|
||||
$this->layout()->redirect("PreorderProduct");
|
||||
}
|
||||
foreach($product_data as $product_id => $price_data) {
|
||||
//var_dump($price_data);exit;
|
||||
$product = new PreorderProduct($product_id);
|
||||
if(!$product->id) {
|
||||
$this->layout()->setFlash("Produkt $product_id nicht gefunden", "error");
|
||||
$this->layout()->redirect("PreorderProduct","",[], "product-".$netoperator_id);
|
||||
}
|
||||
|
||||
// create new PreorderProductPrice
|
||||
$price = PreorderProductPrice::create([
|
||||
"netowner_id" => $netowner_id,
|
||||
"preorderproduct_id" => $product->id,
|
||||
"netoperator_id" => $netoperator_id,
|
||||
]);
|
||||
if($price_data["description"]) $price->description = trim($price_data["description"]);
|
||||
|
||||
if($product->type == "operator_setup" || $product->type == "enduser_setup") {
|
||||
if($price_data["price_setup"]) $price->price_setup = Layout::commaToDot(trim($price_data["price_setup"]));
|
||||
} elseif($product->type == "operator_usage") {
|
||||
if($price_data["price_inet"]) $price->price_inet = Layout::commaToDot(trim($price_data["price_inet"]));
|
||||
if($price_data["price_inet_tv"]) $price->price_inet_tv = Layout::commaToDot(trim($price_data["price_inet_tv"]));
|
||||
if($price_data["price_catv"]) $price->price_catv = Layout::commaToDot(trim($price_data["price_catv"]));
|
||||
if($price_data["price_passive"]) $price->price_passive = Layout::commaToDot(trim($price_data["price_passive"]));
|
||||
}
|
||||
|
||||
if(!$price_data["start_date"]) {
|
||||
$this->layout()->setFlash("Von-datum fehlt bei Produkt '".$product->name."' für '".$netoperator->getCompanyOrName()."'", "error");
|
||||
$this->redirect("PreorderProduct","",[], "product-".$netoperator_id."-".$product_id);
|
||||
} else {
|
||||
try {
|
||||
$start_date = new DateTime("@" . $this->dateToTimestamp(trim($price_data["start_date"])));
|
||||
$start_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$price->start_date = $start_date->format("Y-m-d");
|
||||
} catch(Exception $e) {
|
||||
$this->layout()->setFlash("Fehler im Von-datum bei Produkt '".$product->name."' für '".$netoperator->getCompanyOrName()."'", "error");
|
||||
$this->redirect("PreorderProduct","",[], "product-".$netoperator_id."-".$product_id);
|
||||
}
|
||||
}
|
||||
if(trim($price_data["end_date"])) {
|
||||
try {
|
||||
$end_date = new DateTime("@" . $this->dateToTimestamp(trim($price_data["end_date"])));
|
||||
$end_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$price->end_date = $end_date->format("Y-m-d");
|
||||
} catch(Exception $e) {
|
||||
$this->layout()->setFlash("Fehler im Bis-Datum bei Produkt '".$product->name."' für '".$netoperator->getCompanyOrName()."'", "error");
|
||||
$this->redirect("PreorderProduct","",[], "product-".$netoperator_id."-".$product_id);
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($product, $price);
|
||||
|
||||
$price->save();
|
||||
|
||||
// marketshare prices
|
||||
if(array_key_exists("marketshareprice", $price_data) && is_array($price_data["marketshareprice"])) {
|
||||
foreach($price_data["marketshareprice"] as $msbracket => $msprice) {
|
||||
if(!is_numeric($msbracket)) continue;
|
||||
if(!$msbracket) continue; // dont save 0
|
||||
|
||||
$msp = PreorderProductMarketshareDiscount::create([
|
||||
"preorderproductprice_id" => $price->id,
|
||||
"bracket" => $msbracket,
|
||||
"price_inet" => Layout::commaToDot(trim($msprice["inet"])),
|
||||
"price_inet_tv" => Layout::commaToDot(trim($msprice["inet_tv"])),
|
||||
"price_catv" => Layout::commaToDot(trim($msprice["catv"])),
|
||||
"price_passive" => Layout::commaToDot(trim($msprice["passive"])),
|
||||
]);
|
||||
$msp->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// create PreorderProductPriceCampaign for all submitted campaign_ids
|
||||
foreach($price_data["campaigns"] as $campaign_id) {
|
||||
$campaign = new Preordercampaign($campaign_id);
|
||||
if(!$campaign->id) {
|
||||
$this->layout()->setFlash("Ungültige Kampagne bei Produkt '".$product->name."' für '".$netoperator->getCompanyOrName()."'", "error");
|
||||
$this->layout()->redirect("PreorderProduct","",[], "product-".$netoperator_id."-".$product_id);
|
||||
}
|
||||
$price_campaign = PreorderProductPriceCampaign::create([
|
||||
"preorderproductprice_id" => $price->id,
|
||||
"preordercampaign_id" => $campaign->id,
|
||||
]);
|
||||
$price_campaign->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Neue Preise erflgreich gespeichert", "success");
|
||||
$this->redirect("PreorderProduct","",[], "product-".$netoperator_id."-".$product_id);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
class PreorderProductMarketshareDiscount extends mfBaseModel {
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "creator") {
|
||||
$creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($creator) {
|
||||
$this->creator = $creator;
|
||||
return $this->creator;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
|
||||
if(!$this->creator->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($editor) {
|
||||
$this->editor = $editor;
|
||||
return $this->editor;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
if(!$this->editor->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new PreorderProductMarketshareDiscount();
|
||||
|
||||
$table_fields = [
|
||||
"preorderproductprice_id", "bracket", "price_inet", "price_inet_tv", "price_catv", "price_passive",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$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 getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("PreorderProductMarketshareDiscount", "*", "1 = 1 ORDER BY preorderproductprice_id,bracket");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new PreorderProductMarketshareDiscount($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProductMarketshareDiscount
|
||||
WHERE $where
|
||||
ORDER BY preorderproductprice_id,bracket LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new PreorderProductMarketshareDiscount($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM PreorderProductMarketshareDiscount
|
||||
WHERE $where";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "preorderproductprice_id ASC, bracket ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProductMarketshareDiscount
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new PreorderProductMarketshareDiscount($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
if(array_key_exists("preorderproductprice_id", $filter)) {
|
||||
$preorderproductprice_id = $filter['preorderproductprice_id'];
|
||||
if(is_numeric($preorderproductprice_id)) {
|
||||
$where .= " AND PreorderProductMarketshareDiscount.preorderproductprice_id=$preorderproductprice_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("bracket", $filter)) {
|
||||
$bracket = $filter['bracket'];
|
||||
if(is_numeric($bracket)) {
|
||||
$where .= " AND PreorderProductMarketshareDiscount.bracket=$bracket";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
381
application/PreorderProductPrice/PreorderProductPrice.php
Normal file
381
application/PreorderProductPrice/PreorderProductPrice.php
Normal file
@@ -0,0 +1,381 @@
|
||||
<?php
|
||||
|
||||
class PreorderProductPrice extends mfBaseModel {
|
||||
private $preorderprduct;
|
||||
private $netowner;
|
||||
private $preordercampaign;
|
||||
private $campaigns;
|
||||
private $campaign;
|
||||
private $marketsharediscounts;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "preorderproduct") {
|
||||
$product = new PreorderProduct($this->preorderprduct_id);
|
||||
if(!$product->id) {
|
||||
return null;
|
||||
}
|
||||
$this->preorderprduct = $product;
|
||||
return $this->preorderprduct;
|
||||
}
|
||||
|
||||
if($name == "netowner") {
|
||||
$netowner = new Address($this->netowner_id);
|
||||
if(!$netowner->id) {
|
||||
return null;
|
||||
}
|
||||
$this->netowner = $netowner;
|
||||
return $this->netowner;
|
||||
}
|
||||
|
||||
if($name == "preordercampaign" || $name == "campaign") {
|
||||
$campaign = new PreorderCampaign($this->preordercampgin_id);
|
||||
if(!$campaign->id) {
|
||||
return null;
|
||||
}
|
||||
$this->preorderprduct = $campaign;
|
||||
$this->campaign = $campaign;
|
||||
return $this->preordercampaign;
|
||||
}
|
||||
|
||||
if($name == "campaigns") {
|
||||
$ccount = PreorderProductPriceCampaign::count(["preorderproductprice_id" => $this->id]);
|
||||
$this->log->debug("Counted $ccount Campaigns for Price ".$this->id);
|
||||
if(!$ccount) return [];
|
||||
$this->campaigns = [];
|
||||
foreach(PreorderProductPriceCampaign::search(["preorderproductprice_id" => $this->id]) as $pppc) {
|
||||
$campaign = $pppc->campaign;
|
||||
if(!$campaign || !$campaign->id) continue;
|
||||
$this->campaigns[$campaign->id] = new PreorderCampaign($campaign->id);
|
||||
}
|
||||
return $this->campaigns;
|
||||
}
|
||||
|
||||
if($name == "marketsharediscounts") {
|
||||
if(!PreorderProductMarketshareDiscount::count(["preorderproductprice_id" => $this->id])) return [];
|
||||
foreach(PreorderProductMarketshareDiscount::search(["preorderproductprice_id" => $this->id]) as $discount) {
|
||||
$this->marketsharediscounts[$discount->bracket] = $discount;
|
||||
}
|
||||
return $this->marketsharediscounts;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($creator) {
|
||||
$this->creator = $creator;
|
||||
return $this->creator;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
|
||||
if(!$this->creator->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($editor) {
|
||||
$this->editor = $editor;
|
||||
return $this->editor;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
if(!$this->editor->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new PreorderProductPrice();
|
||||
|
||||
$table_fields = [
|
||||
"preorderproduct_id", "netowner_id", "netoperator_id", "preordercampaign_id", "description",
|
||||
"start_date", "end_date", "price_inet", "price_inet_tv", "price_catv", "price_passive",
|
||||
"billing_delay", "billing_period", "contract_term", "description", "note",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$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 getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$sql = "SELECT PreorderProductPrice.* FROM PreorderProductPrice
|
||||
LEFT OUTER JOIN (SELECT COUNT(*) as cnt, preorderproductprice_id, preordercampaign_id as preordercampaign_id FROM PreorderProductPriceCampaign GROUP BY PreorderProductPriceCampaign.preorderproductprice_id, PreorderProductPriceCampaign.preordercampaign_id) pppc ON PreorderProductPrice.id = pppc.preorderproductprice_id
|
||||
GROUP BY PreorderProductPrice.id
|
||||
ORDER BY start_date";
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new PreorderProductPrice($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter = [], $order = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!$order) {
|
||||
$order = "start_date ASC";
|
||||
}
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT PreorderProductPrice.* FROM PreorderProductPrice
|
||||
LEFT OUTER JOIN (SELECT COUNT(*) as cnt, preorderproductprice_id, preordercampaign_id as preordercampaign_id FROM PreorderProductPriceCampaign GROUP BY PreorderProductPriceCampaign.preorderproductprice_id, PreorderProductPriceCampaign.preordercampaign_id) pppc ON PreorderProductPrice.id = pppc.preorderproductprice_id
|
||||
WHERE $where
|
||||
GROUP BY PreorderProductPrice.id
|
||||
ORDER BY $order LIMIT 1";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new PreorderProductPrice($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM PreorderProductPrice
|
||||
LEFT OUTER JOIN (SELECT COUNT(*) as cnt, preorderproductprice_id, preordercampaign_id as preordercampaign_id FROM PreorderProductPriceCampaign GROUP BY PreorderProductPriceCampaign.preorderproductprice_id, PreorderProductPriceCampaign.preordercampaign_id) pppc ON PreorderProductPrice.id = pppc.preorderproductprice_id
|
||||
WHERE $where
|
||||
GROUP BY PreorderProductPrice.id";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "start_date ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT PreorderProductPrice.* FROM PreorderProductPrice
|
||||
LEFT OUTER JOIN (SELECT COUNT(*) as cnt, preorderproductprice_id, preordercampaign_id as preordercampaign_id FROM PreorderProductPriceCampaign GROUP BY PreorderProductPriceCampaign.preorderproductprice_id, PreorderProductPriceCampaign.preordercampaign_id) pppc ON PreorderProductPrice.id = pppc.preorderproductprice_id
|
||||
WHERE $where
|
||||
GROUP BY PreorderProductPrice.id
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new PreorderProductPrice($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
if(array_key_exists("preorderproduct_id", $filter)) {
|
||||
$preorderproduct_id = $filter['preorderproduct_id'];
|
||||
if(is_numeric($preorderproduct_id)) {
|
||||
$where .= " AND PreorderProductPrice.preorderproduct_id=$preorderproduct_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("netowner_id", $filter)) {
|
||||
$netowner_id = $filter['netowner_id'];
|
||||
if(is_numeric($netowner_id)) {
|
||||
$where .= " AND PreorderProductPrice.netowner_id=$netowner_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("netoperator_id", $filter)) {
|
||||
$netoperator_id = $filter['netoperator_id'];
|
||||
if($netoperator_id === null || $netoperator_id === false) {
|
||||
$where .= " AND PreorderProductPrice.netoperator_id IS NULL";
|
||||
} elseif(is_numeric($netoperator_id)) {
|
||||
$where .= " AND PreorderProductPrice.netoperator_id=$netoperator_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("preordercampaign_id", $filter)) {
|
||||
$preordercampaign_id = $filter['preordercampaign_id'];
|
||||
if($preordercampaign_id === null || $preordercampaign_id === false) {
|
||||
$where .= " AND (pppc.cnt IS NULL OR pppc.cnt = 0)";
|
||||
} elseif(is_numeric($preordercampaign_id)) {
|
||||
$where .= " AND pppc.preordercampaign_id=$preordercampaign_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("campaign_id", $filter)) {
|
||||
$preordercampaign_id = $filter['campaign_id'];
|
||||
if($preordercampaign_id === null || $preordercampaign_id === false) {
|
||||
$where .= " AND (pppc.cnt IS NULL OR pppc.cnt = 0)";
|
||||
} elseif(is_numeric($preordercampaign_id)) {
|
||||
$where .= " AND pppc.preordercampaign_id=$preordercampaign_id";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists("start_date", $filter)) {
|
||||
$start_date = $filter["start_date"];
|
||||
if($start_date === null || $start_date === false) {
|
||||
$where .= " AND PreorderProductPrice.start_date IS NULL";
|
||||
} elseif($start_date) {
|
||||
$start_date = FronkDB::singleton()->escape($filter["start_date"]);
|
||||
$where .= " AND PreorderProductPrice.start_date='$start_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("start_date>", $filter)) {
|
||||
$start_date = FronkDB::singleton()->escape($filter['start_date>']);
|
||||
if($start_date) {
|
||||
$where .= " AND PreorderProductPrice.start_date > '$start_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("start_date<", $filter)) {
|
||||
$start_date = FronkDB::singleton()->escape($filter['start_date<']);
|
||||
if($start_date) {
|
||||
$where .= " AND PreorderProductPrice.start_date < '$start_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("start_date>=", $filter)) {
|
||||
$start_date = FronkDB::singleton()->escape($filter['start_date>=']);
|
||||
if($start_date) {
|
||||
$where .= " AND PreorderProductPrice.start_date >= '$start_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("start_date<=", $filter)) {
|
||||
$start_date = FronkDB::singleton()->escape($filter['start_date<=']);
|
||||
if($start_date) {
|
||||
$where .= " AND PreorderProductPrice.start_date <= '$start_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("end_date", $filter)) {
|
||||
$end_date = $filter["end_date"];
|
||||
if($end_date === null || $end_date === false) {
|
||||
$where .= " AND PreorderProductPrice.end_date IS NULL";
|
||||
} elseif($end_date) {
|
||||
$end_date = FronkDB::singleton()->escape($filter["end_date"]);
|
||||
$where .= " AND PreorderProductPrice.end_date='$end_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("end_date>", $filter)) {
|
||||
$end_date = FronkDB::singleton()->escape($filter['end_date>']);
|
||||
if($end_date) {
|
||||
$where .= " AND PreorderProductPrice.end_date > '$end_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("end_date<", $filter)) {
|
||||
$end_date = FronkDB::singleton()->escape($filter['end_date<']);
|
||||
if($end_date) {
|
||||
$where .= " AND PreorderProductPrice.end_date < '$end_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("end_date>=", $filter)) {
|
||||
$end_date = FronkDB::singleton()->escape($filter['end_date>=']);
|
||||
if($end_date) {
|
||||
$where .= " AND PreorderProductPrice.end_date >= '$end_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("end_date<=", $filter)) {
|
||||
$end_date = FronkDB::singleton()->escape($filter['end_date<=']);
|
||||
if($end_date) {
|
||||
$where .= " AND PreorderProductPrice.end_date <= '$end_date'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
|
||||
class PreorderProductPriceCampaign extends mfBaseModel {
|
||||
private $price;
|
||||
private $preordercampaign;
|
||||
private $campaign;
|
||||
private $preorderproduct;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "preorderproduct") {
|
||||
$price = $this->getProperty("price");
|
||||
$product = $price->preorderproduct;
|
||||
if(!$product || !$product->id) {
|
||||
return null;
|
||||
}
|
||||
$this->preorderproduct = $product;
|
||||
return $this->preorderproduct;
|
||||
}
|
||||
|
||||
if($name == "price") {
|
||||
$price = new PreorderProductPrice($this->preorderproductprice_id);
|
||||
if(!$price->id) {
|
||||
return null;
|
||||
}
|
||||
$this->price = $price;
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
if($name == "netowner") {
|
||||
$netowner = new Address($this->netowner_id);
|
||||
if(!$netowner->id) {
|
||||
return null;
|
||||
}
|
||||
$this->netowner = $netowner;
|
||||
return $this->netowner;
|
||||
}
|
||||
|
||||
if($name == "preordercampaign" || $name == "campaign") {
|
||||
$campaign = new PreorderCampaign($this->preordercampaign_id);
|
||||
if(!$campaign->id) {
|
||||
return null;
|
||||
}
|
||||
$this->preordercampaign = $campaign;
|
||||
$this->campaign = $campaign;
|
||||
return $this->preordercampaign;
|
||||
}
|
||||
|
||||
|
||||
if($name == "creator") {
|
||||
$creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($creator) {
|
||||
$this->creator = $creator;
|
||||
return $this->creator;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
|
||||
if(!$this->creator->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($editor) {
|
||||
$this->editor = $editor;
|
||||
return $this->editor;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
if(!$this->editor->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new PreorderProductPriceCampaign();
|
||||
|
||||
$table_fields = [
|
||||
"preorderproductprice_id", "preordercampaign_id",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$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 getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("PreorderProductPriceCampaign", "*", "1 = 1 ORDER BY preorderproductprice_id");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new PreorderProductPriceCampaign($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter = [], $order = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!$order) {
|
||||
$order = "preorderproductprice_id ASC";
|
||||
}
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProductPriceCampaign
|
||||
WHERE $where
|
||||
ORDER BY $order LIMIT 1";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new PreorderProductPriceCampaign($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM PreorderProductPriceCampaign
|
||||
WHERE $where";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "preorderproductprice_id ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM PreorderProductPriceCampaign
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new PreorderProductPriceCampaign($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
if(array_key_exists("preordercampaign_id", $filter)) {
|
||||
$preordercampaign_id = $filter['preordercampaign_id'];
|
||||
if(is_numeric($preordercampaign_id)) {
|
||||
$where .= " AND PreorderProductPriceCampaign.preordercampaign_id=$preordercampaign_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("preorderproductprice_id", $filter)) {
|
||||
$preorderproductprice_id = $filter['preorderproductprice_id'];
|
||||
if(is_numeric($preorderproductprice_id)) {
|
||||
$where .= " AND PreorderProductPriceCampaign.preorderproductprice_id=$preorderproductprice_id";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -242,6 +242,10 @@ class UserController extends mfBaseController
|
||||
$user->permissions->canCpeshipping = "false";
|
||||
$user->permissions->canVoipnumbering = "false";
|
||||
$user->permissions->canPreorder = "false";
|
||||
$user->permissions->canPreorderpricing = "false";
|
||||
$user->permissions->canPreorderpricingReadonly = "false";
|
||||
$user->permissions->canPreorderbilling = "false";
|
||||
$user->permissions->canPreorderbillingReadonly = "false";
|
||||
$user->permissions->canOrder = "false";
|
||||
$user->permissions->canBilling = "false";
|
||||
$user->permissions->canFibu = "false";
|
||||
|
||||
86
db/migrations/20250129155121_create_preorder_product.php
Normal file
86
db/migrations/20250129155121_create_preorder_product.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePreorderProduct extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$po = $this->table("Preorder");
|
||||
$po->addColumn("rimo_service_id", "integer", ["null" => true, "default" => null]);
|
||||
$po->update();
|
||||
|
||||
$pp = $this->table("PreorderProduct");
|
||||
$pp->addColumn("type", "enum", ["null" => false, "values" => "enduser_setup, provider_setup, provider_usage"]);
|
||||
$pp->addColumn("name", "string", ["null" => true, "default" => null, "length" => 64]);
|
||||
$pp->addColumn("vatgroup_id", "integer", ["null" => true, "default" => null]);
|
||||
$pp->addColumn("price_inet", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$pp->addColumn("price_inet_tv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$pp->addColumn("price_catv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$pp->addColumn("price_passive", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$pp->addColumn("create_by", "integer", ["null" => false]);
|
||||
$pp->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$pp->addColumn("create", "integer", ["null" => false]);
|
||||
$pp->addColumn("edit", "integer", ["null" => false]);
|
||||
$pp->create();
|
||||
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->addColumn("preorderproduct_id", "integer", ["null" => false]);
|
||||
$ppp->addColumn("netowner_id", "integer", ["null" => false]);
|
||||
$ppp->addColumn("preordercampaign_id", "integer", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("description", "text", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("start_date", "date", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("end_date", "date", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("price_inet", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppp->addColumn("price_inet_tv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppp->addColumn("price_catv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppp->addColumn("price_passive", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppp->addColumn("billing_delay", "integer", ["null" => false, "default" => 0]);
|
||||
$ppp->addColumn("billing_period", "integer", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("contract_term", "integer", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("note", "text", ["null" => true, "default" => null]);
|
||||
$ppp->addColumn("create_by", "integer", ["null" => false]);
|
||||
$ppp->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$ppp->addColumn("create", "integer", ["null" => false]);
|
||||
$ppp->addColumn("edit", "integer", ["null" => false]);
|
||||
$ppp->create();
|
||||
|
||||
$ppmd = $this->table("PreorderProductMarketshareDiscount");
|
||||
$ppmd->addColumn("preorderproductprice_id", "integer", ["null" => false]);
|
||||
$ppmd->addColumn("price_15", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_20", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_25", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_30", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_35", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_40", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_45", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("price_50", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$ppmd->addColumn("create_by", "integer", ["null" => false]);
|
||||
$ppmd->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$ppmd->addColumn("create", "integer", ["null" => false]);
|
||||
$ppmd->addColumn("edit", "integer", ["null" => false]);
|
||||
$ppmd->create();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreorderProductMarketshareDiscount")->drop()->save();
|
||||
$this->table("PreorderProductPrice")->drop()->save();
|
||||
$this->table("PreorderProduct")->drop()->save();
|
||||
$this->table("Preorder")->removeColumn("rimo_service_id")->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
46
db/migrations/20250217133744_preorder_product_change.php
Normal file
46
db/migrations/20250217133744_preorder_product_change.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class PreorderProductChange extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$pp = $this->table("PreorderProduct");
|
||||
$pp->changeColumn("type", "enum", ["null" => false, "values" => "enduser_setup, operator_setup, operator_usage"]);
|
||||
$pp->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "vatgroup_id"]);
|
||||
$pp->update();
|
||||
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->addColumn("netoperator_id", "integer", ["null" => false, "after" => "netowner_id"]);
|
||||
$ppp->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "end_date"]);
|
||||
$ppp->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$pp = $this->table("PreorderProduct");
|
||||
$pp->changeColumn("type", "enum", ["null" => false, "values" => "enduser_setup, provider_setup, provider_usage"]);
|
||||
$pp->removeColumn("price_setup");
|
||||
$pp->update();
|
||||
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->removeColumn("netoperator_id");
|
||||
$ppp->removeColumn("price_setup");
|
||||
//$ppp->removeColumn("description");
|
||||
$ppp->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
34
db/migrations/20250218141907_preorder_product_change_2.php
Normal file
34
db/migrations/20250218141907_preorder_product_change_2.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class PreorderProductChange2 extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->changeColumn("netoperator_id", "integer", ["null" => true]);
|
||||
$ppp->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->removeColumn("description");
|
||||
$ppp->changeColumn("netoperator_id", "integer", ["null" => false]);
|
||||
$ppp->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePreorderProductPriceCampaign extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$pppc = $this->table("PreorderProductPriceCampaign");
|
||||
$pppc->addColumn("preorderproductprice_id", "integer", ["null" => false]);
|
||||
$pppc->addColumn("preordercampaign_id", "integer", ["null" => false]);
|
||||
|
||||
$pppc->addColumn("create_by", "integer", ["null" => false]);
|
||||
$pppc->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$pppc->addColumn("create", "integer", ["null" => false]);
|
||||
$pppc->addColumn("edit", "integer", ["null" => false]);
|
||||
$pppc->create();
|
||||
|
||||
$ppp = $this->table("PreorderProductPrice");
|
||||
$ppp->removeColumn("preordercampaign_id");
|
||||
$ppp->save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreorderProductPriceCampaign")->drop()->save();
|
||||
$this->table("PreorderProductPrice")->addColumn("preordercampaign_id", "integer", ["null" => true, "default" => null, "after" => "netowner_id"])->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class PreorderProductMarketshareDiscountBracket extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$ppmsd = $this->table("PreorderProductMarketshareDiscount");
|
||||
$ppmsd->addColumn("bracket", "integer", ["null" => false, "after" => "preorderproductprice_id"]);
|
||||
$ppmsd->addColumn("price_inet", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "bracket"]);
|
||||
$ppmsd->addColumn("price_inet_tv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "price_inet"]);
|
||||
$ppmsd->addColumn("price_catv", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "price_inet_tv"]);
|
||||
$ppmsd->addColumn("price_passive", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4, "after" => "price_catv"]);
|
||||
$ppmsd->removeColumn("price_15");
|
||||
$ppmsd->removeColumn("price_20");
|
||||
$ppmsd->removeColumn("price_25");
|
||||
$ppmsd->removeColumn("price_30");
|
||||
$ppmsd->removeColumn("price_35");
|
||||
$ppmsd->removeColumn("price_40");
|
||||
$ppmsd->removeColumn("price_45");
|
||||
$ppmsd->removeColumn("price_50");
|
||||
$ppmsd->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddPreorderbillingPermissions extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("WorkerPermission");
|
||||
$table->addColumn("canPreorderpricing", "enum", ["values" => 'false,true', "default" => "false", "after" => "canPreorder"]);
|
||||
$table->addColumn("canPreorderpricingReadonly", "enum", ["values" => 'false,true', "default" => "false", "after" => "canPreorderpricing"]);
|
||||
$table->addColumn("canPreorderbilling", "enum", ["values" => 'false,true', "default" => "false", "after" => "canPreorderpricingReadonly"]);
|
||||
$table->addColumn("canPreorderbillingReadonly", "enum", ["values" => 'false,true', "default" => "false", "after" => "canPreorderbilling"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("WorkerPermission")->removeColumn("canPreorderpricing")->update();
|
||||
$this->table("WorkerPermission")->removeColumn("canPreorderpricingReadonly")->update();
|
||||
$this->table("WorkerPermission")->removeColumn("canPreorderbilling")->update();
|
||||
$this->table("WorkerPermission")->removeColumn("canPreorderbillingReadonly")->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,6 +203,10 @@ h1, h2, h3, h4, h5, h6 {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.submenu .border-top {
|
||||
border-top: 1px solid #eee !important;
|
||||
}
|
||||
|
||||
.sub-submenu {
|
||||
padding-left: 12px !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user