32 include_once
'./payment/classes/class.ilPaymentShoppingCart.php';
33 include_once
'./payment/classes/class.ilPaymentShoppingCartGUI.php';
34 include_once
'./payment/classes/class.ilPaymentCoupons.php';
53 $this->ilias = $ilias;
66 if (!is_array(
$_SESSION[
'bill'][
'personal_data']))
68 $_SESSION[
'bill'][
'personal_data'][
'firstname'] = $this->user_obj->getFirstname();
69 $_SESSION[
'bill'][
'personal_data'][
'lastname'] = $this->user_obj->getLastname();
70 if (strpos(
'_' . $this->user_obj->getStreet(),
' ') > 0)
72 $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(),
' ')+1);
73 $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
74 $_SESSION[
'bill'][
'personal_data'][
'street'] = $street;
75 $_SESSION[
'bill'][
'personal_data'][
'house_number'] = $houseNo;
79 $_SESSION[
'bill'][
'personal_data'][
'street'] = $this->user_obj->getStreet();
80 $_SESSION[
'bill'][
'personal_data'][
'house_number'] =
'';
82 $_SESSION[
'bill'][
'personal_data'][
'po_box'] =
'';
83 $_SESSION[
'bill'][
'personal_data'][
'zipcode'] = $this->user_obj->getZipcode();
84 $_SESSION[
'bill'][
'personal_data'][
'city'] = $this->user_obj->getCity();
86 $_SESSION[
'bill'][
'personal_data'][
'email'] = $this->user_obj->getEmail();
87 $_SESSION[
'bill'][
'personal_data'][
'language'] = $this->user_obj->getLanguage();
90 if (!is_array(
$_SESSION[
'coupons'][
'bill']))
97 $this->lng->loadLanguageModule(
'payment');
99 $ilTabs->clearTargets();
100 $ilTabs->clearSubTabs();
114 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
115 $this->tpl->touchBlock(
'stop_floating');
120 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_personal_data.html',
'payment');
122 $this->tpl->setVariable(
'PERSONAL_DATA_FORMACTION',$this->ctrl->getFormAction($this));
126 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
128 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
129 $this->tpl->setVariable(
'TITLE',$this->lng->txt(
'pay_bmf_personal_data'));
130 $this->tpl->setVariable(
'DESCRIPTION',$this->lng->txt(
'pay_bmf_description_personal_data'));
131 $this->tpl->touchBlock(
'stop_floating');
132 $this->tpl->setVariable(
'TXT_CLOSE_WINDOW',$this->lng->txt(
'close_window'));
135 $this->tpl->setVariable(
'TXT_FIRSTNAME',$this->lng->txt(
'firstname'));
136 $this->tpl->setVariable(
'TXT_LASTNAME',$this->lng->txt(
'lastname'));
137 $this->tpl->setVariable(
'TXT_STREET',$this->lng->txt(
'street'));
138 $this->tpl->setVariable(
'TXT_HOUSE_NUMBER',$this->lng->txt(
'pay_bmf_house_number'));
139 $this->tpl->setVariable(
'TXT_OR',$this->lng->txt(
'pay_bmf_or'));
140 $this->tpl->setVariable(
'TXT_PO_BOX',$this->lng->txt(
'pay_bmf_po_box'));
141 $this->tpl->setVariable(
'TXT_ZIPCODE',$this->lng->txt(
'zipcode'));
142 $this->tpl->setVariable(
'TXT_CITY',$this->lng->txt(
'city'));
143 $this->tpl->setVariable(
'TXT_COUNTRY',$this->lng->txt(
'country'));
144 $this->tpl->setVariable(
'TXT_EMAIL',$this->lng->txt(
'email'));
146 $this->tpl->setVariable(
'INPUT_VALUE',ucfirst($this->lng->txt(
'next')));
147 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
153 $this->tpl->setVariable(
'FIRSTNAME', $this->user_obj->getFirstname());
154 $this->tpl->setVariable(
'LASTNAME', $this->user_obj->getLastname());
155 $this->tpl->setVariable(
'STREET',
156 $this->error !=
'' && isset(
$_POST[
'street'])
159 $this->tpl->setVariable(
'HOUSE_NUMBER',
160 $this->error !=
'' && isset(
$_POST[
'house_number'])
163 $this->tpl->setVariable(
'PO_BOX',
164 $this->error !=
'' && isset(
$_POST[
'po_box'])
167 $this->tpl->setVariable(
'ZIPCODE',
168 $this->error !=
'' && isset(
$_POST[
'zipcode'])
171 $this->tpl->setVariable(
'CITY',
172 $this->error !=
'' && isset(
$_POST[
'city'])
175 $this->tpl->setVariable(
'EMAIL', $this->user_obj->getEmail());
183 if (
$_SESSION[
'bill'][
'personal_data'][
'firstname'] ==
'' ||
184 $_SESSION[
'bill'][
'personal_data'][
'lastname'] ==
'' ||
185 $_POST[
'zipcode'] ==
'' ||
187 $_POST[
'country'] ==
'' ||
188 $_SESSION[
'bill'][
'personal_data'][
'email'] ==
'')
191 $this->error = $this->lng->txt(
'pay_bmf_personal_data_not_valid');
197 if ((
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] ==
'' &&
$_POST[
'po_box'] ==
'') ||
198 ((
$_POST[
'street'] !=
'' ||
$_POST[
'house_number'] !=
'') &&
$_POST[
'po_box'] !=
'') ||
199 (
$_POST[
'street'] !=
'' &&
$_POST[
'house_number'] ==
'') ||
200 (
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] !=
''))
202 $this->error = $this->lng->txt(
'pay_bmf_street_or_pobox');
208 $_SESSION[
'bill'][
'personal_data'][
'firstname'] = $this->user_obj->getFirstname();
209 $_SESSION[
'bill'][
'personal_data'][
'lastname'] = $this->user_obj->getLastname();
211 $_SESSION[
'bill'][
'personal_data'][
'house_number'] =
$_POST[
'house_number'];
217 $_SESSION[
'bill'][
'personal_data'][
'email'] = $this->user_obj->getEmail();
218 $_SESSION[
'bill'][
'personal_data'][
'language'] = $this->user_obj->getLanguage();
231 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
232 $this->tpl->touchBlock(
'stop_floating');
238 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill_confirm.html',
'payment');
242 $this->tpl->setVariable(
'BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
246 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
247 $this->tpl->touchBlock(
'stop_floating');
248 $this->tpl->setVariable(
'TXT_CLOSE_WINDOW',$this->lng->txt(
'close_window'));
251 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS',$this->lng->txt(
'pay_bmf_terms_conditions'));
252 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS_READ',$this->lng->txt(
'pay_bmf_terms_conditions_read'));
253 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS_SHOW',$this->lng->txt(
'pay_bmf_terms_conditions_show'));
254 $this->tpl->setVariable(
'LINK_TERMS_CONDITIONS',
'./payment.php?view=conditions');
255 $this->tpl->setVariable(
'TXT_PASSWORD',$this->lng->txt(
'password'));
256 $this->tpl->setVariable(
'TXT_CONFIRM_ORDER',$this->lng->txt(
'pay_confirm_order'));
258 $this->tpl->setVariable(
'INPUT_VALUE',$this->lng->txt(
'pay_send_order'));
259 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
260 if ($this->error !=
'' &&
261 isset(
$_POST[
'terms_conditions']))
263 $this->tpl->setVariable(
'TERMS_CONDITIONS_' . strtoupper(
$_POST[
'terms_conditions']),
' checked') ;
265 if ($this->error !=
'' &&
266 isset(
$_POST[
'password']))
272 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
273 $this->tpl->setCurrentBlock(
'btn_cell');
274 $this->tpl->setVariable(
'BTN_LINK', $this->ctrl->getLinkTarget($this,
'showPersonalData'));
275 $this->tpl->setVariable(
'BTN_TXT', $this->lng->txt(
'pay_bmf_back'));
276 $this->tpl->parseCurrentBlock(
'btn_cell');
288 $cmd = $this->ctrl->getCmd();
290 switch ($this->ctrl->getNextClass($this))
293 if(!
$cmd = $this->ctrl->getCmd())
295 $cmd =
'showPersonalData';
304 global $ilias, $ilUser, $ilObjDataCache;
310 $this->psc_obj->clearCouponItemsSession();
312 if (is_array($sc) && count($sc) > 0)
314 include_once
'./payment/classes/class.ilPaymentBookings.php';
317 for ($i = 0; $i < count($sc); $i++)
319 if (!empty(
$_SESSION[
'coupons'][
'bill']))
321 $sc[$i][
'math_price'] = (float) $sc[$i][
'betrag'];
323 $tmp_pobject =&
new ilPaymentObject($this->user_obj, $sc[$i][
'pobject_id']);
327 $this->coupon_obj->setId($coupon[
'pc_pk']);
328 $this->coupon_obj->setCurrentCoupon($coupon);
330 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
332 $_SESSION[
'coupons'][
'bill'][
$key][
'total_objects_coupon_price'] += (float) $sc[$i][
'betrag'];
341 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][
'bill']);
343 for ($i = 0; $i < count($sc); $i++)
346 $pobject =&
new ilPaymentObject($this->user_obj,$sc[$i][
'pobject_id']);
348 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$ilUser->getId().
'_'.substr((
string) time(),-3);
349 $transaction = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
350 $price = $sc[$i][
'betrag'];
353 if (array_key_exists($sc[$i][
'pobject_id'], $coupon_discount_items))
355 $bonus = $coupon_discount_items[$sc[$i][
'pobject_id']][
'math_price'] - $coupon_discount_items[$sc[$i][
'pobject_id']][
'discount_price'];
358 $book_obj->setTransaction($inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4));
359 $book_obj->setPobjectId($sc[$i][
'pobject_id']);
360 $book_obj->setCustomerId($ilUser->getId());
361 $book_obj->setVendorId($pobjectData[
'vendor_id']);
362 $book_obj->setPayMethod($pobjectData[
'pay_method']);
363 $book_obj->setOrderDate(time());
364 $book_obj->setDuration($sc[$i][
'dauer']);
365 $book_obj->setUnlimitedDuration($sc[i][
'unlimited_duration']);
366 $book_obj->setPrice($sc[$i][
'betrag_string']);
368 $book_obj->setPayed(1);
369 $book_obj->setAccess(1);
370 $book_obj->setVoucher(
'');
371 $book_obj->setTransactionExtern(
'');
373 $book_obj->setVatRate($sc[$i][
'vat_rate']);
374 $book_obj->setVatUnit($sc[$i][
'vat_unit']);
375 $book_obj->setObjectTitle($sc[$i][
'buchungstext']);
377 include_once
'./payment/classes/class.ilPayMethods.php';
381 if($save_user_adr_bill == 1)
383 $book_obj->setStreet(
$_SESSION[
'bill'][
'personal_data'][
'street'],
$_SESSION[
'bill'][
'personal_data'][
'house_number']);
384 $book_obj->setPoBox(
$_SESSION[
'bill'][
'personal_data'][
'po_box']);
385 $book_obj->setZipcode(
$_SESSION[
'bill'][
'personal_data'][
'zipcode']);
386 $book_obj->setCity(
$_SESSION[
'bill'][
'personal_data'][
'city']);
387 $book_obj->setCountry(
$_SESSION[
'bill'][
'personal_data'][
'country']);
390 $booking_id = $book_obj->add();
392 if (!empty(
$_SESSION[
'coupons'][
'bill']) && $booking_id)
394 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
396 $this->coupon_obj->setId($coupon[
'pc_pk']);
397 $this->coupon_obj->setCurrentCoupon($coupon);
399 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
401 $this->coupon_obj->addCouponForBookingId($booking_id);
409 $obj_id = $ilObjDataCache->lookupObjId($pobjectData[
'ref_id']);
410 $obj_type = $ilObjDataCache->lookupType($obj_id);
411 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
413 $bookings[
'list'][] = array(
415 'title' =>
'['.$obj_id.
']: ' . $obj_title,
416 'duration' => $sc[$i][
'dauer'],
417 'vat_rate' => $sc[$i][
'vat_rate'],
418 'vat_unit' => $sc[$i][
'vat_unit'],
419 'price' => $sc[$i][
'betrag_string'],
420 'betrag' => $sc[$i][
'betrag']
423 $total += $sc[$i][
'betrag'];
424 $total_vat += $sc[$i][
'vat_unit'];
427 if ($sc[$i][
'psc_id']) $this->psc_obj->delete($sc[$i][
'psc_id']);
430 if (!empty(
$_SESSION[
'coupons'][
'bill']))
432 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
434 $this->coupon_obj->setId($coupon[
'pc_pk']);
435 $this->coupon_obj->setCurrentCoupon($coupon);
436 $this->coupon_obj->addTracking();
441 $bookings[
'total'] =
$total;
443 $bookings[
'total_vat'] = $total_vat;
445 $bookings[
'transaction'] = $transaction;
453 global $ilUser, $ilias,
$tpl;
455 $transaction = $bookings[
'transaction'];
457 include_once
'./classes/class.ilTemplate.php';
458 include_once
'./Services/Utilities/classes/class.ilUtil.php';
459 include_once
'./payment/classes/class.ilGeneralSettings.php';
460 include_once
'./payment/classes/class.ilPaymentShoppingCart.php';
461 include_once
'Services/Mail/classes/class.ilMimeMail.php';
465 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill.html',
'payment');
466 $tpl =
new ilTemplate(
'./payment/templates/default/tpl.pay_bill.html',
true,
true,
true);
468 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
469 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
470 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
471 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
474 $tpl->setVariable(
'CUSTOMER_FIRSTNAME', $customer[
'firstname']);
475 $tpl->setVariable(
'CUSTOMER_LASTNAME', $customer[
'lastname']);
476 if($customer[
'po_box']==
'')
478 $tpl->setVariable(
'CUSTOMER_STREET', $customer[
'street'].
' ' . $customer[
'house_number']);
482 $tpl->setVariable(
'CUSTOMER_STREET', $customer[
'po_box']);
484 $tpl->setVariable(
'CUSTOMER_ZIPCODE', $customer[
'zipcode']);
485 $tpl->setVariable(
'CUSTOMER_CITY', $customer[
'city']);
486 $tpl->setVariable(
'CUSTOMER_COUNTRY', $customer[
'country']);
488 $tpl->setVariable(
'BILL_NO', $transaction);
489 $tpl->setVariable(
'DATE', date(
'd.m.Y'));
491 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
492 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
493 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
495 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
496 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
497 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
498 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
500 for ($i = 0; $i < count($bookings[
'list']); $i++)
502 $tmp_pobject =&
new ilPaymentObject($this->user_obj, $bookings[
'list'][$i][
'pobject_id']);
504 $assigned_coupons =
'';
505 if (!empty(
$_SESSION[
'coupons'][
'bill']))
509 $this->coupon_obj->setId($coupon[
'pc_pk']);
510 $this->coupon_obj->setCurrentCoupon($coupon);
512 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
514 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
519 $tpl->setCurrentBlock(
'loop');
520 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings[
'list'][$i][
'type'])));
521 $tpl->setVariable(
'LOOP_TITLE', utf8_decode($bookings[
'list'][$i][
'title']) . $assigned_coupons);
522 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
524 if( $bookings[
'list'][$i][
'duration'] == 0)
526 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
528 $tpl->setVariable(
'LOOP_DURATION', $bookings[
'list'][$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months')));
529 $tpl->setVariable(
'LOOP_VAT_RATE', $bookings[
'list'][$i][
'vat_rate']);
530 $tpl->setVariable(
'LOOP_VAT_UNIT', $bookings[
'list'][$i][
'vat_unit'].
' '.$genSet->get(
'currency_unit'));
531 $tpl->setVariable(
'LOOP_PRICE', $bookings[
'list'][$i][
'price']);
532 $tpl->parseCurrentBlock(
'loop');
537 if (!empty(
$_SESSION[
'coupons'][
'bill']))
539 if (count($items = $bookings[
'list']))
541 $sub_total_amount = $bookings[
'total'];
543 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
545 $this->coupon_obj->setId($coupon[
'pc_pk']);
546 $this->coupon_obj->setCurrentCoupon($coupon);
548 $total_object_price = 0.0;
549 $current_coupon_bonus = 0.0;
551 foreach ($bookings[
'list'] as $item)
553 $tmp_pobject =&
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
555 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
557 $total_object_price += $item[
'betrag'];
563 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
565 $bookings[
'total'] += $current_coupon_bonus * (-1);
567 $tpl->setCurrentBlock(
'cloop');
568 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code']));
569 $tpl->setVariable(
'BONUS', number_format($current_coupon_bonus * (-1), 2,
',',
'.') .
' ' . $genSet->get(
'currency_unit'));
570 $tpl->parseCurrentBlock();
573 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
574 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $genSet->get(
'currency_unit'));
578 if ($bookings[
'total'] < 0)
580 $bookings[
'total'] = 0.0;
581 $bookings[
'total_vat'] = 0.0;
585 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
586 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $genSet->get(
'currency_unit'));
587 if ($bookings[
'total_vat'] > 0)
589 $tpl->setVariable(
'TOTAL_VAT', $bookings[
'total_vat'].
' ' . $genSet->get(
'currency_unit'));
590 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'pay_bmf_vat_included')));
593 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
595 if (!@file_exists($genSet->get(
'pdf_path')))
601 if (@file_exists($genSet->get(
'pdf_path')))
603 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf');
606 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf') &&
607 $ilUser->getEmail() !=
'' &&
608 $ilias->getSetting(
'admin_email') !=
'')
611 $m->
From( $ilias->getSetting(
'admin_email') );
612 $m->To( $ilUser->getEmail() );
613 $m->Subject( $this->lng->txt(
'pay_message_subject') );
614 $message = $this->lng->txt(
'pay_message_hello') .
' ' . $ilUser->getFirstname() .
' ' . $ilUser->getLastname() .
",\n\n";
615 $message .= $this->lng->txt(
'pay_message_thanks') .
"\n\n";
616 $message .= $this->lng->txt(
'pay_message_attachment') .
"\n\n";
617 $message .= $this->lng->txt(
'pay_message_regards') .
"\n\n";
618 $message .= strip_tags($genSet->get(
'address'));
619 $m->Body( $message );
620 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf',
'application/pdf' ) ;
624 @unlink($genSet->get(
'pdf_path') .
'/' . $transaction .
'.html');
625 @unlink($genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf');
630 include_once
'./payment/classes/class.ilPaymentBookings.php';
631 include_once
'./payment/classes/class.ilPaymentShoppingCart.php';
632 include_once
'./payment/classes/class.ilPaymentObject.php';
633 include_once
'./payment/classes/class.ilPaymentPrices.php';
634 include_once
'./payment/classes/class.ilGeneralSettings.php';
635 include_once
'./payment/classes/class.ilPayMethods.php';
645 $sc_obj->clearCouponItemsSession();
647 foreach($items as $entry)
653 if (!empty(
$_SESSION[
'coupons'][
'bill']))
656 $entry[
'math_price'] = $entry[
'price'];
659 $this->coupon_obj->setId($coupon[
'pc_pk']);
660 $this->coupon_obj->setCurrentCoupon($coupon);
662 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
665 $_SESSION[
'coupons'][
'bill'][
$key][
'total_objects_coupon_price'] += $entry[
'price'];
674 $coupon_discount_items = $sc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][
'bill']);
677 foreach($items as $entry)
684 if (array_key_exists($entry[
'pobject_id'], $coupon_discount_items))
686 $bonus = $coupon_discount_items[$entry[
'pobject_id']][
'math_price'] - $coupon_discount_items[$entry[
'pobject_id']][
'discount_price'];
689 $booking_obj->setTransaction($a_transaction);
690 $booking_obj->setPobjectId($entry[
'pobject_id']);
691 $booking_obj->setCustomerId($this->user_obj->getId());
692 $booking_obj->setVendorId($pobject->getVendorId());
693 $booking_obj->setPayMethod($pobject->getPayMethod());
694 $booking_obj->setOrderDate(time());
695 $booking_obj->setDuration($price[
'duration']);
698 $booking_obj->setPayed(1);
699 $booking_obj->setAccess(1);
700 $booking_obj->setVoucher($a_result->buchungsListe->buchungen[$i++]->belegNr);
701 $booking_obj->setTransactionExtern($a_result->buchungsListe->kassenzeichen);
703 $booking_obj->setVatUnit($entry[
'vat_unit']);
704 $obj_id = $ilObjDataCache->lookupObjId($pobject->getRefId());
705 $obj_type = $ilObjDataCache->lookupType($obj_id);
706 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
708 $oVAT =
new ilShopVats((
int)$pobject->getVatId());
709 $obj_vat_rate = $oVAT->
getRate();
712 $book_obj->setObjectTitle($obj_title);
713 $book_obj->setVatRate($obj_vat_rate);
716 if($save_user_adr_bill == 1)
718 $booking_obj->setStreet(
$_SESSION[
'bill'][
'personal_data'][
'street'],
$_SESSION[
'bill'][
'personal_data'][
'house_number']);
719 $booking_obj->setPoBox(
$_SESSION[
'bill'][
'personal_data'][
'po_box']);
720 $booking_obj->setZipcode(
$_SESSION[
'bill'][
'personal_data'][
'zipcode']);
721 $booking_obj->setCity(
$_SESSION[
'bill'][
'personal_data'][
'city']);
722 $booking_obj->setCountry(
$_SESSION[
'bill'][
'personal_data'][
'country']);
725 $current_booking_id = $booking_obj->add();
727 if (!empty(
$_SESSION[
'coupons'][
'bill']) && $current_booking_id)
729 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
731 $this->coupon_obj->setId($coupon[
'pc_pk']);
732 $this->coupon_obj->setCurrentCoupon($coupon);
734 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
736 $this->coupon_obj->addCouponForBookingId($current_booking_id);
741 unset($current_booking_id);
745 if (!empty(
$_SESSION[
'coupons'][
'bill']))
747 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
749 $this->coupon_obj->setId($coupon[
'pc_pk']);
750 $this->coupon_obj->setCurrentCoupon($coupon);
751 $this->coupon_obj->addTracking();
758 include_once
'./payment/classes/class.ilPaymentShoppingCart.php';
762 return $sc_obj->emptyShoppingCart();
772 $this->tpl->addBlockFile(
'CONTENT',
'content',
'tpl.payb_content.html');
780 $this->tpl->addBlockFile(
'STATUSLINE',
'statusline',
'tpl.statusline.html');
781 # $this->__buildLocator();
786 $this->tpl->addBlockFile(
'LOCATOR',
'locator',
'tpl.locator.html');
787 $this->tpl->setVariable(
'TXT_LOCATOR',$this->lng->txt(
'locator'));
789 $this->tpl->setCurrentBlock(
'locator_item');
790 $this->tpl->setVariable(
'ITEM', $this->lng->txt(
'personal_desktop'));
791 $this->tpl->setVariable(
'LINK_ITEM',
'../ilias.php?baseClass=ilPersonalDesktopGUI');
792 #$this->tpl->setVariable('LINK_ITEM', '../usr_personaldesktop.php');
793 $this->tpl->parseCurrentBlock();
795 $this->tpl->setCurrentBlock(
'locator_item');
796 $this->tpl->setVariable(
'PREFIX',
'> ');
797 # $this->tpl->setVariable('ITEM', $this->lng->txt('pay_locator'));
798 $this->tpl->setVariable(
'ITEM',
'Payment');
799 $this->tpl->setVariable(
'LINK_ITEM',
'./payment.php');
800 $this->tpl->parseCurrentBlock();
819 foreach($countries as $code => $text)
821 $tpl->setCurrentBlock(
'loop_countries');
822 $tpl->setVariable(
'LOOP_COUNTRIES', $code);
823 $tpl->setVariable(
'LOOP_COUNTRIES_TXT', $text);
827 $tpl->setVariable(
'LOOP_COUNTRIES_SELECTED',
' selected');
829 $tpl->parseCurrentBlock(
'loop_countries');
831 $tpl->setVariable(
'TXT_PLEASE_SELECT', $this->lng->txt(
'pay_bmf_please_select'));
839 $lng->loadLanguageModule(
'meta');
841 $cntcodes = array (
'DE',
'ES',
'FR',
'GB',
'AT',
'CH',
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
842 'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
843 'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
844 'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
845 'CG',
'CK',
'CR',
'CI',
'HR',
'CU',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'TP',
'EC',
846 'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'FX',
'GF',
'PF',
847 'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GN',
848 'GW',
'GY',
'HT',
'HM',
'HN',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IL',
'IT',
849 'JM',
'JP',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
850 'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
851 'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'MS',
'MA',
'MZ',
'MM',
'NA',
852 'NR',
'NP',
'NL',
'AN',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
853 'PK',
'PW',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
854 'RU',
'RW',
'KN',
'LC',
'VC',
'WS',
'SM',
'ST',
'SA',
'CH',
'SN',
'SC',
'SL',
'SG',
855 'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'ES',
'LK',
'SH',
'PM',
'SD',
'SR',
'SJ',
'SZ',
856 'SE',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
857 'TV',
'UG',
'UA',
'AE',
'GB',
'UY',
'US',
'UM',
'UZ',
'VU',
'VA',
'VE',
'VN',
'VG',
858 'VI',
'WF',
'EH',
'YE',
'ZR',
'ZM',
'ZW');
860 foreach($cntcodes as $cntcode)
862 $cntrs[$cntcode] = $lng->txt(
'meta_c_'.$cntcode);
871 foreach($countries as $code => $text)
884 return $countries[$value];
897 foreach($items as $item)
899 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
904 $f_result[$counter][
'buchungstext'] = $tmp_obj->getTitle();
908 $f_result[$counter][
'buchungstext'] = $this->lng->txt(
'object_not_found');
913 $price = (float) $price_arr[
'price'];
922 $f_result[$counter][
'betrag'] = $price * 1.0;
939 for ($i = 0; $i < count(
$result); $i++)
941 $amount +=
$result[$i][
'betrag'];
951 if (
$_POST[
'terms_conditions'] != 1)
953 $this->error = $this->lng->txt(
'pay_bmf_check_terms_conditions');
958 if (
$_POST[
'password'] ==
'' ||
959 md5(
$_POST[
'password']) != $this->user_obj->getPasswd())
961 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
970 $customer =
$_SESSION[
'bill'][
'personal_data'];
978 include_once
'./payment/classes/class.ilGeneralSettings.php';
990 foreach($items as $item)
992 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
998 $assigned_coupons =
'';
999 if (!empty(
$_SESSION[
'coupons'][
'bill']))
1003 $this->coupon_obj->setId($coupon[
'pc_pk']);
1004 $this->coupon_obj->setCurrentCoupon($coupon);
1006 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1008 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
1014 $f_result[$counter][] = $tmp_obj->getTitle();
1018 $f_result[$counter][] = $this->lng->txt(
'object_not_found');
1021 if ($assigned_coupons !=
'') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
1023 if($price_arr[
'duration'] == 0)
1025 $f_result[$counter][] = $this->lng->txt(
'unlimited_duration');
1029 $f_result[$counter][] = $price_arr[
'duration'] .
' ' . $this->lng->txt(
'paya_months');
1033 $oVAT =
new ilShopVats((
int)$tmp_pobject->getVatId());
1036 $float_price = $price_arr[
'price'];
1038 $f_result[$counter][] = $tmp_pobject->getVat($float_price,
'GUI').
' '.$genSet->get(
'currency_unit');
1039 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
1044 unset($tmp_pobject);
1054 include_once
'./Services/Table/classes/class.ilTableGUI.php';
1061 include_once
'./payment/classes/class.ilGeneralSettings.php';
1066 $tpl =& $tbl->getTemplateObject();
1069 $tpl->setCurrentBlock(
'tbl_form_header');
1071 $tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
1072 $tpl->parseCurrentBlock();
1074 $tbl->setTitle($this->lng->txt(
'paya_shopping_cart'),
'icon_pays_b.gif',$this->lng->txt(
'paya_shopping_cart'));
1075 $tbl->setHeaderNames(array($this->lng->txt(
'title'),
1076 $this->lng->txt(
'duration'),
1077 $this->lng->txt(
'vat_rate'),
1078 $this->lng->txt(
'vat_unit'),
1079 $this->lng->txt(
'price_a')));
1081 $tbl->setHeaderVars(array(
'title',
1087 'cmdClass' =>
'ilpurchasebillgui',
1088 'cmdNode' =>
$_GET[
'cmdNode']));
1090 $tbl->disable(
'footer');
1091 $tbl->disable(
'sort');
1092 $tbl->disable(
'linkbar');
1094 $offset =
$_GET[
'offset'];
1095 $order =
$_GET[
'sort_by'];
1096 $direction =
$_GET[
'sort_order'] ?
$_GET[
'sort_order'] :
'desc';
1098 $tbl->setOrderColumn($order,
'title');
1099 $tbl->setOrderDirection($direction);
1100 $tbl->setOffset($offset);
1101 $tbl->setLimit(
$_GET[
'limit']);
1102 $tbl->setMaxCount(count($a_result_set));
1103 # $tbl->setFooter('tblfooter',$this->lng->txt('previous'),$this->lng->txt('next'));
1104 $tbl->setData($a_result_set);
1108 $totalAmount = $sc_obj->getTotalAmount();
1110 $tpl->setCurrentBlock(
'tbl_footer_linkbar');
1111 $amount .=
"<table class=\"\" style=\"float: right;\">\n";
1112 if (!empty(
$_SESSION[
'coupons'][
'bill']))
1118 $amount .=
"<tr>\n";
1119 $amount .=
"<td>\n";
1120 $amount .=
"<b>" . $this->lng->txt(
"pay_bmf_subtotal_amount") .
":";
1121 $amount .=
"</td>\n";
1122 $amount .=
"<td>\n";
1123 $amount .= number_format($totalAmount[
PAY_METHOD_BILL], 2,
",",
".") .
" " . $genSet->get(
"currency_unit") .
"</b>";
1124 $amount .=
"</td>\n";
1125 $amount .=
"</tr>\n";
1127 foreach (
$_SESSION[
'coupons'][
'bill'] as $coupon)
1129 $this->coupon_obj->setCurrentCoupon($coupon);
1130 $this->coupon_obj->setId($coupon[
'pc_pk']);
1132 $total_object_price = 0.0;
1133 $current_coupon_bonus = 0.0;
1135 foreach ($items as $item)
1137 $tmp_pobject =&
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
1139 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1142 $price = (float) $price_data[
'price'];
1144 $total_object_price += $price;
1147 unset($tmp_pobject);
1150 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1153 $amount .=
"<tr>\n";
1154 $amount .=
"<td>\n";
1155 $amount .= $this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code'] .
':';
1156 $amount .=
"</td>\n";
1157 $amount .=
"<td>\n";
1158 $amount .= number_format($current_coupon_bonus * (-1), 2,
",",
".") .
" " . $genSet->get(
"currency_unit");
1159 $amount .=
"</td>\n";
1160 $amount .=
"</tr>\n";
1163 if ($totalAmount[PAY_METHOD_BILL] < 0)
1166 $this->totalVat = 0;
1171 $amount .=
"<tr>\n";
1172 $amount .=
"<td>\n";
1173 $amount .=
"<b>" . $this->lng->txt(
"pay_bmf_total_amount") .
":";
1174 $amount .=
"</td>\n";
1175 $amount .=
"<td>\n";
1176 $amount .= number_format($totalAmount[
PAY_METHOD_BILL], 2,
",",
".") .
" " . $genSet->get(
"currency_unit");
1177 $amount .=
"</td>\n";
1178 $amount .=
"</tr>\n";
1180 if ($this->totalVat > 0)
1182 $amount .=
"<tr>\n";
1183 $amount .=
"<td>\n";
1184 $amount .= $this->lng->txt(
"pay_bmf_vat_included") .
":";
1185 $amount .=
"</td>\n";
1186 $amount .=
"<td>\n";
1188 $amount .=
"</td>\n";
1189 $amount .=
"</tr>\n";
1192 $amount .=
"</table>\n";
1194 $tpl->setVariable(
'LINKBAR', $amount);
1195 $tpl->parseCurrentBlock(
'tbl_footer_linkbar');
1196 $tpl->setCurrentBlock(
'tbl_footer');
1197 $tpl->setVariable(
'COLUMN_COUNT',5);
1198 $tpl->parseCurrentBlock();
1201 $this->tpl->setVariable(
'ITEMS_TABLE',$tbl->tpl->get());