Added stuff to order form
This commit is contained in:
@@ -188,26 +188,16 @@ class OrderController extends mfBaseController {
|
||||
$order_data['allow_spin'] = ($r->allow_spin) ? 1 : 0;
|
||||
$order_data['note'] = $r->note;
|
||||
|
||||
$order_date = $r->order_date;
|
||||
$order_data['order_date'] = Layout::dateToInt($r->order_date);
|
||||
|
||||
if(!preg_match('/^(\d\d)\.(\d\d)\.(\d\d\d\d)$/',$order_date, $m)) {
|
||||
$errors[] = "Ungültiges Bestelldateum";
|
||||
} else {
|
||||
$day = intval($m[1]);
|
||||
$month = intval($m[2]);
|
||||
$year = intval($m[3]);
|
||||
|
||||
if($day > 31 || $day < 1
|
||||
|| $month > 12 || $month < 1
|
||||
|| $year > date('Y')+1 || $year < date('Y'))
|
||||
{
|
||||
$this->layout()->setFlash("Ungültiges Bestelldatum");
|
||||
$this->layout()->set("Order", $r);
|
||||
if($r->finish_after) {
|
||||
$order_data['finish_after'] = Layout::dateToInt($r->finish_after);
|
||||
if(!$r->finish_after_comment) {
|
||||
$this->layout()->setFlash("Bitte Verzögerungsgrund angeben.", "warn");
|
||||
$this->layout()->set("order", $r);
|
||||
return $this->add();
|
||||
}
|
||||
|
||||
$order_date_ts = mktime(0,0,0,$month,$day,$year);
|
||||
$order_data['order_date'] = $order_date_ts;
|
||||
$order_data['finish_after_comment'] = $r->finish_after_comment;
|
||||
}
|
||||
|
||||
$order_data['edit_by'] = $this->me->id;
|
||||
@@ -272,10 +262,6 @@ class OrderController extends mfBaseController {
|
||||
$this->log->warn(__CLASS__."::save() Invalid product: ".$p['product_id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$product_data = [];
|
||||
$product_data["order_id"] = $new_id;
|
||||
$product_data["product_id"] = $p["product_id"];
|
||||
@@ -284,17 +270,20 @@ 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["billing_delay"] = 0;
|
||||
$product_data["billing_delay"] = ($p["billing_delay"]) ? $p["billing_delay"] : 0;
|
||||
$product_data["billing_period"] = $p["billing_period"];
|
||||
|
||||
|
||||
$require_term = false;
|
||||
if(array_key_exists(TT_ATTRIB_TERMINATION_REQUIRED_NAME, $prod->attributes) && $prod->attributes[TT_ATTRIB_TERMINATION_REQUIRED_NAME] == 1) {
|
||||
$require_term = true;
|
||||
if(!$p['termination_id']) {
|
||||
$this->layout()->setFlash("Produkt nicht gespeichert. Produkt erfordert Anschluss.", "warn");
|
||||
$this->layout()->setFlash("Ein oder mehrere Produkte erfordern Anschluss.", "warn");
|
||||
continue;
|
||||
}
|
||||
$product_data['termination_id'] = $p['termination_id'];
|
||||
} else {
|
||||
$product_data['termination_id'] = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user