ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPurchaseBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
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';
21 
23 {
24  public $ctrl;
25  public $tpl;
26 
27  public $psc_obj = null;
28  public $user_obj = null;
29 
30  public $coupon_obj = null;
31  public $error;
32 
33  public $pmethod_obj = null;
34  private $pm_id = 0;
35  private $totalVat = 0;
36  private $session_var = null;
37 
38  public function __construct($user_obj, $pay_method)
39  {
40  global $lng, $tpl, $ilCtrl, $ilTabs;
41 
43 
44  $this->lng = $lng;
45  $this->ctrl = $ilCtrl;
46  $this->tpl = $tpl;
47  $this->user_obj = $user_obj;
48 
49  $this->pmethod_obj = new ilPayMethods($pay_method);
50  $this->session_var = $this->pmethod_obj->getPmTitle();
51 
52  $this->pm_id = $pay_method;
53 
54  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
55 
56  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
57 
58  if (!is_array($_SESSION[$this->session_var]['personal_data']))
59  {
60  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
61  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
62  if (strpos('_' . $this->user_obj->getStreet(), ' ') > 0)
63  {
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));
66  $_SESSION[$this->session_var]['personal_data']['street'] = $street;
67  $_SESSION[$this->session_var]['personal_data']['house_number'] = $houseNo;
68  }
69  else
70  {
71  $_SESSION[$this->session_var]['personal_data']['street'] = $this->user_obj->getStreet();
72  $_SESSION[$this->session_var]['personal_data']['house_number'] = '';
73  }
74  $_SESSION[$this->session_var]['personal_data']['po_box'] = '';
75  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $this->user_obj->getZipcode();
76  $_SESSION[$this->session_var]['personal_data']['city'] = $this->user_obj->getCity();
77  $_SESSION[$this->session_var]['personal_data']['country'] = $this->__getCountryCode($this->user_obj->getCountry());
78  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
79  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
80  }
81 
82  if (!is_array($_SESSION['coupons'][$this->session_var]))
83  {
84  $_SESSION['coupons'][$this->session_var] = array();
85  }
86 
87  $this->__loadTemplate();
88  $this->error = '';
89  $this->lng->loadLanguageModule('payment');
90 
91  $ilTabs->clearTargets();
92  $ilTabs->clearSubTabs();
93  }
94 
95  public function cancel()
96  {
97  ilUtil::redirect('./payment.php');
98  }
99 
100  public function showPersonalData()
101  {
102  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
103 
104  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
105  {
106  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
107  $this->tpl->touchBlock('stop_floating');
108  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
109  }
110  else
111  {
112  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
113 
114  $oForm = new ilPropertyFormGUI();
115  $oForm->setFormAction($this->ctrl->getFormAction($this, 'getPersonalData'));
116  $oForm->setTitle($this->lng->txt('pay_bmf_personal_data'));
117 
118  $oFirstname = new ilNonEditableValueGUI($this->lng->txt('firstname'));
119  $oFirstname->setValue($this->user_obj->getFirstname());
120  $oForm->addItem($oFirstname);
121 
122  $oLastname = new ilNonEditableValueGUI($this->lng->txt('lastname'));
123  $oLastname->setValue($this->user_obj->getLastname());
124  $oForm->addItem($oLastname);
125 
126  $oStreet = new ilTextInputGUI($this->lng->txt('street'),'street');
127  $oStreet->setValue($this->error != '' && isset($_POST['street'])
128  ? ilUtil::prepareFormOutput($_POST['street'],true)
129  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['street'],true));
130  $oForm->addItem($oStreet);
131 
132  $oHouseNumber = new ilTextInputGUI($this->lng->txt('pay_bmf_house_number'), 'house_number');
133  $oHouseNumber->setValue($this->error != '' && isset($_POST['house_number'])
134  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
135  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['house_number'],true));
136  $oForm->addItem($oHouseNumber);
137 
138  $oPoBox = new ilTextInputGUI($this->lng->txt('pay_bmf_or').' '.$this->lng->txt('pay_bmf_po_box'), 'po_box');
139  $oPoBox->setValue($this->error != '' && isset($_POST['po_box'])
140  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
141  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['po_box'],true));
142  $oForm->addItem($oPoBox);
143 
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());
147  else
148  $oZipCode->setValue($this->error != '' && isset($_POST['zipcode'])
149  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
150  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['zipcode'],true));
151  $oForm->addItem($oZipCode);
152 
153  $oCity = new ilTextInputGUI($this->lng->txt('city'), 'city');
154  if($this->user_obj->getCity()&& !isset($_POST['city']))
155  $oCity->setValue($this->user_obj->getCity());
156  else
157  $oCity->setValue($this->error != '' && isset($_POST['city'])
158  ? ilUtil::prepareFormOutput($_POST['city'],true)
159  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['city'],true));
160  $oForm->addItem($oCity);
161 
162  $oCountry = new ilSelectInputGUI($this->lng->txt('country'), 'country');
163  $oCountry->setOptions($this->__getCountries());
164 
165  if($this->user_obj->getSelectedCountry()&& !isset($_POST['country']))
166  $oCountry->setValue($this->user_obj->getSelectedCountry());
167  else
168  $oCountry->setValue($this->error != '' && isset($_POST['country']) ? $_POST['country']
169  : $_SESSION[$this->session_var]['personal_data']['country']);
170  $oForm->addItem($oCountry);
171 
172  $oEmail = new ilNonEditableValueGUI($this->lng->txt('email'));
173  $oEmail->setValue($this->user_obj->getEmail());
174  $oForm->addItem($oEmail);
175 
176  $oForm->addcommandButton('getPersonalData',ucfirst($this->lng->txt('next')));
177 
178  $this->tpl->setVariable('FORM', $oForm->getHTML());
179  }
180  }
181 
182  public function getPersonalData()
183  {
184 
185  if ($_SESSION[$this->session_var]['personal_data']['firstname'] == '' ||
186  $_SESSION[$this->session_var]['personal_data']['lastname'] == '' ||
187  $_POST['zipcode'] == '' ||
188  $_POST['city'] == '' ||
189  $_POST['country'] == '' ||
190  $_SESSION[$this->session_var]['personal_data']['email'] == '')
191  {
192 
193  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
194  ilUtil::sendInfo($this->error);
195  $this->showPersonalData();
196  return;
197  }
198 
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'] != ''))
203  {
204  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
205  ilUtil::sendInfo($this->error);
206  $this->showPersonalData();
207  return;
208  }
209 
210  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
211  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
212  $_SESSION[$this->session_var]['personal_data']['street'] = $_POST['street'];
213  $_SESSION[$this->session_var]['personal_data']['house_number'] = $_POST['house_number'];
214  $_SESSION[$this->session_var]['personal_data']['po_box'] = $_POST['po_box'];
215  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $_POST['zipcode'];
216  $_SESSION[$this->session_var]['personal_data']['city'] = $_POST['city'];
217  $_SESSION[$this->session_var]['personal_data']['country'] = $_POST['country'];
218 
219  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
220  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
221 
222  $this->error = '';
223  $this->showBillConfirm();
224 
225  }
226 
227  public function showBillConfirm()
228  {
229  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
230 
231  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
232  {
233  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
234  $this->tpl->touchBlock('stop_floating');
235  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
236  }
237  else
238  {
239  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bill_confirm.html','Services/Payment');
240 
241  $this->__showShoppingCart();
242 
243  $this->tpl->setVariable('BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
244 
245  // set table header
246  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_pays_b.png'));
247  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_usr'));
248 
249  // set plain text variables
250  $this->tpl->setVariable('TXT_CONFIRM_ORDER',$this->lng->txt('pay_confirm_order'));
251 
252  $this->tpl->setVariable('INPUT_VALUE',$this->lng->txt('pay_send_order'));
253  $this->tpl->setVariable('CANCEL',$this->lng->txt('cancel'));
254 
255  // Button
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');
261  }
262  }
263 
267  public function executeCommand()
268  {
269  $cmd = $this->ctrl->getCmd();
270 
271  switch ($this->ctrl->getNextClass($this))
272  {
273  default:
274  if(!$cmd = $this->ctrl->getCmd())
275  {
276  $cmd = 'showPersonalData';
277  }
278  $this->$cmd();
279  break;
280  }
281  }
282 
283  public function __addBookings($external_data = null)
284  {
285  global $ilUser, $ilObjDataCache;
286 
287  $sc = $this->psc_obj->getShoppingCart($this->pm_id);
288 
289 # $this->psc_obj->clearCouponItemsSession();
290 
291  if (is_array($sc) && count($sc) > 0)
292  {
293  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
294  //@todo check $this->usr_obj
295  $book_obj = new ilPaymentBookings($this->usr_obj);
296 
297  for ($i = 0; $i < count($sc); $i++)
298  {
299  if (!empty($_SESSION['coupons'][$this->session_var]))
300  {
301  $sc[$i]['math_price'] = (float) $sc[$i]['price'];
302 
303  $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']);
304 
305  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
306  {
307  $this->coupon_obj->setId($coupon['pc_pk']);
308  $this->coupon_obj->setCurrentCoupon($coupon);
309 
310  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
311  {
312  $_SESSION['coupons'][$this->session_var][$key]['total_objects_coupon_price'] += (float) $sc[$i]['price'];
313  $_SESSION['coupons'][$this->session_var][$key]['items'][] = $sc[$i];
314  }
315  }
316 
317  unset($tmp_pobject);
318  }
319  }
320 
321  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION['coupons'][$this->session_var]);
323 
324  for ($i = 0; $i < count($sc); $i++)
325  {
326  $pobjectData = ilPaymentObject::_getObjectData($sc[$i]['pobject_id']);
327  $pobject = new ilPaymentObject($this->user_obj,$sc[$i]['pobject_id']);
328 
329  $price = $sc[$i]['price'];
330  $bonus = 0.0;
331 
332  if (array_key_exists($sc[$i]['pobject_id'], $coupon_discount_items))
333  {
334  $bonus = $coupon_discount_items[$sc[$i]['pobject_id']]['math_price'] - $coupon_discount_items[$sc[$i]['pobject_id']]['discount_price'];
335  if($bonus > 0)
336  $discount = round($bonus, 2)* (-1);
337  else $discount = round($bonus, 2);
338 
339  }
340 
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());
347 
348  $book_obj->setPrice($sc[$i]['price_string']);
349  //$book_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount($bonus * (-1)) : '');
350  $book_obj->setDiscount($discount);
351  $book_obj->setPayed(1);
352  $book_obj->setAccess(1);
353 
354  $book_obj->setVoucher(''); // bmf
355  $book_obj->setTransactionExtern(''); // bmf , paypal
356 
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']);
361 
362  switch($sc[$i]["price_type"])
363  {
365  $book_obj->setDuration($sc[$i]['duration']);
366  break;
367 
369  $book_obj->setDuration(0);
370  $book_obj->setAccessStartdate($sc[$i]['duration_from']);
371  $book_obj->setAccessEnddate($sc[$i]['duration_until']);
372  break;
374  $book_obj->setDuration(0);
375  $book_obj->setAccessEnddate(NULL);
376  $book_obj->setUnlimitedDuration($sc[$i]['unlimited_duration']);
377  break;
378  }
379 
380 
381  $book_obj->setPriceType($sc[$i]["price_type"]);
382 //
383  if($external_data)
384  {
385  $book_obj->setVoucher($external_data['voucher']); // bmf
386  $book_obj->setTransactionExtern($external_data['transaction_extern']); // bmf, paypal
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']);
391  }
392  else
393  if(isset($_SESSION[$this->session_var]['personal_data']))
394  {
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']);
400  }
401  else
402  {
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());
408  }
409 
410  $booking_id = $book_obj->add();
411 
412  // add purchased item to desktop
414 
415  // autosubscribe user if purchased object is a course
416  $obj_type = ilObject::_lookupType((int)$pobject->getRefId(),true);
417 
418  if($obj_type == 'crs')
419  {
421  }
422 
423  if (!empty($_SESSION['coupons'][$this->session_var]) && $booking_id)
424  {
425  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
426  {
427  $this->coupon_obj->setId($coupon['pc_pk']);
428  $this->coupon_obj->setCurrentCoupon($coupon);
429 
430  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
431  {
432  $this->coupon_obj->addCouponForBookingId($booking_id);
433  }
434  }
435  }
436 
437  $obj_id = $ilObjDataCache->lookupObjId($pobjectData['ref_id']);
438  $obj_type = $ilObjDataCache->lookupType($obj_id);
439  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
440 
441  $bookings['list'][] = array(
442  'pobject_id' => $sc[$i]['pobject_id'],
443  'type' => $obj_type,
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()
457  );
458 
459  $total += $sc[$i]['price'];
460  $total_vat += $sc[$i]['vat_unit'];
461  $total_discount += $discount;
462 
463  if ($sc[$i]['psc_id']) $this->psc_obj->delete($sc[$i]['psc_id']);
464  }
465 
466  if (!empty($_SESSION['coupons'][$this->session_var]))
467  {
468  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
469  {
470  $this->coupon_obj->setId($coupon['pc_pk']);
471  $this->coupon_obj->setCurrentCoupon($coupon);
472  $this->coupon_obj->addTracking();
473  }
474  }
475  }
476 
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()))
485  {
486  $bookings['country'] = $this->__getCountryName(strtoupper($book_obj->getCountry()));
487  }
488  else
489  {
490  $bookings['country'] = $book_obj->getCountry();
491  }
492  $bookings['transaction_extern'] = $book_obj->getTransactionExtern();
493 
494  $this->__sendBill($bookings);
495  }
496 
497  public function __sendBill($bookings)
498  {
499  global $tpl, $ilSetting;
500 
501  $i = 0;
502 
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';
508 
509 // $psc_obj = new ilPaymentShoppingCart($this->user_obj);
511  $currency = $genSet->get('currency_unit');
512 
513 // $tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
514  $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
515 
516  if($tpl->placeholderExists('HTTP_PATH'))
517  {
518  $http_path = ilUtil::_getHttpPath();
519  $tpl->setVariable('HTTP_PATH', $http_path);
520  }
522  $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['order_date'], IL_CAL_UNIX))));
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';
526  $str_paymethod = ilPayMethods::getStringByPaymethod($bookings['list'][$i]['b_pay_method']);
527  if(strlen(trim($bookings['transaction_extern'])))
528  {
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']);
531  }
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')));
535 
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')));
540 
541 
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']== '')
545  {
546  $tpl->setVariable('CUSTOMER_STREET', utf8_decode( $bookings['street'])); // contains also housenumber
547  }
548  else
549  {
550  $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['po_box']));
551  }
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']));
555 
556  $tpl->setVariable('BILL_NO', $bookings['transaction']);
557  $tpl->setVariable('DATE', date('d.m.Y'));
558 
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')));
562 
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')));
567 
568  for ($i = 0; $i < count($bookings['list']); $i++)
569  {
570  $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings['list'][$i]['pobject_id']);
571 
572  $assigned_coupons = '';
573  if (!empty($_SESSION['coupons'][$this->session_var]))
574  {
575  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
576  {
577  $this->coupon_obj->setId($coupon['pc_pk']);
578  $this->coupon_obj->setCurrentCoupon($coupon);
579 
580  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
581  {
582  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
583  }
584  }
585  }
586 
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')));
591 
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')));
596 
597  if( $bookings['list'][$i]['duration'] == 0 && $bookings['list'][$i]['access_enddate'] == NULL)
598  {
599  $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
600  }
601  else
602  {
603  $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_startdate'], IL_CAL_DATE)));
604  $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_enddate'], IL_CAL_DATE)));
605 
606 
607  $tmp_duration = $access_startdate.' - '.$access_enddate;
608  if($bookings['list'][$i]['duration'] > 0)
609  {
610  $tmp_duration .= ' / '.$bookings['list'][$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'));
611  }
612  $tpl->setVariable('LOOP_DURATION', $tmp_duration);
613  }
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');
620 
621 
622  $bookings['total'] += (float)$bookings[$i]['price'];
623  $bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
624  #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
625  unset($tmp_pobject);
626 
627  $sub_total_amount = $bookings['total'];
628  }
629 
630  $bookings['total'] += $bookings['total_discount'];
631  if($bookings['total_discount'] < 0)
632  {
633  $tpl->setCurrentBlock('cloop');
634 
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);
637 
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();
641  }
642 
643  if ($bookings['total'] < 0)
644  {
645  $bookings['total'] = 0.00;
646  // $bookings['total_vat'] = 0.0;
647  }
648  $total_net_price = $sub_total_amount-$bookings['total_vat'];
649 
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);
652 
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)
656  {
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')));
659  }
660  if(1 == $bookings['list'][0]['b_pay_method'])
661  {
662  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
663  }
664  else
665  {
666  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
667  }
668 
669  if (!@file_exists($genSet->get('pdf_path')))
670  {
671 
672  ilUtil::makeDir($genSet->get('pdf_path'));
673  }
674 
675  $file_name = time();
676  if (@file_exists($genSet->get('pdf_path')))
677  {
678  ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
679  }
680 
681  if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf') &&
682  $this->user_obj->getEmail() != '' &&
683  $ilSetting->get('admin_email') != '')
684  {
685  $m= new ilMimeMail; // create the mail
686  $m->From( $ilSetting->get('admin_email') );
687  $m->To( $this->user_obj->getEmail() );
688  $m->Subject( $this->lng->txt('pay_message_subject') );
689 
690  // if there is no mailbillingtext use this as standard
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'));
696 
697  //replacePlaceholders...
698  $billing_text = $genSet->getMailBillingText();
699  if(!$billing_text)
700  {
701  $message = '';
702  }
703  if($genSet->getMailUsePlaceholders() == 1)
704  {
705  include_once './Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
706  $message = ilBillingMailPlaceholdersPropertyGUI::replaceBillingMailPlaceholders($billing_text, $this->user_obj->getId());
707  }
708 
709  $m->Body( $message ); // set the body
710  $m->Attach( $genSet->get('pdf_path') . '/' . $file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
711  if($genSet->get('attach_sr_invoice') == 1)
712  {
713  require_once 'Services/RTE/classes/class.ilRTE.php';
714  $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'),1);
715  $reg_file_name = 'statutory_regulations';
716  if (@file_exists($genSet->get('pdf_path')))
717  {
718  ilUtil::html2pdf($regulations, $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf');
719  }
720 
721  $m->Attach( $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
722  }
723 
724  $m->Send(); // send the mail
725  }
726 
727  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
728  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
729 
730  unset($current_booking_id);
731  unset($pobject);
732  unset($_SESSION['coupons'][$this->session_var]);
733 
734  $this->ctrl->redirectByClass('ilShopBoughtObjectsGUI', '');
735  }
736 
738  {
739  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
740 
741  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
742 
743  return $sc_obj->emptyShoppingCart();
744  }
745 
746  function __clearSession()
747  {
748  $_SESSION['coupons'][$this->session_var] = '';
750  }
751 
752  function __loadTemplate()
753  {
754  global $ilTabs;
755 
757 
758  $ilTabs->setTabActive('paya_shopping_cart');
759  $this->tpl->getStandardTemplate();
760  }
761 
762  function __buildStatusline()
763  {
764  $this->tpl->addBlockFile('STATUSLINE', 'statusline', 'tpl.statusline.html');
765 # $this->__buildLocator();
766  }
767 
768  function __buildLocator()
769  {
770  $this->tpl->addBlockFile('LOCATOR', 'locator', 'tpl.locator.html', 'Services/Locator');
771  $this->tpl->setVariable('TXT_LOCATOR',$this->lng->txt('locator'));
772 
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();
777 
778  $this->tpl->setCurrentBlock('locator_item');
779  $this->tpl->setVariable('PREFIX','>&nbsp;');
780  $this->tpl->setVariable('ITEM', 'Payment');
781  $this->tpl->setVariable('LINK_ITEM', './payment.php');
782  $this->tpl->parseCurrentBlock();
783 
784  // CHECK for new mail and info
786 
787  return true;
788  }
789 
790  function __buildStylesheet()
791  {
792  $this->tpl->setVariable('LOCATION_STYLESHEET',ilUtil::getStyleSheetLocation());
793  }
794 
798  public function __getCountries()
799  {
800  global $lng;
801 
802  $lng->loadLanguageModule('meta');
803 
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');
822  $cntrs = array();
823  foreach($cntcodes as $cntcode)
824  {
825  $cntrs[$cntcode] = $lng->txt('meta_c_'.$cntcode);
826  }
827  asort($cntrs);
828  return $cntrs;
829  }
830 
831  public function __getCountryCode($value = '')
832  {
833  $countries = $this->__getCountries();
834  foreach($countries as $code => $text)
835  {
836  if ($text == $value)
837  {
838  return $code;
839  }
840  }
841  return true;
842  }
843 
844  public function __getCountryName($value = '')
845  {
846  $countries = $this->__getCountries();
847  return $countries[$value];
848  }
849 
850  private function __getShoppingCart()
851  {
852  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
853 
854  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
855  {
856  return 0;
857  }
858 
859  $counter = 0;
860  foreach($items as $item)
861  {
862  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
863 
864  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
865  if($tmp_obj)
866  {
867  $f_result[$counter]["object_title"] = $tmp_obj->getTitle();
868  }
869  else
870  {
871  $f_result[$counter]["object_title"] = $this->lng->txt('object_not_found');
872  }
873 
874  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
875 
876  $price = (float) $price_arr['price'];
877  $f_result[$counter]['price'] = $price * 1.0;
878 
879  unset($tmp_obj);
880  unset($tmp_pobject);
881 
882  ++$counter;
883  }
884 
885  return $f_result;
886  }
887 
891  function __getTotalAmount()
892  {
893  $amount = 0;
894 
895  if (is_array($result = $this->__getShoppingCart()))
896  {
897  for ($i = 0; $i < count($result); $i++)
898  {
899  $amount += $result[$i]['price'];
900  }
901  }
902  return $amount;
903  }
904 
905  // if ok, a transaction-id will be generated and the customer gets a bill
906  function getBill()
907  {
908  $this->error = '';
909  ilUtil::sendInfo($this->lng->txt('pay_message_thanks'));
910 
911  $this->__addBookings();
912  }
913 
914  public function __showShoppingCart()
915  {
916  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
917 
919 
920  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
921 
922  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
923  {
924  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
925  }
926 
927  $counter = 0;
928  foreach($items as $item)
929  {
930  $tmp_pobject = new ilPaymentObject($this->user_obj,$item['pobject_id']);
931 
932  $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
933 
934  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
935 
936  $assigned_coupons = '';
937  if (!empty($_SESSION['coupons'][$this->session_var]))
938  {
939  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
940  {
941  $this->coupon_obj->setId($coupon['pc_pk']);
942  $this->coupon_obj->setCurrentCoupon($coupon);
943 
944  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
945  {
946  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
947  }
948  }
949  }
950  $f_result[$counter]['item'] = '';
951  if($tmp_obj)
952  {
953  $f_result[$counter]['title'] = $tmp_obj->getTitle();
954  }
955  else
956  {
957  $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
958  }
959  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
960 
961  switch($price_arr['price_type'])
962  {
964  $f_result[$counter]['duration'] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
965  break;
967  $f_result[$counter]['duration'] =
968  ilDatePresentation::formatDate(new ilDate($price_arr['duration_from'], IL_CAL_DATE))
969  .' - '.ilDatePresentation::formatDate(new ilDate($price_arr['duration_until'], IL_CAL_DATE));
970  break;
972  $f_result[$counter]['duration'] = $this->lng->txt('unlimited_duration');
973  break;
974  }
975 
976  $oVAT = new ilShopVats((int)$tmp_pobject->getVatId());
977  $f_result[$counter]['vat_rate'] = ilShopUtils::_formatVAT($oVAT->getRate());
978 
979  $float_price = $price_arr['price'];
980 
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);
983 
984  $f_result[$counter]['price'] = number_format($float_price, 2, ',', '.') .' '.$genSet->get('currency_unit');
985 
986  unset($tmp_obj);
987  unset($tmp_pobject);
988 
989  ++$counter;
990  }
991 
992  return $this->__showItemsTable($f_result);
993  }
994 
995  private function __showItemsTable($a_result_set)
996  {
997  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
998 
1000  include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1001 
1002  $tbl = new ilShoppingCartTableGUI($this);
1003  $tbl->setId('tbl_id_'.$this->session_var);
1004  $tbl->setTitle($this->lng->txt('paya_shopping_cart'));
1005  /*
1006  " (".$this->lng->txt('payment_system').": ".
1007  ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) .")");
1008  */
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');
1017 
1018  #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1019 
1020  // show total amount of costs
1021  $sc_obj = new ilPaymentShoppingCart($this->user_obj);
1022  $totalAmount = $sc_obj->getTotalAmount();
1023 
1024  if (!empty($_SESSION['coupons'][$this->session_var]))
1025  {
1026  if (count($items = $sc_obj->getEntries($this->pm_id)))
1027  {
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'] ));
1031 
1032  $totalAmount[$current_coupon_bonus] = 0;
1033  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
1034  {
1035  $this->coupon_obj->setId($coupon['pc_pk']);
1036  $this->coupon_obj->setCurrentCoupon($coupon);
1037 
1038  $total_object_price = 0.0;
1039  $current_coupon_bonus = 0.0;
1040 
1041  foreach ($items as $item)
1042  {
1043  $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
1044 
1045  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1046  {
1047  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1048  $price = (float) $price_data['price'];
1049 
1050  $total_object_price += $price;
1051  }
1052  unset($tmp_pobject);
1053  }
1054  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1055  $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * (-1);
1056  }
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'));
1059 
1060 
1061  if ($totalAmount[$this->pm_id] < 0)
1062  {
1063  $totalAmount[$this->pm_id] = 0;
1064  $this->totalVat = 0;
1065  }
1066  }
1067  }
1068 
1069  $this->totalAmount[$this->pm_id] = $totalAmount[$this->pm_id]-($totalAmount[$current_coupon_bonus] * (-1));
1070 
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']);
1073 
1074  if ($this->totalVat > 0)
1075  {
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'));
1078  }
1079 
1080  $tbl->setData($a_result_set);
1081  $this->tpl->setVariable('ITEMS_TABLE',$tbl->getCartHTML());
1082 
1083  return true;
1084  }
1085 }
1086 ?>