Merge branch 'fronkdev' into 'master'
sepa_date & contract_term See merge request fronk/thetool!218
This commit is contained in:
@@ -229,6 +229,14 @@
|
||||
<div class="col-lg-10 alert alert-danger hidden" id="bank-error"></div>
|
||||
</div>
|
||||
|
||||
<?php if($me->can("Fibu")): ?>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="sepa_date">Sepa Mandatsdatum</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="sepa_date" id="sepa_date" value="<?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -426,6 +434,14 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#sepa_date').datepicker({
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
var bankdata_valid = false;
|
||||
|
||||
$("#parent_id").select2({
|
||||
|
||||
@@ -116,7 +116,14 @@
|
||||
</tr><tr>
|
||||
<th>BIC</th>
|
||||
<td><?=$address->bank_account_bic?></td>
|
||||
</tr><tr>
|
||||
</tr>
|
||||
<?php if($me->can("Fibu")): ?>
|
||||
<tr>
|
||||
<th>Sepa Mandatsdatum</th>
|
||||
<td><?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<td colspan="2"><h4>FIBU</h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
if($noTermProducts) {
|
||||
$urlfilter['noTermProducts'] = 1;
|
||||
}
|
||||
if(is_array($filter) && count($filter)) {
|
||||
if(isset($filter) && is_array($filter) && count($filter)) {
|
||||
$urlfilter["filter"] = $filter;
|
||||
}
|
||||
$posturl = self::getUrl("Order", "save", $urlfilter);
|
||||
@@ -589,8 +589,8 @@
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][amount]" id="amount-<?=$i?>" value="<?=($product) ? $product->formatAmount() : ""?>" placeholder="Anzahl/Menge" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_period-<?=$i?>">Verrechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Verrechnungsperiode">
|
||||
<label class="form-label" for="billing_period-<?=$i?>">Rechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Rechnungsperiode">
|
||||
<option value="1" <?=($product->billing_period == 1) ? "selected='selected'" : ""?>>Monatlich</option>
|
||||
<option value="12" <?=($product->billing_period == 12) ? "selected='selected'" : ""?>>Jährlich</option>
|
||||
</select>
|
||||
@@ -649,10 +649,22 @@
|
||||
|
||||
<div class="row mt-1 mb-2">
|
||||
<!-- line 2 -->
|
||||
<div class="col-8">
|
||||
<div class="col-6">
|
||||
<label class="form-label" for="description-<?=$i?>" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[<?=$i?>][description]" id="description-<?=$i?>" placeholder="Zusatztext"><?=$product->description?></textarea>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="contract_term-<?=$i?>">Mindestvertragslaufzeit</label>
|
||||
<select class="form-control" name="products[<?=$i?>][contract_term]" id="contract_term-<?=$i?>" placeholder="Mindestvertragslaufzeit">
|
||||
<option value="0" <?=($product->contract_term == 0) ? "selected='selected'" : ""?>>Keine</option>
|
||||
<option value="1" <?=($product->contract_term == 1) ? "selected='selected'" : ""?>>1 Monat</option>
|
||||
<option value="12" <?=($product->contract_term == 12) ? "selected='selected'" : ""?>>12 Monate</option>
|
||||
<option value="24" <?=($product->contract_term == 24) ? "selected='selected'" : ""?>>24 Monate</option>
|
||||
<option value="36" <?=($product->contract_term == 36) ? "selected='selected'" : ""?>>36 Monate</option>
|
||||
<option value="48" <?=($product->contract_term == 48) ? "selected='selected'" : ""?>>48 Monate</option>
|
||||
<option value="60" <?=($product->contract_term == 60) ? "selected='selected'" : ""?>>60 Monate</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_delay-<?=$i?>" >Verzögerter Verrechnungsstart</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][billing_delay]" id="billing_delay-<?=$i?>" value="<?=$product->billing_delay?>" placeholder="Freimonate" />
|
||||
@@ -718,7 +730,7 @@
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_period-<?=$i?>">Verrechungsperiode</label>
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Verrechnungsperiode">
|
||||
<select class="form-control" name="products[<?=$i?>][billing_period]" id="billing_period-<?=$i?>" placeholder="Rechnungsperiode">
|
||||
<option value="1">Monatlich</option>
|
||||
<option value="12">Jährlich</option>
|
||||
</select>
|
||||
@@ -757,10 +769,22 @@
|
||||
|
||||
<div class="row mt-1 mb-2">
|
||||
<!-- line 2 -->
|
||||
<div class="col-8">
|
||||
<div class="col-6">
|
||||
<label class="form-label" for="description-<?=$i?>" >Zusatztext</label>
|
||||
<textarea class="form-control" name="products[<?=$i?>][description]" id="description-<?=$i?>" placeholder="Zusatztext"></textarea>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="contract_term-<?=$i?>">Mindestvertragslaufzeit</label>
|
||||
<select class="form-control" name="products[<?=$i?>][contract_term]" id="contract_term-<?=$i?>" placeholder="Mindestvertragslaufzeit">
|
||||
<option value="0">Keine</option>
|
||||
<option value="1">1 Monat</option>
|
||||
<option value="12">12 Monate</option>
|
||||
<option value="24">24 Monate</option>
|
||||
<option value="36">36 Monate</option>
|
||||
<option value="48">48 Monate</option>
|
||||
<option value="60">60 Monate</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="billing_delay-<?=$i?>" >Verzögerter Verrechnungsstart</label>
|
||||
<input type="number" class="form-control" name="products[<?=$i?>][billing_delay]" id="billing_delay-<?=$i?>" value="" placeholder="Freimonate" />
|
||||
@@ -1195,12 +1219,13 @@
|
||||
form_id: id
|
||||
},
|
||||
function (success) {
|
||||
//console.log(success);
|
||||
console.log(success);
|
||||
p = success.result.product;
|
||||
id = success.result.form_id;
|
||||
|
||||
$('#billing_delay-' + id).val(p.billing_delay);
|
||||
$('#billing_period-' + id).val(p.billing_period);
|
||||
$('#contract_term-' + id).val(p.contract_term);
|
||||
$('#price-' + id).val(p.price);
|
||||
$('#price_setup-' + id).val(p.price_setup);
|
||||
$('#price_nne-' + id).val(p.price_nne);
|
||||
@@ -1576,7 +1601,7 @@
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="billing_period-' + i +'">Verrechungsperiode</label> \
|
||||
<select class="form-control" name="products[' + i +'][billing_period]" id="billing_period-' + i +'" placeholder="Verrechnungsperiode"> \
|
||||
<select class="form-control" name="products[' + i +'][billing_period]" id="billing_period-' + i +'" placeholder="Rechnungsperiode"> \
|
||||
<option value="1">Monatlich</option> \
|
||||
<option value="12">Jährlich</option> \
|
||||
</select> \
|
||||
@@ -1616,10 +1641,22 @@
|
||||
\
|
||||
<div class="row mt-1 mb-2"> \
|
||||
<!-- line 2 --> \
|
||||
<div class="col-8"> \
|
||||
<div class="col-6"> \
|
||||
<label class="form-label" for="description-' + i +'" >Zusatztext</label> \
|
||||
<textarea class="form-control" name="products[' + i +'][description]" id="description-' + i +'" placeholder="Zusatztext"></textarea> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="contract_term-' + i + '">Mindestvertragslaufzeit</label> \
|
||||
<select class="form-control" name="products[' + i + '][contract_term]" id="contract_term-<?=$i?>" placeholder="Mindestvertragslaufzeit"> \
|
||||
<option value="0">Keine</option> \
|
||||
<option value="1">1 Monat</option> \
|
||||
<option value="12">12 Monate</option> \
|
||||
<option value="24">24 Monate</option> \
|
||||
<option value="36">36 Monate</option> \
|
||||
<option value="48">48 Monate</option> \
|
||||
<option value="60">60 Monate</option> \
|
||||
</select> \
|
||||
</div> \
|
||||
<div class="col-2"> \
|
||||
<label class="form-label" for="billing_delay-' + i +'" >Verzögerter Verrechnungsstart</label> \
|
||||
<input type="number" class="form-control" name="products[' + i +'][billing_delay]" id="billing_delay-' + i + '" value="" placeholder="Freimonate" /> \
|
||||
|
||||
@@ -210,7 +210,21 @@
|
||||
<input type="text" name="billing_delay" id="billing_delay" class="form-control" value="<?=$this::dotToComma($product->billing_delay)?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="contract_term">Mindestvertragslaufzeit</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control" name="contract_term" id="contract_term">
|
||||
<option value="0" <?=($product->contract_term == 0) ? "selected='selected'" : ""?>>Keine</option>
|
||||
<option value="1" <?=($product->contract_term == 1) ? "selected='selected'" : ""?>>1 Monat</option>
|
||||
<option value="12" <?=($product->contract_term == 12) ? "selected='selected'" : ""?>>12 Monate</option>
|
||||
<option value="24" <?=($product->contract_term == 24) ? "selected='selected'" : ""?>>24 Monate</option>
|
||||
<option value="36" <?=($product->contract_term == 36) ? "selected='selected'" : ""?>>36 Monate</option>
|
||||
<option value="48" <?=($product->contract_term == 48) ? "selected='selected'" : ""?>>48 Monate</option>
|
||||
<option value="60" <?=($product->contract_term == 60) ? "selected='selected'" : ""?>>60 Monate</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -243,6 +243,8 @@ class AddressController extends mfBaseController {
|
||||
$data['uid'] = trim($r->uid);
|
||||
|
||||
if($this->me->can("Fibu")) {
|
||||
$data["sepa_date"] = ($r->sepa_date) ? Layout::dateToInt($r->sepa_date) : null;
|
||||
|
||||
$data['fibu_account_number'] = ($r->fibu_account_number) ? trim($r->fibu_account_number) : null;
|
||||
$data['fibu_supplier_number'] = ($r->fibu_supplier_number) ? trim($r->fibu_supplier_number) : null;
|
||||
if($r->fibu_primary_account) {
|
||||
@@ -283,6 +285,13 @@ class AddressController extends mfBaseController {
|
||||
|
||||
if($r->billing_type == "sepa") {
|
||||
$data['billing_type'] = "sepa";
|
||||
if(!$r->sepa_date) {
|
||||
if($mode == "add" || ($mode == "edit" && !$address->sepa_date)) {
|
||||
$data['sepa_date'] = date('U');
|
||||
}
|
||||
} else {
|
||||
$data['sepa_date'] = $r->sepa_date;
|
||||
}
|
||||
} else {
|
||||
$data['billing_type'] = "invoice";
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class AddressModel {
|
||||
public $fibu_supplier_due;
|
||||
public $fibu_supplier_skonto;
|
||||
public $fibu_supplier_skonto_rate;
|
||||
public $fibu_supplier_paymentblock;
|
||||
public $fibu_primary_account;
|
||||
public $spin;
|
||||
public $company;
|
||||
@@ -28,6 +29,7 @@ class AddressModel {
|
||||
public $bank_account_owner;
|
||||
public $bank_account_iban;
|
||||
public $bank_account_bic;
|
||||
public $sepa_date;
|
||||
public $allow_contact;
|
||||
public $allow_spin;
|
||||
|
||||
@@ -365,6 +367,14 @@ class AddressModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("billing_type", $filter)) {
|
||||
$billing_type = FronkDB::singleton()->escape($filter["billing_type"]);
|
||||
if($billing_type) {
|
||||
$where .= " AND billing_type='$billing_type'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Address Type
|
||||
*/
|
||||
|
||||
@@ -498,6 +498,10 @@ class OrderController extends mfBaseController {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
/*
|
||||
* Contacts/Addresses and Billing data
|
||||
*/
|
||||
|
||||
// validate owner
|
||||
$owner = false;
|
||||
$owner_new = false;
|
||||
@@ -642,6 +646,7 @@ class OrderController extends mfBaseController {
|
||||
if($billingaddress_new) {
|
||||
if($r->billing_type == "sepa") {
|
||||
$billing_data['billing_type'] = "sepa";
|
||||
$billing_data['sepa_date'] = date("U");
|
||||
} else {
|
||||
$billing_data['billing_type'] = "invoice";
|
||||
}
|
||||
@@ -659,6 +664,7 @@ class OrderController extends mfBaseController {
|
||||
} elseif($owner_new) {
|
||||
if($r->billing_type == "sepa") {
|
||||
$owner_data['billing_type'] = "sepa";
|
||||
$owner_data['sepa_date'] = date("U");
|
||||
} else {
|
||||
$owner_data['billing_type'] = "invoice";
|
||||
}
|
||||
@@ -685,6 +691,20 @@ class OrderController extends mfBaseController {
|
||||
$techcontact = AddressModel::create($techcontact_data);
|
||||
}
|
||||
|
||||
// set sepa date if not yet set and sepa is active
|
||||
if($billingaddress) {
|
||||
if($billingaddress->billing_type == "sepa" && !$billingaddress->sepa_date) {
|
||||
$billingaddress->sepa_date = date("U");
|
||||
$billingaddress->save();
|
||||
}
|
||||
} else {
|
||||
if($owner->billing_type == "sepa" && !$owner->sepa_date) {
|
||||
$owner->sepa_date = date("U");
|
||||
$owner->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create or save Order object
|
||||
|
||||
$order_data = [];
|
||||
@@ -703,7 +723,7 @@ class OrderController extends mfBaseController {
|
||||
$order_data['allow_spin'] = ($r->allow_spin) ? 1 : 0;
|
||||
$order_data['note'] = $r->note;
|
||||
|
||||
$order_data['order_date'] = Layout::dateToInt($r->order_date);
|
||||
$order_data['order_date'] = ($order_data['order_date']) ? Layout::dateToInt($r->order_date) : null;
|
||||
|
||||
if($r->finish_after) {
|
||||
$order_data['finish_after'] = Layout::dateToInt($r->finish_after);
|
||||
@@ -876,6 +896,7 @@ class OrderController extends mfBaseController {
|
||||
$product_data["billing_delay"] = 6;
|
||||
}
|
||||
$product_data["billing_period"] = $p["billing_period"];
|
||||
$product_data["contract_term"] = $p["contract_term"];
|
||||
|
||||
$product_data['upgrade'] = $order_data['upgrade'];
|
||||
|
||||
@@ -912,6 +933,7 @@ class OrderController extends mfBaseController {
|
||||
$product_data['voicenumber'] = null;
|
||||
}
|
||||
|
||||
$product_data['edit_by'] = $this->me->id;
|
||||
|
||||
if(!$orderproduct_id) {
|
||||
$product = OrderProductModel::create($product_data);
|
||||
|
||||
@@ -284,6 +284,20 @@ class OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("finish_date>", $filter)) {
|
||||
$finish_date = $filter['finish_date>'];
|
||||
if($finish_date) {
|
||||
$where .= " AND `Order`.finish_date > $finish_date";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("finish_date<", $filter)) {
|
||||
$finish_date = $filter['finish_date<'];
|
||||
if($finish_date) {
|
||||
$where .= " AND `Order`.finish_date < $finish_date";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("upgrade", $filter)) {
|
||||
if($filter['upgrade'] == 1) {
|
||||
$where .= " AND `Order`.upgrade = 1";
|
||||
|
||||
@@ -15,6 +15,7 @@ class OrderProductModel
|
||||
public $price_nbe;
|
||||
public $billing_delay;
|
||||
public $billing_period;
|
||||
public $contract_term;
|
||||
public $note;
|
||||
|
||||
public $create_by = null;
|
||||
|
||||
@@ -156,6 +156,7 @@ class ProductController extends mfBaseController {
|
||||
$data['price_setup'] = ($r->price_setup) ? Layout::commaToDot($r->price_setup) : 0;
|
||||
$data['billing_period'] = $r->billing_period;
|
||||
$data['billing_delay'] = ($r->billing_delay) ? $r->billing_delay : 0;
|
||||
$data['contract_term'] = $r->contract_term;
|
||||
$data['ivt_id'] = ($r->ivt_id) ? $r->ivt_id : null;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
@@ -316,7 +317,7 @@ class ProductController extends mfBaseController {
|
||||
if(!$product->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(is_array($product->attributes) && count($product->attributes)) {
|
||||
$attributes = $product->attributes;
|
||||
$product->data->attributes = [];
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
<?php
|
||||
|
||||
class ProductModel {
|
||||
public $name = null;
|
||||
public $description = null;
|
||||
public $sla_id = null;
|
||||
public $external = null;
|
||||
public $name;
|
||||
public $description;
|
||||
public $sla_id;
|
||||
public $external;
|
||||
public $external_id;
|
||||
public $productgroup_id = null;
|
||||
public $producttech_id = null;
|
||||
public $price = null;
|
||||
public $price_setup = null;
|
||||
public $price_nne = null;
|
||||
public $price_nbe = null;
|
||||
public $billing_delay = null;
|
||||
public $billing_period = null;
|
||||
public $ivt_id = null;
|
||||
public $productgroup_id;
|
||||
public $producttech_id;
|
||||
public $price;
|
||||
public $price_setup;
|
||||
public $price_nne;
|
||||
public $price_nbe;
|
||||
public $billing_delay;
|
||||
public $billing_period;
|
||||
public $contract_term;
|
||||
public $ivt_id;
|
||||
|
||||
public $note = null;
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
public $note;
|
||||
public $create_by;
|
||||
public $edit_by;
|
||||
public $create;
|
||||
public $edit;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
|
||||
63
db/migrations/20240125122644_create_contractqueue.php
Normal file
63
db/migrations/20240125122644_create_contractqueue.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateContractqueue extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contractqueue");
|
||||
$table->addColumn("approved", "integer", ["null" => false, "default" => 0]);
|
||||
$table->addColumn("contract_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("order_id", "integer", ["null" => false]);
|
||||
$table->addColumn("orderproduct_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("owner_id", "integer", ["null" => false]);
|
||||
$table->addColumn("billingaddress_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("termination_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("product_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("product_name", "string", ["null" => false, "limit" => 255]);
|
||||
$table->addColumn("product_info", "text", ["null" => true, "default" => null]);
|
||||
$table->addColumn("matchcode", "string", ["null" => true, "default" => null, "limit" => 255]);
|
||||
$table->addColumn("amount", "decimal", ["null" => false, "precision" => 9, "scale" => 6]);
|
||||
$table->addColumn("sla_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("product_external", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$table->addColumn("product_external_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
$table->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$table->addColumn("price_nne", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$table->addColumn("price_nbe", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$table->addColumn("billing_delay", "integer", ["null" => false, "default" => 0]);
|
||||
$table->addColumn("billing_period", "integer", ["null" => false, "default" => 1]);
|
||||
$table->addColumn("order_date", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("finish_date", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("finish_date_by", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("cancel_date", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("cancel_date_by", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("imported_from", "string", ["null" => true, "default" => null, "limit" => 255]);
|
||||
$table->addColumn("imported_data", "string", ["null" => true, "default" => null, "limit" => 255]);
|
||||
$table->addColumn("note", "text", ["null" => true, "default" => null]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->create();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contractqueue")->drop()->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
31
db/migrations/20240125183839_address_add_sepa_date.php
Normal file
31
db/migrations/20240125183839_address_add_sepa_date.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddressAddSepaDate extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Address");
|
||||
$table->addColumn("sepa_date", "integer", ["null" => true, "default" => null, "after" => "bank_account_bic"]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Address")->removeColumn("sepa_date")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
61
db/migrations/20240130120101_contract_add_reseller_id.php
Normal file
61
db/migrations/20240130120101_contract_add_reseller_id.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ContractAddResellerId extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contract");
|
||||
$table->addColumn("crediting_partner_id", "integer", ["null" => true, "default" => null, "after" => "orderproduct_id"]);
|
||||
$table->addColumn("crediting_partner_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "crediting_partner_id"]);
|
||||
$table->addColumn("reseller_id", "integer", ["null" => true, "default" => null, "after" => "crediting_partner_rate"]);
|
||||
$table->addColumn("reseller_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "reseller_id"]);
|
||||
$table->addIndex("orderproduct_id");
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("Contractqueue");
|
||||
$table->addColumn("approved_credit", "integer", ["null" => false, "default" => 0, "after" => "approved"]);
|
||||
$table->addColumn("crediting_partner_id", "integer", ["null" => true, "default" => null, "after" => "orderproduct_id"]);
|
||||
$table->addColumn("crediting_partner_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "crediting_partner_id"]);
|
||||
$table->addColumn("reseller_id", "integer", ["null" => true, "default" => null, "after" => "crediting_partner_rate"]);
|
||||
$table->addColumn("reseller_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "reseller_id"]);
|
||||
$table->addIndex("order_id");
|
||||
$table->addIndex("orderproduct_id");
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Contractqueue");
|
||||
$table->removeIndex("orderproduct_id");
|
||||
$table->removeIndex("order_id");
|
||||
$table->removeColumn("reseller_rate");
|
||||
$table->removeColumn("reseller_id");
|
||||
$table->removeColumn("crediting_partner_rate");
|
||||
$table->removeColumn("crediting_partner_id");
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("Contract");
|
||||
$table->removeIndex("orderproduct_id");
|
||||
$table->removeColumn("reseller_rate");
|
||||
$table->removeColumn("reseller_id");
|
||||
$table->removeColumn("crediting_partner_rate");
|
||||
$table->removeColumn("crediting_partner_id");
|
||||
$table->save();
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ContractLinkAddTypeCredit extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("ContractLink");
|
||||
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange,credit"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("ContractLink");
|
||||
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class OrderChangeOrderdateDefaultNull extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Order");
|
||||
$table->changeColumn("order_date", "integer", ["null" => true, "default" => null]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ProductOrderContractAddContractTerm extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Product");
|
||||
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("OrderProduct");
|
||||
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("Contract");
|
||||
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("Contractqueue");
|
||||
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
|
||||
$table->update();
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Contractqueue")->removeColumn("contract_term")->update();
|
||||
$this->table("Contract")->removeColumn("contract_term")->update();
|
||||
$this->table("OrderProduct")->removeColumn("contract_term")->update();
|
||||
$this->table("Product")->removeColumn("contract_term")->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user