예제 #1
0
 public function deleteMe()
 {
     if (Session::isPluginLoaded("Kunden") and Session::isPluginLoaded("Auftraege")) {
         $K = Kappendix::getKappendixToAdresse($this->getID());
         if ($K != null) {
             $AC = anyC::get("Auftrag", "kundennummer", $K->A("kundennummer"));
             $AC->setLimitV3(1);
             $A = $AC->getNextEntry();
             if ($A === null) {
                 $K->deleteMe();
             }
         }
     }
     parent::deleteMe();
 }
예제 #2
0
 function handleOrder()
 {
     $values = $_SESSION["ticketDataAddress"];
     $F = new Factory("Adresse");
     $values["land"] = ISO3166::getCountryToCode($values["land"]);
     $F->fill($values);
     $exists = $F->exists(true);
     if (!$exists) {
         $AdresseID = $F->store(false, false);
         $K = new Kunden();
         $Kappendix = $K->createKundeToAdresse($AdresseID, false, true);
     } else {
         $AdresseID = $exists->getID();
         $Kappendix = Kappendix::getKappendixToAdresse($AdresseID);
     }
     if ($_SESSION["ticketDataPayment"]["via"] == "debit") {
         $Kappendix->changeA("KappendixKontonummer", $_SESSION["ticketDataPayment"]["debitKontonummer"]);
         $Kappendix->changeA("KappendixBLZ", $_SESSION["ticketDataPayment"]["debitBlz"]);
         $Kappendix->changeA("KappendixKontoinhaber", $_SESSION["ticketDataPayment"]["debitInhaber"]);
         $Kappendix->changeA("KappendixEinzugsermaechtigung", "1");
         $Kappendix->changeA("KappendixEinzugsermaechtigungAltZBTB", "5");
         $Kappendix->changeA("KappendixSameKontoinhaber", "0");
     }
     if (!$exists) {
         $Kappendix->newMe(false);
     } else {
         $Kappendix->saveMe();
     }
     $zahlungsart = 6;
     if ($_SESSION["ticketDataPayment"]["via"] == "debit") {
         $zahlungsart = 1;
     }
     if ($_SESSION["ticketDataPayment"]["via"] == "transfer") {
         $zahlungsart = 5;
     }
     if ($_SESSION["ticketDataPayment"]["via"] == "paypal") {
         $zahlungsart = 7;
     }
     $orderIDs = array();
     foreach ($_SESSION["ticketDataSelection"] as $SeminarID => $anzahl) {
         if ($anzahl == 0) {
             continue;
         }
         $F = new Factory("STeilnehmer");
         $F->sA("STeilnehmerSeminarID", $SeminarID);
         $F->sA("STeilnehmerAdresseID", $AdresseID);
         $F->sA("STeilnehmerAngemeldetAm", time());
         $F->sA("STeilnehmerErwachsene", $anzahl);
         $F->sA("STeilnehmerZahlungsart", $zahlungsart);
         $STeilnehmerID = $F->store();
         $Tickets = array();
         foreach ($_SESSION["ticketDataTickets"] as $k => $v) {
             $ex = explode("_", $k);
             if (count($ex) != 3) {
                 continue;
             }
             if ($ex[1] != $SeminarID) {
                 continue;
             }
             if (!isset($Tickets[$ex[2]])) {
                 $Tickets[$ex[2]] = array();
             }
             $Tickets[$ex[2]][$ex[0]] = $v;
         }
         foreach ($Tickets as $ticket) {
             $F = new Factory("STeilnehmerTicket");
             $F->sA("STeilnehmerTicketSeminarID", $SeminarID);
             $F->sA("STeilnehmerTicketSTeilnehmerID", $STeilnehmerID);
             $F->sA("STeilnehmerTicketVorname", $ticket["Vorname"]);
             $F->sA("STeilnehmerTicketNachname", $ticket["Nachname"]);
             $F->sA("STeilnehmerTicketPosition", $ticket["Position"]);
             $F->sA("STeilnehmerTicketUnternehmen", $ticket["Unternehmen"]);
             $F->sA("STeilnehmerTicketEMail", $ticket["Email"]);
             if ($this->fromPOS) {
                 $F->sA("STeilnehmerTicketFirstSeen", time());
             }
             $F->store();
         }
         $S = new Seminar($SeminarID);
         $S->createRechnungen($STeilnehmerID);
         foreach ($S->createdGRLBMs as $GRLBM) {
             $Auftrag = new Auftrag($GRLBM->A("AuftragID"));
             $Auftrag->sendViaEmail($GRLBM->getID(), "", "", "", false);
             $B = new Bestellung(-1);
             $orderIDs[] = $B->createFromInvoice($GRLBM->A("AuftragID"), $GRLBM, "MMDB/Seminare/STeilnehmer", $STeilnehmerID);
         }
     }
     $_SESSION["ticketStep"] = 6;
     $_SESSION["ticketDataOrderIDs"] = $orderIDs;
 }