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';
50 $this->session_var = $this->pmethod_obj->getPmTitle();
58 if (!is_array(
$_SESSION[$this->session_var][
'personal_data']))
62 if (strpos(
'_' . $this->user_obj->getStreet(),
' ') > 0)
64 $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(),
' ')+1);
65 $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
79 $_SESSION[
$this->session_var][
'personal_data'][
'language'] = $this->user_obj->getLanguage();
82 if (!is_array(
$_SESSION[
'coupons'][$this->session_var]))
89 $this->lng->loadLanguageModule(
'payment');
91 $ilTabs->clearTargets();
92 $ilTabs->clearSubTabs();
104 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
106 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
107 $this->tpl->touchBlock(
'stop_floating');
112 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
115 $oForm->setFormAction($this->ctrl->getFormAction($this,
'getPersonalData'));
116 $oForm->setTitle($this->lng->txt(
'pay_bmf_personal_data'));
119 $oFirstname->
setValue($this->user_obj->getFirstname());
120 $oForm->addItem($oFirstname);
123 $oLastname->
setValue($this->user_obj->getLastname());
124 $oForm->addItem($oLastname);
126 $oStreet =
new ilTextInputGUI($this->lng->txt(
'street'),
'street');
130 $oForm->addItem($oStreet);
132 $oHouseNumber =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_house_number'),
'house_number');
133 $oHouseNumber->
setValue($this->error !=
'' && isset(
$_POST[
'house_number'])
136 $oForm->addItem($oHouseNumber);
138 $oPoBox =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_or').
' '.$this->lng->txt(
'pay_bmf_po_box'),
'po_box');
142 $oForm->addItem($oPoBox);
144 $oZipCode =
new ilTextInputGUI($this->lng->txt(
'zipcode'),
'zipcode');
145 if($this->user_obj->getZipCode() && !isset(
$_POST[
'zipcode']))
146 $oZipCode->
setValue($this->user_obj->getZipCode());
148 $oZipCode->setValue($this->error !=
'' && isset(
$_POST[
'zipcode'])
151 $oForm->addItem($oZipCode);
154 if($this->user_obj->getCity()&& !isset(
$_POST[
'city']))
155 $oCity->
setValue($this->user_obj->getCity());
157 $oCity->setValue($this->error !=
'' && isset(
$_POST[
'city'])
160 $oForm->addItem($oCity);
165 if($this->user_obj->getSelectedCountry()&& !isset(
$_POST[
'country']))
166 $oCountry->setValue($this->user_obj->getSelectedCountry());
168 $oCountry->setValue($this->error !=
'' && isset(
$_POST[
'country']) ?
$_POST[
'country']
169 :
$_SESSION[$this->session_var][
'personal_data'][
'country']);
170 $oForm->addItem($oCountry);
173 $oEmail->
setValue($this->user_obj->getEmail());
174 $oForm->addItem($oEmail);
176 $oForm->addcommandButton(
'getPersonalData',ucfirst($this->lng->txt(
'next')));
178 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
185 if (
$_SESSION[$this->session_var][
'personal_data'][
'firstname'] ==
'' ||
186 $_SESSION[$this->session_var][
'personal_data'][
'lastname'] ==
'' ||
187 $_POST[
'zipcode'] ==
'' ||
189 $_POST[
'country'] ==
'' ||
190 $_SESSION[$this->session_var][
'personal_data'][
'email'] ==
'')
193 $this->error = $this->lng->txt(
'pay_bmf_personal_data_not_valid');
199 if ((
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] ==
'' &&
$_POST[
'po_box'] ==
'') ||
200 ((
$_POST[
'street'] !=
'' ||
$_POST[
'house_number'] !=
'') &&
$_POST[
'po_box'] !=
'') ||
201 (
$_POST[
'street'] !=
'' &&
$_POST[
'house_number'] ==
'') ||
202 (
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] !=
''))
204 $this->error = $this->lng->txt(
'pay_bmf_street_or_pobox');
231 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
233 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
234 $this->tpl->touchBlock(
'stop_floating');
239 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill_confirm.html',
'Services/Payment');
243 $this->tpl->setVariable(
'BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
247 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
250 $this->tpl->setVariable(
'TXT_CONFIRM_ORDER',$this->lng->txt(
'pay_confirm_order'));
252 $this->tpl->setVariable(
'INPUT_VALUE',$this->lng->txt(
'pay_send_order'));
253 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
256 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
257 $this->tpl->setCurrentBlock(
'btn_cell');
258 $this->tpl->setVariable(
'BTN_LINK', $this->ctrl->getLinkTarget($this,
'showPersonalData'));
259 $this->tpl->setVariable(
'BTN_TXT', $this->lng->txt(
'pay_bmf_back'));
260 $this->tpl->parseCurrentBlock(
'btn_cell');
269 $cmd = $this->ctrl->getCmd();
271 switch ($this->ctrl->getNextClass($this))
274 if(!
$cmd = $this->ctrl->getCmd())
276 $cmd =
'showPersonalData';
285 global
$ilUser, $ilObjDataCache;
287 $sc = $this->psc_obj->getShoppingCart($this->pm_id);
289 # $this->psc_obj->clearCouponItemsSession();
291 if (is_array($sc) && count($sc) > 0)
293 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
297 for ($i = 0; $i < count($sc); $i++)
299 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
301 $sc[$i][
'math_price'] = (float) $sc[$i][
'price'];
303 $tmp_pobject =
new ilPaymentObject($this->user_obj, $sc[$i][
'pobject_id']);
305 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
307 $this->coupon_obj->setId($coupon[
'pc_pk']);
308 $this->coupon_obj->setCurrentCoupon($coupon);
310 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
321 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][$this->session_var]);
324 for ($i = 0; $i < count($sc); $i++)
329 $price = $sc[$i][
'price'];
332 if (array_key_exists($sc[$i][
'pobject_id'], $coupon_discount_items))
334 $bonus = $coupon_discount_items[$sc[$i][
'pobject_id']][
'math_price'] - $coupon_discount_items[$sc[$i][
'pobject_id']][
'discount_price'];
336 $discount = round($bonus, 2)* (-1);
337 else $discount = round($bonus, 2);
341 $book_obj->setTransaction($transaction);
342 $book_obj->setPobjectId($sc[$i][
'pobject_id']);
343 $book_obj->setCustomerId($this->user_obj->getId());
344 $book_obj->setVendorId($pobjectData[
'vendor_id']);
345 $book_obj->setPayMethod($pobjectData[
'pay_method']);
346 $book_obj->setOrderDate(time());
348 $book_obj->setPrice($sc[$i][
'price_string']);
350 $book_obj->setDiscount($discount);
351 $book_obj->setPayed(1);
352 $book_obj->setAccess(1);
354 $book_obj->setVoucher(
'');
355 $book_obj->setTransactionExtern(
'');
357 $book_obj->setVatRate($sc[$i][
'vat_rate']);
358 $book_obj->setVatUnit($sc[$i][
'vat_unit']);
359 $book_obj->setObjectTitle(strip_tags($sc[$i][
'object_title']));
360 $book_obj->setAccessExtension($sc[$i][
'extension']);
362 switch($sc[$i][
"price_type"])
365 $book_obj->setDuration($sc[$i][
'duration']);
369 $book_obj->setDuration(0);
370 $book_obj->setAccessStartdate($sc[$i][
'duration_from']);
371 $book_obj->setAccessEnddate($sc[$i][
'duration_until']);
374 $book_obj->setDuration(0);
375 $book_obj->setAccessEnddate(NULL);
376 $book_obj->setUnlimitedDuration($sc[$i][
'unlimited_duration']);
381 $book_obj->setPriceType($sc[$i][
"price_type"]);
385 $book_obj->setVoucher($external_data[
'voucher']);
386 $book_obj->setTransactionExtern($external_data[
'transaction_extern']);
387 $book_obj->setStreet($external_data[
'street'],
'');
388 $book_obj->setZipcode($external_data[
'zipcode']);
389 $book_obj->setCity($external_data[
'city']);
390 $book_obj->setCountry($external_data[
'country']);
393 if(isset(
$_SESSION[$this->session_var][
'personal_data']))
395 $book_obj->setStreet(
$_SESSION[$this->session_var][
'personal_data'][
'street'],
$_SESSION[$this->session_var][
'personal_data'][
'house_number']);
396 $book_obj->setPoBox(
$_SESSION[$this->session_var][
'personal_data'][
'po_box']);
397 $book_obj->setZipcode(
$_SESSION[$this->session_var][
'personal_data'][
'zipcode']);
398 $book_obj->setCity(
$_SESSION[$this->session_var][
'personal_data'][
'city']);
399 $book_obj->setCountry(
$_SESSION[$this->session_var][
'personal_data'][
'country']);
403 $book_obj->setStreet($this->user_obj->getStreet(),
'');
404 $book_obj->setPoBox($this->user_obj->getPoBox());
405 $book_obj->setZipcode($this->user_obj->getZipCode());
406 $book_obj->setCity($this->user_obj->getCity());
407 $book_obj->setCountry($this->user_obj->getCountry());
410 $booking_id = $book_obj->add();
418 if($obj_type ==
'crs')
423 if (!empty(
$_SESSION[
'coupons'][$this->session_var]) && $booking_id)
425 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
427 $this->coupon_obj->setId($coupon[
'pc_pk']);
428 $this->coupon_obj->setCurrentCoupon($coupon);
430 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
432 $this->coupon_obj->addCouponForBookingId($booking_id);
437 $obj_id = $ilObjDataCache->lookupObjId($pobjectData[
'ref_id']);
438 $obj_type = $ilObjDataCache->lookupType($obj_id);
439 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
441 $bookings[
'list'][] = array(
442 'pobject_id' => $sc[$i][
'pobject_id'],
444 'title' =>
'['.$obj_id.
']: ' . $obj_title,
445 'duration' => $sc[$i][
'duration'],
446 'vat_rate' => $sc[$i][
'vat_rate'],
447 'vat_unit' => $sc[$i][
'vat_unit'],
448 'price_string' => $sc[$i][
'price_string'],
449 'price' => $sc[$i][
'price'],
450 "price_type" => $sc[$i][
"price_type"],
451 "duration_from" => $sc[$i][
"duration_from"],
452 "duration_until" => $sc[$i][
"duration_until"],
453 "b_pay_method" => $pobjectData[
"pay_method"],
454 'discount'=> $discount,
455 'access_startdate' => $book_obj->getAccessStartdate(),
456 'access_enddate' => $book_obj->getAccessEnddate()
459 $total += $sc[$i][
'price'];
460 $total_vat += $sc[$i][
'vat_unit'];
461 $total_discount += $discount;
463 if ($sc[$i][
'psc_id']) $this->psc_obj->delete($sc[$i][
'psc_id']);
466 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
468 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
470 $this->coupon_obj->setId($coupon[
'pc_pk']);
471 $this->coupon_obj->setCurrentCoupon($coupon);
472 $this->coupon_obj->addTracking();
477 $bookings[
'total'] =
$total;
478 $bookings[
'total_vat'] = $total_vat;
479 $bookings[
'total_discount'] = $total_discount;
480 $bookings[
'transaction'] = $transaction;
481 $bookings[
'street'] = $book_obj->getStreet();
482 $bookings[
'zipcode'] = $book_obj->getZipCode();
483 $bookings[
'city'] = $book_obj->getCity();
484 if(2 == strlen($book_obj->getCountry()))
486 $bookings[
'country'] = $this->
__getCountryName(strtoupper($book_obj->getCountry()));
490 $bookings[
'country'] = $book_obj->getCountry();
492 $bookings[
'transaction_extern'] = $book_obj->getTransactionExtern();
503 include_once
'./Services/UICore/classes/class.ilTemplate.php';
504 include_once
'./Services/Utilities/classes/class.ilUtil.php';
505 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
506 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
507 include_once
'Services/Mail/classes/class.ilMimeMail.php';
511 $currency = $genSet->get(
'currency_unit');
514 $tpl =
new ilTemplate(
'tpl.pay_bill.html',
true,
true,
'Services/Payment');
516 if($tpl->placeholderExists(
'HTTP_PATH'))
519 $tpl->setVariable(
'HTTP_PATH', $http_path);
523 $tpl->setVariable(
'TXT_CREDIT', utf8_decode($this->lng->txt(
'credit')));
524 $tpl->setVariable(
'TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt(
'day_of_service_provision'));
525 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
527 if(strlen(trim($bookings[
'transaction_extern'])))
529 $tpl->setVariable(
'TXT_EXTERNAL_BILL_NO', str_replace(
'%s',$str_paymethod,utf8_decode($this->lng->txt(
'external_bill_no'))));
530 $tpl->setVariable(
'EXTERNAL_BILL_NO', $bookings[
'transaction_extern']);
532 $tpl->setVariable(
'TXT_POSITION',$this->lng->txt(
'position'));
533 $tpl->setVariable(
'TXT_AMOUNT',$this->lng->txt(
'amount'));
534 $tpl->setVariable(
'TXT_UNIT_PRICE', utf8_decode($this->lng->txt(
'unit_price')));
536 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
537 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
538 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
539 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
542 $tpl->setVariable(
'CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
543 $tpl->setVariable(
'CUSTOMER_LASTNAME',utf8_decode( $this->user_obj->getLastname()));
544 if($bookings[
'po_box']==
'')
546 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode( $bookings[
'street']));
550 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[
'po_box']));
552 $tpl->setVariable(
'CUSTOMER_ZIPCODE', utf8_decode($bookings[
'zipcode']));
553 $tpl->setVariable(
'CUSTOMER_CITY', utf8_decode($bookings[
'city']));
554 $tpl->setVariable(
'CUSTOMER_COUNTRY', utf8_decode($bookings[
'country']));
556 $tpl->setVariable(
'BILL_NO', $bookings[
'transaction']);
557 $tpl->setVariable(
'DATE', date(
'd.m.Y'));
559 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
560 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
561 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
563 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
564 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
565 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
566 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
568 for ($i = 0; $i < count($bookings[
'list']); $i++)
570 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[
'list'][$i][
'pobject_id']);
572 $assigned_coupons =
'';
573 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
575 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
577 $this->coupon_obj->setId($coupon[
'pc_pk']);
578 $this->coupon_obj->setCurrentCoupon($coupon);
580 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
582 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
587 $tpl->setCurrentBlock(
'loop');
588 $tpl->setVariable(
'LOOP_POSITION', $i+1);
589 $tpl->setVariable(
'LOOP_AMOUNT',
'1');
590 $tpl->setVariable(
'LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt(
'period_of_service_provision')));
592 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings[
'list'][$i][
'type'])));
593 $tpl->setVariable(
'LOOP_TITLE',$tmp = utf8_decode($bookings[
'list'][$i][
'title']));
594 $tpl->setVariable(
'LOOP_COUPON', utf8_decode( $assigned_coupons));
595 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
597 if( $bookings[
'list'][$i][
'duration'] == 0 && $bookings[
'list'][$i][
'access_enddate'] == NULL)
599 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
607 $tmp_duration = $access_startdate.
' - '.$access_enddate;
608 if($bookings[
'list'][$i][
'duration'] > 0)
610 $tmp_duration .=
' / '.$bookings[
'list'][$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months'));
612 $tpl->setVariable(
'LOOP_DURATION', $tmp_duration);
614 #$currency = $bookings['list'][$i]['currency_unit'];
615 $tpl->setVariable(
'LOOP_VAT_RATE', number_format($bookings[
'list'][$i][
'vat_rate'], 2,
',',
'.').
' %');
616 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[
'list'][$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
617 $tpl->setVariable(
'LOOP_PRICE', number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
618 $tpl->setVariable(
'LOOP_UNIT_PRICE',number_format($bookings[
'list'][$i][
'price'], 2,
',',
'.').
' '.$currency);
619 $tpl->parseCurrentBlock(
'loop');
622 $bookings[
'total'] += (float)$bookings[$i][
'price'];
623 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
624 #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
627 $sub_total_amount = $bookings[
'total'];
630 $bookings[
'total'] += $bookings[
'total_discount'];
631 if($bookings[
'total_discount'] < 0)
633 $tpl->setCurrentBlock(
'cloop');
635 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
636 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
638 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon')));
639 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
640 $tpl->parseCurrentBlock();
643 if ($bookings[
'total'] < 0)
645 $bookings[
'total'] = 0.00;
648 $total_net_price = $sub_total_amount-$bookings[
'total_vat'];
650 $tpl->setVariable(
'TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt(
'total_netprice')));
651 $tpl->setVariable(
'TOTAL_NETPRICE', number_format($total_net_price, 2,
',',
'.') .
' ' . $currency);
653 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
654 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
655 if ($bookings[
'total_vat'] > 0)
657 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
658 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'plus_vat')));
660 if(1 == $bookings[
'list'][0][
'b_pay_method'])
662 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
666 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
669 if (!@file_exists($genSet->get(
'pdf_path')))
676 if (@file_exists($genSet->get(
'pdf_path')))
678 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
681 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf') &&
682 $this->user_obj->getEmail() !=
'' &&
683 $ilSetting->get(
'admin_email') !=
'')
686 $m->
From( $ilSetting->get(
'admin_email') );
687 $m->To( $this->user_obj->getEmail() );
688 $m->Subject( $this->lng->txt(
'pay_message_subject') );
691 $message = $this->lng->txt(
'pay_message_hello') .
' ' . $this->user_obj->getFirstname() .
' ' . $this->user_obj->getLastname() .
",\n\n";
692 $message .= $this->lng->txt(
'pay_message_thanks') .
"\n\n";
693 $message .= $this->lng->txt(
'pay_message_attachment') .
"\n\n";
694 $message .= $this->lng->txt(
'pay_message_regards') .
"\n\n";
695 $message .= strip_tags($genSet->get(
'address'));
698 $billing_text = $genSet->getMailBillingText();
703 if($genSet->getMailUsePlaceholders() == 1)
705 include_once
'./Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
709 $m->Body( $message );
710 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf',
'application/pdf' ) ;
711 if($genSet->get(
'attach_sr_invoice') == 1)
713 require_once
'Services/RTE/classes/class.ilRTE.php';
715 $reg_file_name =
'statutory_regulations';
716 if (@file_exists($genSet->get(
'pdf_path')))
718 ilUtil::html2pdf($regulations, $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf');
721 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $reg_file_name .
'.pdf',
'application/pdf' ) ;
727 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.html');
728 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
730 unset($current_booking_id);
732 unset(
$_SESSION[
'coupons'][$this->session_var]);
734 $this->ctrl->redirectByClass(
'ilShopBoughtObjectsGUI',
'');
739 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
743 return $sc_obj->emptyShoppingCart();
758 $ilTabs->setTabActive(
'paya_shopping_cart');
759 $this->tpl->getStandardTemplate();
764 $this->tpl->addBlockFile(
'STATUSLINE',
'statusline',
'tpl.statusline.html');
765 # $this->__buildLocator();
770 $this->tpl->addBlockFile(
'LOCATOR',
'locator',
'tpl.locator.html',
'Services/Locator');
771 $this->tpl->setVariable(
'TXT_LOCATOR',$this->lng->txt(
'locator'));
773 $this->tpl->setCurrentBlock(
'locator_item');
774 $this->tpl->setVariable(
'ITEM', $this->lng->txt(
'personal_desktop'));
775 $this->tpl->setVariable(
'LINK_ITEM',
'../ilias.php?baseClass=ilPersonalDesktopGUI');
776 $this->tpl->parseCurrentBlock();
778 $this->tpl->setCurrentBlock(
'locator_item');
779 $this->tpl->setVariable(
'PREFIX',
'> ');
780 $this->tpl->setVariable(
'ITEM',
'Payment');
781 $this->tpl->setVariable(
'LINK_ITEM',
'./payment.php');
782 $this->tpl->parseCurrentBlock();
802 $lng->loadLanguageModule(
'meta');
804 $cntcodes = array (
'DE',
'ES',
'FR',
'GB',
'AT',
'CH',
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
805 'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
806 'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
807 'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
808 'CG',
'CK',
'CR',
'CI',
'HR',
'CU',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'TP',
'EC',
809 'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'FX',
'GF',
'PF',
810 'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GN',
811 'GW',
'GY',
'HT',
'HM',
'HN',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IL',
'IT',
812 'JM',
'JP',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
813 'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
814 'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'MS',
'MA',
'MZ',
'MM',
'NA',
815 'NR',
'NP',
'NL',
'AN',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
816 'PK',
'PW',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
817 'RU',
'RW',
'KN',
'LC',
'VC',
'WS',
'SM',
'ST',
'SA',
'CH',
'SN',
'SC',
'SL',
'SG',
818 'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'ES',
'LK',
'SH',
'PM',
'SD',
'SR',
'SJ',
'SZ',
819 'SE',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
820 'TV',
'UG',
'UA',
'AE',
'GB',
'UY',
'US',
'UM',
'UZ',
'VU',
'VA',
'VE',
'VN',
'VG',
821 'VI',
'WF',
'EH',
'YE',
'ZR',
'ZM',
'ZW');
823 foreach($cntcodes as $cntcode)
825 $cntrs[$cntcode] = $lng->txt(
'meta_c_'.$cntcode);
834 foreach($countries as $code => $text)
847 return $countries[$value];
854 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
860 foreach($items as $item)
862 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
867 $f_result[$counter][
"object_title"] = $tmp_obj->getTitle();
871 $f_result[$counter][
"object_title"] = $this->lng->txt(
'object_not_found');
876 $price = (float) $price_arr[
'price'];
877 $f_result[$counter][
'price'] = $price * 1.0;
897 for ($i = 0; $i < count(
$result); $i++)
899 $amount +=
$result[$i][
'price'];
916 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
922 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
928 foreach($items as $item)
930 $tmp_pobject =
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
936 $assigned_coupons =
'';
937 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
939 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
941 $this->coupon_obj->setId($coupon[
'pc_pk']);
942 $this->coupon_obj->setCurrentCoupon($coupon);
944 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
946 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
950 $f_result[$counter][
'item'] =
'';
953 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
957 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
959 if ($assigned_coupons !=
'') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
961 switch($price_arr[
'price_type'])
964 $f_result[$counter][
'duration'] = $price_arr[
'duration'] .
' ' . $this->lng->txt(
'paya_months');
967 $f_result[$counter][
'duration'] =
972 $f_result[$counter][
'duration'] = $this->lng->txt(
'unlimited_duration');
976 $oVAT =
new ilShopVats((
int)$tmp_pobject->getVatId());
979 $float_price = $price_arr[
'price'];
981 $f_result[$counter][
'vat_unit'] = $tmp_pobject->getVat($float_price,
'GUI').
' '.$genSet->get(
'currency_unit');
982 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
984 $f_result[$counter][
'price'] = number_format($float_price, 2,
',',
'.') .
' '.$genSet->get(
'currency_unit');
997 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1000 include_once
'./Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1003 $tbl->setId(
'tbl_id_'.$this->session_var);
1004 $tbl->setTitle($this->lng->txt(
'paya_shopping_cart'));
1009 $tbl->setRowTemplate(
"tpl.shop_shoppingcart_row.html",
"Services/Payment");
1010 $tbl->addColumn(
'',
'item',
'1%');
1011 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'30%');
1012 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'30%');
1013 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
1014 $tbl->addColumn($this->lng->txt(
'vat_unit'),
'vat_unit',
'15%');
1015 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
1016 $tbl->disable(
'sort');
1018 #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1022 $totalAmount = $sc_obj->getTotalAmount();
1024 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
1026 if (count($items = $sc_obj->getEntries($this->pm_id)))
1028 $tbl->setTotalData(
'TXT_SUB_TOTAL', $this->lng->txt(
'pay_bmf_subtotal_amount') .
": ");
1029 $tbl->setTotalData(
'VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1030 #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
1032 $totalAmount[$current_coupon_bonus] = 0;
1033 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
1035 $this->coupon_obj->setId($coupon[
'pc_pk']);
1036 $this->coupon_obj->setCurrentCoupon($coupon);
1038 $total_object_price = 0.0;
1039 $current_coupon_bonus = 0.0;
1041 foreach ($items as $item)
1043 $tmp_pobject =
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
1045 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1048 $price = (float) $price_data[
'price'];
1050 $total_object_price += $price;
1052 unset($tmp_pobject);
1054 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1055 $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * (-1);
1057 $tbl->setTotalData(
'TXT_COUPON_BONUS', $this->lng->txt(
'paya_coupons_coupon') .
": ");# . $coupon[
'pcc_code'] .
": ");
1058 $tbl->setTotalData(
'VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1061 if ($totalAmount[$this->pm_id] < 0)
1064 $this->totalVat = 0;
1071 $tbl->setTotalData(
'TXT_TOTAL_AMOUNT', $this->lng->txt(
'pay_bmf_total_amount').
": ");
1072 $tbl->setTotalData(
'VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit')); #.$item[
'currency']);
1074 if ($this->totalVat > 0)
1076 $tbl->setTotalData(
'TXT_TOTAL_VAT', $this->lng->txt(
'pay_bmf_vat_included') .
": ");
1077 $tbl->setTotalData(
'VAL_TOTAL_VAT', number_format($this->totalVat , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
1080 $tbl->setData($a_result_set);
1081 $this->tpl->setVariable(
'ITEMS_TABLE',$tbl->getCartHTML());