Filestore Fertiggestellt

Cpeprovisioning Performance Update
This commit is contained in:
Spitzer_Daniel
2023-04-19 17:27:48 +02:00
parent 6293071000
commit 1d394a7852
11 changed files with 1037 additions and 814 deletions

View File

@@ -1,70 +1,86 @@
<?php <?php
if(!is_array($filter)) $filter = []; if (!is_array($filter)) $filter = [];
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Zu provisionierende CPEs";
?> ?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?> <?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<?php echo $cpecounter; ?>
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box"> <div class="page-title-box">
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <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("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">CPE Provisioning</li> <li class="breadcrumb-item active">CPE Provisioning</li>
</ol> </ol>
</div> </div>
<h4 class="page-title">CPE Provisioning</h4> <h4 class="page-title">CPE Provisioning</h4>
</div> </div>
</div> </div>
</div> </div>
<!-- end page title --> <!-- end page title -->
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card"> <div class="card">
<div class="card-body mb-3"> <div class="card-body mb-3">
<h4 class="header-title mb-3">Filter</h4> <h4 class="header-title mb-3">Filter</h4>
<form method="get" action="<?=self::getUrl("Cpeprovisioning")?>"> <form method="get" action="<?= self::getUrl("Cpeprovisioning") ?>">
<div class="row"> <div class="row">
<div class="col-1"> <div class="col-1">
<label class="form-label" for="filter_network_id">Netzgebiet</label> <label class="form-label" for="filter_network_id">Netzgebiet</label>
<select name="filter[network_id]" id="filter_network_id" class="form-control"> <select name="filter[network_id]" id="filter_network_id" class="form-control">
<option></option> <option></option>
<?php foreach(NetworkModel::getAll() as $fnet): ?> <?php foreach (NetworkModel::getAll() as $fnet): ?>
<option value="<?=$fnet->id?>" <?=($filter['network_id'] == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option> <option value="<?= $fnet->id ?>" <?= ($filter['network_id'] == $fnet->id) ? "selected='selected'" : "" ?>><?= $fnet->name ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="form-label" for="filter_routerconfig_finished">Provisioningstatus</label> <label class="form-label" for="filter_routerconfig_finished">Provisioningstatus</label>
<select name="filter[routerconfig_finished]" id="filter_routerconfig_finished" class="form-control"> <select name="filter[routerconfig_finished]" id="filter_routerconfig_finished"
<option value="0" <?=($filter['routerconfig_finished'] == 0) ? "selected='selected'" : ""?>>Offen</option> class="form-control">
<option value="1" <?=($filter['routerconfig_finished'] == 1) ? "selected='selected'" : ""?>>Abgeschlossen</option> <option value="0" <?= ($filter['routerconfig_finished'] == 0) ? "selected='selected'" : "" ?>>
Offen
</option>
<option value="1" <?= ($filter['routerconfig_finished'] == 1) ? "selected='selected'" : "" ?>>
Abgeschlossen
</option>
</select> </select>
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="form-label" for="filter_hide_delayed_finish">Verzögerte Herstellung</label> <label class="form-label" for="filter_hide_delayed_finish">Verzögerte Herstellung</label>
<select name="filter[hide_delayed_finish]" id="filter_hide_delayed_finish" class="form-control"> <select name="filter[hide_delayed_finish]" id="filter_hide_delayed_finish"
<option value="0" <?=(array_key_exists("hide_delayed_finish", $filter) &&$filter['hide_delayed_finish'] != 1) ? "selected='selected'" : ""?>>Anzeigen</option> class="form-control">
<option value="1" <?=(!array_key_exists("hide_delayed_finish", $filter) || $filter['hide_delayed_finish'] == 1) ? "selected='selected'" : ""?>>Nicht anzeigen</option> <option value="0" <?= (array_key_exists("hide_delayed_finish", $filter) && $filter['hide_delayed_finish'] != 1) ? "selected='selected'" : "" ?>>
Anzeigen
</option>
<option value="1" <?= (!array_key_exists("hide_delayed_finish", $filter) || $filter['hide_delayed_finish'] == 1) ? "selected='selected'" : "" ?>>
Nicht anzeigen
</option>
</select> </select>
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="form-label" for="filter_owner">Kunde</label> <label class="form-label" for="filter_owner">Kunde</label>
<input type="text" class="form-control" name="filter[owner]" id="filter_owner" value="<?=$filter['owner']?>" /> <input type="text" class="form-control" name="filter[owner]" id="filter_owner"
value="<?= $filter['owner'] ?>"/>
</div> </div>
</div> </div>
<div class="row mt-2"> <div class="row mt-2">
<div class="col"> <div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button> <button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Cpeprovisioning")?>">Filter zurücksetzen</a> <a class="btn btn-secondary" href="<?= self::getUrl("Cpeprovisioning") ?>">Filter
zurücksetzen</a>
</div> </div>
</div> </div>
</form> </form>
@@ -75,22 +91,21 @@
<div class="card"> <div class="card">
<div class="card-body mb-3"> <div class="card-body mb-3">
<div class="overflow-auto">
<div class="float-left"> <div class="float-left">
<h4 class="header-title">CPE Provisioning</h4> <h4 class="header-title">CPE Provisioning</h4>
</div> </div>
</div>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<div class="pagination justify-content-center"> <div class="pagination justify-content-center">
<?php if(count($products)): ?>
Zu provisionierende CPEs 1 bis <?=count($products)?>
<?php else: ?>
Keine zu provisionierende CPEs gefunden
<?php endif; ?>
</div> </div>
<table class="table"> <table class="table">
<?php $prov_count = 0; ?> <?php $prov_count = 0; ?>
<?php foreach($products as $product): ?> <?php foreach ($products as $product): ?>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> bottom-no-border"> <tr class="<?= ($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd" ?> bottom-no-border">
<th>Netzgebiet</th> <th>Netzgebiet</th>
<th>Service PIN</th> <th>Service PIN</th>
<th>Kunde</th> <th>Kunde</th>
@@ -99,51 +114,68 @@
<th>VLANs</th> <th>VLANs</th>
<th></th> <th></th>
</tr> </tr>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> top-no-border bottom-no-border"> <tr class="<?= ($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd" ?> top-no-border bottom-no-border">
<td class="pb-0"> <td class="pb-0">
<?=($product->termination_id) ? $product->termination->building->network->name : $product->order->owner->zip." ".$product->order->owner->city?> <?= ($product->termination_id) ? $product->termination->building->network->name : $product->order->owner->zip . " " . $product->order->owner->city ?>
</td> </td>
<td class="text-pink pb-0"><?=$product->order->owner->spin?></td> <td class="text-pink pb-0"><?= $product->order->owner->spin ?></td>
<td class="pb-0"><?=$product->order->owner->getCompanyOrName()?></td> <td class="pb-0"><?= $product->order->owner->getCompanyOrName() ?></td>
<td class="pb-0"><?=$product->product->name?><?=($product->termination_id) ? " <small class='text-pink'>".$product->termination->code."</small>" : ""?></td> <td class="pb-0"><?= $product->product->name ?><?= ($product->termination_id) ? " <small class='text-pink'>" . $product->termination->code . "</small>" : "" ?></td>
<td class="pb-0"><?=$product->product->attributes['bras_type']->value?> - Down: <?=$product->product->attributes["bw_down"]->value?> / Up: <?=$product->product->attributes["bw_up"]->value?></td> <td class="pb-0"><?= $product->product->attributes['bras_type']->value ?> -
Down: <?= $product->product->attributes["bw_down"]->value ?> /
Up: <?= $product->product->attributes["bw_up"]->value ?></td>
<td class="text-monospace pb-0"> <td class="text-monospace pb-0">
<?php if($product->termination_id): ?> <?php if ($product->termination_id): ?>
<?php if($product->termination->getPop()->vlan_public): ?> <?php if ($product->termination->getPop()->vlan_public): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
Public: <strong><?=$product->termination->getPop()->vlan_public?></strong> Public: <strong><?= $product->termination->getPop()->vlan_public ?></strong>
<input type="checkbox" name="vlan_public" form="cpeprovform-<?=$product->id?>" value="<?=$product->termination->getPop()->vlan_public?>" <?=($product->cpeprovisioning->vlan_public) ? "checked='checked'" : ""?> /> <input type="checkbox" name="vlan_public"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->termination->getPop()->vlan_public ?>" <?= ($product->cpeprovisioning->vlan_public) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php if($product->termination->getPop()->vlan_nat): ?> <?php if ($product->termination->getPop()->vlan_nat): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
NAT: <strong><?=$product->termination->getPop()->vlan_nat?></strong> NAT: <strong><?= $product->termination->getPop()->vlan_nat ?></strong>
<input type="checkbox" name="vlan_nat" form="cpeprovform-<?=$product->id?>" value="<?=$product->termination->getPop()->vlan_nat?>" <?=($product->cpeprovisioning->vlan_nat) ? "checked='checked'" : ""?> /> <input type="checkbox" name="vlan_nat"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->termination->getPop()->vlan_nat ?>" <?= ($product->cpeprovisioning->vlan_nat) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php if($product->termination->getPop()->vlan_ipv6): ?> <?php if ($product->termination->getPop()->vlan_ipv6): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
IPv6: <strong><?=$product->termination->getPop()->vlan_ipv6?></strong> IPv6: <strong><?= $product->termination->getPop()->vlan_ipv6 ?></strong>
<input type="checkbox" name="vlan_ipv6" form="cpeprovform-<?=$product->id?>" value="<?=$product->termination->getPop()->vlan_ipv6?>" <?=($product->cpeprovisioning->vlan_ipv6) ? "checked='checked'" : ""?> /> <input type="checkbox" name="vlan_ipv6"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->termination->getPop()->vlan_ipv6 ?>" <?= ($product->cpeprovisioning->vlan_ipv6) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php else: ?> <?php else: ?>
<?php if($product->product->attributes['vlan_default_public']->value): ?> <?php if ($product->product->attributes['vlan_default_public']->value): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
Public: <strong><?=$product->product->attributes['vlan_default_public']->value?></strong> Public:
<input type="checkbox" name="vlan_public" form="cpeprovform-<?=$product->id?>" value="<?=$product->product->attributes['vlan_default_public']->value?>" <?=($product->cpeprovisioning->vlan_public) ? "checked='checked'" : ""?> /> <strong><?= $product->product->attributes['vlan_default_public']->value ?></strong>
<input type="checkbox" name="vlan_public"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->product->attributes['vlan_default_public']->value ?>" <?= ($product->cpeprovisioning->vlan_public) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php if($product->product->attributes['vlan_default_nat']->value): ?> <?php if ($product->product->attributes['vlan_default_nat']->value): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
NAT: <strong><?=$product->product->attributes['vlan_default_nat']->value?></strong> NAT:
<input type="checkbox" name="vlan_nat" form="cpeprovform-<?=$product->id?>" value="<?=$product->product->attributes['vlan_default_nat']->value?>" <?=($product->cpeprovisioning->vlan_nat) ? "checked='checked'" : ""?> /> <strong><?= $product->product->attributes['vlan_default_nat']->value ?></strong>
<input type="checkbox" name="vlan_nat"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->product->attributes['vlan_default_nat']->value ?>" <?= ($product->cpeprovisioning->vlan_nat) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php if($product->product->attributes['vlan_default_ipv6']->value): ?> <?php if ($product->product->attributes['vlan_default_ipv6']->value): ?>
<label class="order-date-pill active pointer mb-0"> <label class="order-date-pill active pointer mb-0">
IPv6: <strong><?=$product->product->attributes['vlan_default_ipv6']->value?></strong> IPv6:
<input type="checkbox" name="vlan_ipv6" form="cpeprovform-<?=$product->id?>" value="<?=$product->product->attributes['vlan_default_ipv6']->value?>" <?=($product->cpeprovisioning->vlan_public) ? "checked='checked'" : ""?> /> <strong><?= $product->product->attributes['vlan_default_ipv6']->value ?></strong>
<input type="checkbox" name="vlan_ipv6"
form="cpeprovform-<?= $product->id ?>"
value="<?= $product->product->attributes['vlan_default_ipv6']->value ?>" <?= ($product->cpeprovisioning->vlan_public) ? "checked='checked'" : "" ?> />
</label> </label>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
@@ -156,79 +188,103 @@
$hw = false; $hw = false;
$voip = false; $voip = false;
foreach($product->order->products as $prod) { foreach ($product->order->products as $prod) {
if(is_array($prod->product->attributes) && count($prod->product->attributes)) { if (is_array($prod->product->attributes) && count($prod->product->attributes)) {
if(array_key_exists("hw_only", $prod->product->attributes)) { if (array_key_exists("hw_only", $prod->product->attributes)) {
if($prod->product->attributes["hw_only"]->value) { if ($prod->product->attributes["hw_only"]->value) {
$hw[] = (int)$prod->amount."x ".$prod->product->name; $hw[] = (int)$prod->amount . "x " . $prod->product->name;
} }
} }
if(array_key_exists("voip_chan", $prod->product->attributes)) { if (array_key_exists("voip_chan", $prod->product->attributes)) {
if($prod->product->attributes["voip_chan"]->value) { if ($prod->product->attributes["voip_chan"]->value) {
$voip = true; $voip = true;
} }
} }
if(array_key_exists("vot", $prod->product->attributes)) { if (array_key_exists("vot", $prod->product->attributes)) {
if($prod->product->attributes["vot"]->value) { if ($prod->product->attributes["vot"]->value) {
$vot = true; $vot = true;
} }
} }
if($product->order->install_date) { if ($product->order->install_date) {
$vo_termin = $product->order->install_date; $vo_termin = $product->order->install_date;
} }
if($hw && $voip_chan) { if ($hw && $voip_chan) {
break; break;
} }
} }
} }
?> ?>
<?=($vot || $vo_termin) ? "<i class='fas fa-tools text-purple mr-2' data-toggletooltip='tooltip' title='Vorortinstallation'></i>" : ""?> <?= ($vot || $vo_termin) ? "<i class='fas fa-tools text-purple mr-2' data-toggletooltip='tooltip' title='Vorortinstallation'></i>" : "" ?>
<?=($hw) ? "<a href='#' class='fas fa-shopping-bag text-purple mr-2' onclick='return false;' title='Hardware' data-toggle='popover' data-placement='top' data-content='".implode("<br />",$hw)."' ></a>" : ""?> <?= ($hw) ? "<a href='#' class='fas fa-shopping-bag text-purple mr-2' onclick='return false;' title='Hardware' data-toggle='popover' data-placement='top' data-content='" . implode("<br />", $hw) . "' ></a>" : "" ?>
<?=($voip) ? "<i class='fas fa-phone text-purple mr-2' data-toggletooltip='tooltip' title='Voice Produkt vorhanden'></i>" : ""?> <?= ($voip) ? "<i class='fas fa-phone text-purple mr-2' data-toggletooltip='tooltip' title='Voice Produkt vorhanden'></i>" : "" ?>
<?=($product->order->note) ? "<a href='#' class='fas fa-clipboard-list text-purple' onclick='return false;' data-toggle='popover' data-placement='top' data-content='".str_replace('"', '&#34;', str_replace("\n",'<br />',$product->order->note))."'></a>" : ""?> <?= ($product->order->note) ? "<a href='#' class='fas fa-clipboard-list text-purple' onclick='return false;' data-toggle='popover' data-placement='top' data-content='" . str_replace('"', '&#34;', str_replace("\n", '<br />', $product->order->note)) . "'></a>" : "" ?>
</td> </td>
</tr> </tr>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> bottom-no-border top-no-border"> <tr class="<?= ($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd" ?> bottom-no-border top-no-border">
<td> <td>
<?php if($product->termination_id && $product->termination->getPop()): ?> <?php if ($product->termination_id && $product->termination->getPop()): ?>
<strong>POP</strong>: <?=$product->termination->getPop()->name?> <strong>POP</strong>: <?= $product->termination->getPop()->name ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td><strong>Telefon:</strong> <?=$product->order->owner->phone?></td> <td><strong>Telefon:</strong> <?= $product->order->owner->phone ?></td>
<td><strong>Email:</strong> <?=$product->order->owner->email?></td> <td><strong>Email:</strong> <?= $product->order->owner->email ?></td>
<td><a target="_blank" href="<?=self::getUrl("Order", "Index", ["id" => $product->order_id, "addJournal" => 1])?>"><i class="fas fa-scroll"></i> Bestelljournal</a></td> <td><a target="_blank"
href="<?= self::getUrl("Order", "Index", ["id" => $product->order_id, "addJournal" => 1]) ?>"><i
class="fas fa-scroll"></i> Bestelljournal</a></td>
<td colspan="3"></td> <td colspan="3"></td>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> bottom-no-border"> <tr class="<?= ($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd" ?> bottom-no-border">
<td colspan="6"> <td colspan="6">
<form method="post" id="cpeprovform-<?=$product->id?>" action="<?=self::getUrl("Cpeprovisioning", "Save", ["filter" => $filter])?>"> <form method="post" id="cpeprovform-<?= $product->id ?>"
<input type="hidden" name="id" value="<?=$product->cpeprovisioning->id?>" /> action="<?= self::getUrl("Cpeprovisioning", "Save", ["filter" => $filter]) ?>">
<input type="hidden" name="order_id" value="<?=$product->order_id?>" /> <input type="hidden" name="id" value="<?= $product->cpeprovisioning->id ?>"/>
<input type="hidden" name="orderproduct_id" value="<?=$product->id?>" /> <input type="hidden" name="order_id" value="<?= $product->order_id ?>"/>
<input type="hidden" name="termination_id" value="<?=$product->termination_id?>" /> <input type="hidden" name="orderproduct_id" value="<?= $product->id ?>"/>
<input type="hidden" name="termination_id" value="<?= $product->termination_id ?>"/>
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<label for="routertype-<?=$product->id?>">Router</label> <label for="routertype-<?= $product->id ?>">Router</label>
<select class="form-control" name="routertype" id="routertype-<?=$product->id?>"> <select class="form-control" name="routertype"
id="routertype-<?= $product->id ?>">
<option></option> <option></option>
<option value="eigener Router" <?=($product->cpeprovisioning->routertype == "eigener Router") ? "selected='selected'" : ""?>>Eigener Router</option> <option value="eigener Router" <?= ($product->cpeprovisioning->routertype == "eigener Router") ? "selected='selected'" : "" ?>>
<option value="anderes CPE" <?=($product->cpeprovisioning->routertype == "anderes CPE") ? "selected='selected'" : ""?>>Anderes CPE</option> Eigener Router
<?php if(preg_match('/^(pppoe|dhcp)$/', $product->product->attributes['bras_type']->value)): ?> </option>
<option value="TP-Link Archer C80" <?=($product->cpeprovisioning->routertype == "TP-Link Archer C80") ? "selected='selected'" : ""?>>TP-Link Archer C80 (Inet, IPTV)</option> <option value="anderes CPE" <?= ($product->cpeprovisioning->routertype == "anderes CPE") ? "selected='selected'" : "" ?>>
<option value="FritzBox 4040" <?=($product->cpeprovisioning->routertype == "FritzBox 4040") ? "selected='selected'" : ""?>>FritzBox 4040 (Inet, IPTV)</option> Anderes CPE
<option value="FritzBox 7530" <?=($product->cpeprovisioning->routertype == "FritzBox 7530") ? "selected='selected'" : ""?>>FritzBox 7530 (Inet, Phone, IPTV)</option> </option>
<option value="FritzBox 7590" <?=($product->cpeprovisioning->routertype == "FritzBox 7590") ? "selected='selected'" : ""?>>FritzBox 7590 (Inet, Phone, IPTV)</option> <?php if (preg_match('/^(pppoe|dhcp)$/', $product->product->attributes['bras_type']->value)): ?>
<?php elseif($product->product->attributes['bras_type']->value = "static"): ?> <option value="TP-Link Archer C80" <?= ($product->cpeprovisioning->routertype == "TP-Link Archer C80") ? "selected='selected'" : "" ?>>
<option value="Mikrotik HAP AC" <?=($product->cpeprovisioning->routertype == "Mikrotik HAP AC") ? "selected='selected'" : ""?>>Mikrotik HAP AC (Inet, IPTV)</option> TP-Link Archer C80 (Inet, IPTV)
<option value="Mikrotik HEX S" <?=($product->cpeprovisioning->routertype == "Mikrotik HEX S") ? "selected='selected'" : ""?>>Mikrotik HEX S (Inet, IPTV)</option> </option>
<option value="Mikrotik RB3011" <?=($product->cpeprovisioning->routertype == "Mikrotik RB3011") ? "selected='selected'" : ""?>>Mikrotik RB3011 (Inet, IPTV)</option> <option value="FritzBox 4040" <?= ($product->cpeprovisioning->routertype == "FritzBox 4040") ? "selected='selected'" : "" ?>>
<?php elseif($product->product->attributes['bras_type']->value == "cmts"): ?> FritzBox 4040 (Inet, IPTV)
<option value="FritzBox 6490 Cable" <?=($product->cpeprovisioning->routertype == "FritzBox 6490 Cable") ? "selected='selected'" : ""?>>FritzBox 6490 Cable (Inet, Phone, IPTV)</option> </option>
<option value="FritzBox 7530" <?= ($product->cpeprovisioning->routertype == "FritzBox 7530") ? "selected='selected'" : "" ?>>
FritzBox 7530 (Inet, Phone, IPTV)
</option>
<option value="FritzBox 7590" <?= ($product->cpeprovisioning->routertype == "FritzBox 7590") ? "selected='selected'" : "" ?>>
FritzBox 7590 (Inet, Phone, IPTV)
</option>
<?php elseif ($product->product->attributes['bras_type']->value = "static"): ?>
<option value="Mikrotik HAP AC" <?= ($product->cpeprovisioning->routertype == "Mikrotik HAP AC") ? "selected='selected'" : "" ?>>
Mikrotik HAP AC (Inet, IPTV)
</option>
<option value="Mikrotik HEX S" <?= ($product->cpeprovisioning->routertype == "Mikrotik HEX S") ? "selected='selected'" : "" ?>>
Mikrotik HEX S (Inet, IPTV)
</option>
<option value="Mikrotik RB3011" <?= ($product->cpeprovisioning->routertype == "Mikrotik RB3011") ? "selected='selected'" : "" ?>>
Mikrotik RB3011 (Inet, IPTV)
</option>
<?php elseif ($product->product->attributes['bras_type']->value == "cmts"): ?>
<option value="FritzBox 6490 Cable" <?= ($product->cpeprovisioning->routertype == "FritzBox 6490 Cable") ? "selected='selected'" : "" ?>>
FritzBox 6490 Cable (Inet, Phone, IPTV)
</option>
<?php endif; ?> <?php endif; ?>
</select> </select>
</div> </div>
@@ -237,51 +293,68 @@
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="wifi_ssid-<?=$product->id?>">WLAN SSID</label> <label class="form-label" for="wifi_ssid-<?= $product->id ?>">WLAN
<input class="form-control" type="text" name="wifi_ssid" id="router_wifi_ssid-<?=$product->id?>" value="<?=$product->cpeprovisioning->wifi_ssid?>" /> SSID</label>
<input class="form-control" type="text" name="wifi_ssid"
id="router_wifi_ssid-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->wifi_ssid ?>"/>
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="wifi_pass-<?=$product->id?>">WPA Key</label> <label class="form-label" for="wifi_pass-<?= $product->id ?>">WPA
<input class="form-control" type="text" name="wifi_pass" id="router_wifi_pass-<?=$product->id?>" value="<?=$product->cpeprovisioning->wifi_pass?>" /> Key</label>
<input class="form-control" type="text" name="wifi_pass"
id="router_wifi_pass-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->wifi_pass ?>"/>
</div> </div>
</div> </div>
<?php if($vot || $vo_termin): ?> <?php if ($vot || $vo_termin): ?>
<div class="col-md-5"></div> <div class="col-md-5"></div>
<?php else: ?> <?php else: ?>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group text-center"> <div class="form-group text-center">
<label class="form-label" for="shipping-<?=$product->id?>">Versandauftrag</label> <label class="form-label" for="shipping-<?= $product->id ?>">Versandauftrag</label>
<input class="form-control" type="checkbox" value="1" name="shipping" id="shipping-<?=$product->id?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> <?=($product->cpeprovisioning->shipping) ? "checked='checked'" : ""?> /> <input class="form-control" type="checkbox" value="1"
name="shipping"
id="shipping-<?= $product->id ?>" <?= ($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : "" ?> <?= ($product->cpeprovisioning->shipping) ? "checked='checked'" : "" ?> />
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="ship_weight-<?=$product->id?>">Gewicht</label> <label class="form-label" for="ship_weight-<?= $product->id ?>">Gewicht</label>
<input class="form-control" type="text" name="ship_weight" id="ship_weight-<?=$product->id?>" value="<?=$product->cpeprovisioning->ship_weight?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> /> <input class="form-control" type="text" name="ship_weight"
id="ship_weight-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->ship_weight ?>" <?= ($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : "" ?> />
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="ship_length-<?=$product->id?>">Länge</label> <label class="form-label" for="ship_length-<?= $product->id ?>">Länge</label>
<input class="form-control" type="text" name="ship_length" id="ship_length-<?=$product->id?>" value="<?=$product->cpeprovisioning->ship_length?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> /> <input class="form-control" type="text" name="ship_length"
id="ship_length-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->ship_length ?>" <?= ($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : "" ?> />
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="ship_width-<?=$product->id?>">Breite</label> <label class="form-label" for="ship_width-<?= $product->id ?>">Breite</label>
<input class="form-control" type="text" name="ship_width" id="ship_width-<?=$product->id?>" value="<?=$product->cpeprovisioning->ship_width?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> /> <input class="form-control" type="text" name="ship_width"
id="ship_width-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->ship_width ?>" <?= ($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : "" ?> />
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="ship_height-<?=$product->id?>">Höhe</label> <label class="form-label"
<input class="form-control" type="text" name="ship_height" id="ship_height-<?=$product->id?>" value="<?=$product->cpeprovisioning->ship_height?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> /> for="ship_height-<?= $product->id ?>">Höhe</label>
<input class="form-control" type="text" name="ship_height"
id="ship_height-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->ship_height ?>" <?= ($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : "" ?> />
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -289,8 +362,12 @@
<div class="col-md-1"> <div class="col-md-1">
<div class="form-group text-center"> <div class="form-group text-center">
<label class="form-label text-success" for="routerconfig_finished-<?=$product->id?>">Routerkonfig <i class="fas fa-check"></i></label> <label class="form-label text-success"
<input class="form-control" type="checkbox" value="1" name="routerconfig_finished" id="routerconfig_finished-<?=$product->id?>" <?=($product->cpeprovisioning->routerconfig_finished) ? "checked='checked'" : ""?> /> for="routerconfig_finished-<?= $product->id ?>">Routerkonfig <i
class="fas fa-check"></i></label>
<input class="form-control" type="checkbox" value="1"
name="routerconfig_finished"
id="routerconfig_finished-<?= $product->id ?>" <?= ($product->cpeprovisioning->routerconfig_finished) ? "checked='checked'" : "" ?> />
</div> </div>
</div> </div>
@@ -301,29 +378,39 @@
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> top-no-border"> <tr class="<?= ($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd" ?> top-no-border">
<td colspan="6"> <td colspan="6">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="mac-<?=$product->id?>">Router MAC Adresse</label> <label class="form-label" for="mac-<?= $product->id ?>">Router MAC
<input class="form-control" form="cpeprovform-<?=$product->id?>" type="text" name="mac" id="mac-<?=$product->id?>" value="<?=$product->cpeprovisioning->mac?>" /> Adresse</label>
<input class="form-control" form="cpeprovform-<?= $product->id ?>"
type="text" name="mac" id="mac-<?= $product->id ?>"
value="<?= $product->cpeprovisioning->mac ?>"/>
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<?php if($product->termination_id): ?> <?php if ($product->termination_id): ?>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="mac-<?=$product->id?>">ONT montiert / ONT SN</label> <label class="form-label" for="mac-<?= $product->id ?>">ONT montiert /
ONT SN</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<?php if($product->termination->getWorkflowValue("ont_deployed", "int")): ?> <?php if ($product->termination->getWorkflowValue("ont_deployed", "int")): ?>
<button type="button" class="btn btn-outline-success" disabled="disabled"><i class="fas fa-check"></i></button> <button type="button" class="btn btn-outline-success"
disabled="disabled"><i class="fas fa-check"></i>
</button>
<?php else: ?> <?php else: ?>
<button type="button" class="btn btn-outline-secondary" disabled="disabled"><i class="fas fa-times"></i></button> <button type="button" class="btn btn-outline-secondary"
disabled="disabled"><i class="fas fa-times"></i>
</button>
<?php endif; ?> <?php endif; ?>
</div> </div>
<input class="form-control" form="cpeprovform-<?=$product->id?>" type="text" name="ont_sn" id="ont_sn-<?=$product->id?>" value="<?=($product->termination_id) ? $product->termination->getWorkflowValue("ont_sn", "string") : ""?>" /> <input class="form-control" form="cpeprovform-<?= $product->id ?>"
type="text" name="ont_sn" id="ont_sn-<?= $product->id ?>"
value="<?= ($product->termination_id) ? $product->termination->getWorkflowValue("ont_sn", "string") : "" ?>"/>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -334,15 +421,20 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="note-<?=$product->id?>">Kommentar</label> <label class="form-label" for="note-<?= $product->id ?>">Kommentar</label>
<textarea class="form-control" form="cpeprovform-<?=$product->id?>" name="note" id="note-<?=$product->id?>"><?=htmlentities($product->cpeprovisioning->note)?></textarea> <textarea class="form-control" form="cpeprovform-<?= $product->id ?>"
name="note"
id="note-<?= $product->id ?>"><?= htmlentities($product->cpeprovisioning->note) ?></textarea>
</div> </div>
</div> </div>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<label class="form-label">&nbsp;</label> <label class="form-label">&nbsp;</label>
<button class="form-control btn btn-primary" form="cpeprovform-<?=$product->id?>" type="submit"><i class="fas fa-save"></i> Speichern</button> <button class="form-control btn btn-primary"
form="cpeprovform-<?= $product->id ?>" type="submit"><i
class="fas fa-save"></i> Speichern
</button>
</div> </div>
</div> </div>
@@ -356,18 +448,21 @@
</table> </table>
<div class="pagination justify-content-center"> <div class="pagination justify-content-center">
<?php if(count($products)): ?> <?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
Zu provisionierende CPEs 1 bis <?=count($products)?> </div>
<div class="pagination justify-content-center">
<?php if (count($products)): ?>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function () {
$(function () { $(function () {
$('[data-toggle="popover"]').popover({html: true}) $('[data-toggle="popover"]').popover({html: true})
}) })
@@ -376,6 +471,6 @@
$(function () { $(function () {
$('[data-toggletooltip="tooltip"]').tooltip({html: true}) $('[data-toggletooltip="tooltip"]').tooltip({html: true})
}) })
</script> </script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?> <?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -127,7 +127,7 @@ $pagination_entity_name = "Device";
<script type="text/javascript"> <script type="text/javascript">
var hidesearch=[9]; var hidesearch=[9];
var columndefs={ type: 'ip-address', targets: 4 };
$(document).ready(function () { $(document).ready(function () {
}); });

View File

@@ -25,6 +25,9 @@ if (!$me->permissions->isAdmin) {
} }
} }
if (empty($mode) && $filestorehistory) {
$mode = "edit-history";
}
?> ?>
<div class="row"> <div class="row">
@@ -34,7 +37,7 @@ if (!$me->permissions->isAdmin) {
<div class="card-body"> <div class="card-body">
<h4 class="header-title mb-2"><?= ($file->id) ? "Datei bearbeiten" : "Neue Datei" ?></h4> <h4 class="header-title mb-2"><?= ($file->id) ? "Datei bearbeiten" : "Neue Datei" ?></h4>
<form class="form-horizontal" method="post" enctype="multipart/form-data" <form class="form-horizontal" method="post" enctype="multipart/form-data"
action="<?= self::getUrl("Filestore", "save") ?>"> action="<?= self::getUrl("Filestore", "save", ["mode" => $mode]) ?>">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@@ -44,10 +47,11 @@ if (!$me->permissions->isAdmin) {
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Name *</label> <label class="col-lg-2 col-form-label" for="name">Name *</label>
<div class="col-lg-10"> <div class="col-lg-10">
<?php if (empty($mode)) : ?> <?php if (empty($mode) && !$filestorehistory) : ?>
<input value="<?= $file->name ?>" class="form-control" name="name" <input value="<?= $file->name ?>" class="form-control"
name="name"
id="name"> id="name">
<?php elseif ($mode == "add-version") : ?> <?php else : ?>
<span><?= $file->name ?></span> <span><?= $file->name ?></span>
<?php endif; ?> <?php endif; ?>
</div> </div>
@@ -55,9 +59,10 @@ if (!$me->permissions->isAdmin) {
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label> <label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label>
<div class="col-lg-10"> <div class="col-lg-10">
<?php if (empty($mode)) : ?> <?php if (empty($mode) && !$filestorehistory) : ?>
<select class="select2 form-control " name="network_id" id="network_id"> <select class="select2 form-control "
<option>&nbsp;</option> name="network_id" id="network_id">
<option value="">&nbsp;</option>
<?php foreach ($networks as $key => $network): <?php foreach ($networks as $key => $network):
if (!$me->permissions->isAdmin) { if (!$me->permissions->isAdmin) {
if (!array_key_exists($network->id, $allowedNetworks)) { if (!array_key_exists($network->id, $allowedNetworks)) {
@@ -68,7 +73,7 @@ if (!$me->permissions->isAdmin) {
<option value="<?= $network->id ?>" <?= ($file->network_id == $network->id) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option> <option value="<?= $network->id ?>" <?= ($file->network_id == $network->id) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php elseif ($mode == "add-version") : <?php else :
foreach ($networks as $key => $network): foreach ($networks as $key => $network):
if (($file->network_id == $network->id)) : if (($file->network_id == $network->id)) :
$networkName = $network->name; $networkName = $network->name;
@@ -86,12 +91,15 @@ if (!$me->permissions->isAdmin) {
id="description"><?= htmlentities($file->description) ?></textarea> id="description"><?= htmlentities($file->description) ?></textarea>
</div> </div>
</div> </div>
<?php if (empty($mode) || $mode=="add-version") : ?>
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" for="filestore">Datei</label> <label class="col-lg-2 col-form-label" for="filestore">Datei</label>
<div class="col-lg-10"> <div class="col-lg-10">
<input type="file" class="form-control-file" id="filestore" name="filestore"> <input type="file" class="form-control-file" id="filestore"
name="filestore">
</div> </div>
</div> </div>
<?php endif; ?>
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2"></label> <label class="col-lg-2"></label>
<div class="col-lg-10"> <div class="col-lg-10">

View File

@@ -50,7 +50,8 @@
<th>Name</th> <th>Name</th>
<th>Beschreibung</th> <th>Beschreibung</th>
<th>Netzgebiet</th> <th>Netzgebiet</th>
<th>Bearbeiter</th> <th style="min-width: 270px;">Bearbeiter</th>
<th>Datum/Uhrzeit</th>
<th class="edit-width-large"></th> <th class="edit-width-large"></th>
</tr> </tr>
<tr id="filterrow"> <tr id="filterrow">
@@ -59,6 +60,7 @@
<th></th> <th></th>
<th></th> <th></th>
<th></th> <th></th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -80,19 +82,21 @@
?><!-- (--> ?><!-- (-->
<?php //= date("d.m.Y , H:i", $file->create) <?php //= date("d.m.Y , H:i", $file->create)
?><!--)</td>--> ?><!--)</td>-->
<td><?= $file->editor->name ?> (<?= date("d.m.Y , H:i", $file->edit) ?>)</td> <td><?= $file->editor->name ?></td>
<td><?= date("d.m.Y , H:i", $file->edit) ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;"> <td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("File", "download", ["id" => $file->file_id]) ?>"><i <a href="<?= self::getUrl("File", "download", ["id" => $file->file_id]) ?>"><i
class="far fa-download" title="Download"></i></a> class="far fa-download" title="Download"></i></a>
<a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id, "mode" => "add-version"]) ?>"><i <a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id, "mode" => "add-version"]) ?>"><i
class="far fa-file-circle-plus" title="Dateiversion hinzufügen"></i></a> class="far fa-file-circle-plus" title="Dateiversion hinzufügen"></i></a>
<?php if (!empty($fileshistory[$file->id])) : ?>
<i data-id="<?= $file->id ?>" title="Versionsverlauf" <i data-id="<?= $file->id ?>" title="Versionsverlauf"
class="fa-solid fa-clock-rotate-left history-ico check-history"></i> class="fa-solid fa-clock-rotate-left history-ico check-history"></i>
<?php endif; ?>
<a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id]) ?>"><i <a href="<?= self::getUrl("Filestore", "edit", ["id" => $file->id]) ?>"><i
class="far fa-edit" title="Bearbeiten"></i></a> class="far fa-edit" title="Bearbeiten"></i></a>
<?php if ($me->permissions->isAdmin || $me->id == $file->edit_by) : ?> <?php if ($me->permissions->isAdmin) : ?>
<a style="float: right" <a style="float: right"
href="<?= self::getUrl("Filestore", "delete", ["id" => $file->id]) ?>" href="<?= self::getUrl("Filestore", "delete", ["id" => $file->id]) ?>"
onclick="if(!confirm('Datei wirklich löschen?')) return false;" onclick="if(!confirm('Datei wirklich löschen?')) return false;"
@@ -114,7 +118,7 @@
<script type="text/javascript"> <script type="text/javascript">
var hidesearch = [3, 4]; var hidesearch = [3, 4, 5];
var cstmdom = "flrtip"; var cstmdom = "flrtip";
$(document).ready(function () { $(document).ready(function () {
$(".check-history").click(function () { $(".check-history").click(function () {
@@ -127,22 +131,23 @@
{id: $(this).data('id')}, {id: $(this).data('id')},
function (data) { function (data) {
if (data) {
let expandtr; let expandtr;
expandtr = `<tr class="filestore-history-tr filestore-history-` + fsiid + `"> expandtr = `<tr class="filestore-history-tr filestore-history-` + fsiid + `">
<td colspan="5" class="filestore-history-td" > <td colspan="7" class="filestore-history-td" >
<table class="float-right table table-bordered table-condensed" style="width: auto;"> <table class="float-right table table-bordered table-condensed" style="width: 1300px;">
<thead> <thead>
<tr style="background-color: #fff"> <tr style="background-color: #fff">
<th>Beschreibung</th> <th>Beschreibung</th>
<th>Bearbeiter</th> <th style="width: 270px;">Bearbeiter</th>
<th style="width: 235px;">Datum/Uhrzeit</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
`; `;
$.each(data, function (i, item) { $.each(data, function (i, item) {
let isdelete = ''; let isdelete = '';
console.log(item.edit);
var date = new Date(item.edit * 1000); var date = new Date(item.edit * 1000);
var day = "0" + date.getDay(); var day = "0" + date.getDay();
var month = "0" + date.getMonth(); var month = "0" + date.getMonth();
@@ -151,14 +156,13 @@
var minutes = "0" + date.getMinutes(); var minutes = "0" + date.getMinutes();
var formattedTime = day + '.' + month + '.' + year + ', ' + hours + ':' + minutes.substr(-2); var formattedTime = day + '.' + month + '.' + year + ', ' + hours + ':' + minutes.substr(-2);
if (item.is_delete == "1") { if (item.is_delete == "1") {
isdelete = `<a style="float: right" href="/Filestore/delete/?id=` + item.file_id + `&amp;s=0" onclick="if(!confirm('Datei wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>`; isdelete = `<a style="float: right" href="/FilestoreHistory/delete/?id=` + item.id + `&amp;s=0" onclick="if(!confirm('Datei wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>`;
} }
expandtr = expandtr + `<tr class="filestore-history"> expandtr = expandtr + `<tr class="filestore-history">
<td>` + item.description + `</td> <td>` + item.description + `</td>
<td>` + item.workername + `</td>
<td>` + item.workername + ` (` + formattedTime + `)</td> <td>` + formattedTime + `</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;width: 140px;"> <td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;width: 140px;">
<a href="/File/download/?id=` + item.file_id + `&amp;s=0"><i class="far fa-download" title="Download"></i></a> <a href="/File/download/?id=` + item.file_id + `&amp;s=0"><i class="far fa-download" title="Download"></i></a>
` + isdelete + ` ` + isdelete + `
@@ -168,6 +172,7 @@
}); });
expandtr = expandtr + `</table></td></tr>`; expandtr = expandtr + `</table></td></tr>`;
dataobject.closest('tr').after(expandtr); dataobject.closest('tr').after(expandtr);
}
}); });
} }
}); });

View File

@@ -1,20 +1,26 @@
<?php <?php
class CpeprovisioningController extends mfBaseController { class CpeprovisioningController extends mfBaseController
{
protected function init() { protected function init()
$this->needlogin=true; {
$this->needlogin = true;
$me = new User(); $me = new User();
$me->loadMe(); $me->loadMe();
$this->me = $me; $this->me = $me;
$this->layout()->set("me",$me); $this->layout()->set("me", $me);
if(!$me->is(["Admin"])) { if (!$me->is(["Admin"])) {
$this->redirect("Dashboard"); $this->redirect("Dashboard");
} }
} }
protected function indexAction() { protected function indexAction()
{
$cpecounter = 0;
$r = $this->request;
$page = $r->s;
$this->layout()->setTemplate("Cpeprovisioning/Index"); $this->layout()->setTemplate("Cpeprovisioning/Index");
$cpeproducts = []; $cpeproducts = [];
@@ -22,8 +28,8 @@ class CpeprovisioningController extends mfBaseController {
$filter = $this->getPreparedFilter($this->request->filter); $filter = $this->getPreparedFilter($this->request->filter);
// pagination defaults // pagination defaults
$pagination = []; $pagination = [];
$pagination['start'] = 0; $pagination['start'] = $page;
$pagination['count'] = 20; $pagination['count'] = 25;
$pagination['maxItems'] = 0; $pagination['maxItems'] = 0;
$order_filter = $filter; $order_filter = $filter;
@@ -33,58 +39,76 @@ class CpeprovisioningController extends mfBaseController {
*/ */
//var_dump($order_filter);exit; //var_dump($order_filter);exit;
$orders = OrderModel::search($order_filter); $orders = OrderModel::search($order_filter);
$orderproductsprefetch = OrderProductModel::precache();
foreach ($orders as $order) {
if ($order_filter["hide_delayed_finish"] && $order->finish_after) {
foreach($orders as $order) {
if($order_filter["hide_delayed_finish"] && $order->finish_after) {
// show at most 4 weeks before finish_after date // show at most 4 weeks before finish_after date
//$after_ts = Layout::dateToInt($order->finish_after); //$after_ts = Layout::dateToInt($order->finish_after);
if($order->finish_after > date("U") + (31 * 86400)) { if ($order->finish_after > date("U") + (31 * 86400)) {
$this->log->debug("Before 4 weeks before finish_after oid ".$order->id); $this->log->debug("Before 4 weeks before finish_after oid " . $order->id);
continue; continue;
} }
} }
if(is_array($order->terminations) && count($order->terminations)) {
if(!$order->cpeprovisioning_enabled && $order->terminations[0]->status->code < TT_TERMSTATUS_CONNECTED) { if (is_array($orderproductsprefetch['terminations'][$order->id]) && count($orderproductsprefetch['terminations'][$order->id])) {
if (!$order->cpeprovisioning_enabled && $orderproductsprefetch['terminations'][$order->id][0]['statuscode'] < TT_TERMSTATUS_CONNECTED) {
continue; continue;
} }
} }
foreach($order->products as $orderproduct) { foreach ($orderproductsprefetch[$order->id] as $orderproduct) {
if($orderproduct->cpeprovisioning->routerconfig_finished == 1) {
if(!$filter['routerconfig_finished']) continue;
if ($orderproduct['routerconfig_finished'] == 1) {
if (!$filter['routerconfig_finished']) continue;
} else { } else {
if($filter['routerconfig_finished']) continue; if ($filter['routerconfig_finished']) continue;
} }
$product = $orderproduct->product;
if(is_array($product->attributes) && count($product->attributes)) {
$productattributes = $orderproduct['attributes'];
if (is_array($productattributes) && count($productattributes)) {
// filter out products without bras_type // filter out products without bras_type
if(array_key_exists("bras_type", $product->attributes) && $product->attributes['bras_type']->value) {
$cpeproducts[] = $orderproduct; if (array_key_exists("bras_type", $productattributes) && $productattributes) {
$pagination['maxItems']++;
if ($pagination['maxItems'] >= $pagination['start']+1 && $pagination['maxItems'] <= $pagination['start'] + $pagination['count']) {
$cpeproducts[] = OrderProductModel::getOne($orderproduct['id']);
}
} else { } else {
$this->log->debug("no bras_type oid ".$order->id); $this->log->debug("no bras_type oid " . $order->id);
continue; continue;
} }
} else { } else {
// ignore products without attributes // ignore products without attributes
$this->log->debug("no attributes oid ".$order->id); $this->log->debug("no attributes oid " . $order->id);
continue; continue;
} }
} }
}
}
$this->layout()->set("pagination", $pagination);
$this->layout()->set("products", $cpeproducts); $this->layout()->set("products", $cpeproducts);
} }
private function getPreparedFilter($filter) { private function getPreparedFilter($filter)
{
$new_filter = []; $new_filter = [];
if(!is_array($filter)) $filter = []; if (!is_array($filter)) $filter = [];
if(array_key_exists("hide_delayed_finish", $filter)) { if (array_key_exists("hide_delayed_finish", $filter)) {
if($filter["hide_delayed_finish"] == "1") { if ($filter["hide_delayed_finish"] == "1") {
$new_filter["hide_delayed_finish"] = true; $new_filter["hide_delayed_finish"] = true;
} else { } else {
$new_filter["hide_delayed_finish"] = false; $new_filter["hide_delayed_finish"] = false;
@@ -94,8 +118,8 @@ class CpeprovisioningController extends mfBaseController {
$new_filter["hide_delayed_finish"] = true; $new_filter["hide_delayed_finish"] = true;
} }
if(array_key_exists("routerconfig_finished", $filter)) { if (array_key_exists("routerconfig_finished", $filter)) {
if($filter["routerconfig_finished"] == "1") { if ($filter["routerconfig_finished"] == "1") {
$new_filter["routerconfig_finished"] = true; $new_filter["routerconfig_finished"] = true;
$new_filter["hide_delayed_finish"] = false; $new_filter["hide_delayed_finish"] = false;
} else { } else {
@@ -111,21 +135,22 @@ class CpeprovisioningController extends mfBaseController {
$new_filter['upgrade'] = 0; $new_filter['upgrade'] = 0;
foreach($filter as $name => $value) { foreach ($filter as $name => $value) {
$new_filter[$name] = $value; $new_filter[$name] = $value;
} }
//var_dump($new_filter);exit; //var_dump($new_filter);exit;
return $new_filter; return $new_filter;
} }
protected function saveAction() { protected function saveAction()
{
$r = $this->request; $r = $this->request;
$id = $r->id; $id = $r->id;
//var_dump($r);exit; //var_dump($r);exit;
if(is_numeric($id) && $id > 0) { if (is_numeric($id) && $id > 0) {
$mode = "edit"; $mode = "edit";
$cpeprovisioning = new Cpeprovisioning($id); $cpeprovisioning = new Cpeprovisioning($id);
if(!$cpeprovisioning->id) { if (!$cpeprovisioning->id) {
$this->layout()->setFlash("Eintrag nicht gefunden", "error"); $this->layout()->setFlash("Eintrag nicht gefunden", "error");
$this->redirect("Cpeprovisioning"); $this->redirect("Cpeprovisioning");
} }
@@ -135,13 +160,13 @@ class CpeprovisioningController extends mfBaseController {
$order_id = $r->order_id; $order_id = $r->order_id;
$termination_id = $r->termination_id; $termination_id = $r->termination_id;
if(!(is_numeric($termination_id) && $termination_id > 0) && !(is_numeric($order_id) && $order_id > 0)) { if (!(is_numeric($termination_id) && $termination_id > 0) && !(is_numeric($order_id) && $order_id > 0)) {
$this->layout()->setFlash("Anschluss oder Bestellung nicht gefunden", "error"); $this->layout()->setFlash("Anschluss oder Bestellung nicht gefunden", "error");
$this->redirect("Cpeprovisioning"); $this->redirect("Cpeprovisioning");
} }
$orderproduct = OrderProductModel::getFirst(["order_id" => $order_id, "termination_id" => $termination_id]); $orderproduct = OrderProductModel::getFirst(["order_id" => $order_id, "termination_id" => $termination_id]);
if(!$orderproduct) { if (!$orderproduct) {
$this->layout()->setFlash("Anschluss gehört nicht zur Bestellung", "error"); $this->layout()->setFlash("Anschluss gehört nicht zur Bestellung", "error");
$this->redirect("Cpeprovisioning"); $this->redirect("Cpeprovisioning");
} }
@@ -167,7 +192,7 @@ class CpeprovisioningController extends mfBaseController {
$prov_data["edit_by"] = $this->me->id; $prov_data["edit_by"] = $this->me->id;
if($mode == "add") { if ($mode == "add") {
$prov_data["create_by"] = $this->me->id; $prov_data["create_by"] = $this->me->id;
$cpeprovisioning = CpeprovisioningModel::create($prov_data); $cpeprovisioning = CpeprovisioningModel::create($prov_data);
} else { } else {
@@ -176,31 +201,31 @@ class CpeprovisioningController extends mfBaseController {
//var_dump($prov_data);exit; //var_dump($prov_data);exit;
$new_id = $cpeprovisioning->save(); $new_id = $cpeprovisioning->save();
if(!$new_id) { if (!$new_id) {
$this->layout()->setFlash("Fehler beim Speichern", "error"); $this->layout()->setFlash("Fehler beim Speichern", "error");
$this->redirect("Cpeprovisioning"); $this->redirect("Cpeprovisioning");
} }
// saved successfully, if routerconfig_finished make Journal entry in Order // saved successfully, if routerconfig_finished make Journal entry in Order
if($cpeprovisioning->routerconfig_finished) { if ($cpeprovisioning->routerconfig_finished) {
$order_product = new OrderProduct($r->orderproduct_id); $order_product = new OrderProduct($r->orderproduct_id);
if($cpeprovisioning->shipping) { if ($cpeprovisioning->shipping) {
$text = "CPE zu Produkt \"".$order_product->product->name."\" zum Versand vorbereitet.\n\n"; $text = "CPE zu Produkt \"" . $order_product->product->name . "\" zum Versand vorbereitet.\n\n";
} else { } else {
$text = "CPE zu Produkt \"".$order_product->product->name."\" vorbereitet für Techniker zur Vorortinstallation.\n\n"; $text = "CPE zu Produkt \"" . $order_product->product->name . "\" vorbereitet für Techniker zur Vorortinstallation.\n\n";
} }
$text .= "Router: ".$cpeprovisioning->routertype."\n"; $text .= "Router: " . $cpeprovisioning->routertype . "\n";
$text .= "Zugangstyp: ".$order_product->product->attributes['bras_type']->value."\n"; $text .= "Zugangstyp: " . $order_product->product->attributes['bras_type']->value . "\n";
if($cpeprovisioning->vlan_public) { if ($cpeprovisioning->vlan_public) {
$text .= "Vlan Public: ".$cpeprovisioning->vlan_public."\n"; $text .= "Vlan Public: " . $cpeprovisioning->vlan_public . "\n";
} }
if($cpeprovisioning->vlan_nat) { if ($cpeprovisioning->vlan_nat) {
$text .= "Vlan NAT: ".$cpeprovisioning->vlan_nat."\n"; $text .= "Vlan NAT: " . $cpeprovisioning->vlan_nat . "\n";
} }
if($cpeprovisioning->vlan_ipv6) { if ($cpeprovisioning->vlan_ipv6) {
$text .= "Vlan IPv6: ".$cpeprovisioning->vlan_ipv6."\n"; $text .= "Vlan IPv6: " . $cpeprovisioning->vlan_ipv6 . "\n";
} }
$journal = new OrderJournal(); $journal = new OrderJournal();
@@ -210,7 +235,7 @@ class CpeprovisioningController extends mfBaseController {
$journal->edit_by = $this->me->id; $journal->edit_by = $this->me->id;
$journal_id = $journal->save(); $journal_id = $journal->save();
if(!$journal_id) { if (!$journal_id) {
$this->layout()->setFlash("Konnte nicht ins Bestelljournal schreiben!", "warning"); $this->layout()->setFlash("Konnte nicht ins Bestelljournal schreiben!", "warning");
} else { } else {
$cpeprovisioning->order_journal_id = $journal_id; $cpeprovisioning->order_journal_id = $journal_id;
@@ -219,16 +244,16 @@ class CpeprovisioningController extends mfBaseController {
} }
// save ONT sn // save ONT sn
if($r->ont_sn) { if ($r->ont_sn) {
$termination = new Termination($termination_id); $termination = new Termination($termination_id);
$orig_sn = $termination->getWorkflowvalue("ont_sn", "string"); $orig_sn = $termination->getWorkflowvalue("ont_sn", "string");
if($orig_sn === null) { if ($orig_sn === null) {
$sn_item = WorkflowitemModel::getFirst(["name" => "ont_sn", "object_type" => "termination"]); $sn_item = WorkflowitemModel::getFirst(["name" => "ont_sn", "object_type" => "termination"]);
//var_dump($sn_item);exit; //var_dump($sn_item);exit;
//var_dump(mfValuecache::singleton()->get("wfItemvalue-item-".$sn_item->id."-object-".$termination_id));exit; //var_dump(mfValuecache::singleton()->get("wfItemvalue-item-".$sn_item->id."-object-".$termination_id));exit;
if(!$sn_item->id) { if (!$sn_item->id) {
$this->log->error("ont_sn workflow item not found"); $this->log->error("ont_sn workflow item not found");
} else { } else {
$sn_item->setObjectId($termination_id); $sn_item->setObjectId($termination_id);
@@ -240,16 +265,15 @@ class CpeprovisioningController extends mfBaseController {
} }
if($r->ont_sn != $orig_sn) { if ($r->ont_sn != $orig_sn) {
$termination->workflowitems["ont_sn"]->value->setValue($r->ont_sn); $termination->workflowitems["ont_sn"]->value->setValue($r->ont_sn);
$termination->workflowitems["ont_sn"]->value->save(); $termination->workflowitems["ont_sn"]->value->save();
} }
} }
$query = []; $query = [];
if(is_numeric($this->request->s) && $this->request->s > 0) { if (is_numeric($this->request->s) && $this->request->s > 0) {
$query["s"] = $this->request->s; $query["s"] = $this->request->s;
} }
if (is_array($this->request->filter)) { if (is_array($this->request->filter)) {
@@ -259,7 +283,7 @@ class CpeprovisioningController extends mfBaseController {
$qs = http_build_query($query); $qs = http_build_query($query);
$this->layout()->setFlash("Eintrag erfolgreich gespeichert.", "success"); $this->layout()->setFlash("Eintrag erfolgreich gespeichert.", "success");
$this->redirect("Cpeprovisioning","Index", $qs); $this->redirect("Cpeprovisioning", "Index", $qs);
} }

View File

@@ -24,7 +24,7 @@ private $file;
return $this->editor; return $this->editor;
} }
if($name == "histories") { if($name == "histories") {
$this->histories=FilestoreHistoryModel::search(["filestore_id="=>$this->id]); $this->histories=FilestoreHistoryModel::search(["filestore_id$filter"=>$this->id]);
return $this->histories; return $this->histories;
} }

View File

@@ -19,14 +19,15 @@ class FilestoreController extends mfBaseController
{ {
$this->layout()->setTemplate("Filestore/Index"); $this->layout()->setTemplate("Filestore/Index");
$files = FilestoreModel::getAll(); $files = FilestoreModel::getAll();
$fileshistory = FilestoreHistoryModel::getAll();
$networkaddress = NetworkAddressModel::getAll(); $networkaddress = NetworkAddressModel::getAll();
$this->layout()->set("files", $files); $this->layout()->set("files", $files);
$this->layout()->set("fileshistory", $fileshistory);
$this->layout()->set("networkaddresses", $networkaddress); $this->layout()->set("networkaddresses", $networkaddress);
} }
protected function addAction() protected function addAction()
@@ -40,7 +41,7 @@ class FilestoreController extends mfBaseController
{ {
$r = $this->request; $r = $this->request;
$id = $r->id; $id = $r->id;
$editmode=$r->mode; $editmode = $r->mode;
//var_dump($r->get());exit; //var_dump($r->get());exit;
if (is_numeric($id) && $id > 0) { if (is_numeric($id) && $id > 0) {
@@ -69,16 +70,24 @@ class FilestoreController extends mfBaseController
} }
$data = []; $data = [];
if ($editmode != "add-version" && $editmode != "edit-history") {
$data['name'] = trim($r->name); $data['name'] = trim($r->name);
$data['network_id'] = trim($r->network_id); $data['network_id'] = trim($r->network_id);
}
$data['description'] = trim($r->description); $data['description'] = trim($r->description);
$data['edit_by'] = trim($this->me->id); $data['edit_by'] = trim($this->me->id);
if (!$data['name']) { if (!$data['name'] && $editmode != "add-version" && $editmode != "edit-history") {
$this->layout()->setFlash("Name darf nicht leer sein", "error"); $this->layout()->setFlash("Name darf nicht leer sein", "error");
$this->redirect("Filestore"); $this->redirect("Filestore");
} }
if (!$data['network_id'] && $editmode != "add-version" && $editmode != "edit-history") {
$this->layout()->setFlash("Netzgebiet darf nicht leer sein", "error");
$this->redirect("Filestore");
}
if (array_key_exists("filestore", $_FILES) && !$_FILES['filestore']['error']) { if (array_key_exists("filestore", $_FILES) && !$_FILES['filestore']['error']) {
$upload_error = false; $upload_error = false;
@@ -116,14 +125,18 @@ class FilestoreController extends mfBaseController
} }
$data['file_id'] = $file_id; $data['file_id'] = $file_id;
if ($mode == "edit") { if ($mode == "edit" && $editmode == "add-version") {
$fsh = FilestoreHistoryModel::create($dataHistory); $fsh = FilestoreHistoryModel::create($dataHistory);
} }
} else { } else {
if ($mode == "add") { if ($mode == "add" || $editmode == "add-version") {
$this->layout()->setFlash("Keine Datei angegeben", "error"); $this->layout()->setFlash("Keine Datei angegeben", "error");
if ($editmode == "add-version") {
$this->redirect("Filestore");
} else {
$this->redirect("Filestore", "add"); $this->redirect("Filestore", "add");
} }
}
} }
@@ -170,7 +183,7 @@ class FilestoreController extends mfBaseController
} }
$filestore = new Filestore($id); $filestore = new Filestore($id);
$filestorehistory = new FilestoreHistory($id); $filestorehistory = FilestoreHistoryModel::getAllhistory($id);;
if (!$filestore->id) { if (!$filestore->id) {
$this->layout()->setFlash("Datei nicht gefunden", "error"); $this->layout()->setFlash("Datei nicht gefunden", "error");
$this->redirect("Filestore"); $this->redirect("Filestore");
@@ -198,7 +211,6 @@ class FilestoreController extends mfBaseController
foreach ($filstore->histories as $h) { foreach ($filstore->histories as $h) {
$h->file->delete(); $h->file->delete();
$h->delete(); $h->delete();
} }
$filstore->file->delete(); $filstore->file->delete();
// check if Product is unused // check if Product is unused
@@ -223,7 +235,7 @@ class FilestoreController extends mfBaseController
$data[$counter]['workername'] = $history->data->workername; $data[$counter]['workername'] = $history->data->workername;
$data[$counter]['workerid'] = $history->data->workerid; $data[$counter]['workerid'] = $history->data->workerid;
$data[$counter]['edit'] = $history->edit; $data[$counter]['edit'] = $history->edit;
if (trim($this->me->id) == $history->data->workerid) { if (trim($this->me->id) == $history->data->workerid || $this->me->is(["Admin"])) {
$data[$counter]['is_delete'] = 1; $data[$counter]['is_delete'] = 1;
} else { } else {
$data[$counter]['is_delete'] = 0; $data[$counter]['is_delete'] = 0;

View File

@@ -147,5 +147,19 @@ class FilestoreHistoryController extends mfBaseController
return $this->addAction(); return $this->addAction();
} }
protected function deleteAction()
{
$id = $this->request->id;
$filstorehistory = new FilestoreHistory($id);
if (!$filstorehistory->id || $filstorehistory->id != $id) {
$this->layout()->setFlash("Datei nicht gefunden.", "error");
$this->redirect("Filestore");
}
$filstorehistory->delete();
$this->redirect("Filestore");
}
} }

View File

@@ -58,12 +58,12 @@ class FilestoreHistoryModel
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$sql = "SELECT FilestoreHistory.* FROM FilestoreHistory $sql = "SELECT FilestoreHistory.* FROM FilestoreHistory
LEFT JOIN File ON (FilestoreHistory.file_id = File.id)
ORDER BY name"; ";
$res = $db->query($sql); $res = $db->query($sql);
if ($db->num_rows($res)) { if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) { while ($data = $db->fetch_array($res)) {
$items[] = new FilestoreHistory($data); $items[$data['filestore_id']] = 1;
} }
} }
return $items; return $items;
@@ -114,12 +114,10 @@ class FilestoreHistoryModel
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$where = self::getSqlFilter($filter); $where = self::getSqlFilter($filter);
$sql = "SELECT FilestoreHistory.* FROM FilestoreHistory $sql = "SELECT FilestoreHistory.* FROM FilestoreHistory
LEFT JOIN File ON (FilestoreHistory.file_id = File.id) LEFT JOIN File ON (FilestoreHistory.file_id = File.id)
WHERE $where WHERE $where
ORDER BY name"; ORDER BY name";
$res = $db->query($sql); $res = $db->query($sql);
if ($db->num_rows($res)) { if ($db->num_rows($res)) {

View File

@@ -1,6 +1,7 @@
<?php <?php
class OrderProductModel { class OrderProductModel
{
public $order_id; public $order_id;
public $product_id; public $product_id;
public $termination_id; public $termination_id;
@@ -22,55 +23,58 @@ class OrderProductModel {
public $edit = null; public $edit = null;
public static function create(Array $data) { public static function create(array $data)
{
$model = new OrderProduct(); $model = new OrderProduct();
foreach($data as $field => $value) { foreach ($data as $field => $value) {
if(property_exists(get_called_class(), $field)) { if (property_exists(get_called_class(), $field)) {
$model->$field = $value; $model->$field = $value;
} }
} }
if(!array_key_exists("note", $data)) { if (!array_key_exists("note", $data)) {
$model->note = ""; $model->note = "";
} }
$me = new User(); $me = new User();
$me->loadMe(); $me->loadMe();
if($model->create_by === null) { if ($model->create_by === null) {
$model->create_by = $me->id; $model->create_by = $me->id;
} }
if($model->edit_by === null) { if ($model->edit_by === null) {
$model->edit_by = $me->id; $model->edit_by = $me->id;
} }
return $model; return $model;
} }
public static function getOne($id) { public static function getOne($id)
if(!is_numeric($id) || !$id) { {
if (!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400); throw new Exception("Invalid number", 400);
} }
$item = []; $item = [];
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$res = $db->select("OrderProduct", "*", "id=$id LIMIT 1"); $res = $db->select("OrderProduct", "*", "id=$id LIMIT 1");
if($db->num_rows($res)) { if ($db->num_rows($res)) {
$data = $db->fetch_object($res); $data = $db->fetch_object($res);
$item = new OrderProduct($data); $item = new OrderProduct($data);
} }
return $item; return $item;
} }
public static function getAll() { public static function getAll()
{
$items = []; $items = [];
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$res = $db->select("OrderProduct", "*", "1=1 ORDER BY order_id, pos, product_id, description"); $res = $db->select("OrderProduct", "*", "1=1 ORDER BY order_id, pos, product_id, description");
if($db->num_rows($res)) { if ($db->num_rows($res)) {
while($data = $db->fetch_object($res)) { while ($data = $db->fetch_object($res)) {
$items[] = new OrderProduct($data); $items[] = new OrderProduct($data);
} }
} }
@@ -78,15 +82,16 @@ class OrderProductModel {
} }
public static function getFirst($filter = false) { public static function getFirst($filter = false)
{
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$where = self::getSqlFilter($filter); $where = self::getSqlFilter($filter);
$res = $db->select("OrderProduct", "*", "$where ORDER BY order_id, pos, product_id, description"); $res = $db->select("OrderProduct", "*", "$where ORDER BY order_id, pos, product_id, description");
if($db->num_rows($res)) { if ($db->num_rows($res)) {
$data = $db->fetch_object($res); $data = $db->fetch_object($res);
$item = new OrderProduct($data); $item = new OrderProduct($data);
if($item->id) { if ($item->id) {
return $item; return $item;
} else { } else {
return null; return null;
@@ -95,7 +100,8 @@ class OrderProductModel {
return null; return null;
} }
public static function search($filter) { public static function search($filter)
{
$items = []; $items = [];
$db = FronkDB::singleton(); $db = FronkDB::singleton();
@@ -104,8 +110,8 @@ class OrderProductModel {
//mfLoghandler::singleton()->debug($sql); //mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql); $res = $db->query($sql);
if($db->num_rows($res)) { if ($db->num_rows($res)) {
while($data = $db->fetch_object($res)) { while ($data = $db->fetch_object($res)) {
$items[] = new OrderProduct($data); $items[] = new OrderProduct($data);
} }
} }
@@ -113,27 +119,80 @@ class OrderProductModel {
return $items; return $items;
} }
private static function getSqlFilter($filter) { public static function precache()
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT `OrderProduct`.`id`, `OrderProduct`.`order_id`, `OrderProduct`.`product_id`, `OrderProduct`.`termination_id`
,`ProducttechAttribute`.`name` ProducttechAttributename,
`routerconfig_finished`,
`Termination`.`id` `terminationid`,
`Terminationstatus`.`code` `statuscode`
FROM `OrderProduct`
INNER JOIN `Product` ON (`OrderProduct`.`product_id`=`Product`.`id`)
INNER JOIN `Producttech` ON (`Producttech`.`id`=`Product`.`producttech_id`)
INNER JOIN `ProductAttribute` ON (`ProductAttribute`.`product_id`=`Product`.`id`)
INNER JOIN `ProducttechAttribute` ON (`ProductAttribute`.`producttechattribute_id`=`ProducttechAttribute`.`id`)
LEFT JOIN `Termination` ON (`OrderProduct`.`termination_id`=`Termination`.`id`)
LEFT JOIN `Terminationstatus` ON (`Terminationstatus`.`id` = `Termination`.`status_id`)
LEFT JOIN `Cpeprovisioning` ON (`Cpeprovisioning`.`orderproduct_id`=`OrderProduct`.`id`)
";
//mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if ($db->num_rows($res)) {
$oldProduct = "";
$oldOrder = "";
while ($data = $db->fetch_array($res)) {
if ($data['terminationid'])
{
$items['terminations'][$data['order_id']][]['statuscode']=$data['statuscode'];
}
if ($oldOrder != $data['order_id']) {
$items[$data['order_id']]['statuscode'] = $data['statuscode'];
}
if ($oldProduct != $data['id']) {
$items[$data['order_id']][$data['id']]['id'] = $data['id'];
$items[$data['order_id']][$data['id']]['product_id'] = $data['product_id'];
$items[$data['order_id']][$data['id']]['termination_id'] = $data['termination_id'];
$items[$data['order_id']][$data['id']]['routerconfig_finished'] = $data['routerconfig_finished'];
}
if ($data['routerconfig_finished'] == 1) {
$items[$data['order_id']][$data['id']]['routerconfig_finished'] = $data['routerconfig_finished'];
}
$items[$data['order_id']][$data['id']]['attributes'][$data['ProducttechAttributename']] = $data['ProducttechAttributename'];
$oldProduct = $data['id'];
$oldOrder = $data['order_id'];
}
}
return $items;
}
private static function getSqlFilter($filter)
{
$where = "1=1 "; $where = "1=1 ";
//var_dump($filter);exit; //var_dump($filter);exit;
if(array_key_exists("order_id", $filter)) { if (array_key_exists("order_id", $filter)) {
$order_id = $filter['order_id']; $order_id = $filter['order_id'];
if(is_numeric($order_id)) { if (is_numeric($order_id)) {
$where .= " AND order_id=$order_id"; $where .= " AND order_id=$order_id";
} }
} }
if(array_key_exists("product_id", $filter)) { if (array_key_exists("product_id", $filter)) {
$product_id = $filter['product_id']; $product_id = $filter['product_id'];
if(is_numeric($product_id)) { if (is_numeric($product_id)) {
$where .= " AND order_id=$product_id"; $where .= " AND order_id=$product_id";
} }
} }
if(array_key_exists("termination_id", $filter)) { if (array_key_exists("termination_id", $filter)) {
$termination_id = $filter['termination_id']; $termination_id = $filter['termination_id'];
if(is_numeric($termination_id)) { if (is_numeric($termination_id)) {
$where .= " AND termination_id=$termination_id"; $where .= " AND termination_id=$termination_id";
} }
} }

View File

@@ -10,6 +10,12 @@ if (typeof cstmdom === "undefined") {
cstmdom = "flBrtip"; cstmdom = "flBrtip";
} }
if (typeof columndefs === "undefined") {
var columndefs;
columndefs = "";
}
$('#filterrow th').each(function (i) { $('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text(); let title = $('#datatable thead th').eq($(this).index()).text();
@@ -29,6 +35,8 @@ table = $('#datatable').DataTable({
className: 'btn-success margina' className: 'btn-success margina'
} }
], columnDefs: [
columndefs
], ],
"language": { "language": {
"url": "/datatables/json/german.json" "url": "/datatables/json/german.json"