$order->gorUppslag(); break; case isset($_REQUEST["typ"]) && $_REQUEST["typ"] == "foretag": if (isset($_POST["startdatumRadio"])) { if ($_POST["startdatumRadio"] != 'egetdatum') { $startdatum = $_POST["startdatumRadio"]; } else { $startdatum = $_POST["startdatum"]; } } $typ = "foretag"; $kampanjkod = ""; $antal = ""; $kommun = Kommun::loadById(150); //Ale - legacy $foretagLosen = Foretag::skapaLosen(); //a new is created in api/order if a purchase is made $isValid = 0; $objekt = new Foretag($_REQUEST["namn"], $kommun, $foretagLosen, $startdatum, $kanal, $compAffCode, $isValid); //last param is "Order::isValid" and is set to 0 - i.e. not a valid order yet $objekt->setTempLosenord($foretagLosen); $objekt->commit(); if (isset($_REQUEST['$camparray'])) { $camparray = $_REQUEST['$camparray']; $refId = "first_iteration"; foreach ($camparray as $ord => $arr) { if ($arr["antal"] > 0) { //$objekt->generateNycklar($arr["antal"], true); if ($refId == "first_iteration") { //first order row $order = new Order($typ, $objekt, $arr["kampanjkod"], $arr["antal"], $kanal, $compAffCode, 0);