} $companyId = Foretag::getCompanyIdByCampaignMemberCode($order->compcampcode); if (is_numeric($companyId) && $companyId > 0) { //everthing looks fine sofar, create the user try { $foretag = Foretag::loadById($companyId); $kommun = Kommun::loadById($order->kid); $kontotyp = ''; //legacy or not used right now $maffcode = ''; //legacy or not used right now $medlem = new Medlem($order->email, $order->anamn, $kommun, $order->sex, $order->fname, $order->lname, $kontotyp, $maffcode); $medlem->confirm($order->pass); $medlem->setAddress($order->street); $medlem->setCo($order->co); $medlem->setZip($order->zip); $medlem->setCity($order->city); $medlem->setPhone($order->phone); $medlem->setCountry($order->country); $medlem->setEpostBekraftad(1); //medlem valid $medlem->setLevelId(1); $foretagsnyckel = $foretag->generateNycklar(1, true, $foretag->getOrderId()); $medlem->setForetagsnyckel($foretagsnyckel[0]); $medlem->commit(); $medlem->loggaIn($order->email, $order->pass, true); //header("Location: " . '/pages/minsida.php?mmForetagsnyckel=' . $foretagsnyckel[0]); header("Location: " . '/pages/minsida.php'); } catch (Exception $e) { $msg = $e->getMessage(); Misc::logMotiomera("Exception - medlem_foretagskod.php Params:\n" . print_r($order, true) . "\n CompanyId = {$companyId} \n Foretagsnyckel \n " . print_r($foretagsnyckel, true) . "\n msg: " . $msg . "\n", 'ERROR');