modifications to use nne/nbe from OrderProduct instead of Product
This commit is contained in:
@@ -41,7 +41,7 @@ Gutschriften
|
||||
Anzahl | Produktname | Verrechungsperiode | Bauabschnitt | NNE
|
||||
-----------------------------------------------------------------------------------------------------------------------
|
||||
<?php foreach($nne_products as $op): ?>
|
||||
<?=sprintf("%-12s", substr($op->amount,0,12))?> | <?=utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | <?=utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | <?=sprintf("%-24s", substr(($op->termination->building->networksection_id) ? $op->termination->building->networksection->name : "<Kein Bauabschnitt>",0,24))?> | EUR <?=$op->product->price_nne?>
|
||||
<?=sprintf("%-12s", substr($op->amount,0,12))?> | <?=utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | <?=utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | <?=sprintf("%-24s", substr(($op->termination->building->networksection_id) ? $op->termination->building->networksection->name : "<Kein Bauabschnitt>",0,24))?> | EUR <?=$op->price_nne?>
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -447,6 +447,7 @@
|
||||
<input type="number" class="form-control" name="products[<?=$product->id?>][billing_delay]" id="billing_delay-<?=$product->id?>" value="<?=$product->billing_delay?>" placeholder="Freimonate" />
|
||||
<small>Max. 6 Monate</small>
|
||||
</div>
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nne-<?=$product->id?>">Preis NNE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price_nne]" id="price_nne-<?=$product->id?>" value="<?=$this::dotToComma($product->price_nne)?>" placeholder="NNE" />
|
||||
@@ -455,6 +456,7 @@
|
||||
<label class="form-label" for="price_nbe-<?=$product->id?>">Preis NBE</label>
|
||||
<input type="text" class="form-control" name="products[<?=$product->id?>][price_nbe]" id="price_nne-<?=$product->id?>" value="<?=$this::dotToComma($product->price_nbe)?>" placeholder="NBE" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -536,6 +538,7 @@
|
||||
<small>Max. 6 Monate</small>
|
||||
</div>
|
||||
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="price_nne-new">Preis NNE</label>
|
||||
<input type="text" class="form-control" name="products[new][price_nne]" id="price_nne-new" value="" placeholder="NNE" />
|
||||
@@ -544,6 +547,7 @@
|
||||
<label class="form-label" for="price_nbe-new">Preis NBE</label>
|
||||
<input type="text" class="form-control" name="products[new][price_nbe]" id="price_nbe-new" value="" placeholder="NBE" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -544,8 +544,17 @@ class OrderController extends mfBaseController {
|
||||
$product_data["description"] = $p["description"];
|
||||
$product_data["price"] = Layout::commaToDot($p["price"]);
|
||||
$product_data["price_setup"] = Layout::commaToDot($p["price_setup"]);
|
||||
$product_data["price_nne"] = Layout::commaToDot($p["price_nne"]);
|
||||
$product_data["price_nbe"] = Layout::commaToDot($p["price_nbe"]);
|
||||
|
||||
if($this->me->is("Admin") && $p["price_nne"]) {
|
||||
$product_data["price_nne"] = Layout::commaToDot($p["price_nne"]);
|
||||
} else {
|
||||
$product_data["price_nne"] = $prod->price_nne;
|
||||
}
|
||||
if($this->me->is("Admin") && $p["price_nbe"]) {
|
||||
$product_data["price_nbe"] = Layout::commaToDot($p["price_nbe"]);
|
||||
} else {
|
||||
$product_data["price_nbe"] = $prod->price_nbe;
|
||||
}
|
||||
|
||||
$product_data["billing_delay"] = ($p["billing_delay"]) ? $p["billing_delay"] : 0;
|
||||
if($product_data["billing_delay"] > 6) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
//require 'vendor/autoload.php';
|
||||
require("../config/config.php");
|
||||
|
||||
define('FRONKDB_SQLDEBUG',false);
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
|
||||
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
$me = new User(1);
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("OrderProduct", "id", "price_nne = 0 AND price_nbe = 0");
|
||||
if(!$db->num_rows($res)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$op = new OrderProduct($data->id);
|
||||
|
||||
|
||||
|
||||
if(!($op->product->price_nne > 0) && !($op->product->price_nbe > 0)) {
|
||||
//echo "nope\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
echo $op->product->name."\n ".$op->price_nne. " ".$op->price_nbe." -> ".$op->product->price_nne." ".$op->product->price_nbe."\n";
|
||||
|
||||
//continue;
|
||||
$op->price_nne = $op->product->price_nne;
|
||||
$op->price_nbe = $op->product->price_nbe;
|
||||
$op->save();
|
||||
}
|
||||
Reference in New Issue
Block a user