WIP Contract linking / productchange
This commit is contained in:
@@ -208,7 +208,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->id?></a></td>
|
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->id?></a></td>
|
||||||
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->product->name?></a></td>
|
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->product_name?></a></td>
|
||||||
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
|
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
|
||||||
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->order_date) ? date('d.m.Y', $contract->order_date) : ""?></td>
|
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->order_date) ? date('d.m.Y', $contract->order_date) : ""?></td>
|
||||||
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
|
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<?=$contract->id?>" />
|
<input type="hidden" name="id" value="<?=$contract->id?>" />
|
||||||
|
<input type="hidden" name="origin_contract_id" value="<?=$origin_contract_id?>" />
|
||||||
<input type="hidden" name="f" value="<?=$f?>" />
|
<input type="hidden" name="f" value="<?=$f?>" />
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +78,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="matchcode">Anschluss</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<select name="products[<?=$i?>][termination_id]" id="termination_id-<?=$i?>" class="form-control select2">
|
||||||
|
<option></option>
|
||||||
|
<?php foreach($terminations as $t): ?>
|
||||||
|
<option value="<?=$t->id?>" <?=($t->id == $contract->termination_id) ? "selected='selected'" : ""?>><?=$t->code?> - <?=$t->getAddress()?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-lg-2 col-form-label" for="product_name">Individueller Produktname</label>
|
<label class="col-lg-2 col-form-label" for="product_name">Individueller Produktname</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
@@ -254,7 +268,7 @@
|
|||||||
* customer autocomplete
|
* customer autocomplete
|
||||||
*/
|
*/
|
||||||
// kunde
|
// kunde
|
||||||
<?php if($contract->owner_id && is_object(($contract->owner))): ?>
|
<?php if($contract->owner_id && is_object($contract->owner)): ?>
|
||||||
$('#owner_id').autoComplete('set', { value: <?=$contract->owner_id?>, text: '<?=($contract->owner_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->owner->getCompanyOrName()))." (".$contract->owner->zip." ".$contract->owner->city.", ".$contract->owner->street.")".(($contract->owner->customer_number) ? " [".$contract->owner->customer_number."]" : "") : ""?>'});
|
$('#owner_id').autoComplete('set', { value: <?=$contract->owner_id?>, text: '<?=($contract->owner_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->owner->getCompanyOrName()))." (".$contract->owner->zip." ".$contract->owner->city.", ".$contract->owner->street.")".(($contract->owner->customer_number) ? " [".$contract->owner->customer_number."]" : "") : ""?>'});
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$('#owner_id').autoComplete();
|
$('#owner_id').autoComplete();
|
||||||
|
|||||||
@@ -108,10 +108,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<?php foreach($contracts as $contract): ?>
|
<?php foreach($contracts as $contract): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><?=$contract->id?></a></td>
|
<td><a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id])?>"><?=$contract->id?></a></td>
|
||||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner_id])?>" target="_blank"><i class="far fa-eyes" title="Kunde in neuem Tab anzeigen"></i></a> <?=$contract->owner->getCompanyOrName()?></td>
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner_id])?>" target="_blank"><i class="far fa-eyes" title="Kunde in neuem Tab anzeigen"></i></a> <?=$contract->owner->getCompanyOrName()?></td>
|
||||||
<td><a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><?=$contract->product_name?></a></td>
|
<td><a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id])?>"><?=$contract->product_name?></a></td>
|
||||||
<td><a href="<?=self::getUrl("Contract", "view", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
|
<td><a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
|
||||||
<!--<td>
|
<!--<td>
|
||||||
<?php if($contract->termination_id): ?>
|
<?php if($contract->termination_id): ?>
|
||||||
<?=$contract->termination->building->street?><br />
|
<?=$contract->termination->building->street?><br />
|
||||||
@@ -139,9 +139,9 @@
|
|||||||
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->create)?><br /><?=$contract->creator->name?></td>
|
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->create)?><br /><?=$contract->creator->name?></td>
|
||||||
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->edit)?><br /><?=$contract->editor->name?></td>
|
<td class="text-monospace"><?=date('d.m.Y H:i', $contract->edit)?><br /><?=$contract->editor->name?></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("Contract", "view", ["id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-eyes" title="Aktives Produkt anzeigen"></i></a>
|
<a href="<?=self::getUrl("Contract", "view", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-eyes" title="Aktives Produkt anzeigen"></i></a>
|
||||||
<a href="<?=self::getUrl("Contract", "edit", ["id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-edit" title="Aktives Produkt bearbeiten"></i></a>
|
<a href="<?=self::getUrl("Contract", "edit", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>"><i class="far fa-edit" title="Aktives Produkt bearbeiten"></i></a>
|
||||||
<a href="<?=self::getUrl("Contract", "cancel", ["id" => $contract->id, "s" => $s, "filter" => $filter])?>" class="text-danger" title="Produkt kündigen"><i class="far fa-file-slash"></i></a>
|
<a href="<?=self::getUrl("Contract", "cancel", ["contract_id" => $contract->id, "s" => $s, "filter" => $filter])?>" class="text-danger" title="Produkt kündigen"><i class="far fa-file-slash"></i></a>
|
||||||
<?php if($contract->orderproduct_id): ?><a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a><?php endif; ?>
|
<?php if($contract->orderproduct_id): ?><a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><i class="far fa-file-signature" title="Bestellung anzeigen"></i></a><?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Produkt:</th>
|
<th>Produkt:</th>
|
||||||
<td><?=$contract->product_name?></td>
|
<td><?=$contract->product_name?> [<?=$contract->product_id?>]<?=($contract->product_name != $contract->product->name) ? " <i>(".$contract->product->name.")</i>" : ""?></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Produkt Info:</th>
|
<th>Produkt Info:</th>
|
||||||
<td><?=$contract->product_info?></td>
|
<td><?=$contract->product_info?></td>
|
||||||
@@ -55,46 +55,182 @@
|
|||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="text-center mb-3">Konfiguration bearbeiten</h4>
|
<h4 class="text-center mb-3">Neuer Contract</h4>
|
||||||
<?php if(is_array($groups) && count($groups)): ?>
|
|
||||||
<form method="post" action="<?=self::getUrl("Contractconfig", "Save")?>">
|
<form method="post" action="<?=self::getUrl("Contract", "saveProductchange")?>">
|
||||||
<input type="hidden" name="contract_id" value="<?=$contract->id?>" />
|
<input type="hidden" name="contract_id" value="<?=$contract->id?>" />
|
||||||
<table class="table table-sm table-borderless view-table">
|
|
||||||
<?php foreach($groups as $group): ?>
|
<div class="row justify-content-center">
|
||||||
<tr class="bg-light">
|
<div class="col-xl-6">
|
||||||
<th><h4><u><?=$group->name?></u></h4></td>
|
|
||||||
<td></td>
|
<div class="form-group row">
|
||||||
</tr>
|
<label class="col-lg-2 col-form-label" for="product_id">Produkt</label>
|
||||||
<?php foreach($group->items as $item): ?>
|
<div class="col-lg-10">
|
||||||
<tr>
|
<select class="form-control basicAutoComplete" autocomplete="off" name="product_id" id="product_id" data-url="<?=self::getUrl('Product','api')?>?do=findProduct&autocomplete=1" placeholder="Tippen zum suchen..." data-noresults-text="Keine Suchergebnisse">
|
||||||
<th style="max-width: 50vw;"><?=$item->displayname?>:</th>
|
<option></option>
|
||||||
<td style="width: 50vw;">
|
</select>
|
||||||
<?php if($item->type == "enum"): ?>
|
</div>
|
||||||
<select class="form-control" name="itemvalues[<?=$item->id?>]">
|
</div>
|
||||||
<?php foreach($item->getTypedataArray() as $option): ?>
|
|
||||||
<option value="<?=$option?>" <?=($item->getValue() == $option) ? "selected='selected'" : ""?>><?=$option?></option>
|
<div class="form-group row">
|
||||||
<?php endforeach; ?>
|
<label class="col-lg-2 col-form-label" for="matchcode">Matchcode:</label>
|
||||||
</select>
|
<div class="col-lg-10">
|
||||||
<?php else: ?>
|
<input type="text" class="form-control" name="matchcode" id="matchcode" value="<?=$contract->matchcode?>">
|
||||||
<input type="text" class="form-control <?=(is_array($error_items) && in_array($item->id, $error_items)) ? "invalid" : ""?>" name="itemvalues[<?=$item->id?>]" value="<?=(isset($request)) ? $request->itemvalues[$item->id] : $item->getValue()?>" />
|
<small class="font-italic">Eindeutige Identifizierung das Produkts. Z.B. Anschlussadresse, Domainname usw.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if(
|
||||||
|
(is_array($contract->product->attributes) && count($contract->product->attributes))
|
||||||
|
&& (array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $contract->product->attributes)
|
||||||
|
&& $contract->product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME]->value == 1)
|
||||||
|
|| $contract->termination_id
|
||||||
|
): ?>
|
||||||
|
<div class="form-group row" id="termination_id-line">
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="form-group row hidden" id="termination_id-line">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<small><?=$item->description?></small>
|
<label class="col-lg-2 col-form-label" for="matchcode">Anschluss</label>
|
||||||
</td>
|
<div class="col-lg-10">
|
||||||
</tr>
|
<select name="termination_id" id="termination_id" class="form-control select2">
|
||||||
<?php endforeach; ?>
|
<option></option>
|
||||||
<?php endforeach; ?>
|
<?php foreach($terminations as $t): ?>
|
||||||
</table>
|
<option value="<?=$t->id?>" <?=($t->id == $contract->termination_id) ? "selected='selected'" : ""?>><?=$t->code?> - <?=$t->getAddress(true)?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="product_name">Individueller Produktname:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="product_name" id="product_name" value="<?=$contract->product_name?>">
|
||||||
|
<small class="font-italic">Scheint statt dem echten Produktnamen auf der Rechnung auf</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="product_info">Produkt Zusatztext:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="product_info" id="product_info" value="<?=$contract->product_info?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="price_setup">Preis Setup:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="price_setup" id="price_setup" value="<?=$contract->price_setup?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="price">Preis Periodisch:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="price" id="price" value="<?=$contract->price?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="price_nne">Preis NNE</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="price_nne" id="price_nne" value="<?=$contract->price_nne?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="price_nbe">Preis NBE</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="price_nbe" id="price_nbe" value="<?=$contract->price_nbe?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="billing_period">Verrechnungsperiode</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<select class="form-control" name="billing_period" id="billing_period" placeholder="Verrechnungsperiode">
|
||||||
|
<option value="1" <?=($product->billing_period == 1) ? "selected='selected'" : ""?>>Monatlich</option>
|
||||||
|
<option value="12" <?=($product->billing_period == 12) ? "selected='selected'" : ""?>>Jährlich</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="billing_delay">Verzögerter Verrechnungsstart</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="billing_delay" id="billing_delay" placeholder="Freimonate" value="<?=$contract->billing_delay?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
||||||
|
<h4>Verknüpfte Verträge</h4>
|
||||||
|
|
||||||
|
<table class="table table-striped table-sm table-bordered table-hover">
|
||||||
|
<tr>
|
||||||
|
<th title="Verlinkten Contract mit neuem Contract verknüpfen">Übernehmen</th>
|
||||||
|
<th title="Verlinkten Contract mit altem Contract zusammen kündigen">Kündigen</th>
|
||||||
|
<th>Kunde</th>
|
||||||
|
<th>Contract ID</th>
|
||||||
|
<th>Produkt</th>
|
||||||
|
<th>Matchcode</th>
|
||||||
|
<th>Bestelldatum</th>
|
||||||
|
<th>Fertigstellung</th>
|
||||||
|
<th>Kündigung</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($contract->links as $link): ?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if($link->contract_id == $contract->id) {
|
||||||
|
$linkcontract = $link->origin;
|
||||||
|
} else {
|
||||||
|
$linkcontract = $link->contract;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><input type="radio" class="form-check" id="link-<?=$link->id?>-action-keep" name="links[<?=$link->id?>]" value="keep" <?=($linkcontract->cancel_date && $linkcontract->cancel_date < date('U')) ? "" : "checked='checked'"?> /></td>
|
||||||
|
<td><input type="radio" class="form-check" id="link-<?=$link->id?>-action-cancel" name="links[<?=$link->id?>]" value="cancel" /></td>
|
||||||
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>" target="_blank"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->id?></a></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->product_name?></a></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>" target="_blank"><?=$linkcontract->matchcode?></a></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TODO: Fileupload -->
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea id="note" class="form-control" name="note" rows="5"><?=$contract->note?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<input type="submit" class="btn btn-primary" value="Konfiguration speichern" />
|
<input type="submit" class="btn btn-primary" value="Produktwechsel speichern" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -105,4 +241,76 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(".select2").select2({
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: ""
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
* product autocomplete
|
||||||
|
*/
|
||||||
|
<?php if($contract->product_id && is_object(($contract->product))): ?>
|
||||||
|
$('#product_id').autoComplete('set', { value: <?=$contract->product_id?>, text: '<?=($contract->product_id) ? str_replace("'", "\\'", str_replace(["\n", "\r"], " ", $contract->product->name))." [".$contract->product_id."]" : ""?>'});
|
||||||
|
<?php else: ?>
|
||||||
|
$('#product_id').autoComplete();
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
$('#product_id').keydown(function() {
|
||||||
|
if(event.keyCode == 13) {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#product_id').on("autocomplete.select", function(evt, item) {
|
||||||
|
if(item && item.value === 0) {
|
||||||
|
$('#product_id').autoComplete('set', null);
|
||||||
|
}
|
||||||
|
if(item && item.value) {
|
||||||
|
updateProduct(item.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// product autocomplete
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function updateProduct() {
|
||||||
|
var pid = $('input[name=product_id]').val();
|
||||||
|
|
||||||
|
$.get("<?=self::getUrl("Product", "Api")?>",
|
||||||
|
{
|
||||||
|
"do": "getProduct",
|
||||||
|
product_id: pid
|
||||||
|
},
|
||||||
|
function (success) {
|
||||||
|
//console.log(success);
|
||||||
|
p = success.result.product;
|
||||||
|
|
||||||
|
$('#product_name').val(p.name);
|
||||||
|
//$('#product_info').val(p.name);
|
||||||
|
$('#billing_delay').val(p.billing_delay);
|
||||||
|
$('#billing_period').val(p.billing_period);
|
||||||
|
$('#price').val(p.price);
|
||||||
|
$('#price_setup').val(p.price_setup);
|
||||||
|
$('#price_nne').val(p.price_nne);
|
||||||
|
$('#price_nbe').val(p.price_nbe);
|
||||||
|
|
||||||
|
if(typeof p.attributes === 'object' && "termination_required" in p.attributes && p.attributes.termination_required == 1) {
|
||||||
|
$('#termination_id-line').show();
|
||||||
|
$('#termination_id').select2({
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: ""
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#termination_id-line').hide();
|
||||||
|
//$('#termination_id-' + id + '-line').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
'json');
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||||
@@ -23,46 +23,32 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
|
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
|
||||||
<a href="<?=self::getUrl("Contract","edit", ['id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
|
<a href="<?=self::getUrl("Contract","edit", ['contract_id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<?php if(!$contract->finish_date || $contract->finish_date > date('U')): ?>
|
||||||
|
<h2 class="text-center mb-3 text-secondary">In Herstellung</h2>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if($contract->isCancelled()): ?>
|
<?php if($contract->isCancelled()): ?>
|
||||||
<h2 class="text-center mb-3 text-danger">GEKÜNDIGT</h2>
|
<h2 class="text-center mb-3 text-danger">GEKÜNDIGT</h2>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<h3 class="text-center mb-3 <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=$contract->product_name?> (<?=$contract->id?>)</h3>
|
<h3 class="text-center mb-3 <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=$contract->product_name?> [<?=$contract->id?>]</h3>
|
||||||
|
|
||||||
<table class="table table-sm table-striped view-table">
|
<table class="table table-sm table-striped view-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="max-width: 50vw;">Matchcode:</th>
|
<th style="max-width: 50vw;">Matchcode:</th>
|
||||||
<td style="width: 50vw;"><?=$contract->matchcode?></td>
|
<td style="width: 50vw;"><?=$contract->matchcode?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>Vertragsinhaber:</th>
|
|
||||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner->id])?>"><?=$contract->owner->getCompanyOrName()?> (<?=$contract->owner->customer_number?>)</a></td>
|
|
||||||
</tr>
|
|
||||||
<?php if($contract->billingaddress_id): ?>
|
|
||||||
<tr>
|
|
||||||
<th>Rechnungsempfänger:</th>
|
|
||||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner->id])?>"><?=$contract->billingaddress->getCompanyOrName()?> (<?=$contract->billingaddress->customer_number?>)</a></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
<tr>
|
|
||||||
<th>Produkt:</th>
|
|
||||||
<td><?=$contract->product_name?></td>
|
|
||||||
</tr><tr>
|
|
||||||
<th>Produkt Info:</th>
|
|
||||||
<td><?=$contract->product_info?></td>
|
|
||||||
</tr>
|
|
||||||
<!-- upgrades -->
|
<!-- upgrades -->
|
||||||
<?php if(is_array($contract->upgradeFrom) && count($contract->upgradeFrom)): ?>
|
<?php if(is_array($contract->upgradeFrom) && count($contract->upgradeFrom)): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Upgrade von:</th>
|
<th>Upgrade von:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->upgradeFrom as $link): ?>
|
<?php foreach($contract->upgradeFrom as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date && $link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -72,7 +58,7 @@
|
|||||||
<th>Upgrade auf:</th>
|
<th>Upgrade auf:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->upgradeTo as $link): ?>
|
<?php foreach($contract->upgradeTo as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -84,7 +70,7 @@
|
|||||||
<th>Downgrade von:</th>
|
<th>Downgrade von:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->downgradeFrom as $link): ?>
|
<?php foreach($contract->downgradeFrom as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -94,7 +80,7 @@
|
|||||||
<th>Downgrade auf:</th>
|
<th>Downgrade auf:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->downgradeTo as $link): ?>
|
<?php foreach($contract->downgradeTo as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -106,7 +92,7 @@
|
|||||||
<th>Produktwechsel von:</th>
|
<th>Produktwechsel von:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->productchangeFrom as $link): ?>
|
<?php foreach($contract->productchangeFrom as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -116,7 +102,7 @@
|
|||||||
<th>Produktwechsel auf:</th>
|
<th>Produktwechsel auf:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->productchangeTo as $link): ?>
|
<?php foreach($contract->productchangeTo as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -128,7 +114,7 @@
|
|||||||
<th>Umzug von:</th>
|
<th>Umzug von:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->relocationFrom as $link): ?>
|
<?php foreach($contract->relocationFrom as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date && $link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->origin_contract_id])?>" class="contract-link <?=($link->origin->cancel_date && $link->origin->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->origin->product_name?> [<?=$link->origin->matchcode?>] (<?=$link->origin_contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -138,11 +124,29 @@
|
|||||||
<th>Umzug auf:</th>
|
<th>Umzug auf:</th>
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($contract->relocationTo as $link): ?>
|
<?php foreach($contract->relocationTo as $link): ?>
|
||||||
<a href="<?=self::getUrl("Contract", "View", ["id" => $link->contract_id])?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
<a href="<?=self::getUrl("Contract", "View", ["contract_id" => $link->contract_id])?>" class="contract-link <?=($link->contract->cancel_date && $link->contract->cancel_date <= date('U')) ? "canceled" : ""?>"><?=$link->contract->product_name?> [<?=$link->contract->matchcode?>] (<?=$link->contract_id?>)</a><br />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<tr>
|
||||||
|
<th>Vertragsinhaber:</th>
|
||||||
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->owner_id])?>"><?=$contract->owner->getCompanyOrName()?> [<?=$contract->owner->customer_number?>]</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php if($contract->billingaddress_id): ?>
|
||||||
|
<tr>
|
||||||
|
<th>Rechnungsempfänger:</th>
|
||||||
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $contract->billingaddress_id])?>"><?=$contract->billingaddress->getCompanyOrName()?> [<?=$contract->billingaddress->customer_number?>]</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<tr>
|
||||||
|
<th>Produkt:</th>
|
||||||
|
<td><?=$contract->product_name?> [<?=$contract->product_id?>]<?=($contract->product_name != $contract->product->name) ? " <i>(".$contract->product->name.")</i>" : ""?></td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Produkt Info:</th>
|
||||||
|
<td><?=$contract->product_info?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>SLA:</th>
|
<th>SLA:</th>
|
||||||
@@ -197,9 +201,13 @@
|
|||||||
</tr><tr class="bg-white">
|
</tr><tr class="bg-white">
|
||||||
<td colspan="2" class="text-center">
|
<td colspan="2" class="text-center">
|
||||||
<a href="<?=self::getUrl("Contractconfig", "edit", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-info">Konfiguration bearbeiten</button></a>
|
<a href="<?=self::getUrl("Contractconfig", "edit", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-info">Konfiguration bearbeiten</button></a>
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary">Inhaberwechsel</button>
|
<?php if($contract->finish_date && $contract->finish_date < date('U')): ?>
|
||||||
<button type="button" class="btn btn-sm btn-outline-success">Produkt-/Standortwechsel</button>
|
<button type="button" class="btn btn-sm btn-outline-secondary">Inhaberwechsel</button>
|
||||||
<button type="button" class="btn btn-sm btn-outline-danger">Kündigen</button>
|
<a href="<?=self::getUrl("Contract", "productchange", ["contract_id" => $contract->id])?>"><button type="button" class="btn btn-sm btn-outline-success">Produkt-/Standortwechsel</button></a>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-danger">Kündigen</button>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?=self::getUrl("Contract", "finishContract", ['contract_id' => $contract->id])?>" onclick="if(!confirm('Jetzt fertigstellen und in Verrechnung geben?')) return false"><button type="button" class="btn btn-sm btn-success">Fertigstellen</button></a>
|
||||||
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -210,12 +218,13 @@
|
|||||||
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4>Verknüpfte Verträge</h4>
|
<h4>Verknüpfte Verträge <small><a href="<?=self::getUrl("Contract", "add", ["origin_contract_id" => $contract->id])?>"><i class="fas fa-plus"></i>Neuen Contract anlegen</a></small></h4>
|
||||||
|
|
||||||
<table class="table table-striped table-sm table-bordered table-hover">
|
<table class="table table-striped table-sm table-bordered table-hover">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Kunde</th>
|
<th>Kunde</th>
|
||||||
<th>Contract ID</th>
|
<th>Contract ID</th>
|
||||||
|
<th>Typ</th>
|
||||||
<th>Produkt</th>
|
<th>Produkt</th>
|
||||||
<th>Matchcode</th>
|
<th>Matchcode</th>
|
||||||
<th>Bestelldatum</th>
|
<th>Bestelldatum</th>
|
||||||
@@ -227,18 +236,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($link->contract_id == $contract->id) {
|
if($link->contract_id == $contract->id) {
|
||||||
|
$direction = "von";
|
||||||
$linkcontract = $link->origin;
|
$linkcontract = $link->origin;
|
||||||
} else {
|
} else {
|
||||||
$linkcontract = $link->contract;
|
$linkcontract = $link->contract;
|
||||||
|
if($link->type == "upgrade" || $link->type == "downgrade") {
|
||||||
|
$direction = "auf";
|
||||||
|
}
|
||||||
|
if($link->type == "relocation") {
|
||||||
|
$direction = "nach";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
|
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->product->name?></a></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=__($link->type, "contract")?> <?=($link->type != "link") ? $direction : ""?></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $linkcontract->id])?>"><?=$linkcontract->matchcode?></a></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->product_name?></a></td>
|
||||||
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->matchcode?></a></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
|
||||||
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
|
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
|
||||||
@@ -251,38 +268,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!--
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h4>Konfiguration</h4>
|
|
||||||
|
|
||||||
<table class="table table-sm table-striped view-table">
|
|
||||||
<?php foreach($contract->configgroups as $group): ?>
|
|
||||||
<tr>
|
|
||||||
<th style="max-width: 50vw;"><h4><?=$group->name?></h4></th>
|
|
||||||
<td style="width: 50vw;"></td>
|
|
||||||
</tr>
|
|
||||||
<?php foreach($group->items as $item): ?>
|
|
||||||
<tr>
|
|
||||||
<th style="max-width: 50vw;"><?=$item->displayname?>:</th>
|
|
||||||
<td style="width: 50vw;">
|
|
||||||
<?=$item->value->string?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</table>
|
|
||||||
<div class="text-center">
|
|
||||||
<a href="#" class="btn btn-sm btn-outline-primary">Konfiguration bearbeiten</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
|
<a href="<?=self::getUrl("Contract","Index", ['filter' => $filter, 's' => $s])?>" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Vertragsübersicht</a>
|
||||||
<a href="<?=self::getUrl("Contract","edit", ['id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
|
<a href="<?=self::getUrl("Contract","edit", ['contract_id' => $contract->id, 'filter' => $filter, 's' => $s, 'f' => "view"])?>" class="btn btn-sm btn-outline-success"><i class="fas fa-edit"></i> Vertrag bearbeiten</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
Name: <input type="text" class="form-control" name="producttech_new_name" id="producttech_new_name" value="<?=$producttech_new_name?>">
|
Name: <input type="text" class="form-control" name="producttech_new_name" id="producttech_new_name" value="<?=$producttech_new_name?>">
|
||||||
Kundentyp: <select name="producttech_new_customer_type" class="form-control"><option value="residential">Residential</option><option value="business">Business</option></select>
|
Kundentyp: <select name="producttech_new_customer_type" class="form-control"><option value="residential">Residential</option><option value="business">Business</option></select>
|
||||||
RTR Code: <input type="text" class="form-control" name="producttech_new_rtrcode" id="producttech_new_rtrcode" value="<?=$producttech_new_rtrcode?>">
|
<!--RTR Code: <input type="text" class="form-control" name="producttech_new_rtrcode" id="producttech_new_rtrcode" value="<?=$producttech_new_rtrcode?>">-->
|
||||||
Beschreibung: <textarea class="form-control" name="producttech_new_description" id="productgroup_new_description"><?=$producttech_new_description?></textarea>
|
Beschreibung: <textarea class="form-control" name="producttech_new_description" id="productgroup_new_description"><?=$producttech_new_description?></textarea>
|
||||||
Interne Notiz: <textarea class="form-control" name="producttech_new_note" id="productgroup_new_note"><?=$producttech_new_note?></textarea>
|
Interne Notiz: <textarea class="form-control" name="producttech_new_note" id="productgroup_new_note"><?=$producttech_new_note?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Contract extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$now = date('U');
|
$now = date('U');
|
||||||
if($this->cancel_date < $now) {
|
if($this->cancel_date <= $now) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +110,18 @@ class Contract extends mfBaseModel {
|
|||||||
public function getProperty($name) {
|
public function getProperty($name) {
|
||||||
if($this->$name == null) {
|
if($this->$name == null) {
|
||||||
|
|
||||||
if(!$this->id) {
|
if($name == "billingaddress" && $this->billingaddress_id) {
|
||||||
return null;
|
$this->billingaddress = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->billingaddress_id);
|
||||||
|
if($this->billingaddress === null) {
|
||||||
|
$this->billingaddress = new Address($this->billingaddress_id);
|
||||||
|
if($this->billingaddress->id) {
|
||||||
|
mfValuecache::singleton()->set("mfObjectmodel-Address-".$this->billingaddress_id, $this->billingaddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->billingaddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($name == "owner") {
|
if($name == "owner" && $this->owner_id) {
|
||||||
$this->owner = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->owner_id);
|
$this->owner = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->owner_id);
|
||||||
if($this->owner === null) {
|
if($this->owner === null) {
|
||||||
$this->owner = new Address($this->owner_id);
|
$this->owner = new Address($this->owner_id);
|
||||||
@@ -125,18 +132,12 @@ class Contract extends mfBaseModel {
|
|||||||
return $this->owner;
|
return $this->owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($name == "billingaddress") {
|
|
||||||
|
if(!$this->id) {
|
||||||
$this->billingaddress = mfValuecache::singleton()->get("mfObjectmodel-Address-".$this->billingaddress_id);
|
return null;
|
||||||
if($this->billingaddress === null) {
|
|
||||||
$this->billingaddress = new Address($this->billingaddress_id);
|
|
||||||
if($this->billingaddress->id) {
|
|
||||||
mfValuecache::singleton()->set("mfObjectmodel-Address-".$this->billingaddress_id, $this->billingaddress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->billingaddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($name == "product") {
|
if($name == "product") {
|
||||||
$this->product = mfValuecache::singleton()->get("mfObjectmodel-Product-".$this->product_id);
|
$this->product = mfValuecache::singleton()->get("mfObjectmodel-Product-".$this->product_id);
|
||||||
if($this->product === null) {
|
if($this->product === null) {
|
||||||
@@ -264,4 +265,45 @@ class Contract extends mfBaseModel {
|
|||||||
return $this->$name;
|
return $this->$name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When object is cloned, new object will call this funtion to let us clean up the new Contract.
|
||||||
|
* Throws Exception if cloning fails.
|
||||||
|
*/
|
||||||
|
public function __clone() {
|
||||||
|
$me = new User;
|
||||||
|
$me->loadMe();
|
||||||
|
|
||||||
|
$old_id = $this->id;
|
||||||
|
$old_nummer = $this->nummer;
|
||||||
|
unset($this->id);
|
||||||
|
|
||||||
|
|
||||||
|
// cleanup Contract daten
|
||||||
|
$this->orderproduct_id = null;
|
||||||
|
$this->order_date = null;
|
||||||
|
$this->finish_date = null;
|
||||||
|
$this->finish_date_by = null;
|
||||||
|
$this->cancel_date = null;
|
||||||
|
$this->cancel_date_by = null;
|
||||||
|
$this->create_by = $me->id;
|
||||||
|
$this->edit_by = $me->id;
|
||||||
|
|
||||||
|
$this->create = null;
|
||||||
|
$this->edit = null;
|
||||||
|
$this->saved = 0;
|
||||||
|
$this->mode = "new";
|
||||||
|
$this->_old_data = new StdClass();
|
||||||
|
|
||||||
|
//$this->save();
|
||||||
|
|
||||||
|
if($old_id == $this->id) {
|
||||||
|
$this->log->error("save() of cloned Contract $old_nummer failed!");
|
||||||
|
throw new Exception("Saving clone failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->log->debug("Cloned Contract $old_id");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,10 @@ class ContractController extends mfBaseController {
|
|||||||
protected function viewAction() {
|
protected function viewAction() {
|
||||||
$this->layout()->setTemplate("Contract/View");
|
$this->layout()->setTemplate("Contract/View");
|
||||||
|
|
||||||
$id = $this->request->id;
|
$id = $this->request->contract_id;
|
||||||
|
if(!$id) {
|
||||||
|
$id = $this->request->id;
|
||||||
|
}
|
||||||
if(!is_numeric($id) || !$id) {
|
if(!is_numeric($id) || !$id) {
|
||||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
$this->redirect("Contract");
|
$this->redirect("Contract");
|
||||||
@@ -90,12 +93,280 @@ class ContractController extends mfBaseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function productchangeAction() {
|
||||||
|
$this->layout()->setTemplate("Contract/ProductchangeForm");
|
||||||
|
|
||||||
|
$id = $this->request->contract_id;
|
||||||
|
if(!$id) {
|
||||||
|
$id = $this->request->id;
|
||||||
|
}
|
||||||
|
if(!is_numeric($id) || !$id) {
|
||||||
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = new Contract($id);
|
||||||
|
if(!$contract->id) {
|
||||||
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->layout()->set("contract", $contract);
|
||||||
|
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||||
|
|
||||||
|
if($this->request->filter) {
|
||||||
|
$this->layout()->set("filter", $this->request->filter);
|
||||||
|
}
|
||||||
|
if($this->request->s) {
|
||||||
|
$this->layout()->set("filter", $this->request->s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function saveProductchangeAction() {
|
||||||
|
$r = $this->request;
|
||||||
|
|
||||||
|
$id = $r->contract_id;
|
||||||
|
if(!is_numeric($id) || !$id) {
|
||||||
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = new Contract($id);
|
||||||
|
if(!$contract->id) {
|
||||||
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_contract = clone($contract);
|
||||||
|
|
||||||
|
|
||||||
|
$contract_data = [];
|
||||||
|
$contract_data['product_id'] = $r->product_id;
|
||||||
|
$contract_data['product_name'] = trim($r->product_name);
|
||||||
|
$contract_data['product_info'] = trim($r->product_info);
|
||||||
|
$contract_data['matchcode'] = trim($r->matchcode);
|
||||||
|
$contract_data['termination_id'] = $r->termination_id;
|
||||||
|
$contract_data['amount'] = 1;
|
||||||
|
$contract_data['price'] = $r->price;
|
||||||
|
$contract_data['price_setup'] = $r->price_setup;
|
||||||
|
$contract_data['price_nne'] = $r->price_nne;
|
||||||
|
$contract_data['price_nbe'] = $r->price_nbe;
|
||||||
|
$contract_data['note'] = trim($r->note);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* termination check
|
||||||
|
*/
|
||||||
|
$product = new Product($r->product_id);
|
||||||
|
if(!$product->id) {
|
||||||
|
$this->layout()->setFlash("Produkt nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract_data['product_external'] = $product->external;
|
||||||
|
$contract_data['product_external_id'] = $product->external_id;
|
||||||
|
$contract_data['sla_id'] = $product->sla_id;
|
||||||
|
|
||||||
|
$require_term = false;
|
||||||
|
if(array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $product->attributes) && $product->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME]->value == 1) {
|
||||||
|
//var_dump($prod->attributes);
|
||||||
|
$require_term = true;
|
||||||
|
$termination = new Termination($contract_data['termination_id']);
|
||||||
|
|
||||||
|
if(!$contract_data['termination_id'] || !$termination->id) {
|
||||||
|
$this->layout()->setFlash("Produkt erfordert Anschluss.", "error");
|
||||||
|
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$contract_data['termination_id'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$new_contract->update($contract_data);
|
||||||
|
$new_contract_id = $new_contract->save();
|
||||||
|
|
||||||
|
if(!$new_contract_id) {
|
||||||
|
$this->layout()->setFlash("Neuer Contract konnte nicht gespeichert werden", "error");
|
||||||
|
$this->redirect("Contract", "productchange", ["contract_id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(is_array($r->links) && count($r->links)) {
|
||||||
|
foreach($r->links as $link_id => $action) {
|
||||||
|
$old_link = new ContractLink($link_id);
|
||||||
|
if(!$old_link->id) continue;
|
||||||
|
$new_link_origin_id = 0;
|
||||||
|
$new_link_origin_id = 0;
|
||||||
|
// check if link contains this contract
|
||||||
|
if($old_link->contract_id == $contract->id) {
|
||||||
|
$new_link_contract_id = $new_contract->id;
|
||||||
|
$new_link_origin_id = $old_link->origin_contract_id;
|
||||||
|
} elseif($old_link->origin_contract_id == $contract->id) {
|
||||||
|
$new_link_contract_id = $old_link->contract_id;
|
||||||
|
$new_link_origin_id = $new_contract->id;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_link = ContractLinkModel::create([
|
||||||
|
'contract_id' => $new_link_contract_id,
|
||||||
|
'origin_contract_id' => $new_link_origin_id,
|
||||||
|
'type' => $old_link->type,
|
||||||
|
]);
|
||||||
|
if(!$new_link->save()) {
|
||||||
|
$this->layout()->setFlash("Konnte neuen Link nicht speichern", "warn");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($action == "cancel") {
|
||||||
|
$old_link->change_action = "cancel";
|
||||||
|
if(!$old_link->save()) {
|
||||||
|
$this->layout()->setFlash("Konnte alten Link nicht speichern", "warn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($new_link);exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Upgrade Link erstellen
|
||||||
|
*/
|
||||||
|
$change_type = "upgrade";
|
||||||
|
/*if($contract->product_id != $new_contract->product_id) {
|
||||||
|
$change_type = "upgrade";
|
||||||
|
} elseif($contract->matchcode != $new_contract->matchcode) {
|
||||||
|
$change_type = "relocation";
|
||||||
|
} else {
|
||||||
|
$change_type = "productchange";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$link = ContractLinkModel::create([
|
||||||
|
'contract_id' => $new_contract_id,
|
||||||
|
'origin_contract_id' => $id,
|
||||||
|
'type' => $change_type
|
||||||
|
]);
|
||||||
|
|
||||||
|
$link_id = $link->save();
|
||||||
|
if(!$link_id) {
|
||||||
|
$this->layout()->setFlash("Konnte Verknüpfung nicht speichern", "warn");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->layout()->setFlash("Neuer Contract erfolgreich erstellt", "success");
|
||||||
|
$this->redirect("Contract", "view", ["contract_id" => $new_contract_id]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function finishContractAction() {
|
||||||
|
$r = $this->request;
|
||||||
|
|
||||||
|
$id = $r->contract_id;
|
||||||
|
if(!is_numeric($id) || !$id) {
|
||||||
|
$this->layout()->setFlash("Contract nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = new Contract($id);
|
||||||
|
if(!$contract->id) {
|
||||||
|
$this->layout()->setFlash("Contract nicht gefunden", "error");
|
||||||
|
$this->redirect("Contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = date('U');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Vorgänger Contracts kündigen
|
||||||
|
*/
|
||||||
|
foreach(ContractLinkModel::search(['contract_id' => $id]) as $link) {
|
||||||
|
if(!in_array($link->type, ["upgrade","downgrade","relocation","productchange"])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$origin = $link->origin;
|
||||||
|
$origin->cancel_date = $now;
|
||||||
|
$origin->cancel_date_by = $this->me->id;
|
||||||
|
$origin->edit_by = $this->me->id;
|
||||||
|
if(!$origin->save()) {
|
||||||
|
$this->layout()->setFlash("Achtung: Konnte nicht alle Vorgängercontracts kündigen!", "warn");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* alte Links übernehmen / kündigen
|
||||||
|
*/
|
||||||
|
foreach(ContractLinkModel::search(['type' => "link", 'contract_id' => $origin->id] ) as $old_link) {
|
||||||
|
// verlinkten Contract kündigen (wenn nicht schon gekündigt)
|
||||||
|
if($old_link->change_action == "cancel" && !$old_link->contract->cancel_date) {
|
||||||
|
$old_link->origin->update([
|
||||||
|
'cancel_date' => $now,
|
||||||
|
'cancel_date_by' => $this->me->id,
|
||||||
|
'edit_by' => $this->me->id
|
||||||
|
]);
|
||||||
|
$old_link->origin->save();
|
||||||
|
|
||||||
|
$old_link->change_action = null;
|
||||||
|
$old_link->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ContractLinkModel::search(['type' => "link", 'origin_contract_id' => $origin->id] ) as $old_link) {
|
||||||
|
// verlinkten Contract kündigen (wenn nicht schon gekündigt)
|
||||||
|
if($old_link->change_action == "cancel" && !$old_link->contract->cancel_date) {
|
||||||
|
$old_link->contract->update([
|
||||||
|
'cancel_date' => $now,
|
||||||
|
'cancel_date_by' => $this->me->id,
|
||||||
|
'edit_by' => $this->me->id
|
||||||
|
]);
|
||||||
|
$old_link->contract->save();
|
||||||
|
|
||||||
|
$old_link->change_action = null;
|
||||||
|
$old_link->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$contract->finish_date = $now;
|
||||||
|
$contract->finish_date_by = $this->me->id;
|
||||||
|
if(!$contract->save()) {
|
||||||
|
$this->layout()->setFlash("Contract konnte nicht gespeichert werden", "error");
|
||||||
|
$this->redirect("Contract", "view", ['contract_id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bestehende Links übernehmen oder kündigen
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->layout()->setFlash("Contract erfolgreich fertiggestellt", "success");
|
||||||
|
$this->redirect("Contract", "view", ['contract_id' => $id]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function addAction() {
|
protected function addAction() {
|
||||||
$this->layout()->setTemplate("Contract/Form");
|
$this->layout()->setTemplate("Contract/Form");
|
||||||
|
$this->layout()->set("terminations", TerminationModel::getAll());
|
||||||
|
|
||||||
|
if($this->request->origin_contract_id) {
|
||||||
|
$origin = new Contract($this->request->origin_contract_id);
|
||||||
|
if($origin->id) {
|
||||||
|
$contract = new Contract();
|
||||||
|
$contract->owner_id = $origin->owner_id;
|
||||||
|
$contract->billingaddress_id = $origin->billingaddress_id;
|
||||||
|
$contract->matchcode = $origin->matchcode;
|
||||||
|
//var_dump($contract);exit;
|
||||||
|
$this->layout()->set("contract", $contract);
|
||||||
|
$this->layout()->set("origin_contract_id", $origin->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function editAction() {
|
protected function editAction() {
|
||||||
$id = $this->request->id;
|
$id = $this->request->contract_id;
|
||||||
|
if(!$id) {
|
||||||
|
$id = $this->request->id;
|
||||||
|
}
|
||||||
if(!is_numeric($id) || !$id) {
|
if(!is_numeric($id) || !$id) {
|
||||||
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
$this->layout()->setFlash("Vertrag nicht gefunden", "error");
|
||||||
$this->redirect("Contract");
|
$this->redirect("Contract");
|
||||||
@@ -205,6 +476,21 @@ class ContractController extends mfBaseController {
|
|||||||
|
|
||||||
$this->layout()->setFlash("Vertrag erfolgreich gespeichert.", "success");
|
$this->layout()->setFlash("Vertrag erfolgreich gespeichert.", "success");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create link to origin contract if set
|
||||||
|
*/
|
||||||
|
if($mode == "add" && $r->origin_contract_id) {
|
||||||
|
$origin = new Contract($r->origin_contract_id);
|
||||||
|
if($origin->id) {
|
||||||
|
$link = ContractLinkModel::create([
|
||||||
|
'contract_id' => $contract_id,
|
||||||
|
'origin_contract_id' => $origin->id,
|
||||||
|
'type' => 'link'
|
||||||
|
]);
|
||||||
|
$link->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ContractLinks */
|
/* ContractLinks */
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ContractModel {
|
|||||||
|
|
||||||
$db = FronkDB::singleton();
|
$db = FronkDB::singleton();
|
||||||
|
|
||||||
$res = $db->select("Contract", "*", "1 = 1 ORDER BY owner_id,product_id,`create`");
|
$res = $db->select("Contract", "*", "1 = 1 ORDER BY owner_id,`create`");
|
||||||
if($db->num_rows($res)) {
|
if($db->num_rows($res)) {
|
||||||
while($data = $db->fetch_object($res)) {
|
while($data = $db->fetch_object($res)) {
|
||||||
$items[] = new Contract($data);
|
$items[] = new Contract($data);
|
||||||
@@ -129,7 +129,7 @@ class ContractModel {
|
|||||||
LEFT JOIN Product ON (Contract.product_id = Product.id)
|
LEFT JOIN Product ON (Contract.product_id = Product.id)
|
||||||
WHERE $where
|
WHERE $where
|
||||||
GROUP BY Contract.id
|
GROUP BY Contract.id
|
||||||
ORDER BY Contract.owner_id,Contract.product_id,Contract.`create`";
|
ORDER BY Contract.owner_id,Contract.`create`";
|
||||||
|
|
||||||
if(is_array($limit) && count($limit)) {
|
if(is_array($limit) && count($limit)) {
|
||||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class ContractLinkModel {
|
|||||||
public $contract_id;
|
public $contract_id;
|
||||||
public $origin_contract_id;
|
public $origin_contract_id;
|
||||||
public $type;
|
public $type;
|
||||||
|
public $change_action;
|
||||||
|
|
||||||
public $create_by = null;
|
public $create_by = null;
|
||||||
public $edit_by = null;
|
public $edit_by = null;
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class ProductController extends mfBaseController {
|
|||||||
if($r->producttech_id == "new") {
|
if($r->producttech_id == "new") {
|
||||||
$nt = [];
|
$nt = [];
|
||||||
$nt['name'] = $r->producttech_new_name;
|
$nt['name'] = $r->producttech_new_name;
|
||||||
$nt['rtrcode'] = $r->producttech_new_rtrcode;
|
//$nt['rtrcode'] = $r->producttech_new_rtrcode;
|
||||||
$nt['customer_type'] = ($r->producttech_new_customer_type == "business") ? "business" : "residential";
|
$nt['customer_type'] = ($r->producttech_new_customer_type == "business") ? "business" : "residential";
|
||||||
$nt['description'] = $r->producttech_new_description;
|
$nt['description'] = $r->producttech_new_description;
|
||||||
$nt['note'] = $r->producttech_new_note;
|
$nt['note'] = $r->producttech_new_note;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class ProducttechModel {
|
class ProducttechModel {
|
||||||
public $name = null;
|
public $name = null;
|
||||||
public $rtrcode = null;
|
//public $rtrcode = null;
|
||||||
public $customer_type = null;
|
public $customer_type = null;
|
||||||
public $description = null;
|
public $description = null;
|
||||||
|
|
||||||
|
|||||||
@@ -45,5 +45,9 @@ $l['preorder.order'] = "Vollanschluss";
|
|||||||
$l['preorder.reorder'] = "Nachbestellung";
|
$l['preorder.reorder'] = "Nachbestellung";
|
||||||
|
|
||||||
$l['contract.link'] = "Verknüpfung";
|
$l['contract.link'] = "Verknüpfung";
|
||||||
|
$l['contract.upgrade'] = "Upgrade";
|
||||||
|
$l['contract.downgrade'] = "Downgrade";
|
||||||
|
$l['contract.relocation'] = "Umzug";
|
||||||
|
$l['contract.productchange'] = "Produktwechsel";
|
||||||
|
|
||||||
$lang['de'] = $l;
|
$lang['de'] = $l;
|
||||||
@@ -16,13 +16,13 @@ class mfBaseModel {
|
|||||||
public $id;
|
public $id;
|
||||||
public $data;
|
public $data;
|
||||||
public $_old_data;
|
public $_old_data;
|
||||||
private $create;
|
protected $create;
|
||||||
private $edit;
|
protected $edit;
|
||||||
private $worker;
|
private $worker;
|
||||||
protected $forcestr;
|
protected $forcestr;
|
||||||
|
|
||||||
private $mode = "new";
|
protected $mode = "new";
|
||||||
private $saved = 0;
|
protected $saved = 0;
|
||||||
protected $db;
|
protected $db;
|
||||||
protected $log;
|
protected $log;
|
||||||
protected $table=false;
|
protected $table=false;
|
||||||
|
|||||||
Reference in New Issue
Block a user