ILIAS  Release_5_0_x_branch Revision 61816
 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  private $payed = 1;
39  private $access = 1;
40 
41  public function __construct($user_obj, $pay_method)
42  {
43  global $lng, $tpl, $ilCtrl, $ilTabs;
44 
46 
47  $this->lng = $lng;
48  $this->ctrl = $ilCtrl;
49  $this->tpl = $tpl;
50  $this->user_obj = $user_obj;
51 
52  $this->pmethod_obj = new ilPayMethods($pay_method);
53  $this->session_var = $this->pmethod_obj->getPmTitle();
54 
55  $this->pm_id = $pay_method;
56 
57  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
58 
59  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
60 
61  if (!is_array($_SESSION[$this->session_var]['personal_data']))
62  {
63  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
64  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
65  if (strpos('_' . $this->user_obj->getStreet(), ' ') > 0)
66  {
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));
69  $_SESSION[$this->session_var]['personal_data']['street'] = $street;
70  $_SESSION[$this->session_var]['personal_data']['house_number'] = $houseNo;
71  }
72  else
73  {
74  $_SESSION[$this->session_var]['personal_data']['street'] = $this->user_obj->getStreet();
75  $_SESSION[$this->session_var]['personal_data']['house_number'] = '';
76  }
77  $_SESSION[$this->session_var]['personal_data']['po_box'] = '';
78  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $this->user_obj->getZipcode();
79  $_SESSION[$this->session_var]['personal_data']['city'] = $this->user_obj->getCity();
80  $_SESSION[$this->session_var]['personal_data']['country'] = $this->__getCountryCode($this->user_obj->getCountry());
81  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
82  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
83  }
84 
85  if (!is_array($_SESSION['coupons'][$this->session_var]))
86  {
87  $_SESSION['coupons'][$this->session_var] = array();
88  }
89 
90  $this->__loadTemplate();
91  $this->error = '';
92  $this->lng->loadLanguageModule('payment');
93 
94  $ilTabs->clearTargets();
95  $ilTabs->clearSubTabs();
96  }
97 
98  public function cancel()
99  {
100  ilUtil::redirect('./payment.php');
101  }
102 
103  public function showPersonalData()
104  {
105  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
106 
107  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
108  {
109  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
110  $this->tpl->touchBlock('stop_floating');
111  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
112  }
113  else
114  {
115  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
116 
117  $oForm = new ilPropertyFormGUI();
118  $oForm->setFormAction($this->ctrl->getFormAction($this, 'getPersonalData'));
119  $oForm->setTitle($this->lng->txt('pay_bmf_personal_data'));
120 
121  $oFirstname = new ilNonEditableValueGUI($this->lng->txt('firstname'));
122  $oFirstname->setValue($this->user_obj->getFirstname());
123  $oForm->addItem($oFirstname);
124 
125  $oLastname = new ilNonEditableValueGUI($this->lng->txt('lastname'));
126  $oLastname->setValue($this->user_obj->getLastname());
127  $oForm->addItem($oLastname);
128 
129  $oStreet = new ilTextInputGUI($this->lng->txt('street'),'street');
130  $oStreet->setValue($this->error != '' && isset($_POST['street'])
131  ? ilUtil::prepareFormOutput($_POST['street'],true)
132  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['street'],true));
133  $oForm->addItem($oStreet);
134 
135  $oHouseNumber = new ilTextInputGUI($this->lng->txt('pay_bmf_house_number'), 'house_number');
136  $oHouseNumber->setValue($this->error != '' && isset($_POST['house_number'])
137  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
138  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['house_number'],true));
139  $oForm->addItem($oHouseNumber);
140 
141  $oPoBox = new ilTextInputGUI($this->lng->txt('pay_bmf_or').' '.$this->lng->txt('pay_bmf_po_box'), 'po_box');
142  $oPoBox->setValue($this->error != '' && isset($_POST['po_box'])
143  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
144  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['po_box'],true));
145  $oForm->addItem($oPoBox);
146 
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());
150  else
151  $oZipCode->setValue($this->error != '' && isset($_POST['zipcode'])
152  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
153  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['zipcode'],true));
154  $oForm->addItem($oZipCode);
155 
156  $oCity = new ilTextInputGUI($this->lng->txt('city'), 'city');
157  if($this->user_obj->getCity()&& !isset($_POST['city']))
158  $oCity->setValue($this->user_obj->getCity());
159  else
160  $oCity->setValue($this->error != '' && isset($_POST['city'])
161  ? ilUtil::prepareFormOutput($_POST['city'],true)
162  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['city'],true));
163  $oForm->addItem($oCity);
164 
165  $oCountry = new ilSelectInputGUI($this->lng->txt('country'), 'country');
166  $oCountry->setOptions($this->__getCountries());
167 
168  if($this->user_obj->getSelectedCountry()&& !isset($_POST['country']))
169  $oCountry->setValue($this->user_obj->getSelectedCountry());
170  else
171  $oCountry->setValue($this->error != '' && isset($_POST['country']) ? $_POST['country']
172  : $_SESSION[$this->session_var]['personal_data']['country']);
173  $oForm->addItem($oCountry);
174 
175  $oEmail = new ilNonEditableValueGUI($this->lng->txt('email'));
176  $oEmail->setValue($this->user_obj->getEmail());
177  $oForm->addItem($oEmail);
178 
179  $oForm->addcommandButton('getPersonalData',ucfirst($this->lng->txt('next')));
180 
181  $this->tpl->setVariable('FORM', $oForm->getHTML());
182  }
183  }
184 
185  public function getPersonalData()
186  {
187 
188  if ($_SESSION[$this->session_var]['personal_data']['firstname'] == '' ||
189  $_SESSION[$this->session_var]['personal_data']['lastname'] == '' ||
190  $_POST['zipcode'] == '' ||
191  $_POST['city'] == '' ||
192  $_POST['country'] == '' ||
193  $_SESSION[$this->session_var]['personal_data']['email'] == '')
194  {
195 
196  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
197  ilUtil::sendInfo($this->error);
198  $this->showPersonalData();
199  return;
200  }
201 
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'] != ''))
206  {
207  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
208  ilUtil::sendInfo($this->error);
209  $this->showPersonalData();
210  return;
211  }
212 
213  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
214  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
215  $_SESSION[$this->session_var]['personal_data']['street'] = $_POST['street'];
216  $_SESSION[$this->session_var]['personal_data']['house_number'] = $_POST['house_number'];
217  $_SESSION[$this->session_var]['personal_data']['po_box'] = $_POST['po_box'];
218  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $_POST['zipcode'];
219  $_SESSION[$this->session_var]['personal_data']['city'] = $_POST['city'];
220  $_SESSION[$this->session_var]['personal_data']['country'] = $_POST['country'];
221 
222  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
223  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
224 
225  $this->error = '';
226  $this->showBillConfirm();
227 
228  }
229 
230  public function showBillConfirm()
231  {
232  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
233 
234  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
235  {
236  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
237  $this->tpl->touchBlock('stop_floating');
238  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
239  }
240  else
241  {
242  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bill_confirm.html','Services/Payment');
243 
244  $this->__showShoppingCart();
245 
246  $this->tpl->setVariable('BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
247 
248  // set table header
249  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_usr'));
250 
251  // set plain text variables
252  $this->tpl->setVariable('TXT_CONFIRM_ORDER',$this->lng->txt('pay_confirm_order'));
253 
254  $this->tpl->setVariable('INPUT_VALUE',$this->lng->txt('pay_send_order'));
255  $this->tpl->setVariable('CANCEL',$this->lng->txt('cancel'));
256 
257  // Button
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');
263  }
264  }
265 
269  public function executeCommand()
270  {
271  $cmd = $this->ctrl->getCmd();
272 
273  switch ($this->ctrl->getNextClass($this))
274  {
275  default:
276  if(!$cmd = $this->ctrl->getCmd())
277  {
278  $cmd = 'showPersonalData';
279  }
280  $this->$cmd();
281  break;
282  }
283  }
284 
285  public function __addBookings($external_data = null)
286  {
287  global $ilUser, $ilObjDataCache;
288 
289  $sc = $this->psc_obj->getShoppingCart($this->pm_id);
290  $total = 0;
291  $total_vat = 0;
292  $total_discount = 0;
293 
294 # $this->psc_obj->clearCouponItemsSession();
295 
296  if (is_array($sc) && count($sc) > 0)
297  {
298  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
299  //@todo check $this->usr_obj
300  $book_obj = new ilPaymentBookings($this->usr_obj);
301 
302  for ($i = 0; $i < count($sc); $i++)
303  {
304  if (!empty($_SESSION['coupons'][$this->session_var]))
305  {
306  $sc[$i]['math_price'] = (float) $sc[$i]['price'];
307 
308  $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']);
309 
310  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
311  {
312  $this->coupon_obj->setId($coupon['pc_pk']);
313  $this->coupon_obj->setCurrentCoupon($coupon);
314 
315  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
316  {
317  $_SESSION['coupons'][$this->session_var][$key]['total_objects_coupon_price'] += (float) $sc[$i]['price'];
318  $_SESSION['coupons'][$this->session_var][$key]['items'][] = $sc[$i];
319  }
320  }
321 
322  unset($tmp_pobject);
323  }
324  }
325 
326  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION['coupons'][$this->session_var]);
328 
329  for ($i = 0; $i < count($sc); $i++)
330  {
331  $pobjectData = ilPaymentObject::_getObjectData($sc[$i]['pobject_id']);
332  $pobject = new ilPaymentObject($this->user_obj,$sc[$i]['pobject_id']);
333 
334  $price = $sc[$i]['price'];
335  $bonus = 0.0;
336 
337  if (array_key_exists($sc[$i]['pobject_id'], $coupon_discount_items))
338  {
339  $bonus = $coupon_discount_items[$sc[$i]['pobject_id']]['math_price'] - $coupon_discount_items[$sc[$i]['pobject_id']]['discount_price'];
340  if($bonus > 0)
341  $discount = round($bonus, 2)* (-1);
342  else $discount = round($bonus, 2);
343 
344  }
345 
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());
352 
353  $book_obj->setPrice($sc[$i]['price_string']);
354  //$book_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount($bonus * (-1)) : '');
355  $book_obj->setDiscount($discount);
356  $book_obj->setPayed($this->getPayed());
357  $book_obj->setAccess($this->getAccess());
358 
359  $book_obj->setVoucher(''); // bmf
360  $book_obj->setTransactionExtern(''); // bmf , paypal
361 
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']);
366 
367  switch($sc[$i]["price_type"])
368  {
370  $book_obj->setDuration($sc[$i]['duration']);
371  break;
372 
374  $book_obj->setDuration(0);
375  $book_obj->setAccessStartdate($sc[$i]['duration_from']);
376  $book_obj->setAccessEnddate($sc[$i]['duration_until']);
377  break;
379  $book_obj->setDuration(0);
380  $book_obj->setAccessEnddate(NULL);
381  $book_obj->setUnlimitedDuration($sc[$i]['unlimited_duration']);
382  break;
383  }
384 
385 
386  $book_obj->setPriceType($sc[$i]["price_type"]);
387 //
388  if($external_data)
389  {
390  $book_obj->setVoucher($external_data['voucher']); // bmf
391  $book_obj->setTransactionExtern($external_data['transaction_extern']); // bmf, paypal
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']);
396  }
397  else
398  if(isset($_SESSION[$this->session_var]['personal_data']))
399  {
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']);
405  }
406  else
407  {
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());
413  }
414 
415  $booking_id = $book_obj->add();
416 
417  // add purchased item to desktop
419 
420  // autosubscribe user if purchased object is a course
421  $obj_type = ilObject::_lookupType((int)$pobject->getRefId(),true);
422 
423  if($obj_type == 'crs')
424  {
426  }
427 
428  if (!empty($_SESSION['coupons'][$this->session_var]) && $booking_id)
429  {
430  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
431  {
432  $this->coupon_obj->setId($coupon['pc_pk']);
433  $this->coupon_obj->setCurrentCoupon($coupon);
434 
435  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
436  {
437  $this->coupon_obj->addCouponForBookingId($booking_id);
438  }
439  }
440  }
441 
442  $obj_id = $ilObjDataCache->lookupObjId($pobjectData['ref_id']);
443  $obj_type = $ilObjDataCache->lookupType($obj_id);
444  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
445 
446  $bookings['list'][] = array(
447  'pobject_id' => $sc[$i]['pobject_id'],
448  'type' => $obj_type,
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()
462  );
463 
464  $total += $sc[$i]['price'];
465  $total_vat += $sc[$i]['vat_unit'];
466  $total_discount += $discount;
467 
468  if ($sc[$i]['psc_id']) $this->psc_obj->delete($sc[$i]['psc_id']);
469  }
470 
471  if (!empty($_SESSION['coupons'][$this->session_var]))
472  {
473  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
474  {
475  $this->coupon_obj->setId($coupon['pc_pk']);
476  $this->coupon_obj->setCurrentCoupon($coupon);
477  $this->coupon_obj->addTracking();
478  }
479  }
480  }
481 
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()))
490  {
491  $bookings['country'] = $this->__getCountryName(strtoupper($book_obj->getCountry()));
492  }
493  else
494  {
495  $bookings['country'] = $book_obj->getCountry();
496  }
497  $bookings['transaction_extern'] = $book_obj->getTransactionExtern();
498 
499  $this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
500  $_SESSION['forceRedirectToShoppingcart'] = 1;
501 
502  $this->__sendBill($bookings);
503  }
504 
505  public function __sendBill($bookings)
506  {
507  global $tpl, $ilSetting;
508 
509  $i = 0;
510 
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';
516 
517 // $psc_obj = new ilPaymentShoppingCart($this->user_obj);
519  $currency = $genSet->get('currency_unit');
520 
521 // $tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
522  $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
523 
524  if($tpl->placeholderExists('HTTP_PATH'))
525  {
526  $http_path = ilUtil::_getHttpPath();
527  $tpl->setVariable('HTTP_PATH', $http_path);
528  }
530  $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['order_date'], IL_CAL_UNIX))));
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';
534  $str_paymethod = ilPayMethods::getStringByPaymethod($bookings['list'][$i]['b_pay_method']);
535  if(strlen(trim($bookings['transaction_extern'])))
536  {
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']);
539  }
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')));
543 
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')));
548 
549 
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']== '')
553  {
554  $tpl->setVariable('CUSTOMER_STREET', utf8_decode( $bookings['street'])); // contains also housenumber
555  }
556  else
557  {
558  $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['po_box']));
559  }
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']));
563 
564  $tpl->setVariable('BILL_NO', $bookings['transaction']);
565  $tpl->setVariable('DATE', date('d.m.Y'));
566 
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')));
570 
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')));
575 
576  for ($i = 0; $i < count($bookings['list']); $i++)
577  {
578  $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings['list'][$i]['pobject_id']);
579 
580  $assigned_coupons = '';
581  if (!empty($_SESSION['coupons'][$this->session_var]))
582  {
583  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
584  {
585  $this->coupon_obj->setId($coupon['pc_pk']);
586  $this->coupon_obj->setCurrentCoupon($coupon);
587 
588  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
589  {
590  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
591  }
592  }
593  }
594 
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')));
599 
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')));
604 
605  if( $bookings['list'][$i]['duration'] == 0 && $bookings['list'][$i]['access_enddate'] == NULL)
606  {
607  $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
608  }
609  else
610  {
611  $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_startdate'], IL_CAL_DATE)));
612  $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_enddate'], IL_CAL_DATE)));
613 
614 
615  $tmp_duration = $access_startdate.' - '.$access_enddate;
616  if($bookings['list'][$i]['duration'] > 0)
617  {
618  $tmp_duration .= ' / '.$bookings['list'][$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'));
619  }
620  $tpl->setVariable('LOOP_DURATION', $tmp_duration);
621  }
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');
628 
629 
630  $bookings['total'] += (float)$bookings[$i]['price'];
631  $bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
632  #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
633  unset($tmp_pobject);
634 
635  $sub_total_amount = $bookings['total'];
636  }
637 
638  $bookings['total'] += $bookings['total_discount'];
639  if($bookings['total_discount'] < 0)
640  {
641  $tpl->setCurrentBlock('cloop');
642 
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);
645 
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();
649  }
650 
651  if ($bookings['total'] < 0)
652  {
653  $bookings['total'] = 0.00;
654  // $bookings['total_vat'] = 0.0;
655  }
656  $total_net_price = $sub_total_amount-$bookings['total_vat'];
657 
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);
660 
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)
664  {
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')));
667  }
668  if(1 == $bookings['list'][0]['b_pay_method'])
669  {
670  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
671  }
672  else
673  {
674  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
675  }
676 
677  if (!@file_exists($genSet->get('pdf_path')))
678  {
679 
680  ilUtil::makeDir($genSet->get('pdf_path'));
681  }
682 
683  $file_name = time();
684  if (@file_exists($genSet->get('pdf_path')))
685  {
686  ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
687  }
688 
689  if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf') &&
690  $this->user_obj->getEmail() != '' &&
691  $ilSetting->get('admin_email') != '')
692  {
693  $m= new ilMimeMail; // create the mail
694  $m->From( $ilSetting->get('admin_email') );
695  $m->To( $this->user_obj->getEmail() );
696  $m->Subject( $this->lng->txt('pay_message_subject') );
697 
698  // if there is no mailbillingtext use this as standard
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'));
704 
705  //replacePlaceholders...
706  $billing_text = $genSet->getMailBillingText();
707  if(!$billing_text)
708  {
709  $message = '';
710  }
711  if($genSet->getMailUsePlaceholders() == 1)
712  {
713  include_once './Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
714  $message = ilBillingMailPlaceholdersPropertyGUI::replaceBillingMailPlaceholders($billing_text, $this->user_obj->getId());
715  }
716 
717  $m->Body( $message ); // set the body
718  $m->Attach( $genSet->get('pdf_path') . '/' . $file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
719  if($genSet->get('attach_sr_invoice') == 1)
720  {
721  require_once 'Services/RTE/classes/class.ilRTE.php';
722  $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'),1);
723  $reg_file_name = 'statutory_regulations';
724  if (@file_exists($genSet->get('pdf_path')))
725  {
726  ilUtil::html2pdf($regulations, $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf');
727  }
728 
729  $m->Attach( $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
730  }
731 
732  $m->Send(); // send the mail
733  }
734 
735  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
736  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
737 
738  unset($current_booking_id);
739  unset($pobject);
740  unset($_SESSION['coupons'][$this->session_var]);
741 
742  $this->ctrl->redirectByClass('ilShopBoughtObjectsGUI', '');
743  }
744 
746  {
747  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
748 
749  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
750 
751  return $sc_obj->emptyShoppingCart();
752  }
753 
754  function __clearSession()
755  {
756  $_SESSION['coupons'][$this->session_var] = '';
758  }
759 
760  function __loadTemplate()
761  {
762  global $ilTabs;
763 
765 
766  $ilTabs->setTabActive('paya_shopping_cart');
767  $this->tpl->getStandardTemplate();
768  }
769 
770  function __buildStatusline()
771  {
772  $this->tpl->addBlockFile('STATUSLINE', 'statusline', 'tpl.statusline.html');
773 # $this->__buildLocator();
774  }
775 
776  function __buildLocator()
777  {
778  $this->tpl->addBlockFile('LOCATOR', 'locator', 'tpl.locator.html', 'Services/Locator');
779  $this->tpl->setVariable('TXT_LOCATOR',$this->lng->txt('locator'));
780 
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();
785 
786  $this->tpl->setCurrentBlock('locator_item');
787  $this->tpl->setVariable('PREFIX','>&nbsp;');
788  $this->tpl->setVariable('ITEM', 'Payment');
789  $this->tpl->setVariable('LINK_ITEM', './payment.php');
790  $this->tpl->parseCurrentBlock();
791 
792  // CHECK for new mail and info
794 
795  return true;
796  }
797 
798  function __buildStylesheet()
799  {
800  $this->tpl->setVariable('LOCATION_STYLESHEET',ilUtil::getStyleSheetLocation());
801  }
802 
806  public function __getCountries()
807  {
808  global $lng;
809 
810  $lng->loadLanguageModule('meta');
811 
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');
830  $cntrs = array();
831  foreach($cntcodes as $cntcode)
832  {
833  $cntrs[$cntcode] = $lng->txt('meta_c_'.$cntcode);
834  }
835  asort($cntrs);
836  return $cntrs;
837  }
838 
839  public function __getCountryCode($value = '')
840  {
841  $countries = $this->__getCountries();
842  foreach($countries as $code => $text)
843  {
844  if ($text == $value)
845  {
846  return $code;
847  }
848  }
849  return true;
850  }
851 
852  public function __getCountryName($value = '')
853  {
854  $countries = $this->__getCountries();
855  return $countries[$value];
856  }
857 
858  private function __getShoppingCart()
859  {
860  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
861 
862  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
863  {
864  return 0;
865  }
866 
867  $counter = 0;
868  foreach($items as $item)
869  {
870  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
871 
872  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
873  if($tmp_obj)
874  {
875  $f_result[$counter]["object_title"] = $tmp_obj->getTitle();
876  }
877  else
878  {
879  $f_result[$counter]["object_title"] = $this->lng->txt('object_not_found');
880  }
881 
882  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
883 
884  $price = (float) $price_arr['price'];
885  $f_result[$counter]['price'] = $price * 1.0;
886 
887  unset($tmp_obj);
888  unset($tmp_pobject);
889 
890  ++$counter;
891  }
892 
893  return $f_result;
894  }
895 
899  function __getTotalAmount()
900  {
901  $amount = 0;
902 
903  if (is_array($result = $this->__getShoppingCart()))
904  {
905  for ($i = 0; $i < count($result); $i++)
906  {
907  $amount += $result[$i]['price'];
908  }
909  }
910  return $amount;
911  }
912 
913  // if ok, a transaction-id will be generated and the customer gets a bill
914  function getBill()
915  {
916  $this->error = '';
917  ilUtil::sendInfo($this->lng->txt('pay_message_thanks'));
918 
919  $this->__addBookings();
920  }
921 
922  public function __showShoppingCart()
923  {
924  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
925 
927 
928  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
929 
930  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
931  {
932  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
933  }
934 
935  $counter = 0;
936  foreach($items as $item)
937  {
938  $tmp_pobject = new ilPaymentObject($this->user_obj,$item['pobject_id']);
939 
940  $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
941 
942  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
943 
944  $assigned_coupons = '';
945  if (!empty($_SESSION['coupons'][$this->session_var]))
946  {
947  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
948  {
949  $this->coupon_obj->setId($coupon['pc_pk']);
950  $this->coupon_obj->setCurrentCoupon($coupon);
951 
952  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
953  {
954  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
955  }
956  }
957  }
958  $f_result[$counter]['item'] = '';
959  if($tmp_obj)
960  {
961  $f_result[$counter]['title'] = $tmp_obj->getTitle();
962  }
963  else
964  {
965  $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
966  }
967  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
968 
969  switch($price_arr['price_type'])
970  {
972  $f_result[$counter]['duration'] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
973  break;
975  $f_result[$counter]['duration'] =
976  ilDatePresentation::formatDate(new ilDate($price_arr['duration_from'], IL_CAL_DATE))
977  .' - '.ilDatePresentation::formatDate(new ilDate($price_arr['duration_until'], IL_CAL_DATE));
978  break;
980  $f_result[$counter]['duration'] = $this->lng->txt('unlimited_duration');
981  break;
982  }
983 
984  $oVAT = new ilShopVats((int)$tmp_pobject->getVatId());
985  $f_result[$counter]['vat_rate'] = ilShopUtils::_formatVAT($oVAT->getRate());
986 
987  $float_price = $price_arr['price'];
988 
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);
991 
992  $f_result[$counter]['price'] = number_format($float_price, 2, ',', '.') .' '.$genSet->get('currency_unit');
993 
994  unset($tmp_obj);
995  unset($tmp_pobject);
996 
997  ++$counter;
998  }
999 
1000  return $this->__showItemsTable($f_result);
1001  }
1002 
1003  private function __showItemsTable($a_result_set)
1004  {
1005  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
1006 
1007  $genSet = ilPaymentSettings::_getInstance();
1008  include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1009 
1010  $tbl = new ilShoppingCartTableGUI($this);
1011  $tbl->setId('tbl_id_'.$this->session_var);
1012  $tbl->setTitle($this->lng->txt('paya_shopping_cart'));
1013  /*
1014  " (".$this->lng->txt('payment_system').": ".
1015  ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) .")");
1016  */
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');
1025 
1026  #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1027 
1028  // show total amount of costs
1029  $sc_obj = new ilPaymentShoppingCart($this->user_obj);
1030  $totalAmount = $sc_obj->getTotalAmount();
1031 
1032  if (!empty($_SESSION['coupons'][$this->session_var]))
1033  {
1034  if (count($items = $sc_obj->getEntries($this->pm_id)))
1035  {
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'] ));
1039 
1040  $totalAmount['current_coupon_bonus'] = 0;
1041  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
1042  {
1043  $this->coupon_obj->setId($coupon['pc_pk']);
1044  $this->coupon_obj->setCurrentCoupon($coupon);
1045 
1046  $total_object_price = 0.0;
1047  $current_coupon_bonus = 0.0;
1048 
1049  foreach ($items as $item)
1050  {
1051  $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
1052 
1053  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1054  {
1055  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1056  $price = (float) $price_data['price'];
1057 
1058  $total_object_price += $price;
1059  }
1060  unset($tmp_pobject);
1061  }
1062  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1063  $totalAmount['current_coupon_bonus'] += $current_coupon_bonus * (-1);
1064  }
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'));
1067 
1068 
1069  if ($totalAmount[$this->pm_id] < 0)
1070  {
1071  $totalAmount[$this->pm_id] = 0;
1072  $this->totalVat = 0;
1073  }
1074  }
1075  }
1076 
1077  $this->totalAmount[$this->pm_id] = $totalAmount[$this->pm_id]-($totalAmount['current_coupon_bonus'] * (-1));
1078 
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']);
1081 
1082  if ($this->totalVat > 0)
1083  {
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'));
1086  }
1087 
1088  $tbl->setData($a_result_set);
1089  $this->tpl->setVariable('ITEMS_TABLE',$tbl->getCartHTML());
1090 
1091  return true;
1092  }
1093 
1097  public function getAccess()
1098  {
1099  return $this->access;
1100  }
1101 
1105  public function setAccess($access)
1106  {
1107  $this->access = $access;
1108  }
1109 
1113  public function getPayed()
1114  {
1115  return $this->payed;
1116  }
1117 
1121  public function setPayed($payed)
1122  {
1123  $this->payed = $payed;
1124  }
1125 
1126 }
1127 ?>