30 require_once
'./include/inc.header.php';
31 require_once
'./payment/classes/class.ilPaymentObject.php';
32 require_once
'./payment/classes/class.ilPaymentBookings.php';
33 require_once
'./payment/classes/class.ilPaymentShoppingCart.php';
34 require_once
'./Services/User/classes/class.ilObjUser.php';
35 require_once
'./Services/Payment/classes/class.ilERP.php';
53 $this->erp_cls =
"ilERPDebtor_" . $this->active_erp[
'erp_short'];
54 require_once
'./Services/Payment/classes/class.' . $this->erp_cls.
'.php';
56 $this->deb =
new $this->erp_cls();
58 $this->sc = $this->cart->getShoppingCart(
$pay_type );
67 if (!$this->deb->getDebtorByNumber($this->ilUser->getId()))
69 $this->deb->setAll( array(
70 'number' => $this->ilUser->getId(),
71 'name' => $this->ilUser->getFullName(),
72 'email' => $this->ilUser->email,
73 'address' => $this->ilUser->street,
74 'postalcode' => $this->ilUser->zipcode,
75 'city' => $this->ilUser->city,
76 'country' => $this->ilUser->country,
77 'phone' => $this->ilUser->phone_mobile)
79 $this->deb->createDebtor($this->ilUser->getId());
87 $this->deb->createInvoice();
89 foreach ($this->sc as $i)
94 $ilias_tid = $this->ilUser->getId() .
"_" . $tid;
98 $bo->setPobjectId( isset($i[
'pobject_id']) ? $i[
'pobject_id'] : 0 );
99 $bo->setCustomerId( $this->ilUser->getId() );
100 $bo->setVendorId( $pod[
'vendor_id'] );
101 $bo->setPayMethod($this->paytype);
102 $bo->setOrderDate(time());
103 $bo->setDuration($i[
'dauer']);
104 $bo->setPrice( $i[
'betrag'] );
108 $bo->setVatRate( $i[
'vat_rate'] );
109 $bo->setVatUnit( $i[
'vat_unit'] );
111 $bo->setTransactionExtern($tid);
112 $product_name = $i[
'buchungstext'];
113 $duration = $i[
'dauer'];
114 $amount = $i[
'betrag'];
116 include_once
'./payment/classes/class.ilPayMethods.php';
117 $save_adr = (int) ilPaymethods::_enabled(
'save_user_adr_epay') ? 1 : 0;
120 $bo->setStreet($this->ilUser->getStreet(),
'');
122 $bo->setZipcode($this->ilUser->getZipcode());
123 $bo->setCity($this->ilUser->getCity);
124 $bo->setCountry($this->ilUser->getCountry());
132 if ( $i[
'typ'] ==
'crs')
134 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
135 $this->deb->createInvoiceLine( 0, $product_name .
" (" . $duration.
")", 1, $amount );
136 $products[] = $product_name;
140 $cp->sendNotification($cp->NOTIFY_ACCEPT_SUBSCRIBER, $this->ilUser->getId());
143 $inv = $this->deb->bookInvoice();
144 $invoice_number = $this->deb->getInvoiceNumber();
146 $attach = $this->deb->getInvoicePDF($inv);
147 $this->deb->saveInvoice($attach,
false);
148 $lng->loadLanguageModule(
'payment');
149 $this->deb->sendInvoice($lng->txt(
'pay_order_paid_subject'),
150 $this->ilUser->getFullName() .
",\n" .
151 str_replace(
'%products%', implode(
", ", $products), $lng->txt(
'pay_order_paid_body')) ,
152 $this->ilUser->getEmail(),
153 $attach, $lng->txt(
'pays_invoice') .
"-" . $invoice_number
155 $this->cart->emptyShoppingCart();