13 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
14 include_once
'./Services/Payment/classes/class.ilShopShoppingCartGUI.php';
15 include_once
'./Services/Payment/classes/class.ilPaymentCoupons.php';
16 include_once
'./Services/Payment/classes/class.ilShopVatsList.php';
17 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
18 include_once
'./Services/Payment/classes/class.ilShopUtils.php';
19 include_once
'./Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
20 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
53 $this->session_var = $this->pmethod_obj->getPmTitle();
61 if (!is_array(
$_SESSION[$this->session_var][
'personal_data']))
65 if (strpos(
'_' . $this->user_obj->getStreet(),
' ') > 0)
67 $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(),
' ')+1);
68 $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
82 $_SESSION[
$this->session_var][
'personal_data'][
'language'] = $this->user_obj->getLanguage();
85 if (!is_array(
$_SESSION[
'coupons'][$this->session_var]))
92 $this->lng->loadLanguageModule(
'payment');
94 $ilTabs->clearTargets();
95 $ilTabs->clearSubTabs();
107 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
109 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
110 $this->tpl->touchBlock(
'stop_floating');
115 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
118 $oForm->setFormAction($this->ctrl->getFormAction($this,
'getPersonalData'));
119 $oForm->setTitle($this->lng->txt(
'pay_bmf_personal_data'));
122 $oFirstname->
setValue($this->user_obj->getFirstname());
123 $oForm->addItem($oFirstname);
126 $oLastname->
setValue($this->user_obj->getLastname());
127 $oForm->addItem($oLastname);
129 $oStreet =
new ilTextInputGUI($this->lng->txt(
'street'),
'street');
133 $oForm->addItem($oStreet);
135 $oHouseNumber =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_house_number'),
'house_number');
136 $oHouseNumber->
setValue($this->error !=
'' && isset(
$_POST[
'house_number'])
139 $oForm->addItem($oHouseNumber);
141 $oPoBox =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_or').
' '.$this->lng->txt(
'pay_bmf_po_box'),
'po_box');
145 $oForm->addItem($oPoBox);
147 $oZipCode =
new ilTextInputGUI($this->lng->txt(
'zipcode'),
'zipcode');
148 if($this->user_obj->getZipCode() && !isset(
$_POST[
'zipcode']))
149 $oZipCode->
setValue($this->user_obj->getZipCode());
151 $oZipCode->setValue($this->error !=
'' && isset(
$_POST[
'zipcode'])
154 $oForm->addItem($oZipCode);
157 if($this->user_obj->getCity()&& !isset(
$_POST[
'city']))
158 $oCity->
setValue($this->user_obj->getCity());
160 $oCity->setValue($this->error !=
'' && isset(
$_POST[
'city'])
163 $oForm->addItem($oCity);
168 if($this->user_obj->getSelectedCountry()&& !isset(
$_POST[
'country']))
169 $oCountry->setValue($this->user_obj->getSelectedCountry());
171 $oCountry->setValue($this->error !=
'' && isset(
$_POST[
'country']) ?
$_POST[
'country']
172 :
$_SESSION[$this->session_var][
'personal_data'][
'country']);
173 $oForm->addItem($oCountry);
176 $oEmail->
setValue($this->user_obj->getEmail());
177 $oForm->addItem($oEmail);
179 $oForm->addcommandButton(
'getPersonalData',ucfirst($this->lng->txt(
'next')));
181 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
188 if (
$_SESSION[$this->session_var][
'personal_data'][
'firstname'] ==
'' ||
189 $_SESSION[$this->session_var][
'personal_data'][
'lastname'] ==
'' ||
190 $_POST[
'zipcode'] ==
'' ||
192 $_POST[
'country'] ==
'' ||
193 $_SESSION[$this->session_var][
'personal_data'][
'email'] ==
'')
196 $this->error = $this->lng->txt(
'pay_bmf_personal_data_not_valid');
202 if ((
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] ==
'' &&
$_POST[
'po_box'] ==
'') ||
203 ((
$_POST[
'street'] !=
'' ||
$_POST[
'house_number'] !=
'') &&
$_POST[
'po_box'] !=
'') ||
204 (
$_POST[
'street'] !=
'' &&
$_POST[
'house_number'] ==
'') ||
205 (
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] !=
''))
207 $this->error = $this->lng->txt(
'pay_bmf_street_or_pobox');
234 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
236 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
237 $this->tpl->touchBlock(
'stop_floating');
242 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill_confirm.html',
'Services/Payment');
246 $this->tpl->setVariable(
'BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
250 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
253 $this->tpl->setVariable(
'TXT_CONFIRM_ORDER',$this->lng->txt(
'pay_confirm_order'));
255 $this->tpl->setVariable(
'INPUT_VALUE',$this->lng->txt(
'pay_send_order'));
256 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
259 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
260 $this->tpl->setCurrentBlock(
'btn_cell');
261 $this->tpl->setVariable(
'BTN_LINK', $this->ctrl->getLinkTarget($this,
'showPersonalData'));
262 $this->tpl->setVariable(
'BTN_TXT', $this->lng->txt(
'pay_bmf_back'));
263 $this->tpl->parseCurrentBlock(
'btn_cell');
272 $cmd = $this->ctrl->getCmd();
274 switch ($this->ctrl->getNextClass($this))
277 if(!
$cmd = $this->ctrl->getCmd())
279 $cmd =
'showPersonalData';
288 global
$ilUser, $ilObjDataCache;
290 $sc = $this->psc_obj->getShoppingCart($this->pm_id);
292 # $this->psc_obj->clearCouponItemsSession();
294 if (is_array($sc) && count($sc) > 0)
296 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
300 for ($i = 0; $i < count($sc); $i++)
302 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
304 $sc[$i][
'math_price'] = (float) $sc[$i][
'price'];
306 $tmp_pobject =
new ilPaymentObject($this->user_obj, $sc[$i][
'pobject_id']);
308 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
310 $this->coupon_obj->setId($coupon[
'pc_pk']);
311 $this->coupon_obj->setCurrentCoupon($coupon);
313 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
324 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][$this->session_var]);
327 for ($i = 0; $i < count($sc); $i++)
332 $price = $sc[$i][
'price'];
335 if (array_key_exists($sc[$i][
'pobject_id'], $coupon_discount_items))
337 $bonus = $coupon_discount_items[$sc[$i][
'pobject_id']][
'math_price'] - $coupon_discount_items[$sc[$i][
'pobject_id']][
'discount_price'];
339 $discount = round($bonus, 2)* (-1);
340 else $discount = round($bonus, 2);
344 $book_obj->setTransaction($transaction);
345 $book_obj->setPobjectId($sc[$i][
'pobject_id']);
346 $book_obj->setCustomerId($this->user_obj->getId());
347 $book_obj->setVendorId($pobjectData[
'vendor_id']);
348 $book_obj->setPayMethod($pobjectData[
'pay_method']);
349 $book_obj->setOrderDate(time());
351 $book_obj->setPrice($sc[$i][
'price_string']);
353 $book_obj->setDiscount($discount);
354 $book_obj->setPayed($this->
getPayed());
355 $book_obj->setAccess($this->
getAccess());
357 $book_obj->setVoucher(
'');
358 $book_obj->setTransactionExtern(
'');
360 $book_obj->setVatRate($sc[$i][
'vat_rate']);
361 $book_obj->setVatUnit($sc[$i][
'vat_unit']);
362 $book_obj->setObjectTitle(strip_tags($sc[$i][
'object_title']));
363 $book_obj->setAccessExtension($sc[$i][
'extension']);
365 switch($sc[$i][
"price_type"])
368 $book_obj->setDuration($sc[$i][
'duration']);
372 $book_obj->setDuration(0);
373 $book_obj->setAccessStartdate($sc[$i][
'duration_from']);
374 $book_obj->setAccessEnddate($sc[$i][
'duration_until']);
377 $book_obj->setDuration(0);
378 $book_obj->setAccessEnddate(NULL);
379 $book_obj->setUnlimitedDuration($sc[$i][
'unlimited_duration']);
384 $book_obj->setPriceType($sc[$i][
"price_type"]);
388 $book_obj->setVoucher($external_data[
'voucher']);
389 $book_obj->setTransactionExtern($external_data[
'transaction_extern']);
390 $book_obj->setStreet($external_data[
'street'],
'');
391 $book_obj->setZipcode($external_data[
'zipcode']);
392 $book_obj->setCity($external_data[
'city']);
393 $book_obj->setCountry($external_data[
'country']);
396 if(isset(
$_SESSION[$this->session_var][
'personal_data']))
398 $book_obj->setStreet(
$_SESSION[$this->session_var][
'personal_data'][
'street'],
$_SESSION[$this->session_var][
'personal_data'][
'house_number']);
399 $book_obj->setPoBox(
$_SESSION[$this->session_var][
'personal_data'][
'po_box']);
400 $book_obj->setZipcode(
$_SESSION[$this->session_var][
'personal_data'][
'zipcode']);
401 $book_obj->setCity(
$_SESSION[$this->session_var][
'personal_data'][
'city']);
402 $book_obj->setCountry(
$_SESSION[$this->session_var][
'personal_data'][
'country']);
406 $book_obj->setStreet($this->user_obj->getStreet(),
'');
407 $book_obj->setPoBox($this->user_obj->getPoBox());
408 $book_obj->setZipcode($this->user_obj->getZipCode());
409 $book_obj->setCity($this->user_obj->getCity());
410 $book_obj->setCountry($this->user_obj->getCountry());
413 $booking_id = $book_obj->add();
421 if($obj_type ==
'crs')
426 if (!empty(
$_SESSION[
'coupons'][$this->session_var]) && $booking_id)
428 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
430 $this->coupon_obj->setId($coupon[
'pc_pk']);
431 $this->coupon_obj->setCurrentCoupon($coupon);
433 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
435 $this->coupon_obj->addCouponForBookingId($booking_id);
440 $obj_id = $ilObjDataCache->lookupObjId($pobjectData[
'ref_id']);
441 $obj_type = $ilObjDataCache->lookupType($obj_id);
442 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
444 $bookings[
'list'][] = array(
445 'pobject_id' => $sc[$i][
'pobject_id'],
447 'title' =>
'['.$obj_id.
']: ' . $obj_title,
448 'duration' => $sc[$i][
'duration'],
449 'vat_rate' => $sc[$i][
'vat_rate'],
450 'vat_unit' => $sc[$i][
'vat_unit'],
451 'price_string' => $sc[$i][
'price_string'],
452 'price' => $sc[$i][
'price'],
453 "price_type" => $sc[$i][
"price_type"],
454 "duration_from" => $sc[$i][
"duration_from"],
455 "duration_until" => $sc[$i][
"duration_until"],
456 "b_pay_method" => $pobjectData[
"pay_method"],
457 'discount'=> $discount,
458 'access_startdate' => $book_obj->getAccessStartdate(),
459 'access_enddate' => $book_obj->getAccessEnddate()
462 $total += $sc[$i][
'price'];
463 $total_vat += $sc[$i][
'vat_unit'];
464 $total_discount += $discount;
466 if ($sc[$i][
'psc_id']) $this->psc_obj->delete($sc[$i][
'psc_id']);
469 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
471 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
473 $this->coupon_obj->setId($coupon[
'pc_pk']);
474 $this->coupon_obj->setCurrentCoupon($coupon);
475 $this->coupon_obj->addTracking();
480 $bookings[
'total'] =
$total;
481 $bookings[
'total_vat'] = $total_vat;
482 $bookings[
'total_discount'] = $total_discount;
483 $bookings[
'transaction'] = $transaction;
484 $bookings[
'street'] = $book_obj->getStreet();
485 $bookings[
'zipcode'] = $book_obj->getZipCode();
486 $bookings[
'city'] = $book_obj->getCity();
487 if(2 == strlen($book_obj->getCountry()))
489 $bookings[
'country'] = $this->
__getCountryName(strtoupper($book_obj->getCountry()));
493 $bookings[
'country'] = $book_obj->getCountry();
495 $bookings[
'transaction_extern'] = $book_obj->getTransactionExtern();
497 $this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
498 $_SESSION[
'forceRedirectToShoppingcart'] = 1;
509 include_once
'./Services/UICore/classes/class.ilTemplate.php';
510 include_once
'./Services/Utilities/classes/class.ilUtil.php';
511 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
512 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
513 include_once
'Services/Mail/classes/class.ilMimeMail.php';
517 $currency = $genSet->get(
'currency_unit');
520 $tpl =
new ilTemplate(
'tpl.pay_bill.html',
true,
true,
'Services/Payment');
522 if($tpl->placeholderExists(
'HTTP_PATH'))
525 $tpl->setVariable(
'HTTP_PATH', $http_path);
529 $tpl->setVariable(
'TXT_CREDIT', utf8_decode($this->lng->txt(
'credit')));
530 $tpl->setVariable(
'TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt(
'day_of_service_provision'));
531 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
533 if(strlen(trim($bookings[
'transaction_extern'])))
535 $tpl->setVariable(
'TXT_EXTERNAL_BILL_NO', str_replace(
'%s',$str_paymethod,utf8_decode($this->lng->txt(
'external_bill_no'))));
536 $tpl->setVariable(
'EXTERNAL_BILL_NO', $bookings[
'transaction_extern']);
538 $tpl->setVariable(
'TXT_POSITION',$this->lng->txt(
'position'));
539 $tpl->setVariable(
'TXT_AMOUNT',$this->lng->txt(
'amount'));
540 $tpl->setVariable(
'TXT_UNIT_PRICE', utf8_decode($this->lng->txt(
'unit_price')));
542 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
543 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
544 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
545 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
548 $tpl->setVariable(
'CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
549 $tpl->setVariable(
'CUSTOMER_LASTNAME',utf8_decode( $this->user_obj->getLastname()));
550 if($bookings[
'po_box']==
'')
552 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode( $bookings[
'street']));
556 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[
'po_box']));
558 $tpl->setVariable(
'CUSTOMER_ZIPCODE', utf8_decode($bookings[
'zipcode']));
559 $tpl->setVariable(
'CUSTOMER_CITY', utf8_decode($bookings[
'city']));
560 $tpl->setVariable(
'CUSTOMER_COUNTRY', utf8_decode($bookings[
'country']));
562 $tpl->setVariable(
'BILL_NO', $bookings[
'transaction']);
563 $tpl->setVariable(
'DATE', date(
'd.m.Y'));
565 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
566 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
567 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
569 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
570 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
571 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
572 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
574 for ($i = 0; $i < count($bookings[
'list']); $i++)
576 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[
'list'][$i][
'pobject_id']);
578 $assigned_coupons =
'';
579 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
581 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
583 $this->coupon_obj->setId($coupon[
'pc_pk']);
584 $this->coupon_obj->setCurrentCoupon($coupon);
586 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
588 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
593 $tpl->setCurrentBlock(
'loop');
594 $tpl->setVariable(
'LOOP_POSITION', $i+1);
595 $tpl->setVariable(
'LOOP_AMOUNT',
'1');
596 $tpl->setVariable(
'LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt(
'period_of_service_provision')));
598 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings[
'list'][$i][
'type'])));
599 $tpl->setVariable(
'LOOP_TITLE',$tmp = utf8_decode($bookings[
'list'][$i][
'title']));
600 $tpl->setVariable(
'LOOP_COUPON', utf8_decode( $assigned_coupons));
601 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
603 if( $bookings[
'list'][$i][
'duration'] == 0 && $bookings[
'list'][$i][
'access_enddate'] == NULL)
605 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
613 $tmp_duration = $access_startdate.
' - '.$access_enddate;
614 if($bookings[
'list'][$i][
'duration'] > 0)
616 $tmp_duration .=
' / '.$bookings[
'list'][$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months'));
618 $tpl->setVariable(
'LOOP_DURATION', $tmp_duration);
620 #$currency = $bookings['list'][$i]['currency_unit'];
621 $tpl->setVariable(
'LOOP_VAT_RATE', number_format($bookings[
'list'][$i][
'vat_rate'], 2,
',',
'.').
' %');
622 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[
'list'][$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
623 $tpl->setVariable(
'LOOP_PRICE', number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
624 $tpl->setVariable(
'LOOP_UNIT_PRICE',number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
625 $tpl->parseCurrentBlock(
'loop');
628 $bookings[
'total'] += (float)$bookings[$i][
'price'];
629 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
630 #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
633 $sub_total_amount = $bookings[
'total'];
636 $bookings[
'total'] += $bookings[
'total_discount'];
637 if($bookings[
'total_discount'] < 0)
639 $tpl->setCurrentBlock(
'cloop');
641 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
642 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
644 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon')));
645 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
646 $tpl->parseCurrentBlock();
649 if ($bookings[
'total'] < 0)
651 $bookings[
'total'] = 0.00;
654 $total_net_price = $sub_total_amount-$bookings[
'total_vat'];
656 $tpl->setVariable(
'TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt(
'total_netprice')));
657 $tpl->setVariable(
'TOTAL_NETPRICE', number_format($total_net_price, 2,
',',
'.') .
' ' . $currency);
659 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
660 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
661 if ($bookings[
'total_vat'] > 0)
663 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
664 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'plus_vat')));
666 if(1 == $bookings[
'list'][0][
'b_pay_method'])
668 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
672 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
675 if (!@file_exists($genSet->get(
'pdf_path')))
682 if (@file_exists($genSet->get(
'pdf_path')))
684 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
687 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf') &&
688 $this->user_obj->getEmail() !=
'' &&
689 $ilSetting->get(
'admin_email') !=
'')
692 $m->
From( $ilSetting->get(
'admin_email') );
693 $m->To( $this->user_obj->getEmail() );
694 $m->Subject( $this->lng->txt(
'pay_message_subject') );
697 $message = $this->lng->txt(
'pay_message_hello') .
' ' . $this->user_obj->getFirstname() .
' ' . $this->user_obj->getLastname() .
",\n\n";
698 $message .= $this->lng->txt(
'pay_message_thanks') .
"\n\n";
699 $message .= $this->lng->txt(
'pay_message_attachment') .
"\n\n";
700 $message .= $this->lng->txt(
'pay_message_regards') .
"\n\n";
701 $message .= strip_tags($genSet->get(
'address'));
704 $billing_text = $genSet->getMailBillingText();
709 if($genSet->getMailUsePlaceholders() == 1)
711 include_once
'./Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
715 $m->Body( $message );
716 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf',
'application/pdf' ) ;
717 if($genSet->get(
'attach_sr_invoice') == 1)
719 require_once
'Services/RTE/classes/class.ilRTE.php';
721 $reg_file_name =
'statutory_regulations';
722 if (@file_exists($genSet->get(
'pdf_path')))
724 ilUtil::html2pdf($regulations, $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf');
727 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf',
'application/pdf' ) ;
733 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.html');
734 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
736 unset($current_booking_id);
738 unset(
$_SESSION[
'coupons'][$this->session_var]);
740 $this->ctrl->redirectByClass(
'ilShopBoughtObjectsGUI',
'');
745 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
749 return $sc_obj->emptyShoppingCart();
764 $ilTabs->setTabActive(
'paya_shopping_cart');
765 $this->tpl->getStandardTemplate();
770 $this->tpl->addBlockFile(
'STATUSLINE',
'statusline',
'tpl.statusline.html');
771 # $this->__buildLocator();
776 $this->tpl->addBlockFile(
'LOCATOR',
'locator',
'tpl.locator.html',
'Services/Locator');
777 $this->tpl->setVariable(
'TXT_LOCATOR',$this->lng->txt(
'locator'));
779 $this->tpl->setCurrentBlock(
'locator_item');
780 $this->tpl->setVariable(
'ITEM', $this->lng->txt(
'personal_desktop'));
781 $this->tpl->setVariable(
'LINK_ITEM',
'../ilias.php?baseClass=ilPersonalDesktopGUI');
782 $this->tpl->parseCurrentBlock();
784 $this->tpl->setCurrentBlock(
'locator_item');
785 $this->tpl->setVariable(
'PREFIX',
'> ');
786 $this->tpl->setVariable(
'ITEM',
'Payment');
787 $this->tpl->setVariable(
'LINK_ITEM',
'./payment.php');
788 $this->tpl->parseCurrentBlock();
808 $lng->loadLanguageModule(
'meta');
810 $cntcodes = array (
'DE',
'ES',
'FR',
'GB',
'AT',
'CH',
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
811 'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
812 'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
813 'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
814 'CG',
'CK',
'CR',
'CI',
'HR',
'CU',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'TP',
'EC',
815 'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'FX',
'GF',
'PF',
816 'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GN',
817 'GW',
'GY',
'HT',
'HM',
'HN',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IL',
'IT',
818 'JM',
'JP',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
819 'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
820 'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'MS',
'MA',
'MZ',
'MM',
'NA',
821 'NR',
'NP',
'NL',
'AN',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
822 'PK',
'PW',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
823 'RU',
'RW',
'KN',
'LC',
'VC',
'WS',
'SM',
'ST',
'SA',
'CH',
'SN',
'SC',
'SL',
'SG',
824 'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'ES',
'LK',
'SH',
'PM',
'SD',
'SR',
'SJ',
'SZ',
825 'SE',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
826 'TV',
'UG',
'UA',
'AE',
'GB',
'UY',
'US',
'UM',
'UZ',
'VU',
'VA',
'VE',
'VN',
'VG',
827 'VI',
'WF',
'EH',
'YE',
'ZR',
'ZM',
'ZW');
829 foreach($cntcodes as $cntcode)
831 $cntrs[$cntcode] = $lng->txt(
'meta_c_'.$cntcode);
840 foreach($countries as $code => $text)
853 return $countries[$value];
860 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
866 foreach($items as $item)
868 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
873 $f_result[$counter][
"object_title"] = $tmp_obj->getTitle();
877 $f_result[$counter][
"object_title"] = $this->lng->txt(
'object_not_found');
882 $price = (float) $price_arr[
'price'];
883 $f_result[$counter][
'price'] = $price * 1.0;
903 for ($i = 0; $i < count(
$result); $i++)
905 $amount +=
$result[$i][
'price'];
922 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
928 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
934 foreach($items as $item)
936 $tmp_pobject =
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
942 $assigned_coupons =
'';
943 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
945 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
947 $this->coupon_obj->setId($coupon[
'pc_pk']);
948 $this->coupon_obj->setCurrentCoupon($coupon);
950 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
952 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
956 $f_result[$counter][
'item'] =
'';
959 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
963 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
965 if ($assigned_coupons !=
'') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
967 switch($price_arr[
'price_type'])
970 $f_result[$counter][
'duration'] = $price_arr[
'duration'] .
' ' . $this->lng->txt(
'paya_months');
973 $f_result[$counter][
'duration'] =
978 $f_result[$counter][
'duration'] = $this->lng->txt(
'unlimited_duration');
982 $oVAT =
new ilShopVats((
int)$tmp_pobject->getVatId());
985 $float_price = $price_arr[
'price'];
987 $f_result[$counter][
'vat_unit'] = $tmp_pobject->getVat($float_price,
'GUI').
' '.$genSet->get(
'currency_unit');
988 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
990 $f_result[$counter][
'price'] = number_format($float_price, 2,
',',
'.') .
' '.$genSet->get(
'currency_unit');
1003 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1006 include_once
'./Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1009 $tbl->setId(
'tbl_id_'.$this->session_var);
1010 $tbl->setTitle($this->lng->txt(
'paya_shopping_cart'));
1015 $tbl->setRowTemplate(
"tpl.shop_shoppingcart_row.html",
"Services/Payment");
1016 $tbl->addColumn(
'',
'item',
'1%');
1017 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'30%');
1018 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'30%');
1019 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
1020 $tbl->addColumn($this->lng->txt(
'vat_unit'),
'vat_unit',
'15%');
1021 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
1022 $tbl->disable(
'sort');
1024 #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1028 $totalAmount = $sc_obj->getTotalAmount();
1030 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
1032 if (count($items = $sc_obj->getEntries($this->pm_id)))
1034 $tbl->setTotalData(
'TXT_SUB_TOTAL', $this->lng->txt(
'pay_bmf_subtotal_amount') .
": ");
1035 $tbl->setTotalData(
'VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1036 #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
1038 $totalAmount[$current_coupon_bonus] = 0;
1039 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
1041 $this->coupon_obj->setId($coupon[
'pc_pk']);
1042 $this->coupon_obj->setCurrentCoupon($coupon);
1044 $total_object_price = 0.0;
1045 $current_coupon_bonus = 0.0;
1047 foreach ($items as $item)
1049 $tmp_pobject =
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
1051 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1054 $price = (float) $price_data[
'price'];
1056 $total_object_price += $price;
1058 unset($tmp_pobject);
1060 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1061 $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * (-1);
1063 $tbl->setTotalData(
'TXT_COUPON_BONUS', $this->lng->txt(
'paya_coupons_coupon') .
": ");# . $coupon[
'pcc_code'] .
": ");
1064 $tbl->setTotalData(
'VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1067 if ($totalAmount[$this->pm_id] < 0)
1070 $this->totalVat = 0;
1077 $tbl->setTotalData(
'TXT_TOTAL_AMOUNT', $this->lng->txt(
'pay_bmf_total_amount').
": ");
1078 $tbl->setTotalData(
'VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit')); #.$item[
'currency']);
1080 if ($this->totalVat > 0)
1082 $tbl->setTotalData(
'TXT_TOTAL_VAT', $this->lng->txt(
'pay_bmf_vat_included') .
": ");
1083 $tbl->setTotalData(
'VAL_TOTAL_VAT', number_format($this->totalVat , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1086 $tbl->setData($a_result_set);
1087 $this->tpl->setVariable(
'ITEMS_TABLE',$tbl->getCartHTML());