+
+
+
+
+
@@ -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 @@
\
\
\
-
diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php
index b98869fc5..dcb836a34 100644
--- a/application/Order/OrderController.php
+++ b/application/Order/OrderController.php
@@ -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);
diff --git a/application/Order/OrderModel.php b/application/Order/OrderModel.php
index 724bb3787..ea8cd61e0 100644
--- a/application/Order/OrderModel.php
+++ b/application/Order/OrderModel.php
@@ -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";
diff --git a/application/OrderProduct/OrderProductModel.php b/application/OrderProduct/OrderProductModel.php
index a1a2c395a..0af892007 100644
--- a/application/OrderProduct/OrderProductModel.php
+++ b/application/OrderProduct/OrderProductModel.php
@@ -15,6 +15,7 @@ class OrderProductModel
public $price_nbe;
public $billing_delay;
public $billing_period;
+ public $contract_term;
public $note;
public $create_by = null;
diff --git a/application/Product/ProductController.php b/application/Product/ProductController.php
index 82e53042b..745cda09b 100644
--- a/application/Product/ProductController.php
+++ b/application/Product/ProductController.php
@@ -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 = [];
diff --git a/application/Product/ProductModel.php b/application/Product/ProductModel.php
index b7ccc17a1..bb2638e8d 100644
--- a/application/Product/ProductModel.php
+++ b/application/Product/ProductModel.php
@@ -1,26 +1,27 @@