예제 #1
0
!empty($_REQUEST['street1']) ? $order->street1 = $_REQUEST['street1'] : ($order->street1 = '');
!empty($_REQUEST['street2']) ? $order->street2 = $_REQUEST['street2'] : ($order->street2 = '');
!empty($_REQUEST['street3']) ? $order->street3 = $_REQUEST['street3'] : ($order->street3 = '');
!empty($_REQUEST['zip']) ? $order->zip = $_REQUEST['zip'] : ($order->zip = '');
!empty($_REQUEST['city']) ? $order->city = $_REQUEST['city'] : ($order->city = '');
!empty($_REQUEST['country']) ? $order->country = $_REQUEST['country'] : ($order->country = '');
$order->street = $order->street1;
!empty($order->street2) ? $order->street = $order->street . ' ' . $order->street2 : null;
!empty($order->street3) ? $order->street = $order->street . ' ' . $order->street3 : null;
$redirPage = $SETTINGS["url"] . "/pages/foretag_kampanj.php?anamn=" . $order->anamn . "&mailone=" . $order->email . '&firstname=' . $order->fname . '&lastname=' . $order->lname . '&co=' . $order->co . '&phone=' . $order->phone . '&street1=' . $order->street1 . '&street2=' . $order->street2 . '&street3=' . $order->street3 . '&zip=' . $order->zip . '&city=' . $order->city;
if ($order->compcampcode == '' or $order->email == '' or $order->fname == '' or $order->lname == '') {
    Misc::logMotiomera("Error action/medlem_foretagskod.php  Fält saknas!  \n Params:\n" . print_r($order, true) . "\n ", 'ERROR');
    $redirPage .= "&msg=fields_missing";
    header('Location: ' . $redirPage);
}
$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);