11 require_once
'./include/inc.header.php';
12 require_once
'./Services/Payment/classes/class.ilPaymentObject.php';
13 require_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
14 require_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
15 require_once
'./Services/User/classes/class.ilObjUser.php';
16 require_once
'./Services/Payment/classes/class.ilERP.php';
34 $this->erp_cls =
"ilERPDebtor_" . $this->active_erp[
'erp_short'];
35 require_once
'./Services/Payment/classes/class.' . $this->erp_cls.
'.php';
37 $this->deb =
new $this->erp_cls();
39 $this->sc = $this->cart->getShoppingCart(
$pay_type );
48 if (!$this->deb->getDebtorByNumber($this->ilUser->getId()))
50 $this->deb->setAll( array(
51 'number' => $this->ilUser->getId(),
52 'name' => $this->ilUser->getFullName(),
53 'email' => $this->ilUser->email,
54 'address' => $this->ilUser->street,
55 'postalcode' => $this->ilUser->zipcode,
56 'city' => $this->ilUser->city,
57 'country' => $this->ilUser->country,
58 'phone' => $this->ilUser->phone_mobile)
60 $this->deb->createDebtor($this->ilUser->getId());
68 $this->deb->createInvoice();
70 foreach ($this->sc as $i)
75 $ilias_tid = $this->ilUser->getId() .
"_" . $tid;
79 $bo->setPobjectId( isset($i[
'pobject_id']) ? $i[
'pobject_id'] : 0 );
80 $bo->setCustomerId( $this->ilUser->getId() );
81 $bo->setVendorId( $pod[
'vendor_id'] );
82 $bo->setPayMethod($this->paytype);
83 $bo->setOrderDate(time());
87 $bo->setDuration($i[
'duration']);
88 $bo->setPrice(
$sc[$i][
'price_string']);
92 $bo->setVatRate( $i[
'vat_rate'] );
93 $bo->setVatUnit( $i[
'vat_unit'] );
95 $bo->setTransactionExtern($tid);
99 $product_name = $i[
'object_title'];
100 $duration = $i[
'duration'];
101 $amount = $i[
'price'];
103 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
104 $save_adr = (int) ilPaymethods::_EnabledSaveUserAddress($this->paytype) ? 1 : 0;
107 $bo->setStreet($this->ilUser->getStreet(),
'');
109 $bo->setZipcode($this->ilUser->getZipcode());
110 $bo->setCity($this->ilUser->getCity);
111 $bo->setCountry($this->ilUser->getCountry());
119 if ( $i[
'typ'] ==
'crs')
121 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
122 $this->deb->createInvoiceLine( 0, $product_name .
" (" . $duration.
")", 1, $amount );
123 $products[] = $product_name;
127 $cp->sendNotification($cp->NOTIFY_ACCEPT_SUBSCRIBER, $this->ilUser->getId());
130 $inv = $this->deb->bookInvoice();
131 $invoice_number = $this->deb->getInvoiceNumber();
133 $attach = $this->deb->getInvoicePDF($inv);
134 $this->deb->saveInvoice($attach,
false);
135 $lng->loadLanguageModule(
'payment');
136 $this->deb->sendInvoice($lng->txt(
'pay_order_paid_subject'),
137 $this->ilUser->getFullName() .
",\n" .
138 str_replace(
'%products%', implode(
", ", $products), $lng->txt(
'pay_order_paid_body')) ,
139 $this->ilUser->getEmail(),
140 $attach, $lng->txt(
'pays_invoice') .
"-" . $invoice_number
142 $this->cart->emptyShoppingCart();