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();
55 $this->pm_id = $pay_method;
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));
249 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
252 $this->tpl->setVariable(
'TXT_CONFIRM_ORDER',$this->lng->txt(
'pay_confirm_order'));
254 $this->tpl->setVariable(
'INPUT_VALUE',$this->lng->txt(
'pay_send_order'));
255 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
258 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
259 $this->tpl->setCurrentBlock(
'btn_cell');
260 $this->tpl->setVariable(
'BTN_LINK', $this->ctrl->getLinkTarget($this,
'showPersonalData'));
261 $this->tpl->setVariable(
'BTN_TXT', $this->lng->txt(
'pay_bmf_back'));
262 $this->tpl->parseCurrentBlock(
'btn_cell');
271 $cmd = $this->ctrl->getCmd();
273 switch ($this->ctrl->getNextClass($this))
276 if(!
$cmd = $this->ctrl->getCmd())
278 $cmd =
'showPersonalData';
287 global
$ilUser, $ilObjDataCache;
289 $sc = $this->psc_obj->getShoppingCart($this->pm_id);
294 # $this->psc_obj->clearCouponItemsSession();
296 if (is_array($sc) && count($sc) > 0)
298 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
302 for ($i = 0; $i < count($sc); $i++)
304 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
306 $sc[$i][
'math_price'] = (float) $sc[$i][
'price'];
308 $tmp_pobject =
new ilPaymentObject($this->user_obj, $sc[$i][
'pobject_id']);
310 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
312 $this->coupon_obj->setId($coupon[
'pc_pk']);
313 $this->coupon_obj->setCurrentCoupon($coupon);
315 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
326 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][$this->session_var]);
329 for ($i = 0; $i < count($sc); $i++)
334 $price = $sc[$i][
'price'];
337 if (array_key_exists($sc[$i][
'pobject_id'], $coupon_discount_items))
339 $bonus = $coupon_discount_items[$sc[$i][
'pobject_id']][
'math_price'] - $coupon_discount_items[$sc[$i][
'pobject_id']][
'discount_price'];
341 $discount = round($bonus, 2)* (-1);
342 else $discount = round($bonus, 2);
346 $book_obj->setTransaction($transaction);
347 $book_obj->setPobjectId($sc[$i][
'pobject_id']);
348 $book_obj->setCustomerId($this->user_obj->getId());
349 $book_obj->setVendorId($pobjectData[
'vendor_id']);
350 $book_obj->setPayMethod($pobjectData[
'pay_method']);
351 $book_obj->setOrderDate(time());
353 $book_obj->setPrice($sc[$i][
'price_string']);
355 $book_obj->setDiscount($discount);
356 $book_obj->setPayed($this->
getPayed());
357 $book_obj->setAccess($this->
getAccess());
359 $book_obj->setVoucher(
'');
360 $book_obj->setTransactionExtern(
'');
362 $book_obj->setVatRate($sc[$i][
'vat_rate']);
363 $book_obj->setVatUnit($sc[$i][
'vat_unit']);
364 $book_obj->setObjectTitle(strip_tags($sc[$i][
'object_title']));
365 $book_obj->setAccessExtension($sc[$i][
'extension']);
367 switch($sc[$i][
"price_type"])
370 $book_obj->setDuration($sc[$i][
'duration']);
374 $book_obj->setDuration(0);
375 $book_obj->setAccessStartdate($sc[$i][
'duration_from']);
376 $book_obj->setAccessEnddate($sc[$i][
'duration_until']);
379 $book_obj->setDuration(0);
380 $book_obj->setAccessEnddate(NULL);
381 $book_obj->setUnlimitedDuration($sc[$i][
'unlimited_duration']);
386 $book_obj->setPriceType($sc[$i][
"price_type"]);
390 $book_obj->setVoucher($external_data[
'voucher']);
391 $book_obj->setTransactionExtern($external_data[
'transaction_extern']);
392 $book_obj->setStreet($external_data[
'street'],
'');
393 $book_obj->setZipcode($external_data[
'zipcode']);
394 $book_obj->setCity($external_data[
'city']);
395 $book_obj->setCountry($external_data[
'country']);
398 if(isset(
$_SESSION[$this->session_var][
'personal_data']))
400 $book_obj->setStreet(
$_SESSION[$this->session_var][
'personal_data'][
'street'],
$_SESSION[$this->session_var][
'personal_data'][
'house_number']);
401 $book_obj->setPoBox(
$_SESSION[$this->session_var][
'personal_data'][
'po_box']);
402 $book_obj->setZipcode(
$_SESSION[$this->session_var][
'personal_data'][
'zipcode']);
403 $book_obj->setCity(
$_SESSION[$this->session_var][
'personal_data'][
'city']);
404 $book_obj->setCountry(
$_SESSION[$this->session_var][
'personal_data'][
'country']);
408 $book_obj->setStreet($this->user_obj->getStreet(),
'');
409 $book_obj->setPoBox($this->user_obj->getPoBox());
410 $book_obj->setZipcode($this->user_obj->getZipCode());
411 $book_obj->setCity($this->user_obj->getCity());
412 $book_obj->setCountry($this->user_obj->getCountry());
415 $booking_id = $book_obj->add();
423 if($obj_type ==
'crs')
428 if (!empty(
$_SESSION[
'coupons'][$this->session_var]) && $booking_id)
430 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
432 $this->coupon_obj->setId($coupon[
'pc_pk']);
433 $this->coupon_obj->setCurrentCoupon($coupon);
435 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
437 $this->coupon_obj->addCouponForBookingId($booking_id);
442 $obj_id = $ilObjDataCache->lookupObjId($pobjectData[
'ref_id']);
443 $obj_type = $ilObjDataCache->lookupType($obj_id);
444 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
446 $bookings[
'list'][] = array(
447 'pobject_id' => $sc[$i][
'pobject_id'],
449 'title' =>
'['.$obj_id.
']: ' . $obj_title,
450 'duration' => $sc[$i][
'duration'],
451 'vat_rate' => $sc[$i][
'vat_rate'],
452 'vat_unit' => $sc[$i][
'vat_unit'],
453 'price_string' => $sc[$i][
'price_string'],
454 'price' => $sc[$i][
'price'],
455 "price_type" => $sc[$i][
"price_type"],
456 "duration_from" => $sc[$i][
"duration_from"],
457 "duration_until" => $sc[$i][
"duration_until"],
458 "b_pay_method" => $pobjectData[
"pay_method"],
459 'discount'=> $discount,
460 'access_startdate' => $book_obj->getAccessStartdate(),
461 'access_enddate' => $book_obj->getAccessEnddate()
464 $total += $sc[$i][
'price'];
465 $total_vat += $sc[$i][
'vat_unit'];
466 $total_discount += $discount;
468 if ($sc[$i][
'psc_id']) $this->psc_obj->delete($sc[$i][
'psc_id']);
471 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
473 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
475 $this->coupon_obj->setId($coupon[
'pc_pk']);
476 $this->coupon_obj->setCurrentCoupon($coupon);
477 $this->coupon_obj->addTracking();
482 $bookings[
'total'] =
$total;
483 $bookings[
'total_vat'] = $total_vat;
484 $bookings[
'total_discount'] = $total_discount;
485 $bookings[
'transaction'] = $transaction;
486 $bookings[
'street'] = $book_obj->getStreet();
487 $bookings[
'zipcode'] = $book_obj->getZipCode();
488 $bookings[
'city'] = $book_obj->getCity();
489 if(2 == strlen($book_obj->getCountry()))
491 $bookings[
'country'] = $this->
__getCountryName(strtoupper($book_obj->getCountry()));
495 $bookings[
'country'] = $book_obj->getCountry();
497 $bookings[
'transaction_extern'] = $book_obj->getTransactionExtern();
499 $this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
500 $_SESSION[
'forceRedirectToShoppingcart'] = 1;
511 include_once
'./Services/UICore/classes/class.ilTemplate.php';
512 include_once
'./Services/Utilities/classes/class.ilUtil.php';
513 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
514 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
515 include_once
'Services/Mail/classes/class.ilMimeMail.php';
519 $currency = $genSet->get(
'currency_unit');
522 $tpl =
new ilTemplate(
'tpl.pay_bill.html',
true,
true,
'Services/Payment');
524 if($tpl->placeholderExists(
'HTTP_PATH'))
527 $tpl->setVariable(
'HTTP_PATH', $http_path);
531 $tpl->setVariable(
'TXT_CREDIT', utf8_decode($this->lng->txt(
'credit')));
532 $tpl->setVariable(
'TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt(
'day_of_service_provision'));
533 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
535 if(strlen(trim($bookings[
'transaction_extern'])))
537 $tpl->setVariable(
'TXT_EXTERNAL_BILL_NO', str_replace(
'%s',$str_paymethod,utf8_decode($this->lng->txt(
'external_bill_no'))));
538 $tpl->setVariable(
'EXTERNAL_BILL_NO', $bookings[
'transaction_extern']);
540 $tpl->setVariable(
'TXT_POSITION',$this->lng->txt(
'position'));
541 $tpl->setVariable(
'TXT_AMOUNT',$this->lng->txt(
'amount'));
542 $tpl->setVariable(
'TXT_UNIT_PRICE', utf8_decode($this->lng->txt(
'unit_price')));
544 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
545 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
546 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
547 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
550 $tpl->setVariable(
'CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
551 $tpl->setVariable(
'CUSTOMER_LASTNAME',utf8_decode( $this->user_obj->getLastname()));
552 if($bookings[
'po_box']==
'')
554 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode( $bookings[
'street']));
558 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[
'po_box']));
560 $tpl->setVariable(
'CUSTOMER_ZIPCODE', utf8_decode($bookings[
'zipcode']));
561 $tpl->setVariable(
'CUSTOMER_CITY', utf8_decode($bookings[
'city']));
562 $tpl->setVariable(
'CUSTOMER_COUNTRY', utf8_decode($bookings[
'country']));
564 $tpl->setVariable(
'BILL_NO', $bookings[
'transaction']);
565 $tpl->setVariable(
'DATE', date(
'd.m.Y'));
567 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
568 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
569 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
571 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
572 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
573 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
574 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
576 for ($i = 0; $i < count($bookings[
'list']); $i++)
578 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[
'list'][$i][
'pobject_id']);
580 $assigned_coupons =
'';
581 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
583 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
585 $this->coupon_obj->setId($coupon[
'pc_pk']);
586 $this->coupon_obj->setCurrentCoupon($coupon);
588 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
590 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
595 $tpl->setCurrentBlock(
'loop');
596 $tpl->setVariable(
'LOOP_POSITION', $i+1);
597 $tpl->setVariable(
'LOOP_AMOUNT',
'1');
598 $tpl->setVariable(
'LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt(
'period_of_service_provision')));
600 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings[
'list'][$i][
'type'])));
601 $tpl->setVariable(
'LOOP_TITLE',$tmp = utf8_decode($bookings[
'list'][$i][
'title']));
602 $tpl->setVariable(
'LOOP_COUPON', utf8_decode( $assigned_coupons));
603 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
605 if( $bookings[
'list'][$i][
'duration'] == 0 && $bookings[
'list'][$i][
'access_enddate'] == NULL)
607 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
615 $tmp_duration = $access_startdate.
' - '.$access_enddate;
616 if($bookings[
'list'][$i][
'duration'] > 0)
618 $tmp_duration .=
' / '.$bookings[
'list'][$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months'));
620 $tpl->setVariable(
'LOOP_DURATION', $tmp_duration);
622 #$currency = $bookings['list'][$i]['currency_unit'];
623 $tpl->setVariable(
'LOOP_VAT_RATE', number_format($bookings[
'list'][$i][
'vat_rate'], 2,
',',
'.').
' %');
624 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[
'list'][$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
625 $tpl->setVariable(
'LOOP_PRICE', number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
626 $tpl->setVariable(
'LOOP_UNIT_PRICE',number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
627 $tpl->parseCurrentBlock(
'loop');
630 $bookings[
'total'] += (float)$bookings[$i][
'price'];
631 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
632 #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
635 $sub_total_amount = $bookings[
'total'];
638 $bookings[
'total'] += $bookings[
'total_discount'];
639 if($bookings[
'total_discount'] < 0)
641 $tpl->setCurrentBlock(
'cloop');
643 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
644 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
646 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon')));
647 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
648 $tpl->parseCurrentBlock();
651 if ($bookings[
'total'] < 0)
653 $bookings[
'total'] = 0.00;
656 $total_net_price = $sub_total_amount-$bookings[
'total_vat'];
658 $tpl->setVariable(
'TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt(
'total_netprice')));
659 $tpl->setVariable(
'TOTAL_NETPRICE', number_format($total_net_price, 2,
',',
'.') .
' ' . $currency);
661 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
662 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
663 if ($bookings[
'total_vat'] > 0)
665 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
666 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'plus_vat')));
668 if(1 == $bookings[
'list'][0][
'b_pay_method'])
670 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
674 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
677 if (!@file_exists($genSet->get(
'pdf_path')))
684 if (@file_exists($genSet->get(
'pdf_path')))
686 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
689 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf') &&
690 $this->user_obj->getEmail() !=
'' &&
691 $ilSetting->get(
'admin_email') !=
'')
694 $m->
From( $ilSetting->get(
'admin_email') );
695 $m->To( $this->user_obj->getEmail() );
696 $m->Subject( $this->lng->txt(
'pay_message_subject') );
699 $message = $this->lng->txt(
'pay_message_hello') .
' ' . $this->user_obj->getFirstname() .
' ' . $this->user_obj->getLastname() .
",\n\n";
700 $message .= $this->lng->txt(
'pay_message_thanks') .
"\n\n";
701 $message .= $this->lng->txt(
'pay_message_attachment') .
"\n\n";
702 $message .= $this->lng->txt(
'pay_message_regards') .
"\n\n";
703 $message .= strip_tags($genSet->get(
'address'));
706 $billing_text = $genSet->getMailBillingText();
711 if($genSet->getMailUsePlaceholders() == 1)
713 include_once
'./Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
717 $m->Body( $message );
718 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf',
'application/pdf' ) ;
719 if($genSet->get(
'attach_sr_invoice') == 1)
721 require_once
'Services/RTE/classes/class.ilRTE.php';
723 $reg_file_name =
'statutory_regulations';
724 if (@file_exists($genSet->get(
'pdf_path')))
726 ilUtil::html2pdf($regulations, $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf');
729 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf',
'application/pdf' ) ;
735 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.html');
736 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
738 unset($current_booking_id);
740 unset(
$_SESSION[
'coupons'][$this->session_var]);
742 $this->ctrl->redirectByClass(
'ilShopBoughtObjectsGUI',
'');
747 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
751 return $sc_obj->emptyShoppingCart();
766 $ilTabs->setTabActive(
'paya_shopping_cart');
767 $this->tpl->getStandardTemplate();
772 $this->tpl->addBlockFile(
'STATUSLINE',
'statusline',
'tpl.statusline.html');
773 # $this->__buildLocator();
778 $this->tpl->addBlockFile(
'LOCATOR',
'locator',
'tpl.locator.html',
'Services/Locator');
779 $this->tpl->setVariable(
'TXT_LOCATOR',$this->lng->txt(
'locator'));
781 $this->tpl->setCurrentBlock(
'locator_item');
782 $this->tpl->setVariable(
'ITEM', $this->lng->txt(
'personal_desktop'));
783 $this->tpl->setVariable(
'LINK_ITEM',
'../ilias.php?baseClass=ilPersonalDesktopGUI');
784 $this->tpl->parseCurrentBlock();
786 $this->tpl->setCurrentBlock(
'locator_item');
787 $this->tpl->setVariable(
'PREFIX',
'> ');
788 $this->tpl->setVariable(
'ITEM',
'Payment');
789 $this->tpl->setVariable(
'LINK_ITEM',
'./payment.php');
790 $this->tpl->parseCurrentBlock();
810 $lng->loadLanguageModule(
'meta');
812 $cntcodes = array (
'DE',
'ES',
'FR',
'GB',
'AT',
'CH',
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
813 'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
814 'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
815 'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
816 'CG',
'CK',
'CR',
'CI',
'HR',
'CU',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'TP',
'EC',
817 'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'FX',
'GF',
'PF',
818 'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GN',
819 'GW',
'GY',
'HT',
'HM',
'HN',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IL',
'IT',
820 'JM',
'JP',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
821 'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
822 'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'MS',
'MA',
'MZ',
'MM',
'NA',
823 'NR',
'NP',
'NL',
'AN',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
824 'PK',
'PW',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
825 'RU',
'RW',
'KN',
'LC',
'VC',
'WS',
'SM',
'ST',
'SA',
'CH',
'SN',
'SC',
'SL',
'SG',
826 'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'ES',
'LK',
'SH',
'PM',
'SD',
'SR',
'SJ',
'SZ',
827 'SE',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
828 'TV',
'UG',
'UA',
'AE',
'GB',
'UY',
'US',
'UM',
'UZ',
'VU',
'VA',
'VE',
'VN',
'VG',
829 'VI',
'WF',
'EH',
'YE',
'ZR',
'ZM',
'ZW');
831 foreach($cntcodes as $cntcode)
833 $cntrs[$cntcode] = $lng->txt(
'meta_c_'.$cntcode);
842 foreach($countries as $code => $text)
855 return $countries[$value];
862 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
868 foreach($items as $item)
870 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
875 $f_result[$counter][
"object_title"] = $tmp_obj->getTitle();
879 $f_result[$counter][
"object_title"] = $this->lng->txt(
'object_not_found');
884 $price = (float) $price_arr[
'price'];
885 $f_result[$counter][
'price'] = $price * 1.0;
905 for ($i = 0; $i < count(
$result); $i++)
907 $amount +=
$result[$i][
'price'];
924 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
930 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
936 foreach($items as $item)
938 $tmp_pobject =
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
944 $assigned_coupons =
'';
945 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
947 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
949 $this->coupon_obj->setId($coupon[
'pc_pk']);
950 $this->coupon_obj->setCurrentCoupon($coupon);
952 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
954 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
958 $f_result[$counter][
'item'] =
'';
961 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
965 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
967 if ($assigned_coupons !=
'') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
969 switch($price_arr[
'price_type'])
972 $f_result[$counter][
'duration'] = $price_arr[
'duration'] .
' ' . $this->lng->txt(
'paya_months');
975 $f_result[$counter][
'duration'] =
980 $f_result[$counter][
'duration'] = $this->lng->txt(
'unlimited_duration');
984 $oVAT =
new ilShopVats((
int)$tmp_pobject->getVatId());
987 $float_price = $price_arr[
'price'];
989 $f_result[$counter][
'vat_unit'] = $tmp_pobject->getVat($float_price,
'GUI').
' '.$genSet->get(
'currency_unit');
990 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
992 $f_result[$counter][
'price'] = number_format($float_price, 2,
',',
'.') .
' '.$genSet->get(
'currency_unit');
1005 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1008 include_once
'./Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1011 $tbl->setId(
'tbl_id_'.$this->session_var);
1012 $tbl->setTitle($this->lng->txt(
'paya_shopping_cart'));
1017 $tbl->setRowTemplate(
"tpl.shop_shoppingcart_row.html",
"Services/Payment");
1018 $tbl->addColumn(
'',
'item',
'1%');
1019 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'30%');
1020 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'30%');
1021 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
1022 $tbl->addColumn($this->lng->txt(
'vat_unit'),
'vat_unit',
'15%');
1023 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
1024 $tbl->disable(
'sort');
1026 #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1030 $totalAmount = $sc_obj->getTotalAmount();
1032 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
1034 if (count($items = $sc_obj->getEntries($this->pm_id)))
1036 $tbl->setTotalData(
'TXT_SUB_TOTAL', $this->lng->txt(
'pay_bmf_subtotal_amount') .
": ");
1037 $tbl->setTotalData(
'VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1038 #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
1040 $totalAmount[
'current_coupon_bonus'] = 0;
1041 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
1043 $this->coupon_obj->setId($coupon[
'pc_pk']);
1044 $this->coupon_obj->setCurrentCoupon($coupon);
1046 $total_object_price = 0.0;
1047 $current_coupon_bonus = 0.0;
1049 foreach ($items as $item)
1051 $tmp_pobject =
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
1053 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1056 $price = (float) $price_data[
'price'];
1058 $total_object_price += $price;
1060 unset($tmp_pobject);
1062 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1063 $totalAmount[
'current_coupon_bonus'] += $current_coupon_bonus * (-1);
1065 $tbl->setTotalData(
'TXT_COUPON_BONUS', $this->lng->txt(
'paya_coupons_coupon') .
": ");# . $coupon[
'pcc_code'] .
": ");
1066 $tbl->setTotalData(
'VAL_COUPON_BONUS', number_format($totalAmount[
'current_coupon_bonus'], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1069 if ($totalAmount[$this->pm_id] < 0)
1072 $this->totalVat = 0;
1079 $tbl->setTotalData(
'TXT_TOTAL_AMOUNT', $this->lng->txt(
'pay_bmf_total_amount').
": ");
1080 $tbl->setTotalData(
'VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit')); #.$item[
'currency']);
1082 if ($this->totalVat > 0)
1084 $tbl->setTotalData(
'TXT_TOTAL_VAT', $this->lng->txt(
'pay_bmf_vat_included') .
": ");
1085 $tbl->setTotalData(
'VAL_TOTAL_VAT', number_format($this->totalVat , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1088 $tbl->setData($a_result_set);
1089 $this->tpl->setVariable(
'ITEMS_TABLE',$tbl->getCartHTML());